root / trunk / code / projects / libwireless / lib / wl_basic.h @ 1396
History | View | Annotate | Download (1.86 KB)
1 |
/**
|
---|---|
2 |
* @file wl_basic.h
|
3 |
* @brief High Level Wireless Packet Sending-Receiving Functions
|
4 |
*
|
5 |
* Abstracted wireless functionality for sending and receiving packets
|
6 |
*
|
7 |
* @author Christopher Mar, Colony Project, CMU Robotics Club
|
8 |
**/
|
9 |
|
10 |
/**
|
11 |
* @defgroup wl_basic Wireless Basic
|
12 |
* @brief Wireless abstraction for easily sending and receing packets.
|
13 |
*
|
14 |
* A high level abstraction of the wireless library.
|
15 |
*
|
16 |
* This will allow you to easily send and receive packets.
|
17 |
*
|
18 |
* @{
|
19 |
**/
|
20 |
|
21 |
#ifndef WL_BASIC_H
|
22 |
#define WL_BASIC_H
|
23 |
|
24 |
#include <wireless.h> |
25 |
|
26 |
#define WL_BASIC_GROUP 8 |
27 |
|
28 |
/** @brief init wireless for Basic Group **/
|
29 |
int wl_basic_init( void (*handle_receive) (char type, int source, unsigned char* packet, int length) ); |
30 |
/** @brief init wireless for Basic Group with default packet handling **/
|
31 |
int wl_basic_init_default( void ); |
32 |
/** @brief internal function to register a packet handler function **/
|
33 |
void wl_basic_register_handler( void (*handle_receive) (char type, int source, unsigned char* packet, int length) ); |
34 |
/** @brief send a packet to a single robot in Basic Group **/
|
35 |
void wl_basic_send_robot_packet( char type, char* data, int len, int dest ); |
36 |
/** @brief send a packet to all robots in Basic Group **/
|
37 |
void wl_basic_send_global_packet( char type, char* data, int len ); |
38 |
/** @brief default packet handler if none is specified on init **/
|
39 |
void wl_basic_packet_receive_handler( char type, int source, unsigned char* packet, int length ); |
40 |
/** @brief wrapper for wl_do() to return packet data buffer **/
|
41 |
unsigned char* wl_basic_do( void ); |
42 |
|
43 |
/** @brief PacketGroupHandler struct for Basic Group **/
|
44 |
PacketGroupHandler wl_basic_group_handler; |
45 |
|
46 |
struct PacketInfo {
|
47 |
char new_flag;
|
48 |
char type;
|
49 |
int source;
|
50 |
unsigned char* pointer; |
51 |
int length;
|
52 |
}; |
53 |
|
54 |
/**
|
55 |
* @brief current packet information, correct after wl_basic_do()
|
56 |
**/
|
57 |
struct PacketInfo current_packet;
|
58 |
|
59 |
/** @} **/ // end defgroup |
60 |
|
61 |
#endif
|
62 |
|