Project

General

Profile

Statistics
| Revision:

root / trunk / code / projects / colonet / server / Main.cpp @ 508

History | View | Annotate | Download (853 Bytes)

1
#include <stdio.h>
2
#include <signal.h>
3
#include <ColonetServer.h>
4

    
5
ColonetServer colonet_server;
6

    
7
void cleanup(int a) {
8
  printf("TODO deinit wireless here\n");
9
  exit(0);
10
}
11

    
12
/**
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
  signal(SIGINT, cleanup);
27

    
28
  if (colonet_server.start_listening() < 0) {
29
    fprintf(stderr, "ColonetServer.start_listening failed.\n");
30
    return -1;
31
  }
32

    
33
  colonet_server.run_position_monitor();
34

    
35
  colonet_server.run_server();
36

    
37
  return 0;
38
}