c-its-parser 2.1.0

Tools for encoding and decoding ETSI messages (GN + Transport + CAM/DENM/IVIM/SSEM/SREM/MAPEM/SPATEM)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
#[allow(
    non_camel_case_types,
    non_snake_case,
    non_upper_case_globals,
    unused,
    clippy::too_many_arguments
)]
pub mod cam_pdu_descriptions {
    extern crate alloc;
    use core::borrow::Borrow;

    use rasn::prelude::*;

    use super::super::cdd_1_3_1_1::its_container::{
        AccelerationControl,
        CauseCode,
        CenDsrcTollingZone,
        ClosedLanes,
        Curvature,
        CurvatureCalculationMode,
        DangerousGoodsBasic,
        DriveDirection,
        EmbarkationStatus,
        EmergencyPriority,
        ExteriorLights,
        Heading,
        ItsPduHeader,
        LanePosition,
        LateralAcceleration,
        Latitude,
        LightBarSirenInUse,
        Longitude,
        LongitudinalAcceleration,
        PathHistory,
        PerformanceClass,
        ProtectedCommunicationZone,
        ProtectedCommunicationZonesRSU,
        PtActivation,
        ReferencePosition,
        RoadworksSubCauseCode,
        SpecialTransportType,
        Speed,
        SpeedLimit,
        StationType,
        SteeringWheelAngle,
        TrafficRule,
        VehicleLength,
        VehicleRole,
        VehicleWidth,
        VerticalAcceleration,
        YawRate,
    };
    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
    #[rasn(automatic_tags)]
    #[non_exhaustive]
    pub struct BasicContainer {
        #[rasn(identifier = "stationType")]
        pub station_type: StationType,
        #[rasn(identifier = "referencePosition")]
        pub reference_position: ReferencePosition,
    }
    impl BasicContainer {
        pub fn new(station_type: StationType, reference_position: ReferencePosition) -> Self {
            Self {
                station_type,
                reference_position,
            }
        }
    }
    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
    #[rasn(automatic_tags)]
    pub struct BasicVehicleContainerHighFrequency {
        pub heading: Heading,
        pub speed: Speed,
        #[rasn(identifier = "driveDirection")]
        pub drive_direction: DriveDirection,
        #[rasn(identifier = "vehicleLength")]
        pub vehicle_length: VehicleLength,
        #[rasn(identifier = "vehicleWidth")]
        pub vehicle_width: VehicleWidth,
        #[rasn(identifier = "longitudinalAcceleration")]
        pub longitudinal_acceleration: LongitudinalAcceleration,
        pub curvature: Curvature,
        #[rasn(identifier = "curvatureCalculationMode")]
        pub curvature_calculation_mode: CurvatureCalculationMode,
        #[rasn(identifier = "yawRate")]
        pub yaw_rate: YawRate,
        #[rasn(identifier = "accelerationControl")]
        pub acceleration_control: Option<AccelerationControl>,
        #[rasn(identifier = "lanePosition")]
        pub lane_position: Option<LanePosition>,
        #[rasn(identifier = "steeringWheelAngle")]
        pub steering_wheel_angle: Option<SteeringWheelAngle>,
        #[rasn(identifier = "lateralAcceleration")]
        pub lateral_acceleration: Option<LateralAcceleration>,
        #[rasn(identifier = "verticalAcceleration")]
        pub vertical_acceleration: Option<VerticalAcceleration>,
        #[rasn(identifier = "performanceClass")]
        pub performance_class: Option<PerformanceClass>,
        #[rasn(identifier = "cenDsrcTollingZone")]
        pub cen_dsrc_tolling_zone: Option<CenDsrcTollingZone>,
    }
    impl BasicVehicleContainerHighFrequency {
        pub fn new(
            heading: Heading,
            speed: Speed,
            drive_direction: DriveDirection,
            vehicle_length: VehicleLength,
            vehicle_width: VehicleWidth,
            longitudinal_acceleration: LongitudinalAcceleration,
            curvature: Curvature,
            curvature_calculation_mode: CurvatureCalculationMode,
            yaw_rate: YawRate,
            acceleration_control: Option<AccelerationControl>,
            lane_position: Option<LanePosition>,
            steering_wheel_angle: Option<SteeringWheelAngle>,
            lateral_acceleration: Option<LateralAcceleration>,
            vertical_acceleration: Option<VerticalAcceleration>,
            performance_class: Option<PerformanceClass>,
            cen_dsrc_tolling_zone: Option<CenDsrcTollingZone>,
        ) -> Self {
            Self {
                heading,
                speed,
                drive_direction,
                vehicle_length,
                vehicle_width,
                longitudinal_acceleration,
                curvature,
                curvature_calculation_mode,
                yaw_rate,
                acceleration_control,
                lane_position,
                steering_wheel_angle,
                lateral_acceleration,
                vertical_acceleration,
                performance_class,
                cen_dsrc_tolling_zone,
            }
        }
    }
    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
    #[rasn(automatic_tags)]
    pub struct BasicVehicleContainerLowFrequency {
        #[rasn(identifier = "vehicleRole")]
        pub vehicle_role: VehicleRole,
        #[rasn(identifier = "exteriorLights")]
        pub exterior_lights: ExteriorLights,
        #[rasn(identifier = "pathHistory")]
        pub path_history: PathHistory,
    }
    impl BasicVehicleContainerLowFrequency {
        pub fn new(
            vehicle_role: VehicleRole,
            exterior_lights: ExteriorLights,
            path_history: PathHistory,
        ) -> Self {
            Self {
                vehicle_role,
                exterior_lights,
                path_history,
            }
        }
    }
    #[doc = "\tThe root data frame for cooperative awareness messages"]
    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
    #[rasn(automatic_tags)]
    pub struct CAM {
        pub header: ItsPduHeader,
        pub cam: CoopAwareness,
    }
    impl CAM {
        pub fn new(header: ItsPduHeader, cam: CoopAwareness) -> Self {
            Self { header, cam }
        }
    }
    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
    #[rasn(automatic_tags)]
    #[non_exhaustive]
    pub struct CamParameters {
        #[rasn(identifier = "basicContainer")]
        pub basic_container: BasicContainer,
        #[rasn(identifier = "highFrequencyContainer")]
        pub high_frequency_container: HighFrequencyContainer,
        #[rasn(identifier = "lowFrequencyContainer")]
        pub low_frequency_container: Option<LowFrequencyContainer>,
        #[rasn(identifier = "specialVehicleContainer")]
        pub special_vehicle_container: Option<SpecialVehicleContainer>,
    }
    impl CamParameters {
        pub fn new(
            basic_container: BasicContainer,
            high_frequency_container: HighFrequencyContainer,
            low_frequency_container: Option<LowFrequencyContainer>,
            special_vehicle_container: Option<SpecialVehicleContainer>,
        ) -> Self {
            Self {
                basic_container,
                high_frequency_container,
                low_frequency_container,
                special_vehicle_container,
            }
        }
    }
    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
    #[rasn(automatic_tags)]
    pub struct CoopAwareness {
        #[rasn(identifier = "generationDeltaTime")]
        pub generation_delta_time: GenerationDeltaTime,
        #[rasn(identifier = "camParameters")]
        pub cam_parameters: CamParameters,
    }
    impl CoopAwareness {
        pub fn new(
            generation_delta_time: GenerationDeltaTime,
            cam_parameters: CamParameters,
        ) -> Self {
            Self {
                generation_delta_time,
                cam_parameters,
            }
        }
    }
    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
    #[rasn(automatic_tags)]
    pub struct DangerousGoodsContainer {
        #[rasn(identifier = "dangerousGoodsBasic")]
        pub dangerous_goods_basic: DangerousGoodsBasic,
    }
    impl DangerousGoodsContainer {
        pub fn new(dangerous_goods_basic: DangerousGoodsBasic) -> Self {
            Self {
                dangerous_goods_basic,
            }
        }
    }
    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
    #[rasn(automatic_tags)]
    pub struct EmergencyContainer {
        #[rasn(identifier = "lightBarSirenInUse")]
        pub light_bar_siren_in_use: LightBarSirenInUse,
        #[rasn(identifier = "incidentIndication")]
        pub incident_indication: Option<CauseCode>,
        #[rasn(identifier = "emergencyPriority")]
        pub emergency_priority: Option<EmergencyPriority>,
    }
    impl EmergencyContainer {
        pub fn new(
            light_bar_siren_in_use: LightBarSirenInUse,
            incident_indication: Option<CauseCode>,
            emergency_priority: Option<EmergencyPriority>,
        ) -> Self {
            Self {
                light_bar_siren_in_use,
                incident_indication,
                emergency_priority,
            }
        }
    }
    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
    #[rasn(delegate, value("0..=65535"))]
    pub struct GenerationDeltaTime(pub u16);
    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
    #[rasn(choice, automatic_tags)]
    #[non_exhaustive]
    pub enum HighFrequencyContainer {
        basicVehicleContainerHighFrequency(BasicVehicleContainerHighFrequency),
        rsuContainerHighFrequency(RSUContainerHighFrequency),
    }
    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
    #[rasn(choice, automatic_tags)]
    #[non_exhaustive]
    pub enum LowFrequencyContainer {
        basicVehicleContainerLowFrequency(BasicVehicleContainerLowFrequency),
    }
    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
    #[rasn(automatic_tags)]
    pub struct PublicTransportContainer {
        #[rasn(identifier = "embarkationStatus")]
        pub embarkation_status: EmbarkationStatus,
        #[rasn(identifier = "ptActivation")]
        pub pt_activation: Option<PtActivation>,
    }
    impl PublicTransportContainer {
        pub fn new(
            embarkation_status: EmbarkationStatus,
            pt_activation: Option<PtActivation>,
        ) -> Self {
            Self {
                embarkation_status,
                pt_activation,
            }
        }
    }
    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
    #[rasn(automatic_tags)]
    #[non_exhaustive]
    pub struct RSUContainerHighFrequency {
        #[rasn(identifier = "protectedCommunicationZonesRSU")]
        pub protected_communication_zones_rsu: Option<ProtectedCommunicationZonesRSU>,
    }
    impl RSUContainerHighFrequency {
        pub fn new(
            protected_communication_zones_rsu: Option<ProtectedCommunicationZonesRSU>,
        ) -> Self {
            Self {
                protected_communication_zones_rsu,
            }
        }
    }
    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
    #[rasn(automatic_tags)]
    pub struct RescueContainer {
        #[rasn(identifier = "lightBarSirenInUse")]
        pub light_bar_siren_in_use: LightBarSirenInUse,
    }
    impl RescueContainer {
        pub fn new(light_bar_siren_in_use: LightBarSirenInUse) -> Self {
            Self {
                light_bar_siren_in_use,
            }
        }
    }
    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
    #[rasn(automatic_tags)]
    pub struct RoadWorksContainerBasic {
        #[rasn(identifier = "roadworksSubCauseCode")]
        pub roadworks_sub_cause_code: Option<RoadworksSubCauseCode>,
        #[rasn(identifier = "lightBarSirenInUse")]
        pub light_bar_siren_in_use: LightBarSirenInUse,
        #[rasn(identifier = "closedLanes")]
        pub closed_lanes: Option<ClosedLanes>,
    }
    impl RoadWorksContainerBasic {
        pub fn new(
            roadworks_sub_cause_code: Option<RoadworksSubCauseCode>,
            light_bar_siren_in_use: LightBarSirenInUse,
            closed_lanes: Option<ClosedLanes>,
        ) -> Self {
            Self {
                roadworks_sub_cause_code,
                light_bar_siren_in_use,
                closed_lanes,
            }
        }
    }
    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
    #[rasn(automatic_tags)]
    pub struct SafetyCarContainer {
        #[rasn(identifier = "lightBarSirenInUse")]
        pub light_bar_siren_in_use: LightBarSirenInUse,
        #[rasn(identifier = "incidentIndication")]
        pub incident_indication: Option<CauseCode>,
        #[rasn(identifier = "trafficRule")]
        pub traffic_rule: Option<TrafficRule>,
        #[rasn(identifier = "speedLimit")]
        pub speed_limit: Option<SpeedLimit>,
    }
    impl SafetyCarContainer {
        pub fn new(
            light_bar_siren_in_use: LightBarSirenInUse,
            incident_indication: Option<CauseCode>,
            traffic_rule: Option<TrafficRule>,
            speed_limit: Option<SpeedLimit>,
        ) -> Self {
            Self {
                light_bar_siren_in_use,
                incident_indication,
                traffic_rule,
                speed_limit,
            }
        }
    }
    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
    #[rasn(automatic_tags)]
    pub struct SpecialTransportContainer {
        #[rasn(identifier = "specialTransportType")]
        pub special_transport_type: SpecialTransportType,
        #[rasn(identifier = "lightBarSirenInUse")]
        pub light_bar_siren_in_use: LightBarSirenInUse,
    }
    impl SpecialTransportContainer {
        pub fn new(
            special_transport_type: SpecialTransportType,
            light_bar_siren_in_use: LightBarSirenInUse,
        ) -> Self {
            Self {
                special_transport_type,
                light_bar_siren_in_use,
            }
        }
    }
    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
    #[rasn(choice, automatic_tags)]
    #[non_exhaustive]
    pub enum SpecialVehicleContainer {
        publicTransportContainer(PublicTransportContainer),
        specialTransportContainer(SpecialTransportContainer),
        dangerousGoodsContainer(DangerousGoodsContainer),
        roadWorksContainerBasic(RoadWorksContainerBasic),
        rescueContainer(RescueContainer),
        emergencyContainer(EmergencyContainer),
        safetyCarContainer(SafetyCarContainer),
    }
}