root / trunk / code / projects / colonet / ColonetServer / includes / colonet_wireless.h @ 408
History | View | Annotate | Download (1.51 KB)
1 | 11 | emarinel | /** @file colonet_wireless.h
|
---|---|---|---|
2 | *
|
||
3 | * @brief Wireless library for communicating with colony robots
|
||
4 | 167 | emarinel | *
|
5 | 11 | emarinel | * @author Eugene Marinelli
|
6 | 156 | emarinel | * @date 10/10/07
|
7 | 11 | emarinel | */
|
8 | |||
9 | #ifndef COLONET_WIRELESS_H_
|
||
10 | #define COLONET_WIRELESS_H_
|
||
11 | |||
12 | #include <colonet_defs.h> |
||
13 | |||
14 | 347 | emarinel | typedef int(*MsgHandlerFunction)(unsigned char type, short source, int dest, unsigned char* data, int len); |
15 | 11 | emarinel | |
16 | 114 | emarinel | /** @brief Initializes colonet wireless library
|
17 | 167 | emarinel | *
|
18 | 114 | emarinel | * @param wl_port Either SERIAL_PORT or USB_PORT (as defined in COLONET_DEFS)
|
19 | * @param log_filename Path to log file - outputs all raw data on the network
|
||
20 | * If set to NULL, logging is disabled.
|
||
21 | * @param msg_handler Function to be called when a packet is received.
|
||
22 | * Must take a ColonetPacket as an argument (see defn of MsgHandlerFunction)
|
||
23 | 167 | emarinel | *
|
24 | 114 | emarinel | * @return new ColonetWireless object
|
25 | */
|
||
26 | 397 | emarinel | int colonet_wl_init(char* wl_port, MsgHandlerFunction message_handler_, char* log_filename_); |
27 | 11 | emarinel | |
28 | 167 | emarinel | /** @brief Spawns a thread which reads data from the hardware interface
|
29 | 114 | emarinel | * with the colony (either a dongle or a robot programmed to relay data)
|
30 | * and runs msg_handler when a full packet is received
|
||
31 | *
|
||
32 | * @return pointer to the thread
|
||
33 | */
|
||
34 | 117 | emarinel | int colonet_wl_run_listener_thread(void); |
35 | 11 | emarinel | |
36 | 114 | emarinel | void colonet_wl_kill_listener_thread(void); |
37 | 11 | emarinel | |
38 | 114 | emarinel | /**
|
39 | * @brief ...
|
||
40 | *
|
||
41 | * @return void
|
||
42 | */
|
||
43 | 408 | emarinel | int colonet_wl_send(short client_source, short dest, ColonetMessageType msg_type, unsigned char msg_code, |
44 | unsigned char* args); |
||
45 | 11 | emarinel | |
46 | 297 | emarinel | int colonet_get_num_robots(void); |
47 | |||
48 | 298 | emarinel | int** colonet_get_sensor_matrix(int* numrobots, int** ids); |
49 | int* colonet_get_xbee_ids(int* numrobots); |
||
50 | 297 | emarinel | |
51 | 11 | emarinel | #endif |