Project

General

Profile

Statistics
| Revision:

root / trunk / code / projects / libwireless / logger / main.c @ 744

History | View | Annotate | Download (645 Bytes)

1
#include "stdlib.h"
2
#include "stdio.h"
3

    
4
#include <time.h>
5
#include <string.h>
6

    
7
#include "../lib/wireless.h"
8
#include "wl_token_logger.h"
9

    
10
int main(int argc, char** argv)
11
{
12
        int seconds = 60;
13
        if (argc >= 2 && !strcmp(argv[1], "-t"))
14
                seconds = atoi(argv[2]);
15
        
16
        wl_set_com_port("/dev/ttyUSB0");
17

    
18
        wl_init();
19
        //wl_token_logger_register(seconds);
20
        printf("Initialized.\n");
21
        wl_set_channel(0xE);
22
        wl_token_logger_register(seconds);
23
        printf("Started.\n");
24
        
25
        struct timespec delay;
26
        delay.tv_sec = 0;
27
        delay.tv_nsec = 50000000;
28
        while (1)
29
        {
30
                //wl_error_send_string("s");
31
                wl_do();
32
                nanosleep(&delay, 0);
33
        }
34
        
35
        wl_terminate();
36
        
37
        return 0;
38
}
39