Project

General

Profile

Statistics
| Revision:

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

History | View | Annotate | Download (891 Bytes)

1 391 emarinel
#include <stdio.h>
2 508 emarinel
#include <signal.h>
3 391 emarinel
#include <ColonetServer.h>
4 581 jknichel
#include <wireless.h>
5 391 emarinel
6
ColonetServer colonet_server;
7
8 508 emarinel
void cleanup(int a) {
9 581 jknichel
  //wl_terminate();
10
  printf("todo - close wl port\n");
11
12 508 emarinel
  exit(0);
13
}
14
15 391 emarinel
/**
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 508 emarinel
  signal(SIGINT, cleanup);
30
31 391 emarinel
  if (colonet_server.start_listening() < 0) {
32 397 emarinel
    fprintf(stderr, "ColonetServer.start_listening failed.\n");
33 391 emarinel
    return -1;
34
  }
35
36 508 emarinel
  colonet_server.run_position_monitor();
37
38 391 emarinel
  colonet_server.run_server();
39
40
  return 0;
41
}