root / trunk / code / projects / colonet / lib / colonet_wireless / colonet_wireless.h @ 347
History | View | Annotate | Download (1.51 KB)
1 |
/** @file colonet_wireless.h
|
---|---|
2 |
*
|
3 |
* @brief Wireless library for communicating with colony robots
|
4 |
*
|
5 |
* @author Eugene Marinelli
|
6 |
* @date 10/10/07
|
7 |
*/
|
8 |
|
9 |
#ifndef COLONET_WIRELESS_H_
|
10 |
#define COLONET_WIRELESS_H_
|
11 |
|
12 |
#include <colonet_defs.h> |
13 |
|
14 |
typedef int(*MsgHandlerFunction)(unsigned char type, short source, int dest, unsigned char* data, int len); |
15 |
|
16 |
/** @brief Initializes colonet wireless library
|
17 |
*
|
18 |
* @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 |
*
|
24 |
* @return new ColonetWireless object
|
25 |
*/
|
26 |
void colonet_wl_init(char* wl_port, MsgHandlerFunction message_handler_, char* log_filename_); |
27 |
|
28 |
/** @brief Spawns a thread which reads data from the hardware interface
|
29 |
* 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 |
int colonet_wl_run_listener_thread(void); |
35 |
|
36 |
void colonet_wl_kill_listener_thread(void); |
37 |
|
38 |
/**
|
39 |
* @brief ...
|
40 |
*
|
41 |
* @return void
|
42 |
*/
|
43 |
void colonet_wl_send(short client_source, short dest, ColonetMessageType msg_type, unsigned char msg_code, |
44 |
unsigned char* args); |
45 |
|
46 |
int colonet_get_num_robots(void); |
47 |
|
48 |
int** colonet_get_sensor_matrix(int* numrobots, int** ids); |
49 |
int* colonet_get_xbee_ids(int* numrobots); |
50 |
|
51 |
#endif
|