Coverage Report

Created: 2024-02-25 06:36

/src/gpsd/gpsd-3.25.1~dev/libgps/gps_maskdump.c
Line
Count
Source (jump to first uncovered line)
1
2
// This code is generated by maskaudit.py.  Do not hand-hack it!
3
4
/*
5
 * Also, beware that it is something of a CPU hog when called on every packet.
6
 * Try to write guards so it is only called at higher log levels.
7
 */
8
9
#include "../include/gpsd_config.h"  // must be before all includes
10
11
#include <stdio.h>
12
#include <string.h>
13
14
#include "../include/gpsd.h"
15
16
/* Convert gps_mask_t set to a string representation
17
 *
18
 * Return pointer to static buffer contatining the string.
19
 */
20
const char *gps_maskdump(gps_mask_t set)
21
0
{
22
0
    static char buf[260];
23
0
    const struct {
24
0
        gps_mask_t      mask;
25
0
        const char      *name;
26
0
    } *sp, names[] = {
27
0
        {AIS_SET, "AIS"},
28
0
        {ALTITUDE_SET, "ALTITUDE"},
29
0
        {ATTITUDE_SET, "ATTITUDE"},
30
0
        {CLEAR_IS, "CLEAR"},
31
0
        {CLIMBERR_SET, "CLIMBERR"},
32
0
        {CLIMB_SET, "CLIMB"},
33
0
        {DEVICEID_SET, "DEVICEID"},
34
0
        {DEVICELIST_SET, "DEVICELIST"},
35
0
        {DEVICE_SET, "DEVICE"},
36
0
        {DOP_SET, "DOP"},
37
0
        {DRIVER_IS, "DRIVER"},
38
0
        {ECEF_SET, "ECEF"},
39
0
        {EOF_IS, "EOF"},
40
0
        {EOF_SET, "EOF"},
41
0
        {ERROR_SET, "ERROR"},
42
0
        {GOODTIME_IS, "GOODTIME"},
43
0
        {GST_SET, "GST"},
44
0
        {HERR_SET, "HERR"},
45
0
        {IMU_SET, "IMU"},
46
0
        {LATLON_SET, "LATLON"},
47
0
        {LOGMESSAGE_SET, "LOGMESSAGE"},
48
0
        {LOG_SET, "LOG"},
49
0
        {MAGNETIC_TRACK_SET, "MAGNETIC_TRACK"},
50
0
        {MODE_SET, "MODE"},
51
0
        {NAVDATA_SET, "NAVDATA"},
52
0
        {NED_SET, "NED"},
53
0
        {NODATA_IS, "NODATA"},
54
0
        {NTPTIME_IS, "NTPTIME"},
55
0
        {ONLINE_SET, "ONLINE"},
56
0
        {OSCILLATOR_SET, "OSCILLATOR"},
57
0
        {PACKET_SET, "PACKET"},
58
0
        {PASSTHROUGH_IS, "PASSTHROUGH"},
59
0
        {PERR_IS, "PERR"},
60
0
        {POLICY_SET, "POLICY"},
61
0
        {PPS_SET, "PPS"},
62
0
        {RAW_IS, "RAW"},
63
0
        {RAW_SET, "RAW"},
64
0
        {REPORT_IS, "REPORT"},
65
0
        {RTCM2_SET, "RTCM2"},
66
0
        {RTCM3_SET, "RTCM3"},
67
0
        {SATELLITE_SET, "SATELLITE"},
68
0
        {SPEEDERR_SET, "SPEEDERR"},
69
0
        {SPEED_SET, "SPEED"},
70
0
        {STATUS_SET, "STATUS"},
71
0
        {SUBFRAME_SET, "SUBFRAME"},
72
0
        {TIMERR_SET, "TIMERR"},
73
0
        {TIME_SET, "TIME"},
74
0
        {TOFF_SET, "TOFF"},
75
0
        {TRACKERR_SET, "TRACKERR"},
76
0
        {TRACK_SET, "TRACK"},
77
0
        {USED_IS, "USED"},
78
0
        {VECEF_SET, "VECEF"},
79
0
        {VERR_SET, "VERR"},
80
0
        {VERSION_SET, "VERSION"},
81
0
        {VNED_SET, "VNED"},
82
0
    };
83
84
0
    memset(buf, '\0', sizeof(buf));
85
0
    buf[0] = '{';
86
0
    for (sp = names; sp < (names + sizeof(names)/sizeof(names[0])); sp++) {
87
0
        if ((gps_mask_t)0 != (set & sp->mask)) {
88
0
            if ('\0' != buf[1]) {
89
0
                (void)strlcat(buf, "|", sizeof(buf));
90
0
            }
91
0
            (void)strlcat(buf, sp->name, sizeof(buf));
92
0
        }
93
0
    }
94
0
    (void)strlcat(buf, "}", sizeof(buf));
95
0
    return buf;
96
0
}
97