Wireless Basic

Wireless abstraction for easily sending and receing packets. More...

Data Structures

struct  PacketInfo
 struct that contains relevant packet information More...

Defines

#define WL_BASIC_GROUP   8
 default wireless group for basic sending and receiving packets

Functions

int wl_basic_init (void(*handle_receive)(char type, int source, unsigned char *packet, int length))
 init wireless for Basic Group
int wl_basic_init_default (void)
 init wireless for Basic Group with default packet handling
void wl_basic_register_handler (void(*handle_receive)(char type, int source, unsigned char *packet, int length))
 internal function to register a packet handler function
void wl_basic_send_robot_packet (char type, char *data, int len, int dest)
 send a packet to a single robot in Basic Group
void wl_basic_send_global_packet (char type, char *data, int len)
 send a packet to all robots in Basic Group
void wl_basic_packet_receive_handler (char type, int source, unsigned char *packet, int length)
 internal default packet handler if none is specified on init
unsigned char * wl_basic_do_default (void)
 wrapper for wl_do() to return packet data buffer

Variables

PacketGroupHandler wl_basic_group_handler
 PacketGroupHandler struct for Basic Group.
struct PacketInfo current_packet
 current packet information, correct after wl_basic_do()

Detailed Description

Wireless abstraction for easily sending and receing packets.

A high level abstraction of the wireless library.

This will allow you to easily send and receive packets.


Function Documentation

unsigned char* wl_basic_do_default ( void   ) 

wrapper for wl_do() to return packet data buffer

Wrapper for wl_do() for use with the Basic Wireless group. Can only be called if wl_basic_init_default and your packets are handled with the default packet handler. To access packet information, use PacketInfo current_packet.

Returns:
pointer to the data of the packet just received, 0 if no new packet

References current_packet, and wl_do().

int wl_basic_init ( void(*)(char type, int source, unsigned char *packet, int length)  handle_receive  ) 

init wireless for Basic Group

Wrapper for wl_init(). Initializes wireless and registers a packet handler function for Basic Group.

Parameters:
handle_receive function pointer to handler function for Basic Group
Returns:
0 on success, -1 on error

References current_packet, wl_basic_register_handler(), and wl_init().

Referenced by wl_basic_init_default().

int wl_basic_init_default ( void   ) 

init wireless for Basic Group with default packet handling

Wrapper for wl_init(). Initializes wireless and registers the default packet handler for Basig Group.

References wl_basic_init(), and wl_basic_packet_receive_handler().

void wl_basic_packet_receive_handler ( char  type,
int  source,
unsigned char *  packet,
int  length 
)

internal default packet handler if none is specified on init

Default packet handler used if none is specified on init. This should not be called directly by any user program.

Parameters:
type Packet type
source the robot ID of the sending robot
packet Packet buffer, data you received
length Length of the data buffer in bytes

References current_packet.

Referenced by wl_basic_init_default().

void wl_basic_register_handler ( void(*)(char type, int source, unsigned char *packet, int length)  handle_receive  ) 

internal function to register a packet handler function

Internal function to register a packet group handler for Basic Group.

Parameters:
handle_receive function pointer to handler function for Basic Group

References PacketGroupHandler::groupCode, PacketGroupHandler::handle_receive, PacketGroupHandler::handle_response, PacketGroupHandler::timeout_handler, PacketGroupHandler::unregister, WL_BASIC_GROUP, wl_basic_group_handler, and wl_register_packet_group().

Referenced by wl_basic_init().

void wl_basic_send_global_packet ( char  type,
char *  data,
int  len 
)

send a packet to all robots in Basic Group

Send a packet to all robots in Basic Group.

Parameters:
type Packet type
data Packet buffer, data you want to send
len Length of the data buffer in bytes

References WL_BASIC_GROUP, and wl_send_global_packet().

void wl_basic_send_robot_packet ( char  type,
char *  data,
int  len,
int  dest 
)

send a packet to a single robot in Basic Group

Send a packet to a single robot in Basic Group.

Parameters:
type Packet type
data Packet buffer, data you want to send
len Length of the data buffer in bytes
dest Robot ID of the destination robot

References WL_BASIC_GROUP, and wl_send_robot_to_robot_global_packet().


Generated on Sun Sep 20 12:12:02 2009 for libwireless by  doxygen 1.6.1