Public API Functions
[Wireless]

Functions

int8_t wl_init (void)
 Initialize wireless.
int8_t wl_terminate (void)
 Terminate wireless.
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.
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.
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).

Function Documentation

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

Parameters:
packet packet number
Returns:
{SENDING,ACK_OK,ACK_FAILURE,CCA_FAILURE}

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

Returns:
the # of packets lost (up to 255)
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

Parameters:
data an already-initialized array to store the default group packet data in
length the length of the initialized data array
Returns:
the length of the used portion of data array or error (<0)

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()

Parameters:
data an already-initialized array to store the default group packet data in
length the length of the initialized data array
Returns:
the length of the used portion of data array or error (<0)

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

Returns:
0 on success, or error code

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)

Parameters:
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
Returns:
0 on success, or error code

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.

Parameters:
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
Returns:
positive packet number for tracking acks, or error code

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.

Parameters:
data pointer to the byte array of data to be included in the packet
length the length of the data array
Returns:
positive packet number for tracking acks, or error code (TBD)

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.

Parameters:
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
Returns:
positive packet number for tracking acks, or error code

References BROADCAST, GLOBAL, RELIABLE, and wl_send().

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.

Parameters:
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
Returns:
positive packet number for tracking acks, or error code (TBD)

References BROADCAST, PAN, RELIABLE, and wl_send().

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.

Parameters:
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
Returns:
positive packet number for tracking acks, or error code (TBD)

References GLOBAL, and wl_send().

int8_t wl_terminate ( void   ) 

Terminate wireless.

termination function: end xbee communication, deregister all handlers, etc

Returns:
0 on success, or error code

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)

Parameters:
group the packet group number of the handler to unregister
Returns:
0 on success, or error code

References FUNC, INIT_NO, MAX_PACKET_GROUPS, NORMAL_PRIORITY, WL_ERROR_FAILED_UNREGISTRATION, WL_ERROR_LIBRARY_NOT_INITD, and WL_SUCCESS.

Generated on Thu May 6 13:17:00 2010 for libwireless by  doxygen 1.6.3