Data Structures | |
struct | PacketGroupHandler |
struct | PacketGroupHandler |
Functions | |
int | wl_init (void) |
Initialize the wireless library. | |
void | wl_terminate (void) |
Uninitialize the wireless library. | |
void | wl_do (void) |
Perform wireless library functionality. | |
void | wl_register_packet_group (PacketGroupHandler *h) |
Register a packet group with the wireless library. | |
void | wl_unregister_packet_group (PacketGroupHandler *h) |
Unregister a packet group with the wireless library. | |
int | wl_send_robot_to_robot_global_packet (char group, char type, char *data, int len, int dest, char frame) |
Send a packet to a specific robot in any PAN. | |
int | wl_send_robot_to_robot_packet (char group, char type, char *data, int len, int dest, char frame) |
Send a packet to a specific robot in our PAN. | |
int | wl_send_global_packet (char group, char type, char *data, int len, char frame) |
Send a packet to all robots. | |
void | wl_send_pan_packet (char group, char type, char *data, int len, char frame) |
Send a packet to all robots in our PAN. | |
int | wl_set_pan (int pan) |
Set the PAN we are using. | |
int | wl_get_pan (void) |
Get the PAN we are using. | |
int | wl_set_channel (int channel) |
Set the channel we are using. | |
int | wl_get_channel (void) |
Get the channel we are using. | |
int | wl_get_xbee_id (void) |
Get the 16-bit address of the XBee module. | |
void | wl_set_com_port (char *port) |
Set the com port on a computer, undefined on the robot. |
Contains functions and definitions for dealing with wireless functionality.
The wireless library provides a modular method for dealing with wireless packets, by allowing packet groups to be registered. A packet group is a collection of packets which share a packet group code. Each packet in the group also has a type. A packet group code and type are sent with each packet. When a packet with a group code registered in the wireless library is received, the corresponding event handler is called. The event handler uses the packet type and other information stored in the packet to respond.
This architecture allows different wireless functionality to be defined and handled separately, making it simpler and more efficient to take advantage of the XBee's wireless functionality.
void wl_do | ( | void | ) |
Perform wireless library functionality.
Performs wireless library functionality. This function must be called frequently for wireless to perform effectively. This function will call timeout handlers, as well as received packet and transmit status handlers.
int wl_get_channel | ( | void | ) |
Get the channel we are using.
Get the channel the XBee is part of.
int wl_get_pan | ( | void | ) |
Get the PAN we are using.
Get the PAN the XBee is currently part of.
int wl_get_xbee_id | ( | void | ) |
Get the 16-bit address of the XBee module.
Returns the 16-bit address of the XBee module.
int wl_init | ( | void | ) |
Initialize the wireless library.
Initializes the wireless library. Must be called before any other function.
wl_port | File descriptor for wireless port, or NULL for default. |
void wl_register_packet_group | ( | PacketGroupHandler * | h | ) |
Register a packet group with the wireless library.
Register a packet group with the wireless library. The event handlers in the packet group will be called whenever an event dealing with the packet group's group code occurs.
h | the PacketGroupHandler to register |
int wl_send_global_packet | ( | char | group, | |
char | type, | |||
char * | data, | |||
int | len, | |||
char | frame | |||
) |
Send a packet to all robots.
Send a packet to all XBees in all PANs.
group | the packet group | |
type | the packet type | |
data | the packet data | |
len | the packet length in bytes | |
frame | the frame number to see with a TX_STATUS response |
void wl_send_pan_packet | ( | char | group, | |
char | type, | |||
char * | data, | |||
int | len, | |||
char | frame | |||
) |
Send a packet to all robots in our PAN.
Send a packet to all XBee's in the same PAN.
group | the packet group | |
type | the packet type | |
data | the packet data | |
len | the packet length in bytes | |
frame | the frame number to see with a TX_STATUS response |
int wl_send_robot_to_robot_global_packet | ( | char | group, | |
char | type, | |||
char * | data, | |||
int | len, | |||
int | dest, | |||
char | frame | |||
) |
Send a packet to a specific robot in any PAN.
Send a packet to a specific XBee without specifying a PAN.
group | the packet group | |
type | the packet type | |
data | the packet data | |
len | the packet length in bytes | |
dest | the 16-bit address of the XBee to send the packet to | |
frame | the frame number to see with a TX_STATUS response |
int wl_send_robot_to_robot_packet | ( | char | group, | |
char | type, | |||
char * | data, | |||
int | len, | |||
int | dest, | |||
char | frame | |||
) |
Send a packet to a specific robot in our PAN.
Send a packet to a specific XBee in the same PAN.
group | the packet group | |
type | the packet type | |
data | the packet data | |
len | the packet length in bytes | |
dest | the 16-bit address of the XBee to send the packet to | |
frame | the frame number to see with a TX_STATUS response |
int wl_set_channel | ( | int | channel | ) |
Set the channel we are using.
Set the channel the XBee is listening to.
channel | the new channel to join |
int wl_set_pan | ( | int | pan | ) |
Set the PAN we are using.
Set the PAN for the XBee to join.
pan | the new PAN |
void wl_terminate | ( | void | ) |
Uninitialize the wireless library.
Uninitializes the wireless library.
void wl_unregister_packet_group | ( | PacketGroupHandler * | h | ) |
Unregister a packet group with the wireless library.
Unregister a packet group from the wireless library.
h | the packet group to remove |