Revision 399
colonet wireless now setting com port and checking for wlinit errors
trunk/code/projects/colonet/ColonetServer/colonet_wireless.cpp | ||
---|---|---|
58 | 58 |
|
59 | 59 |
message_handler = message_handler_; |
60 | 60 |
|
61 |
printf("Calling wl_init...\n"); |
|
62 |
wl_init(); |
|
63 |
printf("wl_init succeeded.\n"); |
|
61 |
wl_set_com_port(wl_port); |
|
64 | 62 |
|
63 |
printf("Calling wl_init(%s)...\n", wl_port); |
|
64 |
if (wl_init() != 0) { |
|
65 |
fprintf(stderr, "wl_init failed.\n"); |
|
66 |
return -1; |
|
67 |
} |
|
68 |
|
|
65 | 69 |
wl_token_ring_register(); |
66 | 70 |
|
67 | 71 |
printf("Joining token ring...\n"); |
trunk/code/projects/colonet/ColonetServer/wirelessMessageHandler.cpp | ||
---|---|---|
22 | 22 |
extern ColonetServer colonet_server; |
23 | 23 |
|
24 | 24 |
/* Public functions */ |
25 |
int wirelessMessageHandler(unsigned char type, short source, int dest, |
|
26 |
unsigned char* data, int len) { |
|
25 |
int wirelessMessageHandler(unsigned char type, short source, int dest, unsigned char* data, int len) { |
|
27 | 26 |
printf("Server received wireless message!!!\n"); |
28 | 27 |
|
29 | 28 |
printf("server received this packet: "); |
trunk/code/projects/colonet/ColonetServer/options.c | ||
---|---|---|
45 | 45 |
memset(&optionsG, 0, sizeof(ColonetServerOptionsT)); |
46 | 46 |
|
47 | 47 |
if (argc < 2) { |
48 |
printf("No port was specified for listening for client connections." |
|
49 |
" Defaulting to %d\n", DEFAULTPORT); |
|
48 |
printf("No port was specified for listening for client connections. Defaulting to %d\n", DEFAULTPORT); |
|
50 | 49 |
} |
51 | 50 |
|
52 | 51 |
/* Defaults */ |
... | ... | |
69 | 68 |
optionsG.listen_port = atoi(optarg); |
70 | 69 |
|
71 | 70 |
if (optionsG.listen_port < SMALLEST_POSS_LISTEN_PORT) { |
72 |
printf("You cannot listen on a port less than %d.\n", |
|
73 |
SMALLEST_POSS_LISTEN_PORT); |
|
71 |
printf("You cannot listen on a port less than %d.\n", SMALLEST_POSS_LISTEN_PORT); |
|
74 | 72 |
printf("Setting listener port to %d\n", DEFAULTPORT); |
75 | 73 |
optionsG.listen_port = DEFAULTPORT; |
76 | 74 |
} |
... | ... | |
78 | 76 |
case 'w': |
79 | 77 |
/* Set wireless port */ |
80 | 78 |
strcpy(optionsG.wireless_port, optarg); |
79 |
printf("Wireless port set to %s.\n", optionsG.wireless_port); |
|
81 | 80 |
break; |
82 | 81 |
case 'l': |
83 | 82 |
/* Set log filename (and enable logging) */ |
trunk/code/projects/colonet/README | ||
---|---|---|
26 | 26 |
|
27 | 27 |
TROUBLESHOOTING |
28 | 28 |
|
29 |
"Failed to write to xbee, error 9." |
|
30 |
The Xbee is not being recognized by the computer (assuming it is plugged in). Try unplugging it and plugging it in |
|
31 |
again. |
|
29 |
If you get an error like: |
|
30 |
Failed to write to xbee, error 9. |
|
31 |
Failed to join token ring. |
|
32 |
ERROR - colonet_wl_init failed. |
|
33 |
initialize_server: initWireless failed |
|
34 |
|
|
35 |
The xbee on the specified wireless port/file descriptor is not being recognized by the computer (assuming it is |
|
36 |
plugged in and you are using the right port (/dev/ttyUSB0, /dev/ttyUSB1)). Try unplugging it and plugging it in again. |
|
37 |
Check the wireless port (-w option of ColonetServer). |
trunk/code/projects/libwireless/lib/wireless.h | ||
---|---|---|
118 | 118 |
} PacketGroupHandler; |
119 | 119 |
|
120 | 120 |
/**@brief Initialize the wireless library **/ |
121 |
int wl_init(void);
|
|
121 |
int wl_init(); |
|
122 | 122 |
/**@brief Uninitialize the wireless library **/ |
123 | 123 |
void wl_terminate(void); |
124 | 124 |
/**@brief Perform wireless library functionality **/ |
... | ... | |
132 | 132 |
void wl_send_robot_to_robot_global_packet(char group, char type, |
133 | 133 |
char* data, int len, int dest, char frame); |
134 | 134 |
/**@brief Send a packet to a specific robot in our PAN **/ |
135 |
void wl_send_robot_to_robot_packet(char group, char type, |
|
136 |
char* data, int len, int dest, char frame); |
|
135 |
void wl_send_robot_to_robot_packet(char group, char type, char* data, int len, int dest, char frame); |
|
137 | 136 |
/**@brief Send a packet to all robots **/ |
138 | 137 |
int wl_send_global_packet(char group, char type, char* data, int len, char frame); |
139 | 138 |
/**@brief Send a packet to all robots in our PAN **/ |
trunk/code/projects/libwireless/lib/xbee.c | ||
---|---|---|
100 | 100 |
/*Global Variables*/ |
101 | 101 |
|
102 | 102 |
#ifndef ROBOT |
103 |
char* xbee_com_port = XBEE_PORT_DEFAULT; |
|
104 |
int xbee_stream; |
|
105 |
pthread_t* xbee_listen_thread; |
|
103 |
static char* xbee_com_port = XBEE_PORT_DEFAULT;
|
|
104 |
static int xbee_stream;
|
|
105 |
static pthread_t* xbee_listen_thread;
|
|
106 | 106 |
#endif |
107 | 107 |
|
108 | 108 |
// TODO: is this a good size? |
... | ... | |
193 | 193 |
/** |
194 | 194 |
* Initializes the XBee library so that other functions may be used. |
195 | 195 |
**/ |
196 |
int xbee_lib_init(void)
|
|
196 |
int xbee_lib_init() |
|
197 | 197 |
{ |
198 | 198 |
arrival_buf[0] = 'A'; |
199 | 199 |
arrival_buf[1] = 'A'; |
trunk/code/projects/libwireless/lib/xbee.h | ||
---|---|---|
74 | 74 |
#define XBEE_RX 0x81 |
75 | 75 |
|
76 | 76 |
/**@brief Initialize the XBee library **/ |
77 |
int xbee_lib_init(void);
|
|
77 |
int xbee_lib_init(); |
|
78 | 78 |
/**@brief Uninitialize the XBee library **/ |
79 | 79 |
void xbee_terminate(void); |
80 | 80 |
/**@brief Get a packet from the XBee **/ |
trunk/code/projects/libwireless/lib/wireless.c | ||
---|---|---|
96 | 96 |
/** |
97 | 97 |
* Initializes the wireless library. Must be called before any |
98 | 98 |
* other function. |
99 |
* |
|
100 |
* @param wl_port File descriptor for wireless port, or NULL for default. |
|
99 | 101 |
**/ |
100 | 102 |
int wl_init() |
101 | 103 |
{ |
Also available in: Unified diff