libgpsfile  0.2.2
some useful C-functions
gps_table.h
Go to the documentation of this file.
1 /* kate: indent-mode cstyle; tab-width 6; indent-width 6; */
2 #ifndef XGPS_TABLE_H
3 #define XGPS_TABLE_H
4 
5 #include <time.h>
6 #include <cfe/gpstypes.h>
7 #include <cfe-tables/tables.h>
8 
9 #define TIME_NA (struct timeval){0, 0}
10 #define ALTITUDE_NA (alt_t)(ALT_REAL_MIN)
11 #define ACCURACY_NA (acc_t)(-1)
12 
13 #define gps_table_get_num_records(x) table_get_num_records(x)
14 #define gps_table_free(x) table_free(x)
15 /*
16 #define GPS_EXTENSION_SPEED 'A'
17 #define GPS_EXTENSION_CADENCE 'B'
18 #define GPS_EXTENSION_TEMP 'C'
19 #define GPS_EXTENSION_HR 'D'
20 #define GPS_EXTENSION_DISTANCE 'E'
21 #define GPS_EXTENSION_SEALEVELPRESSURE 'F'
22 #define GPS_EXTENSION_POWER 'G'
23 #define GPS_EXTENSION_VERTICALSPEED 'H'
24 #define GPS_EXTENSION_ENERGY 'I'
25 #define GPS_EXTENSION_ACCURACY 'J'
26 #define GPS_EXTENSION_A 'J'*/
27 #define GPS_EXTENSION_NO_VALUE '-'
28 
29 enum
30 {
38 };
39 /*
40 typedef enum
41 {
42  SPEED = GPS_EXTENSION_SPEED,
43  CADENCE = GPS_EXTENSION_CADENCE,
44  TEMPERATURE = GPS_EXTENSION_TEMP,
45  HR = GPS_EXTENSION_HR,
46  DISTANCE = GPS_EXTENSION_DISTANCE,
47  SEALEVELPRESSURE = GPS_EXTENSION_SEALEVELPRESSURE,
48  POWER = GPS_EXTENSION_POWER,
49  VERTICALSPEED = GPS_EXTENSION_VERTICALSPEED,
50  ENERGY = GPS_EXTENSION_ENERGY,
51  ACCURACY = GPS_EXTENSION_ACCURACY,
52  NO_VALUE = GPS_EXTENSION_NO_VALUE
53 } gps_ext_type_t;
54 */
55 typedef enum
56 {
62  HR,
70 
71 INIT_TABLE_TYPE_DEF(gps)
72 rec_t gps_table_store(table_t *t, struct timeval *time, lat_t lat, lng_t lng, alt_t alt, acc_t acc);
73 rec_t gps_table_store_pos(table_t *t, rec_t pos, struct timeval *time, lat_t lat, lng_t lng, alt_t alt, acc_t acc);
74 rec_t gps_table_set_altitude_by_record(const table_t *t, rec_t i, alt_t alt);
75 rec_t gps_table_set_latitude_by_record(const table_t *t, rec_t i, lat_t lat);
76 rec_t gps_table_set_longitude_by_record(const table_t *t, rec_t i, lng_t lng);
77 rec_t gps_table_set_time_by_record(const table_t *t, rec_t i, struct timeval *time);
78 struct timeval gps_table_get_time_by_record(const table_t *t, rec_t i);
79 lat_t gps_table_get_latitude_by_record(const table_t *t, rec_t i);
80 lng_t gps_table_get_longitude_by_record(const table_t *t, rec_t i);
81 alt_t gps_table_get_altitude_by_record(const table_t *t, rec_t i);
82 rec_t gps_table_get_record_by_latlng(const table_t *t, lat_t lat, lng_t lng);
83 long double gps_table_get_distance_by_record(const table_t *t, rec_t i);
84 acc_t gps_table_get_accuracy_by_record(const table_t *t, rec_t i);
85 rec_t gps_table_get_record_by_time_with_start_point(const table_t *t, struct timeval *time, rec_t i);
86 inline rec_t gps_table_get_record_by_time(const table_t *t, struct timeval *time);
87 lat_t gps_table_get_latitude_by_time(const table_t *t, struct timeval *time);
88 lng_t gps_table_get_longitude_by_time(const table_t *t, struct timeval *time);
89 alt_t gps_table_get_altitude_by_time(const table_t *t, struct timeval *time);
90 void gps_table_update_distance(const table_t *t, rec_t i);
91 
92 int8_t gps_table_set_extension_value(const table_t *t, rec_t i, gps_ext_type_t type, float value);
93 float gps_table_get_extension_value(const table_t *t, rec_t i, gps_ext_type_t type);
94 int8_t gps_table_remove_extension(const table_t *t, rec_t i, gps_ext_type_t type);
95 
96 #endif /* XGPSTABLE_H */
rec_t gps_table_get_record_by_time(const table_t *t, struct timeval *time)
rec_t gps_table_store(table_t *t, struct timeval *time, lat_t lat, lng_t lng, alt_t alt, acc_t acc)
rec_t gps_table_set_time_by_record(const table_t *t, rec_t i, struct timeval *time)
int8_t gps_table_set_extension_value(const table_t *t, rec_t i, gps_ext_type_t type, float value)
float gps_table_get_extension_value(const table_t *t, rec_t i, gps_ext_type_t type)
alt_t gps_table_get_altitude_by_record(const table_t *t, rec_t i)
void gps_table_update_distance(const table_t *t, rec_t i)
gps_ext_type_t
Definition: gps_table.h:55
rec_t gps_table_get_record_by_latlng(const table_t *t, lat_t lat, lng_t lng)
rec_t gps_table_set_altitude_by_record(const table_t *t, rec_t i, alt_t alt)
acc_t gps_table_get_accuracy_by_record(const table_t *t, rec_t i)
Definition: gps_table.h:62
lat_t gps_table_get_latitude_by_time(const table_t *t, struct timeval *time)
rec_t gps_table_set_latitude_by_record(const table_t *t, rec_t i, lat_t lat)
int8_t gps_table_remove_extension(const table_t *t, rec_t i, gps_ext_type_t type)
rec_t gps_table_store_pos(table_t *t, rec_t pos, struct timeval *time, lat_t lat, lng_t lng, alt_t alt, acc_t acc)
long double gps_table_get_distance_by_record(const table_t *t, rec_t i)
struct timeval gps_table_get_time_by_record(const table_t *t, rec_t i)
rec_t gps_table_get_record_by_time_with_start_point(const table_t *t, struct timeval *time, rec_t i)
rec_t gps_table_set_longitude_by_record(const table_t *t, rec_t i, lng_t lng)
lng_t gps_table_get_longitude_by_record(const table_t *t, rec_t i)
lat_t gps_table_get_latitude_by_record(const table_t *t, rec_t i)
lng_t gps_table_get_longitude_by_time(const table_t *t, struct timeval *time)
alt_t gps_table_get_altitude_by_time(const table_t *t, struct timeval *time)