This repository has been archived by the owner on Jul 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
gps_maskdump.c
86 lines (79 loc) · 2.44 KB
/
gps_maskdump.c
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
/* This code is generated. Do not hand-hack it! */
/*
* Also, beware that it is something of a CPU hog when called on every packet.
* Try to write guards so it is only called at higher log levels.
*/
#include "gpsd_config.h" /* must be before all includes */
#include <stdio.h>
#include <string.h>
#include "gpsd.h"
const char *gps_maskdump(gps_mask_t set)
{
static char buf[226];
const struct {
gps_mask_t mask;
const char *name;
} *sp, names[] = {
{ONLINE_SET, "ONLINE"},
{TIME_SET, "TIME"},
{TIMERR_SET, "TIMERR"},
{LATLON_SET, "LATLON"},
{ALTITUDE_SET, "ALTITUDE"},
{SPEED_SET, "SPEED"},
{TRACK_SET, "TRACK"},
{CLIMB_SET, "CLIMB"},
{STATUS_SET, "STATUS"},
{MODE_SET, "MODE"},
{DOP_SET, "DOP"},
{HERR_SET, "HERR"},
{VERR_SET, "VERR"},
{ATTITUDE_SET, "ATTITUDE"},
{SATELLITE_SET, "SATELLITE"},
{SPEEDERR_SET, "SPEEDERR"},
{TRACKERR_SET, "TRACKERR"},
{CLIMBERR_SET, "CLIMBERR"},
{DEVICE_SET, "DEVICE"},
{DEVICELIST_SET, "DEVICELIST"},
{DEVICEID_SET, "DEVICEID"},
{RTCM2_SET, "RTCM2"},
{RTCM3_SET, "RTCM3"},
{AIS_SET, "AIS"},
{PACKET_SET, "PACKET"},
{SUBFRAME_SET, "SUBFRAME"},
{GST_SET, "GST"},
{VERSION_SET, "VERSION"},
{POLICY_SET, "POLICY"},
{LOGMESSAGE_SET, "LOGMESSAGE"},
{ERROR_SET, "ERROR"},
{TOFF_SET, "TOFF"},
{PPS_SET, "PPS"},
{NAVDATA_SET, "NAVDATA"},
{OSCILLATOR_SET, "OSCILLATOR"},
{ECEF_SET, "ECEF"},
{VECEF_SET, "VECEF"},
{MAGNETIC_TRACK_SET, "MAGNETIC_TRACK"},
{RAW_SET, "RAW"},
{RAW_IS, "RAW"},
{USED_IS, "USED"},
{DRIVER_IS, "DRIVER"},
{CLEAR_IS, "CLEAR"},
{REPORT_IS, "REPORT"},
{NODATA_IS, "NODATA"},
{NTPTIME_IS, "NTPTIME"},
{PERR_IS, "PERR"},
{PASSTHROUGH_IS, "PASSTHROUGH"},
{EOF_IS, "EOF"},
{GOODTIME_IS, "GOODTIME"},
};
memset(buf, '\0', sizeof(buf));
buf[0] = '{';
for (sp = names; sp < names + sizeof(names)/sizeof(names[0]); sp++)
if ((set & sp->mask)!=0) {
(void)strlcat(buf, sp->name, sizeof(buf));
(void)strlcat(buf, "|", sizeof(buf));
}
if (buf[1] != '\0')
buf[strlen(buf)-1] = '\0';
(void)strlcat(buf, "}", sizeof(buf));
return buf;
}