Interface with the wireless library. More...
Data Structures | |
struct | PacketGroupHandler |
Modules | |
Public Constants | |
Public API Functions | |
Error Codes | |
Defines | |
#define | PACKET_BUFFER_SIZE 250 |
Functions | |
int8_t | wl_init (void) |
Initialize wireless. | |
int8_t | wl_terminate (void) |
Terminate wireless. | |
int8_t | wl_register_handler (uint8_t group, FNPTR, uint8_t priority) |
Function to register new packet handlers (for non-default groups only). | |
int8_t | wl_unregister_handler (uint8_t group) |
Function to unregister existing packet handlers (for non-default groups only). | |
int8_t | wl_get (char *data, uint8_t length) |
The main receive function. Dispatches packets for registered handlers and returns next basic packet if available. | |
int8_t | wl_get_basic (char *data, uint8_t length) |
Returns the next basic packet if available. | |
int8_t | wl_dispatch (void) |
Dispatches packets for registered handlers. | |
int16_t | wl_send (uint8_t *data, uint8_t length, uint8_t group, uint8_t scope, uint16_t dest, uint8_t mode) |
The core send function. This will take all possible arguments and send all types of packets. | |
int16_t | wl_send_global (uint8_t *data, uint8_t length, uint8_t group) |
Wrapper for core send function that will send a global packet across the current channel. | |
int16_t | wl_send_pan (uint8_t *data, uint8_t length, uint8_t group) |
Wrapper for core send function that will send a packet across the current channel on the current pan. | |
int16_t | wl_send_robot (uint8_t *data, uint8_t length, uint8_t group, uint16_t dest, uint8_t mode) |
Wrapper for core send function that will send a packet across the current channel to a specific robot. | |
int16_t | wl_send_basic (uint8_t *data, uint8_t length) |
Default (i.e. basic) send wrapper. | |
uint8_t | wl_ack_error (void) |
Returns the number of acknowledgment errors. | |
int8_t | wl_ack_check (uint8_t packet) |
Checks a specific packet for the acknowledgement status. | |
void | wl_ack_reset (void) |
Resets acknowledgement statistics back to zero. |
Interface with the wireless library.
int8_t wl_ack_check | ( | uint8_t | packet | ) |
Checks a specific packet for the acknowledgement status.
acknowledgement error check check if a specific packet has been lost note: buffer will overflow every 255 packets
packet | packet number |
References WL_ERROR_ARGUMENT.
uint8_t wl_ack_error | ( | void | ) |
Returns the number of acknowledgment errors.
acknowledgment error check if any of the packets you have sent have been lost.
note that all other error checking will be handled by library, so your user behavior won't have to worry about it
void wl_ack_reset | ( | void | ) |
Resets acknowledgement statistics back to zero.
acknowledgement reset reset the acknowledgement buffer
int8_t wl_get | ( | char * | data, | |
uint8_t | length | |||
) |
The main receive function. Dispatches packets for registered handlers and returns next basic packet if available.
the main receive function (similar to wl_do)
when called, this function will receive the next packet on the default packet group it will also dispatch registered packet handler functions for any other packet groups it has received
data | an already-initialized array to store the default group packet data in | |
length | the length of the initialized data array |
References wl_dispatch(), and wl_get_basic().
int8_t wl_get_basic | ( | char * | data, | |
uint8_t | length | |||
) |
Returns the next basic packet if available.
function to receive only packets on the default group this function is only meant to receive packets sent using wl_send_basic()
data | an already-initialized array to store the default group packet data in | |
length | the length of the initialized data array |
References WL_ERROR_TOO_SMALL, WL_SUCCESS, and xbee_basic_buf.
Referenced by wl_get().
int8_t wl_init | ( | void | ) |
Initialize wireless.
initialization function: set up xbee communication and packet handler infrastructure
References INIT_YES, MAX_PACKET_GROUPS, WL_ERROR_INIT_ALREADY_INITD, WL_ERROR_INIT_FAILED, WL_SUCCESS, and xbee_init().
int8_t wl_register_handler | ( | uint8_t | group, | |
FNPTR | , | |||
uint8_t | priority | |||
) |
Function to register new packet handlers (for non-default groups only).
function to register new packet handlers (for non-default groups only)
group | the packet group number of the packets to handle with this function | |
func | the function pointer to the user-specified packet handler | |
priority | flag to set the priority of the function handler |
References FUNC, INIT_NO, MAX_PACKET_GROUPS, WL_ERROR_FAILED_REGISTRATION, WL_ERROR_LIBRARY_NOT_INITD, and WL_SUCCESS.
int16_t wl_send | ( | uint8_t * | data, | |
uint8_t | length, | |||
uint8_t | group, | |||
uint8_t | scope, | |||
uint16_t | dest, | |||
uint8_t | mode | |||
) |
The core send function. This will take all possible arguments and send all types of packets.
The core send function. This will take all possible arguments and send all types of packets.
data | pointer to the byte array of data to be included in the packet | |
length | the length of the data array | |
group | the packet group of the packet | |
scope | flag for sending global packet or your current PAN | |
dest | robot ID (for robot to robot packet) | |
mode | flag for using FAST or RELIABLE sending |
References ACK_OK, BROADCAST, FAST, GLOBAL, nextframe, PAN, RELIABLE, SENDING, WL_ERROR_MODE, WL_ERROR_SCOPE, WL_ERROR_SEND, WL_ERROR_SENDING_BUFFER_FULL, WL_SUCCESS, xbee_checksum_add(), XBEE_OPTIONS_BROADCAST_ALL_PANS, XBEE_OPTIONS_DISABLE_RESPONSE, XBEE_OPTIONS_NONE, xbee_send(), xbee_send_header(), and xbee_sendc().
Referenced by wl_send_basic(), wl_send_global(), wl_send_pan(), and wl_send_robot().
int16_t wl_send_basic | ( | uint8_t * | data, | |
uint8_t | length | |||
) |
Default (i.e. basic) send wrapper.
Default (i.e. basic) send wrapper.
data | pointer to the byte array of data to be included in the packet | |
length | the length of the data array |
Check if it needs to adjust according to data type.
References BASIC, BROADCAST, GLOBAL, RELIABLE, and wl_send().
int16_t wl_send_global | ( | uint8_t * | data, | |
uint8_t | length, | |||
uint8_t | group | |||
) |
Wrapper for core send function that will send a global packet across the current channel.
Wrapper for core send function that will send a global packet across the current channel.
data | pointer to the byte array of data to be included in the packet | |
length | the length of the data array | |
group | the packet group of the packet |
int16_t wl_send_pan | ( | uint8_t * | data, | |
uint8_t | length, | |||
uint8_t | group | |||
) |
Wrapper for core send function that will send a packet across the current channel on the current pan.
Wrapper for core send function that will send a packet across the current channel on the current pan.
data | pointer to the byte array of data to be included in the packet | |
length | the length of the data array | |
group | the packet group of the packet |
int16_t wl_send_robot | ( | uint8_t * | data, | |
uint8_t | length, | |||
uint8_t | group, | |||
uint16_t | dest, | |||
uint8_t | mode | |||
) |
Wrapper for core send function that will send a packet across the current channel to a specific robot.
Wrapper for core send function that will send a packet across the current channel to a specific robot.
data | pointer to the byte array of data to be included in the packet | |
length | the length of the data array | |
group | the packet group of the packet | |
dest | robot ID (for robot to robot packet) | |
mode | flag for using FAST or RELIABLE sending |
int8_t wl_terminate | ( | void | ) |
Terminate wireless.
termination function: end xbee communication, deregister all handlers, etc
References INIT_NO, MAX_PACKET_GROUPS, WL_ERROR_LIBRARY_NOT_INITD, WL_ERROR_TERMINATION_FAILED, WL_SUCCESS, and xbee_terminate().
int8_t wl_unregister_handler | ( | uint8_t | group | ) |
Function to unregister existing packet handlers (for non-default groups only).
function to unregister existing packet handlers (for non-default groups only)
group | the packet group number of the handler to unregister |
References FUNC, INIT_NO, MAX_PACKET_GROUPS, NORMAL_PRIORITY, WL_ERROR_FAILED_UNREGISTRATION, WL_ERROR_LIBRARY_NOT_INITD, and WL_SUCCESS.