root / branches / slam / code / projects / colonet / DataRequests / test / server / test_main.c @ 201
History | View | Annotate | Download (866 Bytes)
1 | 201 | justin | #include <stdlib.h> |
---|---|---|---|
2 | #include <stdio.h> |
||
3 | #include <unistd.h> |
||
4 | #include "wireless.h" |
||
5 | |||
6 | void handle_receive(char type, int source, unsigned char* packet, int length); |
||
7 | |||
8 | unsigned char bom_responded_flag; |
||
9 | |||
10 | int main(void){ |
||
11 | wl_set_com_port("/dev/cu.usbserial-A1000Qu6");
|
||
12 | wl_init(); |
||
13 | PacketGroupHandler* pgh = malloc(sizeof(PacketGroupHandler));
|
||
14 | pgh->groupCode=12;
|
||
15 | pgh->timeout_handler=NULL;
|
||
16 | pgh->handle_response=NULL;
|
||
17 | pgh->handle_receive=handle_receive; |
||
18 | pgh->unregister=NULL;
|
||
19 | wl_register_packet_group(pgh); |
||
20 | int i;
|
||
21 | while(1){ |
||
22 | wl_send_robot_to_robot_global_packet (12, 0, NULL, 0, 9, 0); |
||
23 | printf("Sending robot to robot global packet.\n");
|
||
24 | for(i=0;i<1000;i++){ |
||
25 | wl_do(); |
||
26 | usleep(100);
|
||
27 | } |
||
28 | } |
||
29 | return -1; |
||
30 | } |
||
31 | |||
32 | void handle_receive(char type, int source, unsigned char* packet, int length){ |
||
33 | printf("Received the callback!\n");
|
||
34 | } |