Project

General

Profile

Statistics
| Revision:

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

History | View | Annotate | Download (891 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
  //wl_terminate();
10
  printf("todo - close wl port\n");
11

    
12
  exit(0);
13
}
14

    
15
/**
16
 * @brief The main function of the server
17
 *
18
 * @param argc The number of command line arguments passed to the program
19
 * @param argv The command line arguments passed to the program
20
 *
21
 * @return 0 on success, negative error code on error
22
 */
23
int main(int argc, char** argv) {
24
  if (colonet_server.initialize_server(argc, argv) < 0) {
25
    fprintf(stderr, "\nThere was an error initializing the server.\n");
26
    return -1;
27
  }
28

    
29
  signal(SIGINT, cleanup);
30

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

    
36
  colonet_server.run_position_monitor();
37

    
38
  colonet_server.run_server();
39

    
40
  return 0;
41
}