Revision 347
fixed dumb wl library bug
trunk/code/projects/colonet/lib/colonet_wireless/colonet_wireless.cpp | ||
---|---|---|
50 | 50 |
|
51 | 51 |
|
52 | 52 |
/**************************** Public functions *******************************/ |
53 |
void colonet_wl_init(char* wl_port_, MsgHandlerFunction message_handler_, |
|
54 |
char* log_filename_) {
|
|
55 |
if (log_filename) {
|
|
53 |
void colonet_wl_init(char* wl_port_, MsgHandlerFunction message_handler_, char* log_filename_) {
|
|
54 |
if (log_filename_ != NULL) {
|
|
55 |
printf("Log filename_=%p: %s\n", log_filename_, log_filename_);
|
|
56 | 56 |
logging_enabled = true; |
57 |
sprintf(log_filename, log_filename_);
|
|
57 |
strcpy(log_filename, log_filename_);
|
|
58 | 58 |
} |
59 | 59 |
|
60 | 60 |
strncpy(wl_port, wl_port_, 40); |
trunk/code/projects/colonet/lib/colonet_wireless/colonet_wireless.h | ||
---|---|---|
11 | 11 |
|
12 | 12 |
#include <colonet_defs.h> |
13 | 13 |
|
14 |
typedef int(*MsgHandlerFunction)(unsigned char type, short source, int dest, |
|
15 |
unsigned char* data, int len); |
|
14 |
typedef int(*MsgHandlerFunction)(unsigned char type, short source, int dest, unsigned char* data, int len); |
|
16 | 15 |
|
17 | 16 |
/** @brief Initializes colonet wireless library |
18 | 17 |
* |
... | ... | |
24 | 23 |
* |
25 | 24 |
* @return new ColonetWireless object |
26 | 25 |
*/ |
27 |
void colonet_wl_init(char* wl_port, MsgHandlerFunction message_handler_, |
|
28 |
char* log_filename_); |
|
26 |
void colonet_wl_init(char* wl_port, MsgHandlerFunction message_handler_, char* log_filename_); |
|
29 | 27 |
|
30 | 28 |
/** @brief Spawns a thread which reads data from the hardware interface |
31 | 29 |
* with the colony (either a dongle or a robot programmed to relay data) |
trunk/code/projects/colonet/ColonetServer/ColonetServer.cpp | ||
---|---|---|
27 | 27 |
#define LISTEN_BACKLOG 5 |
28 | 28 |
#define LOG_BUFFER_LENGTH 128 |
29 | 29 |
|
30 |
#define u_int32_t unsigned |
|
31 |
|
|
30 | 32 |
ConnectionPool * connection_pool; |
31 | 33 |
|
32 | 34 |
/** |
... | ... | |
185 | 187 |
char* log_filename = NULL; |
186 | 188 |
|
187 | 189 |
if (optionsG.logging_enabled) { |
190 |
printf("Logging enabled.\n"); |
|
188 | 191 |
log_filename = optionsG.log_filename; |
192 |
} else { |
|
193 |
printf("Logging disabled.\n"); |
|
189 | 194 |
} |
190 | 195 |
|
191 |
colonet_wl_init(optionsG.wireless_port, wirelessMessageHandler, |
|
192 |
log_filename); |
|
196 |
printf("log filename = %p\n", log_filename); |
|
193 | 197 |
|
198 |
colonet_wl_init(optionsG.wireless_port, wirelessMessageHandler, log_filename); |
|
199 |
|
|
194 | 200 |
if (colonet_wl_run_listener_thread()) { |
195 | 201 |
fprintf(stderr, "%s: colonet_wl_run_listener_thread failed.\n", |
196 | 202 |
__FUNCTION__); |
trunk/code/projects/colonet/ColonetServer/options.c | ||
---|---|---|
40 | 40 |
int c; |
41 | 41 |
|
42 | 42 |
memset(&optionsG, 0, sizeof(ColonetServerOptionsT)); |
43 |
|
|
43 |
|
|
44 | 44 |
if (argc < 2) { |
45 | 45 |
printf("No port was specified for listening for client connections." |
46 | 46 |
" Defaulting to %d\n", DEFAULTPORT); |
... | ... | |
59 | 59 |
if (c == -1) { |
60 | 60 |
break; |
61 | 61 |
} |
62 |
|
|
62 |
|
|
63 | 63 |
switch (c) { |
64 | 64 |
case 'p': |
65 | 65 |
/* Listen port */ |
66 | 66 |
optionsG.listen_port = atoi(optarg); |
67 |
|
|
67 |
|
|
68 | 68 |
if (optionsG.listen_port < SMALLEST_POSS_LISTEN_PORT) { |
69 | 69 |
printf("You cannot listen on a port less than %d.\n", |
70 | 70 |
SMALLEST_POSS_LISTEN_PORT); |
Also available in: Unified diff