1
|
send functions:
|
2
|
- core:
|
3
|
wl_send(char *data, uint8_t length, uint8_t group, uint8 scope, uint8 dest, uint8 mode)
|
4
|
- scope = global or current PAN?
|
5
|
- dest = robot ID
|
6
|
- mode = TCP or UDP?
|
7
|
- wrappers:
|
8
|
wl_send_global(char *data, uint8_t length, uint8_t group)
|
9
|
wl_send_pan(char *data, uint8_t length, uint8_t group)
|
10
|
wl_send_robot/p2p(char *data, uint8_t length, uint8_t group, uint8 dest, uint8 mode)
|
11
|
- default:
|
12
|
wl_send_basic(char *data)
|
13
|
|
14
|
ACK (private, for the most part...):
|
15
|
- error
|
16
|
int8_t wl_ack_error()
|
17
|
- return error on lost packet (only last packet sent)
|
18
|
- maybe the # of lost packets, reset on call to this function
|
19
|
|
20
|
receive functions:
|
21
|
- receive functions
|
22
|
int8_t wl_dispatch( void )
|
23
|
- get new packets and call handler functions for received groups
|
24
|
- does not handle default group
|
25
|
- returns error codes
|
26
|
int8_t wl_get( char *data, uint8_t length)
|
27
|
- data is an already-initialized packet
|
28
|
- length is the length of data
|
29
|
- handles basic and dispatch/group
|
30
|
- on return
|
31
|
- data will point to BASIC packet data
|
32
|
- returns the length of packet data or error
|
33
|
- default receive function:
|
34
|
int8_t wl_get_basic( char *data, uint8_t length )
|
35
|
- data is an already-initialized packet
|
36
|
- length is the length of data
|
37
|
- on return
|
38
|
- data will point to packet data
|
39
|
- returns the length of packet data or error
|
40
|
- other per-group handlers:
|
41
|
registered by user
|
42
|
|
43
|
init functions:
|
44
|
- regular init
|
45
|
wl_init( void )
|
46
|
- initialize xbee
|
47
|
- set default channel, PAN
|
48
|
|
49
|
register functions:
|
50
|
- user registers packet group and handler function
|
51
|
int8_t wl_register_handler(uint8_t group, void (*func)(void), uint8_t priority)
|
52
|
- group = group number
|
53
|
- func = function pointer to handler
|
54
|
- priority = 0 for normal (put on buffer), anything else (e.g. 1) for high
|