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