Coverage Report

Created: 2026-05-14 06:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-c2p.c
Line
Count
Source
1
/* packet-c2p.c
2
 * Commsignia Capture Protocol dissector
3
 * Copyright 2025, (C) Commsignia Ltd.
4
 *
5
 * Wireshark - Network traffic analyzer
6
 * By Gerald Combs <gerald@wireshark.org>
7
 * Copyright 1998 Gerald Combs
8
 *
9
 * SPDX-License-Identifier: GPL-2.0-or-later
10
 */
11
12
#include "config.h"
13
14
#include <epan/packet.h>
15
#include <epan/unit_strings.h>
16
#include <inttypes.h>
17
18
19
/**
20
Possible values for Transmission State StationInfo parameter
21
@note Data element is used to provide the current state of the vehicle transmission
22
*/
23
typedef enum sti_transmission_state_t {
24
    STI_TRANSMISSION_STATE_NEUTRAL = 0,                     /**< Neutral state */
25
    STI_TRANSMISSION_PARK,                                  /**< Parking state */
26
    STI_TRANSMISSION_FWD_GEARS,                             /**< Forward gears */
27
    STI_TRANSMISSION_REVERSE_GEARS                          /**< Reverse gears */
28
} sti_transmission_state_t;
29
30
/**
31
Possible values for Auxiliary Brake StationInfo parameter
32
@note The status of the auxiliary brakes (sometimes referred to as the
33
      parking brake) of the vehicle. The auxiliary brakes are in a fully
34
      released (Off) state or in an engaged or in the process of
35
      being engaged (On) state
36
37
@see Dedicated Short Range Communications (DSRC) Message Set Dictionary
38
     SAE J2735_201603 Chapter 7.14 DE_AuxiliaryBrakeStatus
39
*/
40
typedef enum sti_aux_brakes_t {
41
    STI_AUX_BRAKES_OFF = 0,                                 /**< Vehicle's Aux Brakes are off */
42
    STI_AUX_BRAKES_ON                                       /**< Vehicle's Aux Brakes are on (engaged) */
43
} sti_aux_brakes_t;
44
45
/**
46
Possible values for Vehicle Length Confidence StationInfo parameter
47
@note To indicate whether the presence of a trailer is detectable or
48
      whether its length is included in a reported vehicle length value.
49
50
@see Intelligent Transport Systemst (ITS); User and application requirements
51
     ETSI TS 102 894-2 V1.3.1; Part2; Annex 91 - DE_VehicleLengthConfidenceIndication
52
*/
53
typedef enum sti_vehicle_length_conf_t {
54
    STI_VEHICLE_LENGTH_CONF_NO_TRAILER = 0,                 /**< No trailer is present */
55
    STI_VEHICLE_LENGTH_CONF_TRAILER_WITH_LENGTH,            /**< Trailer present with known length */
56
    STI_VEHICLE_LENGTH_CONF_TRAILER_WITH_NA_LENGTH,         /**< Trailer present with unknown length */
57
    STI_VEHICLE_LENGTH_CONF_TRAILER_PRESENCE_IS_UNK         /**< Trailer presence is unknown */
58
} sti_vehicle_length_conf_t;
59
60
/**
61
Possible values for Dangerous Goods StationInfo parameter
62
@note Indicates the type of the dangerous goods being carried by a heavy vehicle.
63
64
@see European Agreement (Applicable as from 1 January 2011): "Concerning the International Carriage
65
     of Dangerous Goods by Road" part II, chapter 2.1.1.1
66
@see Available at http://www.unece.org/trans/danger/publi/adr/adr2011/11ContentsE.html
67
*/
68
typedef enum sti_dangerous_good_t {
69
    STI_DANGEROUS_GOODS_EXPLOSIVES1 = 0,                    /**< Explosive substance type 1 */
70
    STI_DANGEROUS_GOODS_EXPLOSIVES2,                        /**< Explosive substance type 2 */
71
    STI_DANGEROUS_GOODS_EXPLOSIVES3,                        /**< Explosive substance type 3 */
72
    STI_DANGEROUS_GOODS_EXPLOSIVES4,                        /**< Explosive substance type 4 */
73
    STI_DANGEROUS_GOODS_EXPLOSIVES5,                        /**< Explosive substance type 5 */
74
    STI_DANGEROUS_GOODS_EXPLOSIVES6,                        /**< Explosive substance type 6 */
75
    STI_DANGEROUS_GOODS_FLAMMABLE_GASES,                    /**< Flammable gases */
76
    STI_DANGEROUS_GOODS_NON_FLAMMABLE_GASES,                /**< Non flammable gases */
77
    STI_DANGEROUS_GOODS_TOXIC_GASES,                        /**< Toxic gases */
78
    STI_DANGEROUS_GOODS_FLAMMABLE_LIQUIDS,                  /**< Flammable liquids */
79
    STI_DANGEROUS_GOODS_FLAMMABLE_SOLIDS,                   /**< Flammable solids */
80
    STI_DANGEROUS_GOODS_SUBSTANCES_SPONTAIN_COMBUSTION,     /**< Substances liable to spontaneous combustion */
81
    STI_DANGEROUS_GOODS_SUBSTANCES_FLAMBLE_CONTACT_WATER,   /**< Substances emitting flammable gases upon contact with water */
82
    STI_DANGEROUS_GOODS_OXIDIZING_SUBSTANCES,               /**< Oxidizing substances */
83
    STI_DANGEROUS_GOODS_ORGANIC_PEROXIDES,                  /**< Organic peroxides */
84
    STI_DANGEROUS_GOODS_TOXIC_SUBSTANCES,                   /**< Toxic substances */
85
    STI_DANGEROUS_GOODS_INFECTIOUS_SUBSTANCES,              /**< Infectious substances */
86
    STI_DANGEROUS_GOODS_RADIOACTIVE_MATERIAL,               /**< Radioactive material */
87
    STI_DANGEROUS_GOODS_CORROSIVE_SUBSTANCES,               /**< Corrosive substances */
88
    STI_DANGEROUS_GOODS_MISC_DANGEROUS_SUBSTANCES           /**< Miscellaneous dangerous substances */
89
} sti_dangerous_good_t;
90
91
/**
92
Possible values for Station type parameter
93
@note Not to be confused with vehicle role. It may seem redundant,
94
      but while class doesn't change for the lifetime of the vehicle,
95
      role may change based on what it's doing currently.
96
@note It is used to provide a common classification system to categorize DSRC
97
      equipped devices for various cross-cutting uses. Several other
98
      classification systems in this data dictionary can be used to provide
99
      more domain specific detail when required.
100
101
@see Dedicated Short Range Communications (DSRC) Message Set Dictionary
102
     SAE J2735_201603 Chapter 7.15 DE_BasicVehicleClass
103
*/
104
typedef enum sti_station_type_t {
105
    STI_STATION_TYPE_UNK = 0,                              /**< Not equipped, not known or unavailable */
106
    STI_STATION_TYPE_SPECIAL,                              /**< Special use */
107
    STI_STATION_TYPE_PASSENGER_UNK,                        /**< Unknown type passenger vehicle */
108
    STI_STATION_TYPE_PASSENGER_OTHER,                      /**< Other type passenger vehicle */
109
    STI_STATION_TYPE_LIGHT_TRUCK_UNK,                      /**< Unknown type light truck */
110
    STI_STATION_TYPE_LIGHT_TRUCK_OTHER,                    /**< Other type light truck */
111
    STI_STATION_TYPE_TRUCK_UNK,                            /**< Unknown type truck */
112
    STI_STATION_TYPE_TRUCK_OTHER,                          /**< Other type truck */
113
    STI_STATION_TYPE_TRUCK_AXLE_CNT_2,                     /**< Two axle, six tire single units */
114
    STI_STATION_TYPE_TRUCK_AXLE_CNT_3,                     /**< Three axle single units */
115
    STI_STATION_TYPE_TRUCK_AXLE_CNT_4,                     /**< Four or more axle single unit */
116
    STI_STATION_TYPE_TRUCK_AXLE_CNT_4_TRAILER,             /**< Four or less axle single trailer */
117
    STI_STATION_TYPE_TRUCK_AXLE_CNT_5_TRAILER,             /**< Five or less axle single trailer */
118
    STI_STATION_TYPE_TRUCK_AXLE_CNT_6_TRAILER,             /**< Six or more axle single trailer */
119
    STI_STATION_TYPE_TRUCK_AXLE_CNT_5_MULTI_TRAILER,       /**< Five or less axle multi-trailer */
120
    STI_STATION_TYPE_TRUCK_AXLE_CNT_6_MULTI_TRAILER,       /**< Six axle multi-trailer */
121
    STI_STATION_TYPE_TRUCK_AXLE_CNT_7_MULTI_TRAILER,       /**< Seven or more axle multi-trailer */
122
    STI_STATION_TYPE_MOTORCYCLE_UNK,                       /**< Unknown type motorcycle */
123
    STI_STATION_TYPE_MOTORCYCLE_OTHER,                     /**< Other type motorcycle */
124
    STI_STATION_TYPE_MOTORCYCLE_CRUISER_STANDARD,          /**< Cruiser standard motorcycle */
125
    STI_STATION_TYPE_MOTORCYCLE_SPORT_UNCLAD,              /**< Unclad sport motorcycle */
126
    STI_STATION_TYPE_MOTORCYCLE_SPORT_TOURING,             /**< Sport touring motorcycle */
127
    STI_STATION_TYPE_MOTORCYCLE_SUPER_SPORT,               /**< Super sport motorcycle */
128
    STI_STATION_TYPE_MOTORCYCLE_TOURING,                   /**< Touring motorcycle */
129
    STI_STATION_TYPE_MOTORCYCLE_TRIKE,                     /**< Trike motorcycle */
130
    STI_STATION_TYPE_MOTORCYCLE_WITH_PASSENGERS,           /**< Motorcycle with passengers */
131
    STI_STATION_TYPE_TRANSIT_UNK,                          /**< Unknown type transit */
132
    STI_STATION_TYPE_TRANSIT_OTHER,                        /**< Other type transit */
133
    STI_STATION_TYPE_TRANSIT_BRT,                          /**< Bus rapid transit */
134
    STI_STATION_TYPE_TRANSIT_EXPRESS_BUS,                  /**< Express bus */
135
    STI_STATION_TYPE_TRANSIT_LOCAL_BUS,                    /**< Local bus */
136
    STI_STATION_TYPE_TRANSIT_SCHOOL_BUS,                   /**< School bus */
137
    STI_STATION_TYPE_TRANSIT_FIXED_GUIDE_WAY,              /**< Fixed guideway transit, like tram */
138
    STI_STATION_TYPE_TRANSIT_PARATRANSIT,                  /**< Paratransit */
139
    STI_STATION_TYPE_TRANSIT_PARATRANSIT_AMBULANCE,        /**< Paratransit ambulance */
140
    STI_STATION_TYPE_EMERGENCY_UNK,                        /**< Unknown type emergency vehicle */
141
    STI_STATION_TYPE_EMERGENCY_OTHER,                      /**< Other type emergency vehicle */
142
    STI_STATION_TYPE_EMERGENCY_FIRE_LIGHT,                 /**< Light fire emergency vehicle */
143
    STI_STATION_TYPE_EMERGENCY_FIRE_HEAVY,                 /**< Heavy fire emergency vehicle */
144
    STI_STATION_TYPE_EMERGENCY_FIRE_PARAMEDIC,             /**< Fire paramedic emergency vehicle */
145
    STI_STATION_TYPE_EMERGENCY_FIRE_AMBULANCE,             /**< Fire ambulance emergency vehicle */
146
    STI_STATION_TYPE_EMERGENCY_POLICE_LIGHT,               /**< Light police emergency vehicle */
147
    STI_STATION_TYPE_EMERGENCY_POLICE_HEAVY,               /**< Heavy police emergency vehicle */
148
    STI_STATION_TYPE_EMERGENCY_OTHER_RESPONDER,            /**< Other type responder emergency vehicle */
149
    STI_STATION_TYPE_EMERGENCY_OTHER_AMBULANCE,            /**< Other type ambulance emergency vehicle */
150
    STI_STATION_TYPE_OTHER_UNK,                            /**< DSRC equipped unknown type other traveler */
151
    STI_STATION_TYPE_OTHER_OTHER,                          /**< DSRC equipped other type other traveler */
152
    STI_STATION_TYPE_OTHER_PEDESTRIAN,                     /**< DSRC equipped other type pedestrian */
153
    STI_STATION_TYPE_OTHER_VISUALLY_DISABLED,              /**< DSRC equipped visually disabled other traveler */
154
    STI_STATION_TYPE_OTHER_PHYSICALLY_DISABLED,            /**< DSRC equipped physically disabled other traveler */
155
    STI_STATION_TYPE_OTHER_BICYCLE,                        /**< DSRC equipped bicycle */
156
    STI_STATION_TYPE_OTHER_VULNERABLE_ROADWORKER,          /**< DSRC equipped vulnerable road worker */
157
    STI_STATION_TYPE_INFRASTRUCTURE_UNK,                   /**< DSRC equipped unknown type device */
158
    STI_STATION_TYPE_INFRASTRUCTURE_FIXED,                 /**< DSRC equipped fixed device, typically Road Side Units (RSU) */
159
    STI_STATION_TYPE_INFRASTRUCTURE_MOVABLE,               /**< DSRC equipped movable device */
160
    STI_STATION_TYPE_EQUIPPED_CARGO_TRAILER,               /**< DSRC equipped cargo trailer */
161
    STI_STATION_TYPE_LIGHT_VRU_VEHICLE,                    /**< Micrmomobility users (EU CDD release 2) */
162
    STI_STATION_TYPE_ANIMAL                                /**< DSRC equipped animals (EU CDD release 2) */
163
} sti_station_type_t;
164
165
/**
166
Possible values for Basic Vehicle Role StationInfo parameter
167
@note Not to be confused with vehicle class. It may seem redundant,
168
      but while class doesn't change for the lifetime of the vehicle,
169
      role may change based on what it's doing currently,
170
      e.g. simple passenger vehicle can be a safety car while it's in service,
171
      but a basic vehicle when it's not.
172
173
@see Intelligent Transport Systemst (ITS); User and application requirements
174
     ETSI TS 102 894-2 V1.3.1; Part2; Annex 94 - DE_VehicleRole
175
@see Dedicated Short Range Communications (DSRC) Message Set Dictionary
176
     SAE J2735_201603 Chapter 7.16 DE_BasicVehicleRole
177
*/
178
typedef enum sti_vehicle_role_t {
179
    STI_VEHICLE_ROLE_BASIC_VEHICLE = 0,                     /**< Default vehicle role as indicated by the vehicle type */
180
    STI_VEHICLE_ROLE_PUBLIC_TRANSPORT,                      /**< Vehicle is used to operate public transport service */
181
    STI_VEHICLE_ROLE_SPECIAL_TRANSPORT,                     /**< Vehicle is used for special transport purpose, like oversized trucks */
182
    STI_VEHICLE_ROLE_DANGEROUS_GOODS,                       /**< Vehicle is used for dangerous goods transportation */
183
    STI_VEHICLE_ROLE_ROAD_WORK,                             /**< Vehicle is used to realize roadwork or road maintenance mission */
184
    STI_VEHICLE_ROLE_RESCUE,                                /**< Vehicle is used for rescue purpose in case of an accident, like as a towing service */
185
    STI_VEHICLE_ROLE_EMERGENCY,                             /**< Vehicle is used for emergency mission, like ambulance, fire brigade */
186
    STI_VEHICLE_ROLE_SAFETY_CAR,                            /**< Vehicle is used for public safety, like patrol */
187
    STI_VEHICLE_ROLE_TRUCK,                                 /**< Heavy trucks with additional BSM rights and obligations */
188
    STI_VEHICLE_ROLE_MOTORCYCLE,                            /**< Motorcycle role */
189
    STI_VEHICLE_ROLE_ROAD_SIDE_SOURCE,                      /**< For infrastructure generated calls such as fire house, rail infrastructure, roadwork site, etc. */
190
    STI_VEHICLE_ROLE_POLICE,                                /**< Police role */
191
    STI_VEHICLE_ROLE_FIRE,                                  /**< Fire role */
192
    STI_VEHICLE_ROLE_AMBULANCE,                             /**< (does not include private para-transit etc.) */
193
    STI_VEHICLE_ROLE_DOT,                                   /**< All roadwork vehicles */
194
    STI_VEHICLE_ROLE_TRANSIT,                               /**< All transit vehicles */
195
    STI_VEHICLE_ROLE_SLOW_MOVING,                           /**< Also include oversize etc. */
196
    STI_VEHICLE_ROLE_STOP_N_GO,                             /**< To include trash trucks, school buses and others that routinely disturb the free flow of traffic */
197
    STI_VEHICLE_ROLE_CYCLIST,                               /**< Cyclist role */
198
    STI_VEHICLE_ROLE_PEDESTRIAN,                            /**< Also includes those with mobility limitations */
199
    STI_VEHICLE_ROLE_NON_MOTORIZED,                         /**< other, such as horse drawn */
200
    STI_VEHICLE_ROLE_MILITARY,                              /**< Military role */
201
    STI_VEHICLE_ROLE_AGRICULTURE,                           /**< Vehicle is used for agriculture, like farm tractor */
202
    STI_VEHICLE_ROLE_COMMERCIAL,                            /**< Vehicle is used for transportation of commercial goods */
203
    STI_VEHICLE_ROLE_ROAD_OPERATOR,                         /**< Vehicle is used in road operator missions */
204
    STI_VEHICLE_ROLE_TAXI                                   /**< Vehicle is used to provide an authorized taxi service */
205
} sti_vehicle_role_t;
206
207
/**
208
Possible values for Weather Precipitation Situation StationInfo parameter
209
@note Describes the weather situation in terms of precipitation.
210
*/
211
typedef enum sti_weather_precip_situation_t {
212
    STI_WEATHER_PRECIP_SITUATON_OTHER = 0,                  /**< Other type precipitation */
213
    STI_WEATHER_PRECIP_SITUATON_UNK,                        /**< Unknown type precipitation */
214
    STI_WEATHER_PRECIP_SITUATON_NO_PRECIP,                  /**< No precipitation */
215
    STI_WEATHER_PRECIP_SITUATON_UNK_SLIGHT,                 /**< Unknown type slight precipitation */
216
    STI_WEATHER_PRECIP_SITUATON_UNK_MODERATE,               /**< Unknown type moderate precipitation */
217
    STI_WEATHER_PRECIP_SITUATON_UNK_HEAVY,                  /**< Unknown type heavy precipitation */
218
    STI_WEATHER_PRECIP_SITUATON_SNOW_SLIGHT,                /**< Slight snow precipitation */
219
    STI_WEATHER_PRECIP_SITUATON_SNOW_MODERATE,              /**< Moderate snow precipitation */
220
    STI_WEATHER_PRECIP_SITUATON_SNOW_HEAVY,                 /**< Heavy snow precipitation */
221
    STI_WEATHER_PRECIP_SITUATON_RAIN_SLIGHT,                /**< Slight rain precipitation */
222
    STI_WEATHER_PRECIP_SITUATON_RAIN_MODERATE,              /**< Moderate rain precipitation */
223
    STI_WEATHER_PRECIP_SITUATON_RAIN_HEAVY,                 /**< Heavy rain precipitation */
224
    STI_WEATHER_PRECIP_SITUATON_FROZEN_PRECIP_SLIGHT,       /**< Slight frozen precipitation */
225
    STI_WEATHER_PRECIP_SITUATON_FROZEN_PRECIP_MODERATE,     /**< Moderate frozen precipitation */
226
    STI_WEATHER_PRECIP_SITUATON_FROZEN_PRECIP_HEAVY         /**< Heavy frozen precipitation */
227
} sti_weather_precip_situation_t;
228
229
/**
230
Possible values for Wiper State StationInfo parameter
231
@note It is intended to inform other users whether or not it was
232
      raining/snowing at the vehicle's location at the time it was taken.
233
      The element also includes whether the wipers were turned on manually
234
      (driver activated) or automatically (rain sensor activated) to provide
235
      additional information as to driving conditions in the area of the vehicle.
236
237
@see Dedicated Short Range Communications (DSRC) Message Set Dictionary
238
     SAE J2735_201603 Chapter 7.227 DE_WiperStatus
239
*/
240
typedef enum sti_wiper_state_t {
241
    STI_WIPER_STATE_OFF = 0,                                /**< Off state */
242
    STI_WIPER_STATE_INTERMITTENT,                           /**< Intermittent state */
243
    STI_WIPER_STATE_LOW,                                    /**< Low state */
244
    STI_WIPER_STATE_HIGH,                                   /**< High state */
245
    STI_WIPER_STATE_WASHER_IN_USE,                          /**< Washer in use */
246
    STI_WIPER_STATE_AUTO                                    /**< Auto wiper state */
247
} sti_wiper_state_t;
248
249
/**
250
Possible values for Lightbar StationInfo parameter
251
@note It is intended to inform if any sort of additional visible
252
      lighting-alerting system is currently in use by a vehicle.
253
      This includes light bars and the various symbols they can indicate
254
      as well as arrow boards, flashing lights (including back up alerts),
255
      and any other form of lighting not found on normal vehicles of this type
256
      or related to safety systems. Used to reflect any type or style of visual
257
      alerting when a vehicle is progressing and transmitting DSRC messages
258
      to other nearby vehicles about its path.
259
*/
260
typedef enum sti_lightbar_t {
261
    STI_LIGHTBAR_NOT_IN_USE = 0,                            /**< There is a lightbar, but it is currently not in use */
262
    STI_LIGHTBAR_IN_USE,                                    /**< Lightbar in use */
263
    STI_LIGHTBAR_YELLOW_CAUTION_LIGHTS,                     /**< Yellow caution lights */
264
    STI_LIGHTBAR_SCHOOL_BUS_LIGHTS,                         /**< School bus lights */
265
    STI_LIGHTBAR_ARROW_SIGNS_ACTIVE,                        /**< Arrow signs active */
266
    STI_LIGHTBAR_SLOW_MOVING_VEHICLE,                       /**< Slow moving vehicle lights */
267
    STI_LIGHTBAR_FREQ_STOPS                                 /**< Freq stops */
268
} sti_lightbar_t;
269
270
/**
271
Possible values for Siren StationInfo parameter
272
@note A data element which is set if any sort of audible alarm is being
273
      emitted from the vehicle. This includes various common sirens as well
274
      as backup beepers and other slow speed maneuvering alerts.
275
276
@see Dedicated Short Range Communications (DSRC) Message Set Dictionary
277
     SAE J2735_201603 Chapter 7.174 DE_SirenInUse
278
*/
279
typedef enum sti_siren_t {
280
    STI_SIREN_NOT_IN_USE = 0,                               /**< Siren not in use */
281
    STI_SIREN_IN_USE                                        /**< Siren in use */
282
} sti_siren_t;
283
284
/**
285
Possible values for Lane Position StationInfo parameter
286
@note Data frame is used to provide information regarding
287
      what lane a subject vehicle (or other object) is in.
288
      ETSI TS 102 894-2 V1.3.1 supports only 13 lanes.
289
*/
290
typedef enum sti_lane_pos_t {
291
    STI_LANE_POSITION_INNER_HARD_SHOULDER = 0,              /**< Inner hard shoulder position */
292
    STI_LANE_POSITION_INNERMOST_DRIVING_LANE,               /**< Innermost driving lane */
293
    STI_LANE_POSITION_SECOND_LANE_FROM_INSIDE,              /**< Second lane from inside */
294
    STI_LANE_POSITION_THIRD_LANE_FROM_INSIDE,               /**< Third lane from inside */
295
    STI_LANE_POSITION_FOURTH_LANE_FROM_INSIDE,              /**< Fourth lane from inside */
296
    STI_LANE_POSITION_FIFTH_LANE_FROM_INSIDE,               /**< Fifth lane from inside */
297
    STI_LANE_POSITION_SIXTH_LANE_FROM_INSIDE,               /**< Sixth lane from inside */
298
    STI_LANE_POSITION_SEVENTH_LANE_FROM_INSIDE,             /**< Seventh lane from inside */
299
    STI_LANE_POSITION_EIGHTH_LANE_FROM_INSIDE,              /**< Eighth lane from inside */
300
    STI_LANE_POSITION_NINTH_LANE_FROM_INSIDE,               /**< Ninth lane from inside */
301
    STI_LANE_POSITION_TENTH_LANE_FROM_INSIDE,               /**< Tenth lane from inside */
302
    STI_LANE_POSITION_ELEVENTH_LANE_FROM_INSIDE,            /**< Eleventh lane from inside */
303
    STI_LANE_POSITION_TWELFTH_LANE_FROM_INSIDE,             /**< Twelfth lane from inside */
304
    STI_LANE_POSITION_THIRTEENTH_LANE_FROM_INSIDE,          /**< Thirteenth lane from inside */
305
    STI_LANE_POSITION_FOURTEENTH_LANE_FROM_INSIDE,          /**< Fourteenth lane from inside */
306
    STI_LANE_POSITION_FIFTEENTH_LANE_FROM_INSIDE,           /**< Fifteenth lane from inside */
307
    STI_LANE_POSITION_SIXTEENTH_LANE_FROM_INSIDE,           /**< Sixteenth lane from inside */
308
    STI_LANE_POSITION_SEVENTEENTH_LANE_FROM_INSIDE,         /**< Seventeenth lane from inside */
309
    STI_LANE_POSITION_EIGHTEENTH_LANE_FROM_INSIDE,          /**< Eighteenth lane from inside */
310
    STI_LANE_POSITION_NINETEENTH_LANE_FROM_INSIDE,          /**< Nineteenth lane from inside */
311
    STI_LANE_POSITION_TWENTIETH_LANE_FROM_INSIDE,           /**< Twentieth lane from inside */
312
    STI_LANE_POSITION_TWENTY_FIRST_LANE_FROM_INSIDE,        /**< Twenty-first lane from inside */
313
    STI_LANE_POSITION_TWENTY_SECOND_LANE_FROM_INSIDE,       /**< Twenty-second lane from inside */
314
    STI_LANE_POSITION_TWENTY_THIRD_LANE_FROM_INSIDE,        /**< Twenty-third lane from inside */
315
    STI_LANE_POSITION_TWENTY_FOURTH_LANE_FROM_INSIDE,       /**< Twenty-fourth lane from inside */
316
    STI_LANE_POSITION_TWENTY_FIFTH_LANE_FROM_INSIDE,        /**< Twenty-fifth lane from inside */
317
    STI_LANE_POSITION_TWENTY_SIXTH_LANE_FROM_INSIDE,        /**< Twenty-sixth lane from inside */
318
    STI_LANE_POSITION_TWENTY_SEVENTH_LANE_FROM_INSIDE,      /**< Twenty-seventh lane from inside */
319
    STI_LANE_POSITION_TWENTY_EIGHTH_LANE_FROM_INSIDE,       /**< Twenty-eighth lane from inside */
320
    STI_LANE_POSITION_TWENTY_NINTH_LANE_FROM_INSIDE,        /**< Twenty-ninth lane from inside */
321
    STI_LANE_POSITION_THIRTIETH_LANE_FROM_INSIDE,           /**< Thirtieth lane from inside */
322
    STI_LANE_POSITION_THIRTY_FIRST_LANE_FROM_INSIDE,        /**< Thirty-first lane from inside */
323
    STI_LANE_POSITION_THIRTY_SECOND_LANE_FROM_INSIDE,       /**< Thirty-second lane from inside */
324
    STI_LANE_POSITION_OUTER_HARD_SHOULDER,                  /**< Outer hard shoulder position */
325
    STI_LANE_POSITION_OFF_THE_ROAD                          /**< Off the road position */
326
} sti_lane_pos_t;
327
328
/**
329
Possible values for fuel type
330
*/
331
typedef enum sti_fuel_type_t {
332
    STI_FUEL_TYPE_GASOLINE = 0,                             /**< Gasoline fuel type */
333
    STI_FUEL_TYPE_ETHANOL,                                  /**< Ethanol fuel type */
334
    STI_FUEL_TYPE_DIESEL,                                   /**< Diesel fuel type */
335
    STI_FUEL_TYPE_ELECTRIC,                                 /**< Electric fuel type */
336
    STI_FUEL_TYPE_HYBRID,                                   /**< Hybrid fuel type */
337
    STI_FUEL_TYPE_HYDROGEN,                                 /**< Hydrogen fuel type */
338
    STI_FUEL_TYPE_NAT_GAS_LIQUID,                           /**< NAT gas liquefied fuel type */
339
    STI_FUEL_TYPE_NAT_GAS_COMP,                             /**< NAT gas compressed fuel type */
340
    STI_FUEL_TYPE_PROPANE,                                  /**< Propane fuel type */
341
} sti_fuel_type_t;
342
343
/**
344
Possible values for environment area type
345
*/
346
typedef enum sti_area_type_t {
347
    STI_AREA_TYPE_RURAL = 0,                                /**< Rural area */
348
    STI_AREA_TYPE_URBAN,                                    /**< Urban area */
349
} sti_area_type_t;
350
351
/**
352
Possible values for door state related StationInfo parameters
353
*/
354
typedef enum sti_door_state_t {
355
    STI_DOOR_STATE_NA = 0,                                  /**< N/A state */
356
    STI_DOOR_STATE_CLOSED,                                  /**< Closed state */
357
    STI_DOOR_STATE_OPEN,                                    /**< Open state */
358
} sti_door_state_t;
359
360
/**
361
Possible values for belt buckle state related StationInfo parameters
362
*/
363
typedef enum sti_belt_buckle_status_t {
364
    STI_BELT_BUCKLE_DISCONNECTED = 0,                       /**< Belt buckle is disconnected */
365
    STI_BELT_BUCKLE_CONNECTED,                              /**< Belt buckle is connected */
366
} sti_belt_buckle_status_t;
367
368
/**
369
Possible values for Transmission type
370
*/
371
typedef enum sti_transmission_type_t {
372
    STI_TRANSMISSION_TYPE_AUTOMATIC = 0,                    /**< Transmission type is automatic */
373
    STI_TRANSMISSION_TYPE_MANUAL,                           /**< Transmission type is manual */
374
} sti_transmission_type_t;
375
376
/**
377
Possible values for presence of physical separation between own and oncoming lanes of the road/highway
378
*/
379
typedef enum sti_physical_road_separation_t {
380
    STI_PHYSICAL_ROAD_SEPARATION_NOT_PRESENT = 0,           /**< Physical separation is not present */
381
    STI_PHYSICAL_ROAD_SEPARATION_PRESENT                    /**< Physical separation is present */
382
} sti_physical_road_separation_t;
383
384
/**
385
Possible values for RoadClass parameter
386
*/
387
typedef enum sti_road_class_t {
388
    STI_ROAD_CLASS_UNKNOWN = 0,                             /**< Unknown road class */
389
    STI_ROAD_CLASS_MOTORWAY,                                /**< Motorway road class */
390
    STI_ROAD_CLASS_COUNTRY_ROAD,                            /**< Country road road class */
391
    STI_ROAD_CLASS_LOCAL_ROAD,                              /**< Local road road class */
392
} sti_road_class_t;
393
394
/**
395
Possible values for rule of the road
396
*/
397
typedef enum sti_road_rule_t {
398
    STI_ROAD_RULE_RIGHT_HAND_TRAFFIC = 0,                   /**< Right-hand traffic */
399
    STI_ROAD_RULE_LEFT_HAND_TRAFFIC,                        /**< Left-hand traffic */
400
} sti_road_rule_t;
401
402
/**
403
Possible values for StationInfo parameters which have two states
404
*/
405
typedef enum sti_state_t {
406
    STI_STATE_OFF = 0,                                      /**< Off state */
407
    STI_STATE_ON                                            /**< On state */
408
} sti_state_t;
409
410
/**
411
Possible values for StationInfo parameters which have three states
412
*/
413
typedef enum sti_tristate_t {
414
    STI_TRISTATE_OFF = 0,                                   /**< Off state */
415
    STI_TRISTATE_ON,                                        /**< On or active (but not engaged) state */
416
    STI_TRISTATE_ENGAGED                                    /**< Engaged state */
417
} sti_tristate_t;
418
419
420
typedef enum sti_type_t {
421
422
    /**
423
    Transmission state
424
    @type [enum]
425
    @see sti_transmission_state_t
426
    */
427
    STI_TRANSMISSION_STATE = 0,
428
429
    /**
430
    Steering wheel angle.
431
    @note Do not confuse with driving wheel angle.
432
          The steering wheel is what the driver holds in their hands,
433
          the driving wheel is what touches the ground.
434
    @type [angle]
435
    @unit [0.001 degree] CCW positive
436
    */
437
    STI_STEERING_WHEEL_ANGLE,
438
439
    /**
440
    Steering wheel angle confidence
441
    @type [angle]
442
    @unit [0.001 degree]
443
    */
444
    STI_STEERING_WHEEL_ANGLE_CONF,
445
446
    /**
447
    Steering wheel angle rate
448
    @type [angular velocity]
449
    @unit [0.001 degree/second]
450
    */
451
    STI_STEERING_WHEEL_ANGLE_RATE,
452
453
    /**
454
    Driving wheel angle
455
    @note Do not confuse with steering wheel angle.
456
          The steering wheel is what the driver holds in their hands,
457
          the driving wheel is what touches the ground.
458
    @type [angle]
459
    @unit [0.001 degree]
460
    */
461
    STI_DRIVING_WHEEL_ANGLE,
462
463
    /**
464
    Longitudinal acceleration
465
    @type [acceleration]
466
    @unit [mm/s^2]
467
    */
468
    STI_LONG_ACC,
469
470
    /**
471
    Longitudinal acceleration confidence
472
    @type [acceleration]
473
    @unit [mm/s^2]
474
    */
475
    STI_LONG_ACC_CONF,
476
477
    /**
478
    Lateral acceleration
479
    @type [acceleration]
480
    @unit [mm/s^2]
481
    */
482
    STI_LAT_ACC,
483
484
    /**
485
    Lateral acceleration confidence
486
    @type [acceleration]
487
    @unit [mm/s^2]
488
    */
489
    STI_LAT_ACC_CONF,
490
491
    /**
492
    Vertical acceleration
493
    @note If the car is standing still, this should be 0, i.e.
494
          gravity is not included in this value.
495
    @type [acceleration]
496
    @unit [mm/s^2]
497
    */
498
    STI_VERT_ACC,
499
500
    /**
501
    Vertical acceleration confidence
502
    @type [acceleration]
503
    @unit [mm/s^2]
504
    */
505
    STI_VERT_ACC_CONF,
506
507
    /**
508
    Yaw rate
509
    @type [angular velocity]
510
    @unit [0.001 degree/second] CCW positive
511
    */
512
    STI_YAW_RATE,
513
514
    /**
515
    Yaw rate confidence
516
    @type [angular velocity]
517
    @unit [0.001 degree/second]
518
    */
519
    STI_YAW_RATE_CONF,
520
521
    /**
522
    Front left brake applied pressure
523
    @type [thousandths]
524
    @unit [parts-per-thousand]
525
    */
526
    STI_BRAKE_STATUS_LEFT_FRONT,
527
528
    /**
529
    Rear left brake applied pressure
530
    @type [thousandths]
531
    @unit [parts-per-thousand]
532
    */
533
    STI_BRAKE_STATUS_LEFT_REAR,
534
535
    /**
536
    Front right brake applied pressure
537
    @type [thousandths]
538
    @unit [parts-per-thousand]
539
    */
540
    STI_BRAKE_STATUS_RIGHT_FRONT,
541
542
    /**
543
    Rear right brake applied pressure
544
    @type [thousandths]
545
    @unit [parts-per-thousand]
546
    */
547
    STI_BRAKE_STATUS_RIGHT_REAR,
548
549
    /**
550
    Traction control status
551
    @type [enum]
552
    @see sti_tristate_t
553
    */
554
    STI_TRACTION_CONTROL_STATUS,
555
556
    /**
557
    Anti-lock braking system status
558
    @type [enum]
559
    @see sti_tristate_t
560
    */
561
    STI_ABS,
562
563
    /**
564
    Stability control status
565
    @type [enum]
566
    @see sti_tristate_t
567
    */
568
    STI_STABILITY_CONTROL_STATUS,
569
570
    /**
571
    Emergency brake status, also known as 'Brake boost'
572
    @type [enum]
573
    @see sti_state_t
574
    */
575
    STI_EMERGENCY_BRAKE,
576
577
    /**
578
    Auxiliary brake status
579
    @type [enum]
580
    @see sti_aux_brakes_t
581
    */
582
    STI_AUX_BRAKES,
583
584
    /**
585
    Vehicle width
586
    @note The width shall be the widest point of the vehicle with all
587
          factory installed equipment.
588
    @type [length]
589
    @unit [mm]
590
    */
591
    STI_VEHICLE_WIDTH,
592
593
    /**
594
    Vehicle length
595
    @note The length of the vehicle measured from the edge of the front
596
          bumper to the edge of the rear bumper.
597
    @type [length]
598
    @unit [mm]
599
    */
600
    STI_VEHICLE_LENGTH,
601
602
    /**
603
    Vehicle length confidence
604
    @type [enum]
605
    @see sti_vehicle_length_conf_t
606
    */
607
    STI_VEHICLE_LENGTH_CONF,
608
609
    /**
610
    Vehicle height
611
    @type [length]
612
    @unit [mm]
613
    */
614
    STI_VEHICLE_HEIGHT,
615
616
    /**
617
    Vehicle mass
618
    @type [mass]
619
    @unit [gram]
620
    */
621
    STI_VEHICLE_MASS,
622
623
    /**
624
    Stop line violated
625
    @type [enum]
626
    @see sti_state_t
627
    */
628
    STI_EV_STOP_LINE_VIOLATED,
629
630
    /**
631
    Dangerous goods present
632
    @note Indicates the type of the dangerous goods being carried by a heavy vehicle.
633
    @type [enum]
634
    @see sti_dangerous_good_t
635
    */
636
    STI_DANGEROUS_GOODS,
637
638
    /**
639
    Flat tire
640
    @type [enum]
641
    @see sti_state_t
642
    */
643
    STI_EV_FLAT_TIRE,
644
645
    /**
646
    Disabled vehicle
647
    @note An equipped vehicle that has self-declared that it is not
648
          performing all designed/intended functions and/or operations.
649
          Such a vehicle may be moving or may be stationary.
650
    @type [enum]
651
    @see sti_state_t
652
    */
653
    STI_EV_DISABLED_VEHICLE,
654
655
    /**
656
    Airbag deployed
657
    @type [enum]
658
    @see sti_state_t
659
    */
660
    STI_EV_AIRBAG_DEPLOYED,
661
662
    /**
663
    Low beam headlight status
664
    @type [enum]
665
    @see sti_state_t
666
    */
667
    STI_EXT_LIGHT_LOWBEAM_HEAD,
668
669
    /**
670
    High beam headlight status
671
    @type [enum]
672
    @see sti_state_t
673
    */
674
    STI_EXT_LIGHT_HIGHBEAM_HEAD,
675
676
    /**
677
    Left turn signal status
678
    @note Keep in mind that this signal should be
679
          a stable 'on', and should not be blinking
680
    @type [enum]
681
    @see sti_state_t
682
    */
683
    STI_EXT_LIGHT_LEFT_TURN_SIGNAL,
684
685
    /**
686
    Right turn signal status
687
    @note Keep in mind that this signal should be
688
          a stable 'on', and should not be blinking
689
    @type [enum]
690
    @see sti_state_t
691
    */
692
    STI_EXT_LIGHT_RIGHT_TURN_SIGNAL,
693
694
    /**
695
    Hazard light status status
696
    @note Keep in mind that this signal should be
697
          a stable 'on', and should not be blinking.
698
          This value is independent from the turn signal and signifies
699
          the button itself on the dashboard. If this value cannot be
700
          obtained independently, it should be manually set to 'on' if
701
          both turn signals are 'on'.
702
    @type [enum]
703
    @see sti_state_t
704
    */
705
    STI_EXT_LIGHT_HAZARD_LIGHT,
706
707
    /**
708
    Auto light control status status
709
    @type [enum]
710
    @see sti_state_t
711
    */
712
    STI_EXT_LIGHT_AUTO_LIGHT_CONTROL,
713
714
    /**
715
    Daytime running light status
716
    @type [enum]
717
    @see sti_state_t
718
    */
719
    STI_EXT_LIGHT_DAYTIME_RUNNING,
720
721
    /**
722
    Fog light status
723
    @type [enum]
724
    @see sti_state_t
725
    */
726
    STI_EXT_LIGHT_FOG,
727
728
    /**
729
    Parking light status
730
    @type [enum]
731
    @see sti_state_t
732
    */
733
    STI_EXT_LIGHT_PARKING,
734
735
    /**
736
    Reverse light status
737
    @type [enum]
738
    @see sti_state_t
739
    */
740
    STI_EXT_LIGHT_REVERSE,
741
742
    /**
743
    Station type
744
    @note Not to be confused with vehicle role. It may seem redundant,
745
          but while class doesn't change for the lifetime of the vehicle,
746
          role may change based on what it's doing currently.
747
    @type [enum]
748
    @see sti_station_type_t
749
    */
750
    STI_STATION_TYPE,
751
752
    /**
753
    Vehicle role
754
    @note Not to be confused with vehicle class. It may seem redundant,
755
          but while class doesn't change for the lifetime of the vehicle,
756
          role may change based on what it's doing currently,
757
          e.g. simple passenger vehicle can be a safety car while it's in service,
758
          but a basic vehicle when it's not.
759
    @type [enum]
760
    @see sti_vehicle_role_t
761
    */
762
    STI_VEHICLE_ROLE,
763
764
    /**
765
    Height of the front bumper
766
    @type [length]
767
    @unit [mm]
768
    */
769
    STI_BUMPER_HEIGHT_FRONT,
770
771
    /**
772
    Height of the rear bumper
773
    @type [length]
774
    @unit [mm]
775
    */
776
    STI_BUMPER_HEIGHT_REAR,
777
778
    /**
779
    Rain rate
780
    @type [rate]
781
    @unit [0.1 g/s/m^2]
782
    */
783
    STI_WEATHER_RAIN_RATE,
784
785
    /**
786
    Rain sensor
787
    @note Describes the current sensor reading normalized to a 0-1000 range,
788
          where 0 is completely dry, and 1000 is the highest rain value the
789
          sensor is capable of detecting.
790
          Note that this is independent from STI_WEATHER_PRECIP_SITUATON,
791
          which is more of a semantic value. If both are needed, they need to
792
          be set individually.
793
    @type [thousandths]
794
    @unit [parts-per-thousand]
795
    */
796
    STI_RAIN_SENSOR,
797
798
    /**
799
    Precipitation situation
800
    @note Describes the weather situation in terms of precipitation.
801
    @type [enum]
802
    @see sti_weather_precip_situation_t
803
    */
804
    STI_WEATHER_PRECIP_SITUATON,
805
806
    /**
807
    Solar radiation
808
    @type [solar irradiance]
809
    @unit [J/m^2]
810
    */
811
    STI_WEATHER_SOLAR_RADIATION,
812
813
    /**
814
    Coefficient of friction
815
    @type [thousandths]
816
    @unit [parts-per-thousand]
817
    */
818
    STI_WEATHER_COEF_FRICTION,
819
820
    /**
821
    Ambient air temperature
822
    @type [temperature]
823
    @unit [0.1C°]
824
    */
825
    STI_WEATHER_AIR_TEMP,
826
827
    /**
828
    Ambient air pressure
829
    @type [pressure]
830
    @unit [Pascal]
831
    */
832
    STI_WEATHER_AIR_PRESSURE,
833
834
    /**
835
    Front wiper state
836
    @type [enum]
837
    @see sti_wiper_state_t
838
    */
839
    STI_WIPER_STATE_FRONT,
840
841
    /**
842
    Rear wiper state
843
    @type [enum]
844
    @see sti_wiper_state_t
845
    */
846
    STI_WIPER_STATE_REAR,
847
848
    /**
849
    Front wiper rate
850
    @note Usually only makes sense if the wiper state is also set to a
851
          correct value. This has to be done manually.
852
    @type [rate]
853
    @unit [sweeps/minute]
854
    */
855
    STI_WIPER_RATE_FRONT,
856
857
    /**
858
    Rear wiper rate
859
    @note Usually only makes sense if the wiper state is also set to a
860
          correct value. This has to be done manually.
861
    @type [rate]
862
    @unit [sweeps/minute]
863
    */
864
    STI_WIPER_RATE_REAR,
865
866
    /**
867
    Embarkation status
868
    @type [enum]
869
    @see sti_state_t
870
    */
871
    STI_EMBARKATION_STATUS,
872
873
    /**
874
    Lightbar status
875
    @note It is intended to inform if any sort of additional visible
876
          lighting-alerting system is currently in use by a vehicle.
877
    @type [enum]
878
    @see sti_lightbar_t
879
    */
880
    STI_LIGHTBAR,
881
882
    /**
883
    Siren status
884
    @note A data element which is set if any sort of audible alarm is being
885
          emitted from the vehicle.
886
    @type [enum]
887
    @see sti_siren_t
888
    */
889
    STI_SIREN,
890
891
    /**
892
    Accelerator pedal position
893
    @type [thousandths]
894
    @unit [parts-per-thousand]
895
    */
896
    STI_ACCELERATOR_PEDAL,
897
898
    /**
899
    Brake pedal position
900
    @type [thousandths]
901
    @unit [parts-per-thousand]
902
    */
903
    STI_BRAKE_PEDAL,
904
905
    /**
906
    Collision warning
907
    @type [enum]
908
    @see sti_state_t
909
    */
910
    STI_COLLISION_WARNING,
911
912
    /**
913
    Adaptive cruise control status
914
    @type [enum]
915
    @see sti_state_t
916
    */
917
    STI_ADAPTIVE_CRUISE_CONTROL,
918
919
    /**
920
    Cruise control status
921
    @type [enum]
922
    @see sti_state_t
923
    */
924
    STI_CRUISE_CONTROL,
925
926
    /**
927
    Speed limiter status
928
    @type [enum]
929
    @see sti_state_t
930
    */
931
    STI_SPEED_LIMITER,
932
933
    /**
934
    Lane position
935
    @type [enum]
936
    @see sti_lane_pos_t
937
    */
938
    STI_LANE_POSITION,
939
940
    /**
941
    Trailer weight
942
    @type [weight]
943
    @unit [g]
944
    */
945
    STI_TRAILER_WEIGHT,
946
947
    /**
948
    Front left door state
949
    @type [enum]
950
    @see sti_door_state_t
951
    */
952
    STI_DOOR_STATE_FRONT_LEFT,
953
954
    /**
955
    Front right door state
956
    @type [enum]
957
    @see sti_door_state_t
958
    */
959
    STI_DOOR_STATE_FRONT_RIGHT,
960
961
    /**
962
    Rear left door state
963
    @type [enum]
964
    @see sti_door_state_t
965
    */
966
    STI_DOOR_STATE_REAR_LEFT,
967
968
    /**
969
    Rear right door state
970
    @type [enum]
971
    @see sti_door_state_t
972
    */
973
    STI_DOOR_STATE_REAR_RIGHT,
974
975
    /**
976
    Bonnet state
977
    @type [enum]
978
    @see sti_door_state_t
979
    */
980
    STI_DOOR_STATE_BONNET,
981
982
    /**
983
    Trunk state
984
    @type [enum]
985
    @see sti_door_state_t
986
    */
987
    STI_DOOR_STATE_TRUNK,
988
989
    /**
990
    Fuel type
991
    @type [enum]
992
    @see sti_fuel_type_t
993
    */
994
    STI_FUEL_TYPE,
995
996
    /**
997
    Road class
998
    @type [enum]
999
    @see sti_road_class_t
1000
    */
1001
    STI_ROAD_CLASS,
1002
1003
    /**
1004
    Area type
1005
    @type [enum]
1006
    @see sti_area_type_t
1007
    */
1008
    STI_AREA_TYPE,
1009
1010
    /**
1011
    Automatic emergency brake status
1012
    @type [enum]
1013
    @see sti_state_t
1014
    */
1015
    STI_AUTOMATIC_EMERGENCY_BRAKE,
1016
1017
    /**
1018
    Reversible Occupant Restraint System status (e.g. reversible belt-tightener)
1019
    @note Activate when any of the applicable system is active.
1020
    @type [enum]
1021
    @see sti_state_t
1022
    */
1023
    STI_REVERSIBLE_OCCUPANT_RESTRAINT_SYSTEM,
1024
1025
    /**
1026
    A red warning light is active in the vehicle. (See ECE 121)
1027
    @type [enum]
1028
    @see sti_state_t
1029
    */
1030
    STI_RED_WARNING_ACTIVE,
1031
1032
    /**
1033
    First row belt buckle status on the driver side.
1034
    @type [enum]
1035
    @see sti_belt_buckle_status_t
1036
    */
1037
    STI_BELT_BUCKLE_ROW1_DRIVER,
1038
1039
    /**
1040
    First row belt buckle status on the middle.
1041
    @type [enum]
1042
    @see sti_belt_buckle_status_t
1043
    */
1044
    STI_BELT_BUCKLE_ROW1_MIDDLE,
1045
1046
    /**
1047
    First row belt buckle status on the passenger side.
1048
    @type [enum]
1049
    @see sti_belt_buckle_status_t
1050
    */
1051
    STI_BELT_BUCKLE_ROW1_PASSENGER,
1052
1053
    /**
1054
    Second row belt buckle status on the driver side.
1055
    @type [enum]
1056
    @see sti_belt_buckle_status_t
1057
    */
1058
    STI_BELT_BUCKLE_ROW2_DRIVER,
1059
1060
    /**
1061
    Second row belt buckle status on the middle.
1062
    @type [enum]
1063
    @see sti_belt_buckle_status_t
1064
    */
1065
    STI_BELT_BUCKLE_ROW2_MIDDLE,
1066
1067
    /**
1068
    Second row belt buckle status on the passenger side.
1069
    @type [enum]
1070
    @see sti_belt_buckle_status_t
1071
    */
1072
    STI_BELT_BUCKLE_ROW2_PASSENGER,
1073
1074
    /**
1075
    Third row belt buckle status on the driver side.
1076
    @type [enum]
1077
    @see sti_belt_buckle_status_t
1078
    */
1079
    STI_BELT_BUCKLE_ROW3_DRIVER,
1080
1081
    /**
1082
    Third row belt buckle status on the middle.
1083
    @type [enum]
1084
    @see sti_belt_buckle_status_t
1085
    */
1086
    STI_BELT_BUCKLE_ROW3_MIDDLE,
1087
1088
    /**
1089
    Third row belt buckle status on the passenger side.
1090
    @type [enum]
1091
    @see sti_belt_buckle_status_t
1092
    */
1093
    STI_BELT_BUCKLE_ROW3_PASSENGER,
1094
1095
    /**
1096
    Ignition status of the vehicle. (terminal 15)
1097
    @type [enum]
1098
    @see sti_state_t
1099
    */
1100
    STI_IGNITION,
1101
1102
    /**
1103
    Type of the transmission. (automatic or manual)
1104
    @type [enum]
1105
    @see sti_transmission_type_t
1106
    */
1107
    STI_TRANSMISSION_TYPE,
1108
1109
    /**
1110
    Presence of physical separation between own and oncoming lanes of the road/highway
1111
    @type [enum]
1112
    @see sti_physical_road_separation_t
1113
    */
1114
    STI_PHYSICAL_ROAD_SEPARATION,
1115
1116
    /**
1117
    An eCall has been triggered manually by an occupant of the vehicle by the eCall
1118
    button.
1119
    @type [enum]
1120
    @see sti_state_t
1121
    */
1122
    STI_MANUAL_ECALL,
1123
1124
    /**
1125
    Low severity crash crash is detected without the activation of an irreversible occupant
1126
    restraint system. (e.g. high-voltage battery cut-off, door unlock)
1127
    @type [enum]
1128
    @see sti_state_t
1129
    */
1130
    STI_LOW_SEVERITY_CRASH,
1131
1132
    /**
1133
    Pedestrian collision is detected with the activation of at least one irreversible
1134
    pedestrian-protection system. (e.g. pop-up bonnet, outside airbag)
1135
    @type [enum]
1136
    @see sti_state_t
1137
    */
1138
    STI_PEDESTRIAN_COLLISION,
1139
1140
    /**
1141
    High severity crash is detected with the activation of at least one irreversible
1142
    occupant-restraint system. (e.g. pyrotechnic belt-tightener, airbag)
1143
    @type [enum]
1144
    @see sti_state_t
1145
    */
1146
    STI_HIGH_SEVERITY_CRASH,
1147
1148
    /**
1149
    Rule of the road. (e.g. right-hand traffic, left-hand traffic)
1150
    @type [enum]
1151
    @see sti_state_t
1152
    */
1153
    STI_ROAD_RULE,
1154
1155
    /**
1156
    Jackknife.
1157
    @type [enum]
1158
    @see sti_state_t
1159
    */
1160
    STI_EV_JACKKNIFE,
1161
1162
    /**
1163
    Project specific STI values.
1164
    @type [integer]
1165
    @unit [varying]
1166
    */
1167
    STI_PROJECT_00 = 128,
1168
    STI_PROJECT_01,
1169
    STI_PROJECT_02,
1170
    STI_PROJECT_03,
1171
    STI_PROJECT_04,
1172
    STI_PROJECT_05,
1173
    STI_PROJECT_06,
1174
    STI_PROJECT_07,
1175
    STI_PROJECT_08,
1176
    STI_PROJECT_09,
1177
    STI_PROJECT_10,
1178
    STI_PROJECT_11,
1179
    STI_PROJECT_12,
1180
    STI_PROJECT_13,
1181
    STI_PROJECT_14,
1182
    STI_PROJECT_15,
1183
    STI_PROJECT_16,
1184
    STI_PROJECT_17,
1185
    STI_PROJECT_18,
1186
    STI_PROJECT_19,
1187
    STI_PROJECT_20,
1188
    STI_PROJECT_21,
1189
    STI_PROJECT_22,
1190
    STI_PROJECT_23,
1191
    STI_PROJECT_24,
1192
    STI_PROJECT_25,
1193
    STI_PROJECT_26,
1194
    STI_PROJECT_27,
1195
    STI_PROJECT_28,
1196
    STI_PROJECT_29,
1197
    STI_PROJECT_30,
1198
    STI_PROJECT_31,
1199
1200
    /** Number of STI types, do not use as a parameter */
1201
    STI_TYPE_LAST
1202
} sti_type_t;
1203
1204
1205
static int proto_desc;
1206
static int ett_c2p;
1207
static dissector_handle_t ieee80211_handle;
1208
1209
static int hf_c2p_version_desc;
1210
static int hf_c2p_type_desc;
1211
static int hf_c2p_tst_sec_desc;
1212
static int hf_c2p_tst_msec_desc;
1213
static int hf_c2p_primary_channel_desc;
1214
static int hf_c2p_secondary_channel_desc;
1215
static int hf_c2p_used_interface_desc;
1216
static int hf_c2p_datarate_desc;
1217
static int hf_c2p_antenna_desc;
1218
static int hf_c2p_latitude_desc;
1219
static int hf_c2p_longitude_desc;
1220
static int hf_c2p_altitude_desc;
1221
static int hf_c2p_speed_desc;
1222
static int hf_c2p_heading_desc;
1223
static int hf_c2p_semi_major_conf_desc;
1224
static int hf_c2p_semi_minor_conf_desc;
1225
static int hf_c2p_semi_major_ori_desc;
1226
static int hf_c2p_alttitude_acc_desc;
1227
static int hf_c2p_heading_acc_desc;
1228
static int hf_c2p_speed_acc_desc;
1229
static int hf_c2p_rssi_ant_1_desc;
1230
static int hf_c2p_rssi_ant_2_desc;
1231
static int hf_c2p_noise_ant_1_desc;
1232
static int hf_c2p_noise_ant_2_desc;
1233
static int hf_c2p_cbr_ant_1_desc;
1234
static int hf_c2p_cbr_ant_2_desc;
1235
static int hf_c2p_tx_power_desc;
1236
static int hf_c2p_cv2x_tx_power_desc;
1237
static int hf_c2p_tssi_ant_1_desc;
1238
static int hf_c2p_tssi_ant_2_desc;
1239
static int hf_c2p_sps_desc;
1240
static int hf_c2p_sps_port_desc;
1241
static int hf_c2p_event_port_desc;
1242
static int hf_c2p_bw_res_v2xid_desc;
1243
static int hf_c2p_bw_res_period_interval_ms_desc;
1244
static int hf_c2p_bw_res_tx_reservation_size_bytes_desc;
1245
static int hf_c2p_bw_res_tx_priority_desc;
1246
static int hf_c2p_socket_index_desc;
1247
static int hf_c2p_ethertype_desc;
1248
static int hf_c2p_rssi_desc;
1249
static int hf_c2p_nav_fix_is_valid_desc;
1250
static int hf_c2p_gps_timestamp_desc;
1251
static int hf_c2p_sti_length_desc;
1252
static int hf_c2p_sti_type_desc;
1253
static int hf_c2p_sti_value_angle_desc;
1254
static int hf_c2p_sti_value_acceleration_desc;
1255
static int hf_c2p_sti_value_angular_velocity_desc;
1256
static int hf_c2p_sti_value_thousandths_desc;
1257
static int hf_c2p_sti_value_length_desc;
1258
static int hf_c2p_sti_value_mass_desc;
1259
static int hf_c2p_sti_value_rain_rate_desc;
1260
static int hf_c2p_sti_value_solar_irradiance_desc;
1261
static int hf_c2p_sti_value_temperature_desc;
1262
static int hf_c2p_sti_value_pressure_desc;
1263
static int hf_c2p_sti_value_sweep_rate_desc;
1264
static int hf_c2p_sti_value_integer_desc;
1265
static int hf_c2p_sti_value_transmission_state_desc;
1266
static int hf_c2p_sti_value_aux_breaks_desc;
1267
static int hf_c2p_sti_value_vehicle_length_conf_desc;
1268
static int hf_c2p_sti_value_dangerous_goods_desc;
1269
static int hf_c2p_sti_value_station_type_desc;
1270
static int hf_c2p_sti_value_vehicle_role_desc;
1271
static int hf_c2p_sti_value_weather_precip_situation_desc;
1272
static int hf_c2p_sti_value_wiper_state_desc;
1273
static int hf_c2p_sti_value_door_state_desc;
1274
static int hf_c2p_sti_value_fuel_type_desc;
1275
static int hf_c2p_sti_value_road_class_desc;
1276
static int hf_c2p_sti_value_road_rule_desc;
1277
static int hf_c2p_sti_value_area_type_desc;
1278
static int hf_c2p_sti_value_belt_buckle_status_desc;
1279
static int hf_c2p_sti_value_transmission_type_desc;
1280
static int hf_c2p_sti_value_physical_road_separation_desc;
1281
static int hf_c2p_sti_value_siren_desc;
1282
static int hf_c2p_sti_value_lightbar_desc;
1283
static int hf_c2p_sti_value_lane_position_desc;
1284
static int hf_c2p_sti_value_state_desc;
1285
static int hf_c2p_sti_value_tristate_desc;
1286
1287
1288
0
#define C2P_TYPE_DSRC_RX        1UL
1289
0
#define C2P_TYPE_DSRC_TX        2UL
1290
1
#define C2P_TYPE_NAV            3UL
1291
#define C2P_TYPE_CAN            4UL
1292
7
#define C2P_TYPE_STI            5UL
1293
#define C2P_TYPE_POTI           6UL
1294
0
#define C2P_TYPE_CV2X_RX        7UL
1295
0
#define C2P_TYPE_CV2X_TX        8UL
1296
1297
enum { C2P_TYPES_NUM = 9UL };
1298
1299
static const value_string c2p_types[C2P_TYPES_NUM] = {
1300
    { C2P_TYPE_DSRC_RX, "Received DSRC Packet" },
1301
    { C2P_TYPE_DSRC_TX, "Transmitted DSRC Packet" },
1302
    { C2P_TYPE_NAV, "Navigation" },
1303
    { C2P_TYPE_CAN, "CAN" },
1304
    { C2P_TYPE_STI, "StationInfo" },
1305
    { C2P_TYPE_POTI, "Position & Timing" },
1306
    { C2P_TYPE_CV2X_RX, "Received CV2X Packet" },
1307
    { C2P_TYPE_CV2X_TX, "Transmitted CV2X Packet" },
1308
    { 0, NULL }
1309
};
1310
1311
enum { HEADING_PREDEFINED_VALUES_NUM = 7UL };
1312
1313
static const value_string heading_predefined_values[HEADING_PREDEFINED_VALUES_NUM] = {
1314
    { 0, "wgs84North" },
1315
    { 900, "wgs84East" },
1316
    { 1800, "wgs84South" },
1317
    { 2700, "wgs84West" },
1318
    { 3600, "Unavailable" },
1319
    { 3601, "Unavailable" },
1320
    { 0, NULL }
1321
};
1322
1323
static const val64_string sti_transmission_state_types[5] = {
1324
    { STI_TRANSMISSION_STATE_NEUTRAL, "Neutral" },
1325
    { STI_TRANSMISSION_PARK, "Parking" },
1326
    { STI_TRANSMISSION_FWD_GEARS, "Forward gears" },
1327
    { STI_TRANSMISSION_REVERSE_GEARS, "Reverse gears" },
1328
    { 0, NULL }
1329
};
1330
1331
static const val64_string sti_aux_breaks_types[3] = {
1332
    { STI_AUX_BRAKES_OFF, "Off" },
1333
    { STI_AUX_BRAKES_ON, "On" },
1334
    { 0, NULL }
1335
};
1336
1337
static const val64_string sti_vehicle_length_conf_types[5] = {
1338
    { STI_VEHICLE_LENGTH_CONF_NO_TRAILER, "No trailer" },
1339
    { STI_VEHICLE_LENGTH_CONF_TRAILER_WITH_LENGTH, "Trailer with known length" },
1340
    { STI_VEHICLE_LENGTH_CONF_TRAILER_WITH_NA_LENGTH, "Trailer with unknown length" },
1341
    { STI_VEHICLE_LENGTH_CONF_TRAILER_PRESENCE_IS_UNK, "Trailer presence unknown" },
1342
    { 0, NULL }
1343
};
1344
1345
static const val64_string sti_dangerous_goods_types[21] = {
1346
    { STI_DANGEROUS_GOODS_EXPLOSIVES1, "Explosive substance type 1" },
1347
    { STI_DANGEROUS_GOODS_EXPLOSIVES2, "Explosive substance type 2" },
1348
    { STI_DANGEROUS_GOODS_EXPLOSIVES3, "Explosive substance type 3" },
1349
    { STI_DANGEROUS_GOODS_EXPLOSIVES4, "Explosive substance type 4" },
1350
    { STI_DANGEROUS_GOODS_EXPLOSIVES5, "Explosive substance type 5" },
1351
    { STI_DANGEROUS_GOODS_EXPLOSIVES6, "Explosive substance type 6" },
1352
    { STI_DANGEROUS_GOODS_FLAMMABLE_GASES, "Flammable gases" },
1353
    { STI_DANGEROUS_GOODS_NON_FLAMMABLE_GASES, "Non flammable gases" },
1354
    { STI_DANGEROUS_GOODS_TOXIC_GASES, "Toxic gases" },
1355
    { STI_DANGEROUS_GOODS_FLAMMABLE_LIQUIDS, "Flammable liquids" },
1356
    { STI_DANGEROUS_GOODS_FLAMMABLE_SOLIDS, "Flammable solids" },
1357
    { STI_DANGEROUS_GOODS_SUBSTANCES_SPONTAIN_COMBUSTION, "Substances liable to spontaneous combustion" },
1358
    { STI_DANGEROUS_GOODS_SUBSTANCES_FLAMBLE_CONTACT_WATER, "Substances emitting flammable gases upon contact with water" },
1359
    { STI_DANGEROUS_GOODS_OXIDIZING_SUBSTANCES, "Oxidizing substances" },
1360
    { STI_DANGEROUS_GOODS_ORGANIC_PEROXIDES, "Organic peroxides" },
1361
    { STI_DANGEROUS_GOODS_TOXIC_SUBSTANCES, "Toxic substances" },
1362
    { STI_DANGEROUS_GOODS_INFECTIOUS_SUBSTANCES, "Infectious substances" },
1363
    { STI_DANGEROUS_GOODS_RADIOACTIVE_MATERIAL, "Radioactive material" },
1364
    { STI_DANGEROUS_GOODS_CORROSIVE_SUBSTANCES, "Corrosive substances" },
1365
    { STI_DANGEROUS_GOODS_MISC_DANGEROUS_SUBSTANCES, "Miscellaneous dangerous substances" },
1366
    { 0, NULL }
1367
};
1368
1369
static const val64_string sti_station_type_types[59] = {
1370
    { STI_STATION_TYPE_UNK, "Unknown" },
1371
    { STI_STATION_TYPE_SPECIAL, "Special" },
1372
    { STI_STATION_TYPE_PASSENGER_UNK, "Unknown type passenger vehicle" },
1373
    { STI_STATION_TYPE_PASSENGER_OTHER, "Other type passenger vehicle" },
1374
    { STI_STATION_TYPE_LIGHT_TRUCK_UNK, "Unknown type light truck" },
1375
    { STI_STATION_TYPE_LIGHT_TRUCK_OTHER, "Other type light truck" },
1376
    { STI_STATION_TYPE_TRUCK_UNK, "Unknown type truck" },
1377
    { STI_STATION_TYPE_TRUCK_OTHER, "Other type truck" },
1378
    { STI_STATION_TYPE_TRUCK_AXLE_CNT_2, "Two axle, six tire single units" },
1379
    { STI_STATION_TYPE_TRUCK_AXLE_CNT_3, "Three axle single units" },
1380
    { STI_STATION_TYPE_TRUCK_AXLE_CNT_4, "Four or more axle single unit" },
1381
    { STI_STATION_TYPE_TRUCK_AXLE_CNT_4_TRAILER, "Four or less axle single trailer" },
1382
    { STI_STATION_TYPE_TRUCK_AXLE_CNT_5_TRAILER, "Five or less axle single trailer" },
1383
    { STI_STATION_TYPE_TRUCK_AXLE_CNT_6_TRAILER, "Six or more axle single trailer" },
1384
    { STI_STATION_TYPE_TRUCK_AXLE_CNT_5_MULTI_TRAILER, "Five or less axle multi-trailer" },
1385
    { STI_STATION_TYPE_TRUCK_AXLE_CNT_6_MULTI_TRAILER, "Six axle multi-trailer" },
1386
    { STI_STATION_TYPE_TRUCK_AXLE_CNT_7_MULTI_TRAILER, "Seven or more axle multi-trailer" },
1387
    { STI_STATION_TYPE_MOTORCYCLE_UNK, "Unknown type motorcycle" },
1388
    { STI_STATION_TYPE_MOTORCYCLE_OTHER, "Other type motorcycle" },
1389
    { STI_STATION_TYPE_MOTORCYCLE_CRUISER_STANDARD, "Cruiser standard motorcycle" },
1390
    { STI_STATION_TYPE_MOTORCYCLE_SPORT_UNCLAD, "Unclad sport motorcycle" },
1391
    { STI_STATION_TYPE_MOTORCYCLE_SPORT_TOURING, "Sport touring motorcycle" },
1392
    { STI_STATION_TYPE_MOTORCYCLE_SUPER_SPORT, "Super sport motorcycle" },
1393
    { STI_STATION_TYPE_MOTORCYCLE_TOURING, "Touring motorcycle" },
1394
    { STI_STATION_TYPE_MOTORCYCLE_TRIKE, "Trike motorcycle" },
1395
    { STI_STATION_TYPE_MOTORCYCLE_WITH_PASSENGERS, "Motorcycle with passengers" },
1396
    { STI_STATION_TYPE_TRANSIT_UNK, "Unknown type transit" },
1397
    { STI_STATION_TYPE_TRANSIT_OTHER, "Other type transit" },
1398
    { STI_STATION_TYPE_TRANSIT_BRT, "Bus rapid transit" },
1399
    { STI_STATION_TYPE_TRANSIT_EXPRESS_BUS, "Express bus" },
1400
    { STI_STATION_TYPE_TRANSIT_LOCAL_BUS, "Local bus" },
1401
    { STI_STATION_TYPE_TRANSIT_SCHOOL_BUS, "School bus" },
1402
    { STI_STATION_TYPE_TRANSIT_FIXED_GUIDE_WAY, "Fixed guideway transit, like tram" },
1403
    { STI_STATION_TYPE_TRANSIT_PARATRANSIT, "Paratransit" },
1404
    { STI_STATION_TYPE_TRANSIT_PARATRANSIT_AMBULANCE, "Paratransit ambulance" },
1405
    { STI_STATION_TYPE_EMERGENCY_UNK, "Unknown type emergency vehicle" },
1406
    { STI_STATION_TYPE_EMERGENCY_OTHER, "Other type emergency vehicle" },
1407
    { STI_STATION_TYPE_EMERGENCY_FIRE_LIGHT, "Light fire emergency vehicle" },
1408
    { STI_STATION_TYPE_EMERGENCY_FIRE_HEAVY, "Heavy fire emergency vehicle" },
1409
    { STI_STATION_TYPE_EMERGENCY_FIRE_PARAMEDIC, "Fire paramedic emergency vehicle" },
1410
    { STI_STATION_TYPE_EMERGENCY_FIRE_AMBULANCE, "Fire ambulance emergency vehicle" },
1411
    { STI_STATION_TYPE_EMERGENCY_POLICE_LIGHT, "Light police emergency vehicle" },
1412
    { STI_STATION_TYPE_EMERGENCY_POLICE_HEAVY, "Heavy police emergency vehicle" },
1413
    { STI_STATION_TYPE_EMERGENCY_OTHER_RESPONDER, "Other type responder emergency vehicle" },
1414
    { STI_STATION_TYPE_EMERGENCY_OTHER_AMBULANCE, "Other type ambulance emergency vehicle" },
1415
    { STI_STATION_TYPE_OTHER_UNK, "Unknown type other traveler" },
1416
    { STI_STATION_TYPE_OTHER_OTHER, "Other type other traveler" },
1417
    { STI_STATION_TYPE_OTHER_PEDESTRIAN, "Other type pedestrian" },
1418
    { STI_STATION_TYPE_OTHER_VISUALLY_DISABLED, "Visually disabled other traveler" },
1419
    { STI_STATION_TYPE_OTHER_PHYSICALLY_DISABLED, "Physically disabled other traveler" },
1420
    { STI_STATION_TYPE_OTHER_BICYCLE, "Bicycle" },
1421
    { STI_STATION_TYPE_OTHER_VULNERABLE_ROADWORKER, "Vulnerable road worker" },
1422
    { STI_STATION_TYPE_INFRASTRUCTURE_UNK, "Unknown type infrastructure" },
1423
    { STI_STATION_TYPE_INFRASTRUCTURE_FIXED, "Fixed infrastructure" },
1424
    { STI_STATION_TYPE_INFRASTRUCTURE_MOVABLE, "Movable device" },
1425
    { STI_STATION_TYPE_EQUIPPED_CARGO_TRAILER, "Cargo trailer" },
1426
    { STI_STATION_TYPE_LIGHT_VRU_VEHICLE, "Vulnerable road worker" },
1427
    { STI_STATION_TYPE_ANIMAL, "Animal" },
1428
    { 0, NULL }
1429
};
1430
1431
1432
static const val64_string sti_vehicle_role_types[27] = {
1433
    { STI_VEHICLE_ROLE_BASIC_VEHICLE, "Basic vehicle" },
1434
    { STI_VEHICLE_ROLE_PUBLIC_TRANSPORT, "Public transport" },
1435
    { STI_VEHICLE_ROLE_SPECIAL_TRANSPORT, "Special transport" },
1436
    { STI_VEHICLE_ROLE_DANGEROUS_GOODS, "Dangerous goods" },
1437
    { STI_VEHICLE_ROLE_ROAD_WORK, "Roadwork" },
1438
    { STI_VEHICLE_ROLE_RESCUE, "Rescue" },
1439
    { STI_VEHICLE_ROLE_EMERGENCY, "Emergency" },
1440
    { STI_VEHICLE_ROLE_SAFETY_CAR, "Safety car" },
1441
    { STI_VEHICLE_ROLE_TRUCK, "Truck" },
1442
    { STI_VEHICLE_ROLE_MOTORCYCLE, "Motorcycle" },
1443
    { STI_VEHICLE_ROLE_ROAD_SIDE_SOURCE, "RSU" },
1444
    { STI_VEHICLE_ROLE_POLICE, "Police" },
1445
    { STI_VEHICLE_ROLE_FIRE, "Fire" },
1446
    { STI_VEHICLE_ROLE_AMBULANCE, "Ambulance" },
1447
    { STI_VEHICLE_ROLE_DOT, "DoT" },
1448
    { STI_VEHICLE_ROLE_TRANSIT, "Transit" },
1449
    { STI_VEHICLE_ROLE_SLOW_MOVING, "Slow moving" },
1450
    { STI_VEHICLE_ROLE_STOP_N_GO, "Stop 'n' Go" },
1451
    { STI_VEHICLE_ROLE_CYCLIST, "Cyclist" },
1452
    { STI_VEHICLE_ROLE_PEDESTRIAN, "Pedestrian" },
1453
    { STI_VEHICLE_ROLE_NON_MOTORIZED, "Non motorized" },
1454
    { STI_VEHICLE_ROLE_MILITARY, "Military" },
1455
    { STI_VEHICLE_ROLE_AGRICULTURE, "Agriculture" },
1456
    { STI_VEHICLE_ROLE_COMMERCIAL, "Commercial" },
1457
    { STI_VEHICLE_ROLE_ROAD_OPERATOR, "Road operator" },
1458
    { STI_VEHICLE_ROLE_TAXI, "Taxi" },
1459
    { 0, NULL }
1460
};
1461
1462
static const val64_string sti_weather_precip_situation_types[16] = {
1463
    { STI_WEATHER_PRECIP_SITUATON_OTHER, "Other type precipitation" },
1464
    { STI_WEATHER_PRECIP_SITUATON_UNK, "Unknown type precipitation" },
1465
    { STI_WEATHER_PRECIP_SITUATON_NO_PRECIP, "No precipitation" },
1466
    { STI_WEATHER_PRECIP_SITUATON_UNK_SLIGHT, "Unknown type slight precipitation" },
1467
    { STI_WEATHER_PRECIP_SITUATON_UNK_MODERATE, "Unknown type moderate precipitation" },
1468
    { STI_WEATHER_PRECIP_SITUATON_UNK_HEAVY, "Unknown type heavy precipitation" },
1469
    { STI_WEATHER_PRECIP_SITUATON_SNOW_SLIGHT, "Slight snow precipitation" },
1470
    { STI_WEATHER_PRECIP_SITUATON_SNOW_MODERATE, "Moderate snow precipitation" },
1471
    { STI_WEATHER_PRECIP_SITUATON_SNOW_HEAVY, "Heavy snow precipitation" },
1472
    { STI_WEATHER_PRECIP_SITUATON_RAIN_SLIGHT, "Slight rain precipitation" },
1473
    { STI_WEATHER_PRECIP_SITUATON_RAIN_MODERATE, "Moderate rain precipitation" },
1474
    { STI_WEATHER_PRECIP_SITUATON_RAIN_HEAVY, "Heavy rain precipitation" },
1475
    { STI_WEATHER_PRECIP_SITUATON_FROZEN_PRECIP_SLIGHT, "Slight frozen precipitation" },
1476
    { STI_WEATHER_PRECIP_SITUATON_FROZEN_PRECIP_MODERATE, "Moderate frozen precipitation" },
1477
    { STI_WEATHER_PRECIP_SITUATON_FROZEN_PRECIP_HEAVY, "Heavy frozen precipitation" },
1478
    { 0, NULL }
1479
};
1480
1481
static const val64_string sti_wiper_state_types[7] = {
1482
    { STI_WIPER_STATE_OFF, "Off" },
1483
    { STI_WIPER_STATE_INTERMITTENT, "Intermittent" },
1484
    { STI_WIPER_STATE_LOW, "Low" },
1485
    { STI_WIPER_STATE_HIGH, "High" },
1486
    { STI_WIPER_STATE_WASHER_IN_USE, "Washer in use" },
1487
    { STI_WIPER_STATE_AUTO, "Auto" },
1488
    { 0, NULL }
1489
};
1490
1491
static const val64_string sti_lightbar_types[8] = {
1492
    { STI_LIGHTBAR_NOT_IN_USE, "Not in use" },
1493
    { STI_LIGHTBAR_IN_USE, "In use" },
1494
    { STI_LIGHTBAR_YELLOW_CAUTION_LIGHTS, "Yellow caution lights" },
1495
    { STI_LIGHTBAR_SCHOOL_BUS_LIGHTS, "School bus lights" },
1496
    { STI_LIGHTBAR_ARROW_SIGNS_ACTIVE, "Arrow signs active" },
1497
    { STI_LIGHTBAR_SLOW_MOVING_VEHICLE, "Slow moving vehicle lights" },
1498
    { STI_LIGHTBAR_FREQ_STOPS, "Frequent stops" },
1499
    { 0, NULL }
1500
};
1501
1502
static const val64_string sti_door_state_types[4] = {
1503
    { STI_DOOR_STATE_NA, "Unknown" },
1504
    { STI_DOOR_STATE_CLOSED, "Closed" },
1505
    { STI_DOOR_STATE_OPEN, "Open" },
1506
    { 0, NULL }
1507
};
1508
1509
static const val64_string sti_fuel_type_types[10] = {
1510
    { STI_FUEL_TYPE_GASOLINE, "Gasoline" },
1511
    { STI_FUEL_TYPE_ETHANOL, "Ethanol" },
1512
    { STI_FUEL_TYPE_DIESEL, "Diesel" },
1513
    { STI_FUEL_TYPE_ELECTRIC, "Electric" },
1514
    { STI_FUEL_TYPE_HYBRID, "Hybrid" },
1515
    { STI_FUEL_TYPE_HYDROGEN, "Hydrogen" },
1516
    { STI_FUEL_TYPE_NAT_GAS_LIQUID, "NAT gas liquefied" },
1517
    { STI_FUEL_TYPE_NAT_GAS_COMP, "NAT gas compressed" },
1518
    { STI_FUEL_TYPE_PROPANE, "Propane" },
1519
    { 0, NULL }
1520
};
1521
1522
static const val64_string sti_road_class_types[5] = {
1523
    { STI_ROAD_CLASS_UNKNOWN, "Unknown" },
1524
    { STI_ROAD_CLASS_MOTORWAY, "Motorway" },
1525
    { STI_ROAD_CLASS_COUNTRY_ROAD, "Country road" },
1526
    { STI_ROAD_CLASS_LOCAL_ROAD, "Local road" },
1527
    { 0, NULL }
1528
};
1529
1530
static const val64_string sti_road_rule_types[3] = {
1531
    { STI_ROAD_RULE_RIGHT_HAND_TRAFFIC, "Right hand traffic" },
1532
    { STI_ROAD_RULE_LEFT_HAND_TRAFFIC, "Left hand traffic" },
1533
    { 0, NULL }
1534
};
1535
1536
static const val64_string sti_area_type_types[3] = {
1537
    { STI_AREA_TYPE_RURAL, "Rural" },
1538
    { STI_AREA_TYPE_URBAN, "Urban" },
1539
    { 0, NULL }
1540
};
1541
1542
static const val64_string sti_belt_buckle_status_types[3] = {
1543
    { STI_BELT_BUCKLE_DISCONNECTED, "Disconnected" },
1544
    { STI_BELT_BUCKLE_CONNECTED, "Connected" },
1545
    { 0, NULL }
1546
};
1547
1548
static const val64_string sti_transmission_type_types[3] = {
1549
    { STI_TRANSMISSION_TYPE_AUTOMATIC, "Automatic" },
1550
    { STI_TRANSMISSION_TYPE_MANUAL, "Manual" },
1551
    { 0, NULL }
1552
};
1553
1554
static const val64_string sti_physical_road_separation_types[3] = {
1555
    { STI_PHYSICAL_ROAD_SEPARATION_NOT_PRESENT, "Not present" },
1556
    { STI_PHYSICAL_ROAD_SEPARATION_PRESENT, "Present" },
1557
    { 0, NULL }
1558
};
1559
1560
static const val64_string sti_siren_types[3] = {
1561
    { STI_SIREN_NOT_IN_USE, "Not in use" },
1562
    { STI_SIREN_IN_USE, "In use" },
1563
    { 0, NULL }
1564
};
1565
1566
static const val64_string sti_lane_position_types[36] = {
1567
    { STI_LANE_POSITION_INNER_HARD_SHOULDER, "Inner hard shoulder position" },
1568
    { STI_LANE_POSITION_INNERMOST_DRIVING_LANE, "Innermost driving lane" },
1569
    { STI_LANE_POSITION_SECOND_LANE_FROM_INSIDE, "Second lane from inside" },
1570
    { STI_LANE_POSITION_THIRD_LANE_FROM_INSIDE, "Third lane from inside" },
1571
    { STI_LANE_POSITION_FOURTH_LANE_FROM_INSIDE, "Fourth lane from inside" },
1572
    { STI_LANE_POSITION_FIFTH_LANE_FROM_INSIDE, "Fifth lane from inside" },
1573
    { STI_LANE_POSITION_SIXTH_LANE_FROM_INSIDE, "Sixth lane from inside" },
1574
    { STI_LANE_POSITION_SEVENTH_LANE_FROM_INSIDE, "Seventh lane from inside" },
1575
    { STI_LANE_POSITION_EIGHTH_LANE_FROM_INSIDE, "Eighth lane from inside" },
1576
    { STI_LANE_POSITION_NINTH_LANE_FROM_INSIDE, "Ninth lane from inside" },
1577
    { STI_LANE_POSITION_TENTH_LANE_FROM_INSIDE, "Tenth lane from inside" },
1578
    { STI_LANE_POSITION_ELEVENTH_LANE_FROM_INSIDE, "Eleventh lane from inside" },
1579
    { STI_LANE_POSITION_TWELFTH_LANE_FROM_INSIDE, "Twelfth lane from inside" },
1580
    { STI_LANE_POSITION_THIRTEENTH_LANE_FROM_INSIDE, "Thirteenth lane from inside" },
1581
    { STI_LANE_POSITION_FOURTEENTH_LANE_FROM_INSIDE, "Fourteenth lane from inside" },
1582
    { STI_LANE_POSITION_FIFTEENTH_LANE_FROM_INSIDE, "Fifteenth lane from inside" },
1583
    { STI_LANE_POSITION_SIXTEENTH_LANE_FROM_INSIDE, "Sixteenth lane from inside" },
1584
    { STI_LANE_POSITION_SEVENTEENTH_LANE_FROM_INSIDE, "Seventeenth lane from inside" },
1585
    { STI_LANE_POSITION_EIGHTEENTH_LANE_FROM_INSIDE, "Eighteenth lane from inside" },
1586
    { STI_LANE_POSITION_NINETEENTH_LANE_FROM_INSIDE, "Nineteenth lane from inside" },
1587
    { STI_LANE_POSITION_TWENTIETH_LANE_FROM_INSIDE, "Twentieth lane from inside" },
1588
    { STI_LANE_POSITION_TWENTY_FIRST_LANE_FROM_INSIDE, "Twenty-first lane from inside" },
1589
    { STI_LANE_POSITION_TWENTY_SECOND_LANE_FROM_INSIDE, "Twenty-second lane from inside" },
1590
    { STI_LANE_POSITION_TWENTY_THIRD_LANE_FROM_INSIDE, "Twenty-third lane from inside" },
1591
    { STI_LANE_POSITION_TWENTY_FOURTH_LANE_FROM_INSIDE, "Twenty-fourth lane from inside" },
1592
    { STI_LANE_POSITION_TWENTY_FIFTH_LANE_FROM_INSIDE, "Twenty-fifth lane from inside" },
1593
    { STI_LANE_POSITION_TWENTY_SIXTH_LANE_FROM_INSIDE, "Twenty-sixth lane from inside" },
1594
    { STI_LANE_POSITION_TWENTY_SEVENTH_LANE_FROM_INSIDE, "Twenty-seventh lane from inside" },
1595
    { STI_LANE_POSITION_TWENTY_EIGHTH_LANE_FROM_INSIDE, "Twenty-eighth lane from inside" },
1596
    { STI_LANE_POSITION_TWENTY_NINTH_LANE_FROM_INSIDE, "Twenty-ninth lane from inside" },
1597
    { STI_LANE_POSITION_THIRTIETH_LANE_FROM_INSIDE, "Thirtieth lane from inside" },
1598
    { STI_LANE_POSITION_THIRTY_FIRST_LANE_FROM_INSIDE, "Thirty-first lane from inside" },
1599
    { STI_LANE_POSITION_THIRTY_SECOND_LANE_FROM_INSIDE, "Thirty-second lane from inside" },
1600
    { STI_LANE_POSITION_OUTER_HARD_SHOULDER, "Outer hard shoulder position" },
1601
    { STI_LANE_POSITION_OFF_THE_ROAD, "Off the road position" },
1602
    { 0, NULL }
1603
};
1604
1605
static const val64_string sti_state_types[3] = {
1606
    { STI_STATE_OFF, "Off" },
1607
    { STI_STATE_ON, "On" },
1608
    { 0, NULL }
1609
};
1610
1611
static const val64_string sti_tristate_types[4] = {
1612
    { STI_TRISTATE_OFF, "Off" },
1613
    { STI_TRISTATE_ON, "On (but not engaged)" },
1614
    { STI_TRISTATE_ENGAGED, "Engaged" },
1615
    { 0, NULL }
1616
};
1617
1618
static const value_string sti_types[STI_TYPE_LAST + 1] = {
1619
    { STI_TRANSMISSION_STATE, "Transmission state" },
1620
    { STI_STEERING_WHEEL_ANGLE, "Steering wheel angle" },
1621
    { STI_STEERING_WHEEL_ANGLE_CONF, "Steering wheel angle confidence" },
1622
    { STI_STEERING_WHEEL_ANGLE_RATE, "Steering wheel angle rate" },
1623
    { STI_DRIVING_WHEEL_ANGLE, "Driving wheel angle" },
1624
    { STI_LONG_ACC, "Longitudinal acceleration" },
1625
    { STI_LONG_ACC_CONF, "Longitudinal acceleration confidence" },
1626
    { STI_LAT_ACC, "Lateral acceleration" },
1627
    { STI_LAT_ACC_CONF, "Lateral acceleration confidence" },
1628
    { STI_VERT_ACC, "Vertical acceleration" },
1629
    { STI_VERT_ACC_CONF, "Vertical acceleration confidence" },
1630
    { STI_YAW_RATE, "Yaw rate" },
1631
    { STI_YAW_RATE_CONF, "Yaw rate confidence" },
1632
    { STI_BRAKE_STATUS_LEFT_FRONT, "Front left brake applied pressure" },
1633
    { STI_BRAKE_STATUS_LEFT_REAR, "Rear left brake applied pressure" },
1634
    { STI_BRAKE_STATUS_RIGHT_FRONT, "Front right brake applied pressure" },
1635
    { STI_BRAKE_STATUS_RIGHT_REAR, "Rear right brake applied pressure" },
1636
    { STI_TRACTION_CONTROL_STATUS, "Traction control status" },
1637
    { STI_ABS, "Anti-lock braking system status" },
1638
    { STI_STABILITY_CONTROL_STATUS, "Stability control status" },
1639
    { STI_EMERGENCY_BRAKE, "Emergency brake status, also known as 'Brake boost'" },
1640
    { STI_AUX_BRAKES, "Auxiliary brake status" },
1641
    { STI_VEHICLE_WIDTH, "Vehicle width" },
1642
    { STI_VEHICLE_LENGTH, "Vehicle length" },
1643
    { STI_VEHICLE_LENGTH_CONF, "Vehicle length confidence" },
1644
    { STI_VEHICLE_HEIGHT, "Vehicle height" },
1645
    { STI_VEHICLE_MASS, "Vehicle mass" },
1646
    { STI_EV_STOP_LINE_VIOLATED, "Stop line violated" },
1647
    { STI_DANGEROUS_GOODS, "Dangerous goods present" },
1648
    { STI_EV_FLAT_TIRE, "Flat tire" },
1649
    { STI_EV_DISABLED_VEHICLE, "Disabled vehicle" },
1650
    { STI_EV_AIRBAG_DEPLOYED, "Airbag deployed" },
1651
    { STI_EXT_LIGHT_LOWBEAM_HEAD, "Low beam headlight" },
1652
    { STI_EXT_LIGHT_HIGHBEAM_HEAD, "High beam headlight" },
1653
    { STI_EXT_LIGHT_LEFT_TURN_SIGNAL, "Left turn signal" },
1654
    { STI_EXT_LIGHT_RIGHT_TURN_SIGNAL, "Right turn signal" },
1655
    { STI_EXT_LIGHT_HAZARD_LIGHT, "Hazard light" },
1656
    { STI_EXT_LIGHT_AUTO_LIGHT_CONTROL, "Auto light control" },
1657
    { STI_EXT_LIGHT_DAYTIME_RUNNING, "Daytime running light" },
1658
    { STI_EXT_LIGHT_FOG, "Fog light" },
1659
    { STI_EXT_LIGHT_PARKING, "Parking light" },
1660
    { STI_EXT_LIGHT_REVERSE, "Reverse light" },
1661
    { STI_STATION_TYPE, "Station type" },
1662
    { STI_VEHICLE_ROLE, "Vehicle role" },
1663
    { STI_BUMPER_HEIGHT_FRONT, "Height of the front bumper" },
1664
    { STI_BUMPER_HEIGHT_REAR, "Height of the rear bumper" },
1665
    { STI_WEATHER_RAIN_RATE, "Rain rate" },
1666
    { STI_RAIN_SENSOR, "Rain sensor" },
1667
    { STI_WEATHER_PRECIP_SITUATON, "Precipitation situation" },
1668
    { STI_WEATHER_SOLAR_RADIATION, "Solar radiation" },
1669
    { STI_WEATHER_COEF_FRICTION, "Coefficient of friction" },
1670
    { STI_WEATHER_AIR_TEMP, "Ambient air temperature" },
1671
    { STI_WEATHER_AIR_PRESSURE, "Ambient air pressure" },
1672
    { STI_WIPER_STATE_FRONT, "Front wiper state" },
1673
    { STI_WIPER_STATE_REAR, "Rear wiper state" },
1674
    { STI_WIPER_RATE_FRONT, "Front wiper rate" },
1675
    { STI_WIPER_RATE_REAR, "Rear wiper rate" },
1676
    { STI_EMBARKATION_STATUS, "Embarkation status" },
1677
    { STI_LIGHTBAR, "Lightbar status" },
1678
    { STI_SIREN, "Siren status" },
1679
    { STI_ACCELERATOR_PEDAL, "Accelerator pedal position" },
1680
    { STI_BRAKE_PEDAL, "Brake pedal position" },
1681
    { STI_COLLISION_WARNING, "Collision warning" },
1682
    { STI_ADAPTIVE_CRUISE_CONTROL, "Adaptive cruise control status" },
1683
    { STI_CRUISE_CONTROL, "Cruise control status" },
1684
    { STI_SPEED_LIMITER, "Speed limiter status" },
1685
    { STI_LANE_POSITION, "Lane position" },
1686
    { STI_TRAILER_WEIGHT, "Trailer weight" },
1687
    { STI_DOOR_STATE_FRONT_LEFT, "Front left door state" },
1688
    { STI_DOOR_STATE_FRONT_RIGHT, "Front right door state" },
1689
    { STI_DOOR_STATE_REAR_LEFT, "Rear left door state" },
1690
    { STI_DOOR_STATE_REAR_RIGHT, "Rear right door state" },
1691
    { STI_DOOR_STATE_BONNET, "Bonnet state" },
1692
    { STI_DOOR_STATE_TRUNK, "Trunk state" },
1693
    { STI_FUEL_TYPE, "Fuel type" },
1694
    { STI_ROAD_CLASS, "Road class" },
1695
    { STI_ROAD_RULE, "Road rule" },
1696
    { STI_AREA_TYPE, "Area type" },
1697
    { STI_AUTOMATIC_EMERGENCY_BRAKE, "Automatic emergency brake status" },
1698
    { STI_REVERSIBLE_OCCUPANT_RESTRAINT_SYSTEM, "Reversible Occupant Restraint System status" },
1699
    { STI_RED_WARNING_ACTIVE, "A red warning light is active in the vehicle" },
1700
    { STI_BELT_BUCKLE_ROW1_DRIVER, "First row belt buckle status on the driver side" },
1701
    { STI_BELT_BUCKLE_ROW1_MIDDLE, "First row belt buckle status on the middle" },
1702
    { STI_BELT_BUCKLE_ROW1_PASSENGER, "First row belt buckle status on the passenger side" },
1703
    { STI_BELT_BUCKLE_ROW2_DRIVER, "Second row belt buckle status on the driver side" },
1704
    { STI_BELT_BUCKLE_ROW2_MIDDLE, "Second row belt buckle status on the middle" },
1705
    { STI_BELT_BUCKLE_ROW2_PASSENGER, "Second row belt buckle status on the passenger side" },
1706
    { STI_BELT_BUCKLE_ROW3_DRIVER, "Third row belt buckle status on the driver side" },
1707
    { STI_BELT_BUCKLE_ROW3_MIDDLE, "Third row belt buckle status on the middle" },
1708
    { STI_BELT_BUCKLE_ROW3_PASSENGER, "Third row belt buckle status on the passenger side" },
1709
    { STI_IGNITION, "Ignition status" },
1710
    { STI_TRANSMISSION_TYPE, "Type of the transmission" },
1711
    { STI_PHYSICAL_ROAD_SEPARATION, "Presence of physical separation between own and oncoming lanes of the road/highway" },
1712
    { STI_MANUAL_ECALL, "Manual eCall triggered" },
1713
    { STI_LOW_SEVERITY_CRASH, "Low severity crash" },
1714
    { STI_PEDESTRIAN_COLLISION, "Pedestrian collision" },
1715
    { STI_HIGH_SEVERITY_CRASH, "High severity crash" },
1716
    { STI_EV_JACKKNIFE, "Jackknife" },
1717
    { STI_PROJECT_00, "Project #0" },
1718
    { STI_PROJECT_01, "Project #1" },
1719
    { STI_PROJECT_02, "Project #2" },
1720
    { STI_PROJECT_03, "Project #3" },
1721
    { STI_PROJECT_04, "Project #4" },
1722
    { STI_PROJECT_05, "Project #5" },
1723
    { STI_PROJECT_06, "Project #6" },
1724
    { STI_PROJECT_07, "Project #7" },
1725
    { STI_PROJECT_08, "Project #8" },
1726
    { STI_PROJECT_09, "Project #9" },
1727
    { STI_PROJECT_10, "Project #10" },
1728
    { STI_PROJECT_11, "Project #11" },
1729
    { STI_PROJECT_12, "Project #12" },
1730
    { STI_PROJECT_13, "Project #13" },
1731
    { STI_PROJECT_14, "Project #14" },
1732
    { STI_PROJECT_15, "Project #15" },
1733
    { STI_PROJECT_16, "Project #16" },
1734
    { STI_PROJECT_17, "Project #17" },
1735
    { STI_PROJECT_18, "Project #18" },
1736
    { STI_PROJECT_19, "Project #19" },
1737
    { STI_PROJECT_20, "Project #20" },
1738
    { STI_PROJECT_21, "Project #21" },
1739
    { STI_PROJECT_22, "Project #22" },
1740
    { STI_PROJECT_23, "Project #23" },
1741
    { STI_PROJECT_24, "Project #24" },
1742
    { STI_PROJECT_25, "Project #25" },
1743
    { STI_PROJECT_26, "Project #26" },
1744
    { STI_PROJECT_27, "Project #27" },
1745
    { STI_PROJECT_28, "Project #28" },
1746
    { STI_PROJECT_29, "Project #29" },
1747
    { STI_PROJECT_30, "Project #30" },
1748
    { STI_PROJECT_31, "Project #31" },
1749
    { 0, NULL }
1750
};
1751
1752
1753
/** STI parameters to hf_index mapping */
1754
static const int* const sti_params[STI_TYPE_LAST] = {
1755
    [STI_TRANSMISSION_STATE] = &hf_c2p_sti_value_transmission_state_desc,
1756
    [STI_STEERING_WHEEL_ANGLE] = &hf_c2p_sti_value_angle_desc,
1757
    [STI_STEERING_WHEEL_ANGLE_CONF] = &hf_c2p_sti_value_angle_desc,
1758
    [STI_STEERING_WHEEL_ANGLE_RATE] = &hf_c2p_sti_value_angular_velocity_desc,
1759
    [STI_DRIVING_WHEEL_ANGLE] = &hf_c2p_sti_value_angle_desc,
1760
    [STI_LONG_ACC] = &hf_c2p_sti_value_acceleration_desc,
1761
    [STI_LONG_ACC_CONF] = &hf_c2p_sti_value_acceleration_desc,
1762
    [STI_LAT_ACC] = &hf_c2p_sti_value_acceleration_desc,
1763
    [STI_LAT_ACC_CONF] = &hf_c2p_sti_value_acceleration_desc,
1764
    [STI_VERT_ACC] = &hf_c2p_sti_value_acceleration_desc,
1765
    [STI_VERT_ACC_CONF] = &hf_c2p_sti_value_acceleration_desc,
1766
    [STI_YAW_RATE] = &hf_c2p_sti_value_angular_velocity_desc,
1767
    [STI_YAW_RATE_CONF] = &hf_c2p_sti_value_angular_velocity_desc,
1768
    [STI_BRAKE_STATUS_LEFT_FRONT] = &hf_c2p_sti_value_thousandths_desc,
1769
    [STI_BRAKE_STATUS_LEFT_REAR] = &hf_c2p_sti_value_thousandths_desc,
1770
    [STI_BRAKE_STATUS_RIGHT_FRONT] = &hf_c2p_sti_value_thousandths_desc,
1771
    [STI_BRAKE_STATUS_RIGHT_REAR] = &hf_c2p_sti_value_thousandths_desc,
1772
    [STI_TRACTION_CONTROL_STATUS] = &hf_c2p_sti_value_tristate_desc,
1773
    [STI_ABS] = &hf_c2p_sti_value_tristate_desc,
1774
    [STI_STABILITY_CONTROL_STATUS] = &hf_c2p_sti_value_tristate_desc,
1775
    [STI_EMERGENCY_BRAKE] = &hf_c2p_sti_value_state_desc,
1776
    [STI_AUX_BRAKES] = &hf_c2p_sti_value_aux_breaks_desc,
1777
    [STI_VEHICLE_WIDTH] = &hf_c2p_sti_value_length_desc,
1778
    [STI_VEHICLE_LENGTH] = &hf_c2p_sti_value_length_desc,
1779
    [STI_VEHICLE_LENGTH_CONF] = &hf_c2p_sti_value_vehicle_length_conf_desc,
1780
    [STI_VEHICLE_HEIGHT] = &hf_c2p_sti_value_length_desc,
1781
    [STI_VEHICLE_MASS] = &hf_c2p_sti_value_mass_desc,
1782
    [STI_EV_STOP_LINE_VIOLATED] = &hf_c2p_sti_value_state_desc,
1783
    [STI_DANGEROUS_GOODS] = &hf_c2p_sti_value_dangerous_goods_desc,
1784
    [STI_EV_FLAT_TIRE] = &hf_c2p_sti_value_state_desc,
1785
    [STI_EV_DISABLED_VEHICLE] = &hf_c2p_sti_value_state_desc,
1786
    [STI_EV_AIRBAG_DEPLOYED] = &hf_c2p_sti_value_state_desc,
1787
    [STI_EXT_LIGHT_LOWBEAM_HEAD] = &hf_c2p_sti_value_state_desc,
1788
    [STI_EXT_LIGHT_HIGHBEAM_HEAD] = &hf_c2p_sti_value_state_desc,
1789
    [STI_EXT_LIGHT_LEFT_TURN_SIGNAL] = &hf_c2p_sti_value_state_desc,
1790
    [STI_EXT_LIGHT_RIGHT_TURN_SIGNAL] = &hf_c2p_sti_value_state_desc,
1791
    [STI_EXT_LIGHT_HAZARD_LIGHT] = &hf_c2p_sti_value_state_desc,
1792
    [STI_EXT_LIGHT_AUTO_LIGHT_CONTROL] = &hf_c2p_sti_value_state_desc,
1793
    [STI_EXT_LIGHT_DAYTIME_RUNNING] = &hf_c2p_sti_value_state_desc,
1794
    [STI_EXT_LIGHT_FOG] = &hf_c2p_sti_value_state_desc,
1795
    [STI_EXT_LIGHT_PARKING] = &hf_c2p_sti_value_state_desc,
1796
    [STI_EXT_LIGHT_REVERSE] = &hf_c2p_sti_value_state_desc,
1797
    [STI_STATION_TYPE] = &hf_c2p_sti_value_station_type_desc,
1798
    [STI_VEHICLE_ROLE] = &hf_c2p_sti_value_vehicle_role_desc,
1799
    [STI_BUMPER_HEIGHT_FRONT] = &hf_c2p_sti_value_length_desc,
1800
    [STI_BUMPER_HEIGHT_REAR] = &hf_c2p_sti_value_length_desc,
1801
    [STI_WEATHER_RAIN_RATE] = &hf_c2p_sti_value_rain_rate_desc,
1802
    [STI_RAIN_SENSOR] = &hf_c2p_sti_value_thousandths_desc,
1803
    [STI_WEATHER_PRECIP_SITUATON] = &hf_c2p_sti_value_weather_precip_situation_desc,
1804
    [STI_WEATHER_SOLAR_RADIATION] = &hf_c2p_sti_value_solar_irradiance_desc,
1805
    [STI_WEATHER_COEF_FRICTION] = &hf_c2p_sti_value_thousandths_desc,
1806
    [STI_WEATHER_AIR_TEMP] = &hf_c2p_sti_value_temperature_desc,
1807
    [STI_WEATHER_AIR_PRESSURE] = &hf_c2p_sti_value_pressure_desc,
1808
    [STI_WIPER_STATE_FRONT] = &hf_c2p_sti_value_wiper_state_desc,
1809
    [STI_WIPER_STATE_REAR] = &hf_c2p_sti_value_wiper_state_desc,
1810
    [STI_WIPER_RATE_FRONT] = &hf_c2p_sti_value_sweep_rate_desc,
1811
    [STI_WIPER_RATE_REAR] = &hf_c2p_sti_value_sweep_rate_desc,
1812
    [STI_EMBARKATION_STATUS] = &hf_c2p_sti_value_state_desc,
1813
    [STI_LIGHTBAR] = &hf_c2p_sti_value_lightbar_desc,
1814
    [STI_SIREN] = &hf_c2p_sti_value_siren_desc,
1815
    [STI_ACCELERATOR_PEDAL] = &hf_c2p_sti_value_thousandths_desc,
1816
    [STI_BRAKE_PEDAL] = &hf_c2p_sti_value_thousandths_desc,
1817
    [STI_COLLISION_WARNING] = &hf_c2p_sti_value_state_desc,
1818
    [STI_ADAPTIVE_CRUISE_CONTROL] = &hf_c2p_sti_value_state_desc,
1819
    [STI_CRUISE_CONTROL] = &hf_c2p_sti_value_state_desc,
1820
    [STI_SPEED_LIMITER] = &hf_c2p_sti_value_state_desc,
1821
    [STI_LANE_POSITION] = &hf_c2p_sti_value_lane_position_desc,
1822
    [STI_TRAILER_WEIGHT] = &hf_c2p_sti_value_mass_desc,
1823
    [STI_DOOR_STATE_FRONT_LEFT] = &hf_c2p_sti_value_door_state_desc,
1824
    [STI_DOOR_STATE_FRONT_RIGHT] = &hf_c2p_sti_value_door_state_desc,
1825
    [STI_DOOR_STATE_REAR_LEFT] = &hf_c2p_sti_value_door_state_desc,
1826
    [STI_DOOR_STATE_REAR_RIGHT] = &hf_c2p_sti_value_door_state_desc,
1827
    [STI_DOOR_STATE_BONNET] = &hf_c2p_sti_value_door_state_desc,
1828
    [STI_DOOR_STATE_TRUNK] = &hf_c2p_sti_value_door_state_desc,
1829
    [STI_FUEL_TYPE] = &hf_c2p_sti_value_fuel_type_desc,
1830
    [STI_ROAD_CLASS] = &hf_c2p_sti_value_road_class_desc,
1831
    [STI_ROAD_RULE] = &hf_c2p_sti_value_road_rule_desc,
1832
    [STI_AREA_TYPE] = &hf_c2p_sti_value_area_type_desc,
1833
    [STI_AUTOMATIC_EMERGENCY_BRAKE] = &hf_c2p_sti_value_state_desc,
1834
    [STI_REVERSIBLE_OCCUPANT_RESTRAINT_SYSTEM] = &hf_c2p_sti_value_state_desc,
1835
    [STI_RED_WARNING_ACTIVE] = &hf_c2p_sti_value_state_desc,
1836
    [STI_BELT_BUCKLE_ROW1_DRIVER] = &hf_c2p_sti_value_belt_buckle_status_desc,
1837
    [STI_BELT_BUCKLE_ROW1_MIDDLE] = &hf_c2p_sti_value_belt_buckle_status_desc,
1838
    [STI_BELT_BUCKLE_ROW1_PASSENGER] = &hf_c2p_sti_value_belt_buckle_status_desc,
1839
    [STI_BELT_BUCKLE_ROW2_DRIVER] = &hf_c2p_sti_value_belt_buckle_status_desc,
1840
    [STI_BELT_BUCKLE_ROW2_MIDDLE] = &hf_c2p_sti_value_belt_buckle_status_desc,
1841
    [STI_BELT_BUCKLE_ROW2_PASSENGER] = &hf_c2p_sti_value_belt_buckle_status_desc,
1842
    [STI_BELT_BUCKLE_ROW3_DRIVER] = &hf_c2p_sti_value_belt_buckle_status_desc,
1843
    [STI_BELT_BUCKLE_ROW3_MIDDLE] = &hf_c2p_sti_value_belt_buckle_status_desc,
1844
    [STI_BELT_BUCKLE_ROW3_PASSENGER] = &hf_c2p_sti_value_belt_buckle_status_desc,
1845
    [STI_IGNITION] = &hf_c2p_sti_value_state_desc,
1846
    [STI_TRANSMISSION_TYPE] = &hf_c2p_sti_value_transmission_type_desc,
1847
    [STI_PHYSICAL_ROAD_SEPARATION] = &hf_c2p_sti_value_physical_road_separation_desc,
1848
    [STI_MANUAL_ECALL] = &hf_c2p_sti_value_state_desc,
1849
    [STI_LOW_SEVERITY_CRASH] = &hf_c2p_sti_value_state_desc,
1850
    [STI_PEDESTRIAN_COLLISION] = &hf_c2p_sti_value_state_desc,
1851
    [STI_HIGH_SEVERITY_CRASH] = &hf_c2p_sti_value_state_desc,
1852
    [STI_EV_JACKKNIFE] = &hf_c2p_sti_value_state_desc,
1853
    [STI_PROJECT_00] = &hf_c2p_sti_value_integer_desc,
1854
    [STI_PROJECT_01] = &hf_c2p_sti_value_integer_desc,
1855
    [STI_PROJECT_02] = &hf_c2p_sti_value_integer_desc,
1856
    [STI_PROJECT_03] = &hf_c2p_sti_value_integer_desc,
1857
    [STI_PROJECT_04] = &hf_c2p_sti_value_integer_desc,
1858
    [STI_PROJECT_05] = &hf_c2p_sti_value_integer_desc,
1859
    [STI_PROJECT_06] = &hf_c2p_sti_value_integer_desc,
1860
    [STI_PROJECT_07] = &hf_c2p_sti_value_integer_desc,
1861
    [STI_PROJECT_08] = &hf_c2p_sti_value_integer_desc,
1862
    [STI_PROJECT_09] = &hf_c2p_sti_value_integer_desc,
1863
    [STI_PROJECT_10] = &hf_c2p_sti_value_integer_desc,
1864
    [STI_PROJECT_11] = &hf_c2p_sti_value_integer_desc,
1865
    [STI_PROJECT_12] = &hf_c2p_sti_value_integer_desc,
1866
    [STI_PROJECT_13] = &hf_c2p_sti_value_integer_desc,
1867
    [STI_PROJECT_14] = &hf_c2p_sti_value_integer_desc,
1868
    [STI_PROJECT_15] = &hf_c2p_sti_value_integer_desc,
1869
    [STI_PROJECT_16] = &hf_c2p_sti_value_integer_desc,
1870
    [STI_PROJECT_17] = &hf_c2p_sti_value_integer_desc,
1871
    [STI_PROJECT_18] = &hf_c2p_sti_value_integer_desc,
1872
    [STI_PROJECT_19] = &hf_c2p_sti_value_integer_desc,
1873
    [STI_PROJECT_20] = &hf_c2p_sti_value_integer_desc,
1874
    [STI_PROJECT_21] = &hf_c2p_sti_value_integer_desc,
1875
    [STI_PROJECT_22] = &hf_c2p_sti_value_integer_desc,
1876
    [STI_PROJECT_23] = &hf_c2p_sti_value_integer_desc,
1877
    [STI_PROJECT_24] = &hf_c2p_sti_value_integer_desc,
1878
    [STI_PROJECT_25] = &hf_c2p_sti_value_integer_desc,
1879
    [STI_PROJECT_26] = &hf_c2p_sti_value_integer_desc,
1880
    [STI_PROJECT_27] = &hf_c2p_sti_value_integer_desc,
1881
    [STI_PROJECT_28] = &hf_c2p_sti_value_integer_desc,
1882
    [STI_PROJECT_29] = &hf_c2p_sti_value_integer_desc,
1883
    [STI_PROJECT_30] = &hf_c2p_sti_value_integer_desc,
1884
    [STI_PROJECT_31] = &hf_c2p_sti_value_integer_desc,
1885
};
1886
1887
static void set_tst_proto_item_info(tvbuff_t* tvb, int offset, proto_item* ti)
1888
8
{
1889
8
    if((NULL != tvb) && (NULL != ti)) {
1890
8
        uint32_t tst_sec = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
1891
8
        uint32_t tst_msec = tvb_get_uint32(tvb, offset + 4, ENC_BIG_ENDIAN);
1892
1893
8
        static const time_t TIME_2004_IN_ABSTIME = 1072915200ULL;
1894
8
        time_t timestamp = tst_sec + TIME_2004_IN_ABSTIME;
1895
8
        struct tm* utc_time = gmtime(&timestamp);
1896
1897
8
        enum { TIMETAMP_STR_MAX_LEN = 128UL };
1898
8
        char timestamp_str[TIMETAMP_STR_MAX_LEN] = {0};
1899
8
        strftime(timestamp_str, sizeof(timestamp_str), "%Y-%m-%d %H:%M:%S", utc_time);
1900
1901
8
        proto_item_append_text(ti, " - %s.%lu GMT", timestamp_str, (unsigned long)tst_msec);
1902
8
    }
1903
8
}
1904
1905
static void channel_format(char* string, uint32_t value)
1906
0
{
1907
0
    static const uint8_t CHANNEL_NA = 0U;
1908
1909
0
    if(CHANNEL_NA == value) {
1910
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%d)", value);
1911
0
    } else {
1912
0
        snprintf(string, ITEM_LABEL_LENGTH, "%u", value);
1913
0
    }
1914
0
}
1915
1916
static void datarate_format(char* string, uint32_t value)
1917
0
{
1918
0
    static const uint8_t DATARATE_NA = 0U;
1919
1920
0
    if(DATARATE_NA == value) {
1921
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%d)", value);
1922
0
    } else {
1923
0
        static const uint32_t DATARATE_500_KBPS_TO_KBPS_FACTOR = 500UL;
1924
0
        uint32_t value_kbps = value * DATARATE_500_KBPS_TO_KBPS_FACTOR;
1925
0
        snprintf(string, ITEM_LABEL_LENGTH, "%lu Kbps (%u)", (unsigned long)value_kbps, value);
1926
0
    }
1927
0
}
1928
1929
static void latitude_format(char* string, uint32_t value)
1930
0
{
1931
0
    int32_t lat = (int32_t)value;
1932
0
    static const int32_t LATITUDE_NA = 900000001L;
1933
1934
0
    if(LATITUDE_NA == lat) {
1935
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%ld)", (long int)lat);
1936
0
    } else {
1937
0
        snprintf(string, ITEM_LABEL_LENGTH, "%u°%u'%.3f\"%c (%d)",
1938
0
                 abs(lat) / 10000000,
1939
0
                 abs(lat) % 10000000 * 6 / 1000000,
1940
0
                 abs(lat) % 10000000 * 6 % 1000000 * 6.0 / 100000.0,
1941
0
                 (lat >= 0) ? 'N' : 'S',
1942
0
                 lat);
1943
0
    }
1944
0
}
1945
1946
static void longitude_format(char* string, uint32_t value)
1947
0
{
1948
0
    int32_t lon = (int32_t)value;
1949
0
    static const int32_t LONGITUDE_NA = 1800000001L;
1950
1951
0
    if(LONGITUDE_NA == lon) {
1952
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%ld)", (long int)lon);
1953
0
    } else {
1954
0
        snprintf(string, ITEM_LABEL_LENGTH, "%u°%u'%.3f\"%c (%d)",
1955
0
                 abs(lon) / 10000000,
1956
0
                 abs(lon) % 10000000 * 6 / 1000000,
1957
0
                 abs(lon) % 10000000 * 6 % 1000000 * 6.0 / 100000.0,
1958
0
                 (lon >= 0) ? 'E' : 'W',
1959
0
                 lon);
1960
0
    }
1961
0
}
1962
1963
static void altitude_format(char* string, uint32_t value)
1964
0
{
1965
0
    int32_t alt = (int32_t)value;
1966
0
    static const int32_t ALTIITUDE_NA = 800001L;
1967
1968
0
    if(ALTIITUDE_NA == alt) {
1969
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%ld)", (long int)alt);
1970
0
    } else {
1971
0
        static const double FACTOR_0P01_M_TO_M_FACTOR = 0.01;
1972
1973
0
        double value_m = alt * FACTOR_0P01_M_TO_M_FACTOR;
1974
1975
0
        snprintf(string, ITEM_LABEL_LENGTH, "%.2f m (%ld)", value_m, (long int)alt);
1976
0
    }
1977
0
}
1978
1979
static void speed_format(char* string, uint32_t value)
1980
0
{
1981
0
    static const uint32_t SPEED_STANDSTILL = 0UL;
1982
0
    static const uint32_t SPEED_NA = 16383UL;
1983
1984
0
    if(SPEED_STANDSTILL == value) {
1985
0
        snprintf(string, ITEM_LABEL_LENGTH, "Standstill (%lu)", (unsigned long)value);
1986
0
    } else if(SPEED_NA == value) {
1987
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%lu)", (unsigned long)value);
1988
0
    } else {
1989
0
        static const double FACTOR_0P01_MPS_TO_MPS_FACTOR = 0.01;
1990
0
        static const double FACTOR_MPS_TO_KMPH_FACTOR = 3.6;
1991
1992
0
        double v_mps = value * FACTOR_0P01_MPS_TO_MPS_FACTOR;
1993
0
        double v_kmph = v_mps * FACTOR_MPS_TO_KMPH_FACTOR;
1994
1995
0
        snprintf(string,
1996
0
                 ITEM_LABEL_LENGTH,
1997
0
                 "%.2f m/s = %.1f km/h (%lu)",
1998
0
                 v_mps,
1999
0
                 v_kmph,
2000
0
                 (unsigned long)value);
2001
0
    }
2002
0
}
2003
2004
static void heading_format(char* string, uint32_t value)
2005
0
{
2006
0
    const char* p = try_val_to_str(value, VALS(heading_predefined_values));
2007
0
    if(NULL != p) {
2008
0
        snprintf(string, ITEM_LABEL_LENGTH, "%s (%lu)", p, (unsigned long)value);
2009
0
    } else {
2010
0
        static const double FACTOR_0P1_DEG_TO_DEG_FACTOR = 0.1;
2011
0
        double value_deg = value * FACTOR_0P1_DEG_TO_DEG_FACTOR;
2012
2013
0
        snprintf(string, ITEM_LABEL_LENGTH, "%.1f° (%lu)", value_deg, (unsigned long)value);
2014
0
    }
2015
0
}
2016
2017
static void semi_axis_format(char* string, uint32_t value)
2018
0
{
2019
0
    static const uint16_t SEMI_AXIS_NA = 4095U;
2020
0
    static const uint16_t SEMI_AXIS_OOR = 4094U;
2021
2022
0
    if(SEMI_AXIS_NA == value) {
2023
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%lu)", (unsigned long)value);
2024
0
    } else if(SEMI_AXIS_OOR == value) {
2025
0
        snprintf(string, ITEM_LABEL_LENGTH, "Out of range (%lu)", (unsigned long)value);
2026
0
    } else {
2027
0
        static const double FACTOR_0P01_M_TO_M_FACTOR = 0.01;
2028
2029
0
        double value_m = value * FACTOR_0P01_M_TO_M_FACTOR;
2030
0
        snprintf(string, ITEM_LABEL_LENGTH, "%.2f m (%lu)", value_m, (unsigned long)value);
2031
0
    }
2032
0
}
2033
2034
static void altitude_acc_format(char* string, uint32_t value)
2035
0
{
2036
0
    static const uint16_t ALTITUDE_ACC_NA = 65535U;
2037
2038
0
    if(ALTITUDE_ACC_NA == value) {
2039
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%lu)", (unsigned long)value);
2040
0
    } else {
2041
0
        static const double FACTOR_0P01_M_TO_M_FACTOR = 0.01;
2042
2043
0
        double value_m = value * FACTOR_0P01_M_TO_M_FACTOR;
2044
0
        snprintf(string, ITEM_LABEL_LENGTH, "%.2f m (%lu)", value_m, (unsigned long)value);
2045
0
    }
2046
0
}
2047
2048
static void heading_acc_format(char* string, uint32_t value)
2049
0
{
2050
0
    static const uint16_t HEADING_ACC_NA = 127U;
2051
2052
0
    if(HEADING_ACC_NA == value) {
2053
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%lu)", (unsigned long)value);
2054
0
    } else {
2055
0
        static const double FACTOR_0P1_DEG_TO_DEG_FACTOR = 0.1;
2056
0
        double value_deg = value * FACTOR_0P1_DEG_TO_DEG_FACTOR;
2057
2058
0
        snprintf(string, ITEM_LABEL_LENGTH, "%.1f° (%lu)", value_deg, (unsigned long)value);
2059
0
    }
2060
0
}
2061
2062
static void speed_acc_format(char* string, uint32_t value)
2063
0
{
2064
0
    static const uint16_t SPEED_ACC_NA = 127U;
2065
2066
0
    if(SPEED_ACC_NA == value) {
2067
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%lu)", (unsigned long)value);
2068
0
    } else {
2069
0
        static const double FACTOR_0P01_MPS_TO_MPS_FACTOR = 0.01;
2070
0
        static const double FACTOR_MPS_TO_KMPH_FACTOR = 3.6;
2071
2072
0
        double v_mps = value * FACTOR_0P01_MPS_TO_MPS_FACTOR;
2073
0
        double v_kmph = v_mps * FACTOR_MPS_TO_KMPH_FACTOR;
2074
2075
0
        snprintf(string,
2076
0
                 ITEM_LABEL_LENGTH,
2077
0
                 "%.2f m/s = %.1f km/h (%lu)",
2078
0
                 v_mps,
2079
0
                 v_kmph,
2080
0
                 (unsigned long)value);
2081
0
    }
2082
0
}
2083
2084
static void power_format(char* string, uint32_t value)
2085
0
{
2086
0
    int8_t rssi = (int8_t)value;
2087
0
    static const int8_t RSSI_NA = 127;
2088
2089
0
    if(RSSI_NA == rssi) {
2090
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%d)", rssi);
2091
0
    } else {
2092
0
        snprintf(string, ITEM_LABEL_LENGTH, "%d dBm", rssi);
2093
0
    }
2094
0
}
2095
2096
static void cv2x_tx_power_format(char* string, int32_t value)
2097
0
{
2098
0
    static const int32_t POWER_NA = INT16_MAX;
2099
2100
0
    if(POWER_NA == value) {
2101
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%ld)", (long)value);
2102
0
    } else {
2103
0
        snprintf(string, ITEM_LABEL_LENGTH, "%ld dBm", (long)value);
2104
0
    }
2105
0
}
2106
2107
static const value_string priority_format_vals[] = {
2108
    {0, "Highest priority"},
2109
    {1, "Level 1 priority"},
2110
    {2, "Level 2 priority"},
2111
    {3, "Level 3 priority"},
2112
    {4, "Level 4 priority"},
2113
    {5, "Level 5 priority"},
2114
    {6, "Level 6 priority"},
2115
    {7, "Lowest priority"},
2116
    {0, NULL}
2117
};
2118
2119
static void cbr_format(char* string, uint32_t value)
2120
0
{
2121
0
    static const uint16_t CBR_NA = 1001U;
2122
2123
0
    if(CBR_NA == value) {
2124
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%lu)", (unsigned long)value);
2125
0
    } else {
2126
0
        static const double FACTOR_0P1_PERC_TO_PERC_FACTOR = 0.1;
2127
0
        double value_perc = value * FACTOR_0P1_PERC_TO_PERC_FACTOR;
2128
2129
0
        snprintf(string, ITEM_LABEL_LENGTH, "%.1f %% (%lu)", value_perc, (unsigned long)value);
2130
0
    }
2131
0
}
2132
2133
static void gps_timestamp_format(char* string, uint64_t value)
2134
0
{
2135
0
    static const uint64_t GPS_TIMESTAMP_NA = 0U;
2136
2137
0
    if(GPS_TIMESTAMP_NA == value) {
2138
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%" PRIu64 ")", value);
2139
0
    } else {
2140
0
        time_t timestamp = value / 1000ULL;
2141
0
        uint32_t tst_msec = value % 1000UL;
2142
0
        struct tm* utc_time = gmtime(&timestamp);
2143
2144
0
        enum { TIMETAMP_STR_MAX_LEN = 128UL };
2145
0
        char timestamp_str[TIMETAMP_STR_MAX_LEN] = {0};
2146
0
        strftime(timestamp_str, sizeof(timestamp_str), "%Y-%m-%d %H:%M:%S", utc_time);
2147
2148
0
        snprintf(string,
2149
0
                 ITEM_LABEL_LENGTH,
2150
0
                 "%s.%lu GMT (%" PRIu64 ")",
2151
0
                 timestamp_str,
2152
0
                 (unsigned long)tst_msec,
2153
0
                 value);
2154
0
    }
2155
0
}
2156
2157
static bool sti_value_common_format(char* string, int64_t value)
2158
0
{
2159
0
    bool formatted = true;
2160
0
    static const int64_t STI_VALUE_NA = INT64_MIN;
2161
0
    static const int64_t STI_VALUE_OOR_MIN = INT64_MIN + INT64_C(1);
2162
0
    static const int64_t STI_VALUE_OOR_MAX = INT64_MAX;
2163
2164
0
    if(STI_VALUE_NA == value) {
2165
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%" PRId64 ")", value);
2166
0
    } else if(STI_VALUE_OOR_MIN == value) {
2167
0
        snprintf(string,
2168
0
                 ITEM_LABEL_LENGTH,
2169
0
                 "Out of range (minimum) (%" PRId64 ")",
2170
0
                 value);
2171
0
    } else if(STI_VALUE_OOR_MAX == value) {
2172
0
        snprintf(string,
2173
0
                 ITEM_LABEL_LENGTH,
2174
0
                 "Out of range (maximum) (%" PRId64 ")",
2175
0
                 value);
2176
0
    } else {
2177
0
        formatted = false;
2178
0
    }
2179
2180
0
    return formatted;
2181
0
}
2182
2183
2184
static void sti_value_angle_format(char* string, int64_t value)
2185
0
{
2186
0
    if(!sti_value_common_format(string, value)) {
2187
0
        static const double FACTOR_0P001_DEG_TO_DEG_FACTOR = 0.001;
2188
0
        double value_deg = value * FACTOR_0P001_DEG_TO_DEG_FACTOR;
2189
2190
0
        snprintf(string,
2191
0
                 ITEM_LABEL_LENGTH,
2192
0
                 "%.3f° (%" PRId64 ")",
2193
0
                 value_deg,
2194
0
                 value);
2195
0
    }
2196
0
}
2197
2198
static void sti_value_acceleration_format(char* string, int64_t value)
2199
0
{
2200
0
    if(!sti_value_common_format(string, value)) {
2201
0
        static const double MMPS2_TO_MPS2_FACTOR = 0.001;
2202
0
        double value_mps2 = value * MMPS2_TO_MPS2_FACTOR;
2203
2204
0
        snprintf(string,
2205
0
                 ITEM_LABEL_LENGTH,
2206
0
                 "%.3f m/s² (%" PRId64 ")",
2207
0
                 value_mps2,
2208
0
                 value);
2209
0
    }
2210
0
}
2211
2212
static void sti_value_angular_velocity_format(char* string, int64_t value)
2213
0
{
2214
0
    if(!sti_value_common_format(string, value)) {
2215
0
        static const double FACTOR_0P001_DEGPS_TO_DEGPS_FACTOR = 0.001;
2216
0
        double value_degps = value * FACTOR_0P001_DEGPS_TO_DEGPS_FACTOR;
2217
2218
0
        snprintf(string,
2219
0
                 ITEM_LABEL_LENGTH,
2220
0
                 "%.3f°/s (%" PRId64 ")",
2221
0
                 value_degps,
2222
0
                 value);
2223
0
    }
2224
0
}
2225
2226
static void sti_value_thousandths_format(char* string, int64_t value)
2227
0
{
2228
0
    if(!sti_value_common_format(string, value)) {
2229
0
        static const double THOUSANDTHS_TO_PERCENT_FACTOR = 0.1;
2230
0
        double value_percent = value * THOUSANDTHS_TO_PERCENT_FACTOR;
2231
2232
0
        snprintf(string,
2233
0
                ITEM_LABEL_LENGTH,
2234
0
                "%.3f%% (%" PRId64 ")",
2235
0
                value_percent,
2236
0
                value);
2237
0
    }
2238
0
}
2239
2240
static void sti_value_length_format(char* string, int64_t value)
2241
0
{
2242
0
    if(!sti_value_common_format(string, value)) {
2243
0
        static const double MM_TO_M_FACTOR = 0.001;
2244
0
        double value_m = value * MM_TO_M_FACTOR;
2245
2246
0
        snprintf(string,
2247
0
                 ITEM_LABEL_LENGTH,
2248
0
                 "%.3f m (%" PRId64 ")",
2249
0
                 value_m,
2250
0
                 value);
2251
0
    }
2252
0
}
2253
2254
static void sti_value_mass_format(char* string, int64_t value)
2255
0
{
2256
0
    if(!sti_value_common_format(string, value)) {
2257
0
        static const double G_TO_KG_FACTOR = 0.001;
2258
0
        double value_kg = value * G_TO_KG_FACTOR;
2259
2260
0
        snprintf(string,
2261
0
                 ITEM_LABEL_LENGTH,
2262
0
                 "%.3f kg (%" PRId64 ")",
2263
0
                 value_kg,
2264
0
                 value);
2265
0
    }
2266
0
}
2267
2268
static void sti_value_rain_rate_format(char* string, int64_t value)
2269
0
{
2270
0
    if(!sti_value_common_format(string, value)) {
2271
0
        snprintf(string,
2272
0
                 ITEM_LABEL_LENGTH,
2273
0
                 "%" PRId64 " g/s/m²",
2274
0
                 value);
2275
0
    }
2276
0
}
2277
2278
static void sti_value_solar_irradiance_format(char* string, int64_t value)
2279
0
{
2280
0
    if(!sti_value_common_format(string, value)) {
2281
0
        snprintf(string,
2282
0
                 ITEM_LABEL_LENGTH,
2283
0
                 "%" PRId64 " J/m²",
2284
0
                 value);
2285
0
    }
2286
0
}
2287
2288
static void sti_value_temperature_format(char* string, int64_t value)
2289
0
{
2290
0
    if(!sti_value_common_format(string, value)) {
2291
0
        static const double FACTOR_0P1_DEG_TO_DEG_FACTOR = 0.1;
2292
0
        double value_deg = value * FACTOR_0P1_DEG_TO_DEG_FACTOR;
2293
2294
0
        snprintf(string,
2295
0
                 ITEM_LABEL_LENGTH,
2296
0
                 "%.1f° (%" PRId64 ")",
2297
0
                 value_deg,
2298
0
                 value);
2299
0
    }
2300
0
}
2301
2302
static void sti_value_pressure_format(char* string, int64_t value)
2303
0
{
2304
0
    if(!sti_value_common_format(string, value)) {
2305
0
        snprintf(string,
2306
0
                 ITEM_LABEL_LENGTH,
2307
0
                 "%" PRId64 " Pa",
2308
0
                 value);
2309
0
    }
2310
0
}
2311
2312
static void sti_value_sweep_rate_format(char* string, int64_t value)
2313
0
{
2314
0
    if(!sti_value_common_format(string, value)) {
2315
0
        snprintf(string,
2316
0
                 ITEM_LABEL_LENGTH,
2317
0
                 "%" PRId64 " sweeps/min",
2318
0
                 value);
2319
0
    }
2320
0
}
2321
2322
static void sti_value_integer_format(char* string, int64_t value)
2323
0
{
2324
0
    if(!sti_value_common_format(string, value)) {
2325
0
        snprintf(string,
2326
0
                 ITEM_LABEL_LENGTH,
2327
0
                 "%" PRId64,
2328
0
                 value);
2329
0
    }
2330
0
}
2331
2332
static int dissect_dsrc_rx(tvbuff_t* tvb, proto_tree* c2p_tree, packet_info* pinfo)
2333
0
{
2334
0
    int offset = 0;
2335
2336
0
    proto_tree_add_item(c2p_tree, hf_c2p_primary_channel_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2337
0
    offset += 1;
2338
0
    proto_tree_add_item(c2p_tree, hf_c2p_secondary_channel_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2339
0
    offset += 1;
2340
0
    proto_tree_add_item(c2p_tree, hf_c2p_used_interface_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2341
0
    offset += 1;
2342
0
    proto_tree_add_item(c2p_tree, hf_c2p_datarate_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2343
0
    offset += 1;
2344
0
    proto_tree_add_item(c2p_tree, hf_c2p_antenna_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2345
0
    offset += 1;
2346
0
    proto_tree_add_item(c2p_tree, hf_c2p_latitude_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2347
0
    offset += 4;
2348
0
    proto_tree_add_item(c2p_tree, hf_c2p_longitude_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2349
0
    offset += 4;
2350
0
    proto_tree_add_item(c2p_tree, hf_c2p_speed_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2351
0
    offset += 2;
2352
0
    proto_tree_add_item(c2p_tree, hf_c2p_heading_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2353
0
    offset += 2;
2354
0
    proto_tree_add_item(c2p_tree, hf_c2p_rssi_ant_1_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2355
0
    offset += 1;
2356
0
    proto_tree_add_item(c2p_tree, hf_c2p_rssi_ant_2_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2357
0
    offset += 1;
2358
0
    proto_tree_add_item(c2p_tree, hf_c2p_noise_ant_1_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2359
0
    offset += 1;
2360
0
    proto_tree_add_item(c2p_tree, hf_c2p_noise_ant_2_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2361
0
    offset += 1;
2362
0
    proto_tree_add_item(c2p_tree, hf_c2p_cbr_ant_1_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2363
0
    offset += 2;
2364
0
    proto_tree_add_item(c2p_tree, hf_c2p_cbr_ant_2_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2365
0
    offset += 2;
2366
2367
0
    if(NULL != ieee80211_handle) {
2368
0
        proto_tree* root_tree = proto_tree_get_root(c2p_tree);
2369
0
        tvbuff_t* next_tvb = tvb_new_subset_remaining(tvb, offset);
2370
0
        call_dissector(ieee80211_handle, next_tvb, pinfo, root_tree);
2371
0
    }
2372
2373
0
    return offset;
2374
0
}
2375
2376
static int dissect_dsrc_tx(tvbuff_t* tvb, proto_tree* c2p_tree, packet_info* pinfo)
2377
0
{
2378
0
    int offset = 0;
2379
2380
0
    proto_tree_add_item(c2p_tree, hf_c2p_primary_channel_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2381
0
    offset += 1;
2382
0
    proto_tree_add_item(c2p_tree, hf_c2p_secondary_channel_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2383
0
    offset += 1;
2384
0
    proto_tree_add_item(c2p_tree, hf_c2p_used_interface_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2385
0
    offset += 1;
2386
0
    proto_tree_add_item(c2p_tree, hf_c2p_datarate_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2387
0
    offset += 1;
2388
0
    proto_tree_add_item(c2p_tree, hf_c2p_antenna_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2389
0
    offset += 1;
2390
0
    proto_tree_add_item(c2p_tree, hf_c2p_latitude_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2391
0
    offset += 4;
2392
0
    proto_tree_add_item(c2p_tree, hf_c2p_longitude_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2393
0
    offset += 4;
2394
0
    proto_tree_add_item(c2p_tree, hf_c2p_speed_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2395
0
    offset += 2;
2396
0
    proto_tree_add_item(c2p_tree, hf_c2p_heading_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2397
0
    offset += 2;
2398
0
    proto_tree_add_item(c2p_tree, hf_c2p_tx_power_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2399
0
    offset += 1;
2400
0
    proto_tree_add_item(c2p_tree, hf_c2p_tssi_ant_1_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2401
0
    offset += 1;
2402
0
    proto_tree_add_item(c2p_tree, hf_c2p_tssi_ant_2_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2403
0
    offset += 1;
2404
2405
0
    if(NULL != ieee80211_handle) {
2406
0
        proto_tree* root_tree = proto_tree_get_root(c2p_tree);
2407
0
        tvbuff_t* next_tvb = tvb_new_subset_remaining(tvb, offset);
2408
0
        call_dissector(ieee80211_handle, next_tvb, pinfo, root_tree);
2409
0
    }
2410
2411
0
    return offset;
2412
0
}
2413
2414
static int dissect_cv2x_tx(tvbuff_t* tvb, proto_tree* c2p_tree, packet_info* pinfo)
2415
0
{
2416
0
    int offset = 0;
2417
2418
0
    proto_tree_add_item(c2p_tree, hf_c2p_sps_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2419
0
    offset += 1;
2420
0
    proto_tree_add_item(c2p_tree, hf_c2p_sps_port_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2421
0
    offset += 2;
2422
0
    proto_tree_add_item(c2p_tree, hf_c2p_event_port_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2423
0
    offset += 2;
2424
0
    proto_tree_add_item(c2p_tree, hf_c2p_cv2x_tx_power_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2425
0
    offset += 4;
2426
0
    proto_tree_add_item(c2p_tree, hf_c2p_bw_res_v2xid_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2427
0
    offset += 4;
2428
0
    proto_tree_add_item(c2p_tree, hf_c2p_bw_res_period_interval_ms_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2429
0
    offset += 4;
2430
0
    proto_tree_add_item(c2p_tree, hf_c2p_bw_res_tx_reservation_size_bytes_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2431
0
    offset += 4;
2432
0
    proto_tree_add_item(c2p_tree, hf_c2p_bw_res_tx_priority_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2433
0
    offset += 1;
2434
2435
0
    if(NULL != ieee80211_handle) {
2436
0
        proto_tree* root_tree = proto_tree_get_root(c2p_tree);
2437
0
        tvbuff_t* next_tvb = tvb_new_subset_remaining(tvb, offset);
2438
0
        call_dissector(ieee80211_handle, next_tvb, pinfo, root_tree);
2439
0
    }
2440
2441
0
    return offset;
2442
0
}
2443
2444
static int dissect_cv2x_rx(tvbuff_t* tvb, proto_tree* c2p_tree, packet_info* pinfo)
2445
0
{
2446
0
    int offset = 0;
2447
2448
0
    proto_tree_add_item(c2p_tree, hf_c2p_socket_index_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2449
0
    offset += 1;
2450
0
    proto_tree_add_item(c2p_tree, hf_c2p_ethertype_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2451
0
    offset += 2;
2452
0
    proto_tree_add_item(c2p_tree, hf_c2p_rssi_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2453
0
    offset += 1;
2454
0
    proto_tree_add_item(c2p_tree, hf_c2p_datarate_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2455
0
    offset += 1;
2456
2457
0
    if(NULL != ieee80211_handle) {
2458
0
        proto_tree* root_tree = proto_tree_get_root(c2p_tree);
2459
0
        tvbuff_t* next_tvb = tvb_new_subset_remaining(tvb, offset);
2460
0
        call_dissector(ieee80211_handle, next_tvb, pinfo, root_tree);
2461
0
    }
2462
2463
0
    return offset;
2464
0
}
2465
2466
static int dissect_nav(tvbuff_t* tvb, proto_tree* c2p_tree)
2467
1
{
2468
1
    int offset = 0;
2469
2470
1
    proto_tree_add_item(c2p_tree, hf_c2p_nav_fix_is_valid_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2471
1
    offset += 1;
2472
1
    proto_tree_add_item(c2p_tree, hf_c2p_gps_timestamp_desc, tvb, offset, 8, ENC_BIG_ENDIAN);
2473
1
    offset += 8;
2474
1
    proto_tree_add_item(c2p_tree, hf_c2p_latitude_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2475
1
    offset += 4;
2476
1
    proto_tree_add_item(c2p_tree, hf_c2p_longitude_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2477
1
    offset += 4;
2478
1
    proto_tree_add_item(c2p_tree, hf_c2p_altitude_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2479
1
    offset += 4;
2480
1
    proto_tree_add_item(c2p_tree, hf_c2p_heading_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2481
1
    offset += 2;
2482
1
    proto_tree_add_item(c2p_tree, hf_c2p_speed_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2483
1
    offset += 2;
2484
1
    proto_tree_add_item(c2p_tree, hf_c2p_semi_major_conf_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2485
1
    offset += 2;
2486
1
    proto_tree_add_item(c2p_tree, hf_c2p_semi_minor_conf_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2487
1
    offset += 2;
2488
1
    proto_tree_add_item(c2p_tree, hf_c2p_semi_major_ori_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2489
1
    offset += 2;
2490
1
    proto_tree_add_item(c2p_tree, hf_c2p_alttitude_acc_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2491
1
    offset += 2;
2492
1
    proto_tree_add_item(c2p_tree, hf_c2p_heading_acc_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2493
1
    offset += 2;
2494
1
    proto_tree_add_item(c2p_tree, hf_c2p_speed_acc_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2495
1
    offset += 2;
2496
2497
1
    return offset;
2498
1
}
2499
2500
static int dissect_sti(tvbuff_t* tvb, proto_tree* c2p_tree, packet_info* pinfo)
2501
7
{
2502
7
    int offset = 0;
2503
2504
7
    uint32_t length = tvb_get_uint32(tvb, 0, ENC_LITTLE_ENDIAN);
2505
2506
7
    proto_tree_add_item(c2p_tree, hf_c2p_sti_length_desc, tvb, offset, 4, ENC_LITTLE_ENDIAN);
2507
7
    offset += 4;
2508
2509
121
    for(uint32_t i = 0UL; i < length; ++i) {
2510
114
        char* str_display;
2511
114
        str_display = wmem_strdup_printf(pinfo->pool, "STI #%lu", (unsigned long)i);
2512
        /* STI item length is 4 bytes of type and 8 bytes of value */
2513
114
        static const int STI_ITEM_LEN = 12UL;
2514
114
        proto_tree* subtree = proto_tree_add_subtree(c2p_tree,
2515
114
                                                     tvb,
2516
114
                                                     offset,
2517
114
                                                     STI_ITEM_LEN,
2518
114
                                                     ett_c2p,
2519
114
                                                     NULL,
2520
114
                                                     str_display);
2521
114
        sti_type_t sti_type = tvb_get_uint32(tvb, offset, ENC_LITTLE_ENDIAN);
2522
2523
114
        proto_tree_add_item(subtree,
2524
114
                            hf_c2p_sti_type_desc,
2525
114
                            tvb,
2526
114
                            offset,
2527
114
                            4,
2528
114
                            ENC_LITTLE_ENDIAN);
2529
114
        offset += 4;
2530
2531
114
        int hf_index = hf_c2p_sti_value_integer_desc;
2532
2533
114
        if((sti_type < array_length(sti_params)) && (sti_params[sti_type] != NULL)) {
2534
9
            hf_index = *(sti_params[sti_type]);
2535
9
        }
2536
2537
114
        proto_tree_add_item(subtree,
2538
114
                            hf_index,
2539
114
                            tvb,
2540
114
                            offset,
2541
114
                            8,
2542
114
                            ENC_LITTLE_ENDIAN);
2543
114
        offset += 8;
2544
114
    }
2545
2546
7
    return offset;
2547
7
}
2548
2549
static int dissect_c2p(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_)
2550
8
{
2551
8
    int offset = 0;
2552
8
    uint32_t type, version;
2553
8
    char* str_type;
2554
2555
8
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "C2P");
2556
8
    col_clear(pinfo->cinfo, COL_INFO);
2557
2558
2559
8
    proto_item* ti = proto_tree_add_item(tree, proto_desc, tvb, 0, -1, ENC_NA);
2560
2561
8
    proto_tree* c2p_tree = proto_item_add_subtree(ti, ett_c2p);
2562
2563
    /* Version & type */
2564
8
    proto_tree_add_item_ret_uint(c2p_tree, hf_c2p_version_desc, tvb, offset, 1, ENC_BIG_ENDIAN, &version);
2565
8
    proto_tree_add_item_ret_uint(c2p_tree, hf_c2p_type_desc, tvb, offset, 1, ENC_BIG_ENDIAN, &type);
2566
8
    str_type = val_to_str(pinfo->pool, type, c2p_types, "Unknown (%d)");
2567
8
    proto_item_append_text(ti, ", Type: %s", str_type);
2568
8
    col_add_fstr(pinfo->cinfo, COL_INFO, "Type: %s", str_type);
2569
8
    offset += 1;
2570
2571
    /* Timestamp */
2572
8
    proto_tree* c2p_tst_tree = proto_tree_add_subtree(c2p_tree,
2573
8
                                                      tvb,
2574
8
                                                      offset,
2575
8
                                                      -1,
2576
8
                                                      ett_c2p,
2577
8
                                                      NULL,
2578
8
                                                      "Timestamp");
2579
2580
8
    set_tst_proto_item_info(tvb, offset, c2p_tst_tree);
2581
2582
8
    proto_tree_add_item(c2p_tst_tree, hf_c2p_tst_sec_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2583
8
    offset += 4;
2584
8
    proto_tree_add_item(c2p_tst_tree, hf_c2p_tst_msec_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2585
8
    offset += 4;
2586
2587
    /* Set 'Timestamp' length */
2588
8
    proto_item_set_len(c2p_tst_tree, 8);
2589
2590
    /* Dissect the rest depending on type */
2591
8
    tvbuff_t* next_tvb = tvb_new_subset_remaining(tvb, offset);
2592
2593
8
    static const uint8_t C2P_VERSION_0 = 0U;
2594
8
    static const uint8_t C2P_VERSION_1 = 1U;
2595
8
    static const uint8_t C2P_VERSION_2 = 2U;
2596
2597
8
    (void)C2P_VERSION_0;
2598
2599
8
    if(C2P_VERSION_1 == version) {
2600
1
        switch(type) {
2601
0
        case C2P_TYPE_DSRC_RX:
2602
0
            offset += dissect_dsrc_rx(next_tvb, c2p_tree, pinfo);
2603
0
            break;
2604
0
        case C2P_TYPE_DSRC_TX:
2605
0
            offset += dissect_dsrc_tx(next_tvb, c2p_tree, pinfo);
2606
0
            break;
2607
1
        case C2P_TYPE_NAV:
2608
1
            offset += dissect_nav(next_tvb, c2p_tree);
2609
1
            break;
2610
0
        case C2P_TYPE_CV2X_RX:
2611
0
            offset += dissect_cv2x_rx(next_tvb, c2p_tree, pinfo);
2612
0
            break;
2613
0
        case C2P_TYPE_CV2X_TX:
2614
0
            offset += dissect_cv2x_tx(next_tvb, c2p_tree, pinfo);
2615
0
            break;
2616
0
        default:
2617
0
            break;
2618
1
        }
2619
7
    } else if(C2P_VERSION_2 == version) {
2620
7
        switch(type) {
2621
7
        case C2P_TYPE_STI:
2622
7
            offset += dissect_sti(next_tvb, c2p_tree, pinfo);
2623
7
            break;
2624
0
        default:
2625
0
            break;
2626
7
        }
2627
7
    }
2628
2629
    /* Set C2P length */
2630
0
    proto_item_set_len(ti, offset);
2631
2632
0
    return offset;
2633
8
}
2634
2635
void proto_register_c2p(void)
2636
15
{
2637
15
    static hf_register_info header_fields[] = {
2638
15
        {
2639
15
            &hf_c2p_version_desc,
2640
15
            {
2641
15
                "Version",
2642
15
                "c2p.version",
2643
15
                FT_UINT8,
2644
15
                BASE_DEC,
2645
15
                NULL,
2646
15
                0xF0,
2647
15
                NULL,
2648
15
                HFILL
2649
15
            }
2650
15
        },
2651
15
        {
2652
15
            &hf_c2p_type_desc,
2653
15
            {
2654
15
                "Type",
2655
15
                "c2p.type",
2656
15
                FT_UINT8,
2657
15
                BASE_DEC,
2658
15
                VALS(c2p_types),
2659
15
                0x0F,
2660
15
                NULL,
2661
15
                HFILL
2662
15
            }
2663
15
        },
2664
15
        {
2665
15
            &hf_c2p_tst_sec_desc,
2666
15
            {
2667
15
                "Seconds",
2668
15
                "c2p.tst.sec",
2669
15
                FT_UINT32,
2670
15
                BASE_DEC | BASE_UNIT_STRING,
2671
15
                UNS(&units_seconds),
2672
15
                0x00,
2673
15
                NULL,
2674
15
                HFILL
2675
15
            }
2676
15
        },
2677
15
        {
2678
15
            &hf_c2p_tst_msec_desc,
2679
15
            {
2680
15
                "Milliseconds",
2681
15
                "c2p.tst.msec",
2682
15
                FT_UINT32,
2683
15
                BASE_DEC | BASE_UNIT_STRING,
2684
15
                UNS(&units_milliseconds),
2685
15
                0x00,
2686
15
                NULL,
2687
15
                HFILL
2688
15
            }
2689
15
        },
2690
15
        {
2691
15
            &hf_c2p_primary_channel_desc,
2692
15
            {
2693
15
                "Primary channel",
2694
15
                "c2p.primary_channel",
2695
15
                FT_UINT8,
2696
15
                BASE_CUSTOM,
2697
15
                CF_FUNC(channel_format),
2698
15
                0x00,
2699
15
                NULL,
2700
15
                HFILL
2701
15
            }
2702
15
        },
2703
15
        {
2704
15
            &hf_c2p_secondary_channel_desc,
2705
15
            {
2706
15
                "Secondary channel",
2707
15
                "c2p.secondary_channel",
2708
15
                FT_UINT8,
2709
15
                BASE_CUSTOM,
2710
15
                CF_FUNC(channel_format),
2711
15
                0x00,
2712
15
                NULL,
2713
15
                HFILL
2714
15
            }
2715
15
        },
2716
15
        {
2717
15
            &hf_c2p_used_interface_desc,
2718
15
            {
2719
15
                "Used interface",
2720
15
                "c2p.used_interface",
2721
15
                FT_UINT8,
2722
15
                BASE_DEC,
2723
15
                NULL,
2724
15
                0x00,
2725
15
                NULL,
2726
15
                HFILL
2727
15
            }
2728
15
        },
2729
15
        {
2730
15
            &hf_c2p_datarate_desc,
2731
15
            {
2732
15
                "Datarate",
2733
15
                "c2p.datarate",
2734
15
                FT_UINT8,
2735
15
                BASE_CUSTOM,
2736
15
                CF_FUNC(datarate_format),
2737
15
                0x00,
2738
15
                NULL,
2739
15
                HFILL
2740
15
            }
2741
15
        },
2742
15
        {
2743
15
            &hf_c2p_antenna_desc,
2744
15
            {
2745
15
                "Used antenna",
2746
15
                "c2p.used_antenna",
2747
15
                FT_UINT8,
2748
15
                BASE_DEC,
2749
15
                NULL,
2750
15
                0x00,
2751
15
                NULL,
2752
15
                HFILL
2753
15
            }
2754
15
        },
2755
15
        {
2756
15
            &hf_c2p_latitude_desc,
2757
15
            {
2758
15
                "Latitude",
2759
15
                "c2p.latitude",
2760
15
                FT_INT32,
2761
15
                BASE_CUSTOM,
2762
15
                CF_FUNC(latitude_format),
2763
15
                0x00,
2764
15
                NULL,
2765
15
                HFILL
2766
15
            }
2767
15
        },
2768
15
        {
2769
15
            &hf_c2p_longitude_desc,
2770
15
            {
2771
15
                "Longitude",
2772
15
                "c2p.longitude",
2773
15
                FT_INT32,
2774
15
                BASE_CUSTOM,
2775
15
                CF_FUNC(longitude_format),
2776
15
                0x00,
2777
15
                NULL,
2778
15
                HFILL
2779
15
            }
2780
15
        },
2781
15
        {
2782
15
            &hf_c2p_altitude_desc,
2783
15
            {
2784
15
                "Altitude",
2785
15
                "c2p.altitude",
2786
15
                FT_INT32,
2787
15
                BASE_CUSTOM,
2788
15
                CF_FUNC(altitude_format),
2789
15
                0x00,
2790
15
                NULL,
2791
15
                HFILL
2792
15
            }
2793
15
        },
2794
15
        {
2795
15
            &hf_c2p_speed_desc,
2796
15
            {
2797
15
                "Speed",
2798
15
                "c2p.speed",
2799
15
                FT_UINT16,
2800
15
                BASE_CUSTOM,
2801
15
                CF_FUNC(speed_format),
2802
15
                0x00,
2803
15
                NULL,
2804
15
                HFILL
2805
15
            }
2806
15
        },
2807
15
        {
2808
15
            &hf_c2p_heading_desc,
2809
15
            {
2810
15
                "Heading",
2811
15
                "c2p.heading",
2812
15
                FT_UINT16,
2813
15
                BASE_CUSTOM,
2814
15
                CF_FUNC(heading_format),
2815
15
                0x00,
2816
15
                NULL,
2817
15
                HFILL
2818
15
            }
2819
15
        },
2820
15
        {
2821
15
            &hf_c2p_semi_major_conf_desc,
2822
15
            {
2823
15
                "Semi major confidence",
2824
15
                "c2p.semi_major_conf",
2825
15
                FT_UINT16,
2826
15
                BASE_CUSTOM,
2827
15
                CF_FUNC(semi_axis_format),
2828
15
                0x00,
2829
15
                NULL,
2830
15
                HFILL
2831
15
            }
2832
15
        },
2833
15
        {
2834
15
            &hf_c2p_semi_minor_conf_desc,
2835
15
            {
2836
15
                "Semi minor confidence",
2837
15
                "c2p.semi_minor_conf",
2838
15
                FT_UINT16,
2839
15
                BASE_CUSTOM,
2840
15
                CF_FUNC(semi_axis_format),
2841
15
                0x00,
2842
15
                NULL,
2843
15
                HFILL
2844
15
            }
2845
15
        },
2846
15
        {
2847
15
            &hf_c2p_semi_major_ori_desc,
2848
15
            {
2849
15
                "Semi major orientation",
2850
15
                "c2p.semi_major_orientation",
2851
15
                FT_UINT16,
2852
15
                BASE_CUSTOM,
2853
15
                CF_FUNC(heading_format),
2854
15
                0x00,
2855
15
                NULL,
2856
15
                HFILL
2857
15
            }
2858
15
        },
2859
15
        {
2860
15
            &hf_c2p_alttitude_acc_desc,
2861
15
            {
2862
15
                "Altitude accuracy",
2863
15
                "c2p.altitude_accuracy",
2864
15
                FT_UINT16,
2865
15
                BASE_CUSTOM,
2866
15
                CF_FUNC(altitude_acc_format),
2867
15
                0x00,
2868
15
                NULL,
2869
15
                HFILL
2870
15
            }
2871
15
        },
2872
15
        {
2873
15
            &hf_c2p_heading_acc_desc,
2874
15
            {
2875
15
                "Heading accuracy",
2876
15
                "c2p.heading_accuracy",
2877
15
                FT_UINT16,
2878
15
                BASE_CUSTOM,
2879
15
                CF_FUNC(heading_acc_format),
2880
15
                0x00,
2881
15
                NULL,
2882
15
                HFILL
2883
15
            }
2884
15
        },
2885
15
        {
2886
15
            &hf_c2p_speed_acc_desc,
2887
15
            {
2888
15
                "Speed accuracy",
2889
15
                "c2p.speed_accuracy",
2890
15
                FT_UINT16,
2891
15
                BASE_CUSTOM,
2892
15
                CF_FUNC(speed_acc_format),
2893
15
                0x00,
2894
15
                NULL,
2895
15
                HFILL
2896
15
            }
2897
15
        },
2898
15
        {
2899
15
            &hf_c2p_rssi_ant_1_desc,
2900
15
            {
2901
15
                "RSSI on antenna #1",
2902
15
                "c2p.rssi_antenna1",
2903
15
                FT_INT8,
2904
15
                BASE_CUSTOM,
2905
15
                CF_FUNC(power_format),
2906
15
                0x00,
2907
15
                NULL,
2908
15
                HFILL
2909
15
            }
2910
15
        },
2911
15
        {
2912
15
            &hf_c2p_rssi_ant_2_desc,
2913
15
            {
2914
15
                "RSSI on antenna #2",
2915
15
                "c2p.rssi_antenna2",
2916
15
                FT_INT8,
2917
15
                BASE_CUSTOM,
2918
15
                CF_FUNC(power_format),
2919
15
                0x00,
2920
15
                NULL,
2921
15
                HFILL
2922
15
            }
2923
15
        },
2924
15
        {
2925
15
            &hf_c2p_noise_ant_1_desc,
2926
15
            {
2927
15
                "Noise on antenna #1",
2928
15
                "c2p.noise_antenna1",
2929
15
                FT_INT8,
2930
15
                BASE_CUSTOM,
2931
15
                CF_FUNC(power_format),
2932
15
                0x00,
2933
15
                NULL,
2934
15
                HFILL
2935
15
            }
2936
15
        },
2937
15
        {
2938
15
            &hf_c2p_noise_ant_2_desc,
2939
15
            {
2940
15
                "Noise on antenna #2",
2941
15
                "c2p.noise_antenna2",
2942
15
                FT_INT8,
2943
15
                BASE_CUSTOM,
2944
15
                CF_FUNC(power_format),
2945
15
                0x00,
2946
15
                NULL,
2947
15
                HFILL
2948
15
            }
2949
15
        },
2950
15
        {
2951
15
            &hf_c2p_cbr_ant_1_desc,
2952
15
            {
2953
15
                "CBR on antenna #1",
2954
15
                "c2p.cbr_antenna1",
2955
15
                FT_UINT16,
2956
15
                BASE_CUSTOM,
2957
15
                CF_FUNC(cbr_format),
2958
15
                0x00,
2959
15
                NULL,
2960
15
                HFILL
2961
15
            }
2962
15
        },
2963
15
        {
2964
15
            &hf_c2p_cbr_ant_2_desc,
2965
15
            {
2966
15
                "CBR on antenna #2",
2967
15
                "c2p.cbr_antenna2",
2968
15
                FT_UINT16,
2969
15
                BASE_CUSTOM,
2970
15
                CF_FUNC(cbr_format),
2971
15
                0x00,
2972
15
                NULL,
2973
15
                HFILL
2974
15
            }
2975
15
        },
2976
15
        {
2977
15
            &hf_c2p_tx_power_desc,
2978
15
            {
2979
15
                "Transmission power",
2980
15
                "c2p.tx_power",
2981
15
                FT_INT8,
2982
15
                BASE_CUSTOM,
2983
15
                CF_FUNC(power_format),
2984
15
                0x00,
2985
15
                NULL,
2986
15
                HFILL
2987
15
            }
2988
15
        },
2989
15
        {
2990
15
            &hf_c2p_tssi_ant_1_desc,
2991
15
            {
2992
15
                "TSSI on antenna #1",
2993
15
                "c2p.tssi_antenna1",
2994
15
                FT_INT8,
2995
15
                BASE_CUSTOM,
2996
15
                CF_FUNC(power_format),
2997
15
                0x00,
2998
15
                NULL,
2999
15
                HFILL
3000
15
            }
3001
15
        },
3002
15
        {
3003
15
            &hf_c2p_tssi_ant_2_desc,
3004
15
            {
3005
15
                "TSSI on antenna #2",
3006
15
                "c2p.tssi_antenna2",
3007
15
                FT_INT8,
3008
15
                BASE_CUSTOM,
3009
15
                CF_FUNC(power_format),
3010
15
                0x00,
3011
15
                NULL,
3012
15
                HFILL
3013
15
            }
3014
15
        },
3015
15
        {
3016
15
            &hf_c2p_sps_desc,
3017
15
            {
3018
15
                "Is SPS port",
3019
15
                "c2p.cv2x_sps",
3020
15
                FT_BOOLEAN,
3021
15
                BASE_NONE,
3022
15
                NULL,
3023
15
                0x00,
3024
15
                NULL,
3025
15
                HFILL
3026
15
            }
3027
15
        },
3028
15
        {
3029
15
            &hf_c2p_sps_port_desc,
3030
15
            {
3031
15
                "SPS port",
3032
15
                "c2p.cv2x_sps_port",
3033
15
                FT_UINT16,
3034
15
                BASE_DEC,
3035
15
                NULL,
3036
15
                0x00,
3037
15
                NULL,
3038
15
                HFILL
3039
15
            }
3040
15
        },
3041
15
        {
3042
15
            &hf_c2p_event_port_desc,
3043
15
            {
3044
15
                "Event port",
3045
15
                "c2p.cv2x_event_port",
3046
15
                FT_UINT16,
3047
15
                BASE_DEC,
3048
15
                NULL,
3049
15
                0x00,
3050
15
                NULL,
3051
15
                HFILL
3052
15
            }
3053
15
        },
3054
15
        {
3055
15
            &hf_c2p_cv2x_tx_power_desc,
3056
15
            {
3057
15
                "Transmission power",
3058
15
                "c2p.tx_power",
3059
15
                FT_INT32,
3060
15
                BASE_CUSTOM,
3061
15
                CF_FUNC(cv2x_tx_power_format),
3062
15
                0x00,
3063
15
                NULL,
3064
15
                HFILL
3065
15
            }
3066
15
        },
3067
15
        {
3068
15
            &hf_c2p_bw_res_v2xid_desc,
3069
15
            {
3070
15
                "V2X ID",
3071
15
                "c2p.cv2x_id",
3072
15
                FT_INT32,
3073
15
                BASE_DEC,
3074
15
                NULL,
3075
15
                0x00,
3076
15
                NULL,
3077
15
                HFILL
3078
15
            }
3079
15
        },
3080
15
        {
3081
15
            &hf_c2p_bw_res_period_interval_ms_desc,
3082
15
            {
3083
15
                "Bandwidth-reserved periodicity interval",
3084
15
                "c2p.cv2x_bw_res_period_interval",
3085
15
                FT_INT32,
3086
15
                BASE_DEC | BASE_UNIT_STRING,
3087
15
                UNS(&units_seconds),
3088
15
                0x00,
3089
15
                NULL,
3090
15
                HFILL
3091
15
            }
3092
15
        },
3093
15
        {
3094
15
            &hf_c2p_bw_res_tx_reservation_size_bytes_desc,
3095
15
            {
3096
15
                "Tx bandwidth sent bytes",
3097
15
                "c2p.cv2x_bw_res_tx_reservation_size_bytes",
3098
15
                FT_INT32,
3099
15
                BASE_DEC,
3100
15
                NULL,
3101
15
                0x00,
3102
15
                NULL,
3103
15
                HFILL
3104
15
            }
3105
15
        },
3106
15
        {
3107
15
            &hf_c2p_bw_res_tx_priority_desc,
3108
15
            {
3109
15
                "Preserved SPS Tx priority'",
3110
15
                "c2p.cv2x_bw_res_tx_priority",
3111
15
                FT_UINT8,
3112
15
                BASE_DEC,
3113
15
                VALS(priority_format_vals),
3114
15
                0x00,
3115
15
                NULL,
3116
15
                HFILL
3117
15
            }
3118
15
        },
3119
15
        {
3120
15
            &hf_c2p_socket_index_desc,
3121
15
            {
3122
15
                "Socket index",
3123
15
                "c2p.cv2x_socket_index",
3124
15
                FT_UINT8,
3125
15
                BASE_DEC,
3126
15
                NULL,
3127
15
                0x00,
3128
15
                NULL,
3129
15
                HFILL
3130
15
            }
3131
15
        },
3132
15
        {
3133
15
            &hf_c2p_ethertype_desc,
3134
15
            {
3135
15
                "Ethernet header type",
3136
15
                "c2p.cv2x_ethertype",
3137
15
                FT_UINT16,
3138
15
                BASE_HEX,
3139
15
                NULL,
3140
15
                0x00,
3141
15
                NULL,
3142
15
                HFILL
3143
15
            }
3144
15
        },
3145
15
        {
3146
15
            &hf_c2p_rssi_desc,
3147
15
            {
3148
15
                "RSSI",
3149
15
                "c2p.cv2x_rssi",
3150
15
                FT_INT8,
3151
15
                BASE_CUSTOM,
3152
15
                CF_FUNC(power_format),
3153
15
                0x00,
3154
15
                NULL,
3155
15
                HFILL
3156
15
            }
3157
15
        },
3158
15
        {
3159
15
            &hf_c2p_nav_fix_is_valid_desc,
3160
15
            {
3161
15
                "Is valid",
3162
15
                "c2p.nav_fix_is_valid",
3163
15
                FT_BOOLEAN,
3164
15
                BASE_NONE,
3165
15
                NULL,
3166
15
                0x00,
3167
15
                NULL,
3168
15
                HFILL
3169
15
            }
3170
15
        },
3171
15
        {
3172
15
            &hf_c2p_gps_timestamp_desc,
3173
15
            {
3174
15
                "GPS timestamp",
3175
15
                "c2p.gps_timestamp",
3176
15
                FT_UINT64,
3177
15
                BASE_CUSTOM,
3178
15
                CF_FUNC(gps_timestamp_format),
3179
15
                0x00,
3180
15
                NULL,
3181
15
                HFILL
3182
15
            }
3183
15
        },
3184
15
        {
3185
15
            &hf_c2p_sti_length_desc,
3186
15
            {
3187
15
                "Number of STI parameters",
3188
15
                "c2p.sti_length",
3189
15
                FT_UINT32,
3190
15
                BASE_DEC,
3191
15
                NULL,
3192
15
                0x00,
3193
15
                NULL,
3194
15
                HFILL
3195
15
            }
3196
15
        },
3197
15
        {
3198
15
            &hf_c2p_sti_type_desc,
3199
15
            {
3200
15
                "Type",
3201
15
                "c2p.sti_type",
3202
15
                FT_UINT32,
3203
15
                BASE_DEC,
3204
15
                VALS(sti_types),
3205
15
                0x00,
3206
15
                NULL,
3207
15
                HFILL
3208
15
            }
3209
15
        },
3210
15
        {
3211
15
            &hf_c2p_sti_value_angle_desc,
3212
15
            {
3213
15
                "Value",
3214
15
                "c2p.sti_value",
3215
15
                FT_INT64,
3216
15
                BASE_CUSTOM,
3217
15
                CF_FUNC(sti_value_angle_format),
3218
15
                0x00,
3219
15
                NULL,
3220
15
                HFILL
3221
15
            }
3222
15
        },
3223
15
        {
3224
15
            &hf_c2p_sti_value_acceleration_desc,
3225
15
            {
3226
15
                "Value",
3227
15
                "c2p.sti_value",
3228
15
                FT_INT64,
3229
15
                BASE_CUSTOM,
3230
15
                CF_FUNC(sti_value_acceleration_format),
3231
15
                0x00,
3232
15
                NULL,
3233
15
                HFILL
3234
15
            }
3235
15
        },
3236
15
        {
3237
15
            &hf_c2p_sti_value_angular_velocity_desc,
3238
15
            {
3239
15
                "Value",
3240
15
                "c2p.sti_value",
3241
15
                FT_INT64,
3242
15
                BASE_CUSTOM,
3243
15
                CF_FUNC(sti_value_angular_velocity_format),
3244
15
                0x00,
3245
15
                NULL,
3246
15
                HFILL
3247
15
            }
3248
15
        },
3249
15
        {
3250
15
            &hf_c2p_sti_value_thousandths_desc,
3251
15
            {
3252
15
                "Value",
3253
15
                "c2p.sti_value",
3254
15
                FT_INT64,
3255
15
                BASE_CUSTOM,
3256
15
                CF_FUNC(sti_value_thousandths_format),
3257
15
                0x00,
3258
15
                NULL,
3259
15
                HFILL
3260
15
            }
3261
15
        },
3262
15
        {
3263
15
            &hf_c2p_sti_value_length_desc,
3264
15
            {
3265
15
                "Value",
3266
15
                "c2p.sti_value",
3267
15
                FT_INT64,
3268
15
                BASE_CUSTOM,
3269
15
                CF_FUNC(sti_value_length_format),
3270
15
                0x00,
3271
15
                NULL,
3272
15
                HFILL
3273
15
            }
3274
15
        },
3275
15
        {
3276
15
            &hf_c2p_sti_value_mass_desc,
3277
15
            {
3278
15
                "Value",
3279
15
                "c2p.sti_value",
3280
15
                FT_INT64,
3281
15
                BASE_CUSTOM,
3282
15
                CF_FUNC(sti_value_mass_format),
3283
15
                0x00,
3284
15
                NULL,
3285
15
                HFILL
3286
15
            }
3287
15
        },
3288
15
        {
3289
15
            &hf_c2p_sti_value_rain_rate_desc,
3290
15
            {
3291
15
                "Value",
3292
15
                "c2p.sti_value",
3293
15
                FT_INT64,
3294
15
                BASE_CUSTOM,
3295
15
                CF_FUNC(sti_value_rain_rate_format),
3296
15
                0x00,
3297
15
                NULL,
3298
15
                HFILL
3299
15
            }
3300
15
        },
3301
15
        {
3302
15
            &hf_c2p_sti_value_solar_irradiance_desc,
3303
15
            {
3304
15
                "Value",
3305
15
                "c2p.sti_value",
3306
15
                FT_INT64,
3307
15
                BASE_CUSTOM,
3308
15
                CF_FUNC(sti_value_solar_irradiance_format),
3309
15
                0x00,
3310
15
                NULL,
3311
15
                HFILL
3312
15
            }
3313
15
        },
3314
15
        {
3315
15
            &hf_c2p_sti_value_temperature_desc,
3316
15
            {
3317
15
                "Value",
3318
15
                "c2p.sti_value",
3319
15
                FT_INT64,
3320
15
                BASE_CUSTOM,
3321
15
                CF_FUNC(sti_value_temperature_format),
3322
15
                0x00,
3323
15
                NULL,
3324
15
                HFILL
3325
15
            }
3326
15
        },
3327
15
        {
3328
15
            &hf_c2p_sti_value_pressure_desc,
3329
15
            {
3330
15
                "Value",
3331
15
                "c2p.sti_value",
3332
15
                FT_INT64,
3333
15
                BASE_CUSTOM,
3334
15
                CF_FUNC(sti_value_pressure_format),
3335
15
                0x00,
3336
15
                NULL,
3337
15
                HFILL
3338
15
            }
3339
15
        },
3340
15
        {
3341
15
            &hf_c2p_sti_value_sweep_rate_desc,
3342
15
            {
3343
15
                "Value",
3344
15
                "c2p.sti_value",
3345
15
                FT_INT64,
3346
15
                BASE_CUSTOM,
3347
15
                CF_FUNC(sti_value_sweep_rate_format),
3348
15
                0x00,
3349
15
                NULL,
3350
15
                HFILL
3351
15
            }
3352
15
        },
3353
15
        {
3354
15
            &hf_c2p_sti_value_integer_desc,
3355
15
            {
3356
15
                "Value",
3357
15
                "c2p.sti_value",
3358
15
                FT_INT64,
3359
15
                BASE_CUSTOM,
3360
15
                CF_FUNC(sti_value_integer_format),
3361
15
                0x00,
3362
15
                NULL,
3363
15
                HFILL
3364
15
            }
3365
15
        },
3366
15
        {
3367
15
            &hf_c2p_sti_value_transmission_state_desc,
3368
15
            {
3369
15
                "Value",
3370
15
                "c2p.sti_value",
3371
15
                FT_INT64,
3372
15
                BASE_DEC|BASE_VAL64_STRING,
3373
15
                VALS64(sti_transmission_state_types),
3374
15
                0x00,
3375
15
                NULL,
3376
15
                HFILL
3377
15
            }
3378
15
        },
3379
15
        {
3380
15
            &hf_c2p_sti_value_aux_breaks_desc,
3381
15
            {
3382
15
                "Value",
3383
15
                "c2p.sti_value",
3384
15
                FT_INT64,
3385
15
                BASE_DEC|BASE_VAL64_STRING,
3386
15
                VALS64(sti_aux_breaks_types),
3387
15
                0x00,
3388
15
                NULL,
3389
15
                HFILL
3390
15
            }
3391
15
        },
3392
15
        {
3393
15
            &hf_c2p_sti_value_vehicle_length_conf_desc,
3394
15
            {
3395
15
                "Value",
3396
15
                "c2p.sti_value",
3397
15
                FT_INT64,
3398
15
                BASE_DEC|BASE_VAL64_STRING,
3399
15
                VALS64(sti_vehicle_length_conf_types),
3400
15
                0x00,
3401
15
                NULL,
3402
15
                HFILL
3403
15
            }
3404
15
        },
3405
15
        {
3406
15
            &hf_c2p_sti_value_dangerous_goods_desc,
3407
15
            {
3408
15
                "Value",
3409
15
                "c2p.sti_value",
3410
15
                FT_INT64,
3411
15
                BASE_DEC|BASE_VAL64_STRING,
3412
15
                VALS64(sti_dangerous_goods_types),
3413
15
                0x00,
3414
15
                NULL,
3415
15
                HFILL
3416
15
            }
3417
15
        },
3418
15
        {
3419
15
            &hf_c2p_sti_value_station_type_desc,
3420
15
            {
3421
15
                "Value",
3422
15
                "c2p.sti_value",
3423
15
                FT_INT64,
3424
15
                BASE_DEC|BASE_VAL64_STRING,
3425
15
                VALS64(sti_station_type_types),
3426
15
                0x00,
3427
15
                NULL,
3428
15
                HFILL
3429
15
            }
3430
15
        },
3431
15
        {
3432
15
            &hf_c2p_sti_value_vehicle_role_desc,
3433
15
            {
3434
15
                "Value",
3435
15
                "c2p.sti_value",
3436
15
                FT_INT64,
3437
15
                BASE_DEC|BASE_VAL64_STRING,
3438
15
                VALS64(sti_vehicle_role_types),
3439
15
                0x00,
3440
15
                NULL,
3441
15
                HFILL
3442
15
            }
3443
15
        },
3444
15
        {
3445
15
            &hf_c2p_sti_value_weather_precip_situation_desc,
3446
15
            {
3447
15
                "Value",
3448
15
                "c2p.sti_value",
3449
15
                FT_INT64,
3450
15
                BASE_DEC|BASE_VAL64_STRING,
3451
15
                VALS64(sti_weather_precip_situation_types),
3452
15
                0x00,
3453
15
                NULL,
3454
15
                HFILL
3455
15
            }
3456
15
        },
3457
15
        {
3458
15
            &hf_c2p_sti_value_wiper_state_desc,
3459
15
            {
3460
15
                "Value",
3461
15
                "c2p.sti_value",
3462
15
                FT_INT64,
3463
15
                BASE_DEC|BASE_VAL64_STRING,
3464
15
                VALS64(sti_wiper_state_types),
3465
15
                0x00,
3466
15
                NULL,
3467
15
                HFILL
3468
15
            }
3469
15
        },
3470
15
        {
3471
15
            &hf_c2p_sti_value_door_state_desc,
3472
15
            {
3473
15
                "Value",
3474
15
                "c2p.sti_value",
3475
15
                FT_INT64,
3476
15
                BASE_DEC|BASE_VAL64_STRING,
3477
15
                VALS64(sti_door_state_types),
3478
15
                0x00,
3479
15
                NULL,
3480
15
                HFILL
3481
15
            }
3482
15
        },
3483
15
        {
3484
15
            &hf_c2p_sti_value_fuel_type_desc,
3485
15
            {
3486
15
                "Value",
3487
15
                "c2p.sti_value",
3488
15
                FT_INT64,
3489
15
                BASE_DEC|BASE_VAL64_STRING,
3490
15
                VALS64(sti_fuel_type_types),
3491
15
                0x00,
3492
15
                NULL,
3493
15
                HFILL
3494
15
            }
3495
15
        },
3496
15
        {
3497
15
            &hf_c2p_sti_value_road_class_desc,
3498
15
            {
3499
15
                "Value",
3500
15
                "c2p.sti_value",
3501
15
                FT_INT64,
3502
15
                BASE_DEC|BASE_VAL64_STRING,
3503
15
                VALS64(sti_road_class_types),
3504
15
                0x00,
3505
15
                NULL,
3506
15
                HFILL
3507
15
            }
3508
15
        },
3509
15
        {
3510
15
            &hf_c2p_sti_value_road_rule_desc,
3511
15
            {
3512
15
                "Value",
3513
15
                "c2p.sti_value",
3514
15
                FT_INT64,
3515
15
                BASE_DEC|BASE_VAL64_STRING,
3516
15
                VALS64(sti_road_rule_types),
3517
15
                0x00,
3518
15
                NULL,
3519
15
                HFILL
3520
15
            }
3521
15
        },
3522
15
        {
3523
15
            &hf_c2p_sti_value_area_type_desc,
3524
15
            {
3525
15
                "Value",
3526
15
                "c2p.sti_value",
3527
15
                FT_INT64,
3528
15
                BASE_DEC|BASE_VAL64_STRING,
3529
15
                VALS64(sti_area_type_types),
3530
15
                0x00,
3531
15
                NULL,
3532
15
                HFILL
3533
15
            }
3534
15
        },
3535
15
        {
3536
15
            &hf_c2p_sti_value_belt_buckle_status_desc,
3537
15
            {
3538
15
                "Value",
3539
15
                "c2p.sti_value",
3540
15
                FT_INT64,
3541
15
                BASE_DEC|BASE_VAL64_STRING,
3542
15
                VALS64(sti_belt_buckle_status_types),
3543
15
                0x00,
3544
15
                NULL,
3545
15
                HFILL
3546
15
            }
3547
15
        },
3548
15
        {
3549
15
            &hf_c2p_sti_value_transmission_type_desc,
3550
15
            {
3551
15
                "Value",
3552
15
                "c2p.sti_value",
3553
15
                FT_INT64,
3554
15
                BASE_DEC|BASE_VAL64_STRING,
3555
15
                VALS64(sti_transmission_type_types),
3556
15
                0x00,
3557
15
                NULL,
3558
15
                HFILL
3559
15
            }
3560
15
        },
3561
15
        {
3562
15
            &hf_c2p_sti_value_physical_road_separation_desc,
3563
15
            {
3564
15
                "Value",
3565
15
                "c2p.sti_value",
3566
15
                FT_INT64,
3567
15
                BASE_DEC|BASE_VAL64_STRING,
3568
15
                VALS64(sti_physical_road_separation_types),
3569
15
                0x00,
3570
15
                NULL,
3571
15
                HFILL
3572
15
            }
3573
15
        },
3574
15
        {
3575
15
            &hf_c2p_sti_value_siren_desc,
3576
15
            {
3577
15
                "Value",
3578
15
                "c2p.sti_value",
3579
15
                FT_INT64,
3580
15
                BASE_DEC|BASE_VAL64_STRING,
3581
15
                VALS64(sti_siren_types),
3582
15
                0x00,
3583
15
                NULL,
3584
15
                HFILL
3585
15
            }
3586
15
        },
3587
15
        {
3588
15
            &hf_c2p_sti_value_lightbar_desc,
3589
15
            {
3590
15
                "Value",
3591
15
                "c2p.sti_value",
3592
15
                FT_INT64,
3593
15
                BASE_DEC|BASE_VAL64_STRING,
3594
15
                VALS64(sti_lightbar_types),
3595
15
                0x00,
3596
15
                NULL,
3597
15
                HFILL
3598
15
            }
3599
15
        },
3600
15
        {
3601
15
            &hf_c2p_sti_value_lane_position_desc,
3602
15
            {
3603
15
                "Value",
3604
15
                "c2p.sti_value",
3605
15
                FT_INT64,
3606
15
                BASE_DEC|BASE_VAL64_STRING,
3607
15
                VALS64(sti_lane_position_types),
3608
15
                0x00,
3609
15
                NULL,
3610
15
                HFILL
3611
15
            }
3612
15
        },
3613
15
        {
3614
15
            &hf_c2p_sti_value_state_desc,
3615
15
            {
3616
15
                "Value",
3617
15
                "c2p.sti_value",
3618
15
                FT_INT64,
3619
15
                BASE_DEC|BASE_VAL64_STRING,
3620
15
                VALS64(sti_state_types),
3621
15
                0x00,
3622
15
                NULL,
3623
15
                HFILL
3624
15
            }
3625
15
        },
3626
15
        {
3627
15
            &hf_c2p_sti_value_tristate_desc,
3628
15
            {
3629
15
                "Value",
3630
15
                "c2p.sti_value",
3631
15
                FT_INT64,
3632
15
                BASE_DEC|BASE_VAL64_STRING,
3633
15
                VALS64(sti_tristate_types),
3634
15
                0x00,
3635
15
                NULL,
3636
15
                HFILL
3637
15
            }
3638
15
        },
3639
15
    };
3640
3641
15
    int* ett[] = {
3642
15
        &ett_c2p
3643
15
    };
3644
3645
15
    static const char* const C2P_PROTOCOL_NAME = "C2P (Commsignia Capture Protocol)";
3646
15
    static const char* const C2P_PROTOCOL_SHORT_NAME = "C2P";
3647
15
    static const char* const C2P_FILTER_NAME = "c2p";
3648
3649
15
    proto_desc = proto_register_protocol(C2P_PROTOCOL_NAME,
3650
15
                                         C2P_PROTOCOL_SHORT_NAME,
3651
15
                                         C2P_FILTER_NAME);
3652
3653
15
    proto_register_field_array(proto_desc, header_fields, array_length(header_fields));
3654
15
    proto_register_subtree_array(ett, array_length(ett));
3655
15
}
3656
3657
void proto_reg_handoff_c2p(void)
3658
15
{
3659
15
    dissector_handle_t c2p_handle = NULL;
3660
3661
15
    c2p_handle = create_dissector_handle(dissect_c2p, proto_desc);
3662
3663
15
    ieee80211_handle = find_dissector_add_dependency("wlan", proto_desc);
3664
3665
15
    static const uint32_t C2P_PORT = 7943UL;
3666
15
    static const char* const UDP_PORT_NAME = "udp.port";
3667
3668
15
    dissector_add_uint(UDP_PORT_NAME, C2P_PORT, c2p_handle);
3669
15
}
3670