root / trunk / code / projects / libwireless / test / test.c @ 17
History | View | Annotate | Download (974 Bytes)
1 | 17 | bcoltin | #include "stdlib.h" |
---|---|---|---|
2 | #include "stdio.h" |
||
3 | |||
4 | #include "../lib/wireless.h" |
||
5 | #include "../lib/wl_error_group.h" |
||
6 | #include "../lib/wl_token_ring.h" |
||
7 | //#include "../lib/xbee.h"
|
||
8 | |||
9 | #include <time.h> |
||
10 | |||
11 | int main()
|
||
12 | { |
||
13 | /*unsigned char buffer[128];
|
||
14 | xbee_lib_init(0x3331);
|
||
15 | printf("%i\n", xbee_get_address());
|
||
16 | struct timespec delay;
|
||
17 | delay.tv_sec = 0;
|
||
18 | delay.tv_nsec = 100000000;
|
||
19 | while (1)
|
||
20 | {
|
||
21 | int len = xbee_get_packet(buffer);
|
||
22 | if (len != -1)
|
||
23 | {
|
||
24 | int i;
|
||
25 | for (i = 0; i < len; i++)
|
||
26 | printf("%c", buffer[i]);
|
||
27 | printf("\n\r");
|
||
28 | }
|
||
29 | nanosleep(&delay, 0);
|
||
30 | wl_send_global_packet(1, 1, "CHECK", 3,
|
||
31 | 0);
|
||
32 | }
|
||
33 | xbee_terminate();*/
|
||
34 | wl_init(); |
||
35 | printf("Wireless initialized.\n");
|
||
36 | wl_error_register(); |
||
37 | wl_token_ring_register(); |
||
38 | wl_token_ring_join(); |
||
39 | printf("Packet groups initialized.\n");
|
||
40 | |||
41 | struct timespec delay;
|
||
42 | delay.tv_sec = 0;
|
||
43 | delay.tv_nsec = 100000000;
|
||
44 | while (1) |
||
45 | { |
||
46 | //wl_error_send_string("s");
|
||
47 | wl_do(); |
||
48 | nanosleep(&delay, 0);
|
||
49 | } |
||
50 | |||
51 | wl_terminate(); |
||
52 | |||
53 | return 0; |
||
54 | } |