-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatalogger.h
95 lines (79 loc) · 2.78 KB
/
datalogger.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
Control program for SkyTraq GPS data logger.
Copyright (C) 2008 Jesper Zedlitz, [email protected]
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
*/
#ifndef datalogger_h
#define datalogger_h
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <math.h>
#include <unistd.h>
#include <time.h>
#include <sys/time.h>
#include "agps-download.h"
enum {ERROR=-1, SUCCESS};
enum {NACK=-1, ACK};
#define gbuint8 unsigned char
#define gbuint32 unsigned long
#define gbuint16 unsigned int
#ifdef DEBUG_ALL
#undef DEBUG
#define DEBUG(fmt, args...) fprintf(stderr, fmt, ##args)
#else
#define DEBUG(fmt, args...)
#endif
#define SKYTRAQ_SPEED_4800 0
#define SKYTRAQ_SPEED_9600 1
#define SKYTRAQ_SPEED_19200 2
#define SKYTRAQ_SPEED_38400 3
#define SKYTRAQ_SPEED_57600 4
#define SKYTRAQ_SPEED_115200 5
typedef struct SkyTraqPackage {
gbuint8 length;
gbuint8* data;
gbuint8 checksum;
} SkyTraqPackage;
typedef struct skytraq_config {
gbuint32 log_wr_ptr;
gbuint16 sectors_left;
gbuint16 total_sectors;
gbuint32 max_time;
gbuint32 min_time;
gbuint32 max_distance;
gbuint32 min_distance;
gbuint32 max_speed;
gbuint32 min_speed;
gbuint8 datalog_enable;
gbuint8 log_fifo_mode;
gbuint8 agps_enabled;
unsigned agps_hours_left;
} skytraq_config;
int skytraq_read_software_version( int fd);
int skytraq_read_datalogger_config( int fd, skytraq_config* config);
int skytraq_read_datalog_sector( int fd, gbuint8 sector, gbuint8* buffer );
void skytraq_clear_datalog( int fd);
void skytraq_write_datalogger_config( int fd, skytraq_config* config);
long process_buffer(const gbuint8* buffer,const int length,const long last_timestamp);
int skytraq_determine_speed( int fd) ;
unsigned skytraq_mkspeed(unsigned br);
int skytraq_set_serial_speed( int fd, int speed, int permanent);
void skytraq_read_agps_status(int fd, skytraq_config* config);
int skytraq_output_disable( int fd );
int skytraq_output_enable_nmea( int fd );
int skytraq_output_enable_binary( int fd );
int skytraq_send_agps_data( int fd, agps_data* data );
#endif