root / trunk / code / projects / colonet / server / Main.cpp @ 620
History | View | Annotate | Download (901 Bytes)
1 |
#include <stdio.h> |
---|---|
2 |
#include <signal.h> |
3 |
#include <ColonetServer.h> |
4 |
#include <wireless.h> |
5 |
|
6 |
ColonetServer colonet_server; |
7 |
|
8 |
void cleanup(int a) { |
9 |
a = a; |
10 |
|
11 |
//wl_terminate();
|
12 |
printf("todo - close wl port\n");
|
13 |
|
14 |
exit(0);
|
15 |
} |
16 |
|
17 |
/**
|
18 |
* @brief The main function of the server
|
19 |
*
|
20 |
* @param argc The number of command line arguments passed to the program
|
21 |
* @param argv The command line arguments passed to the program
|
22 |
*
|
23 |
* @return 0 on success, negative error code on error
|
24 |
*/
|
25 |
int main(int argc, char** argv) { |
26 |
if (colonet_server.initialize_server(argc, argv) < 0) { |
27 |
fprintf(stderr, "\nThere was an error initializing the server.\n");
|
28 |
return -1; |
29 |
} |
30 |
|
31 |
signal(SIGINT, cleanup); |
32 |
|
33 |
if (colonet_server.start_listening() < 0) { |
34 |
fprintf(stderr, "ColonetServer.start_listening failed.\n");
|
35 |
return -1; |
36 |
} |
37 |
|
38 |
colonet_server.run_position_monitor(); |
39 |
|
40 |
colonet_server.run_server(); |
41 |
|
42 |
return 0; |
43 |
} |