├── .gitignore
├── README.md
├── pom.xml
├── src
├── test
│ └── java
│ │ └── net
│ │ └── gcdc
│ │ └── camdenm
│ │ ├── UperEncoderDecodeTest.java
│ │ ├── ICLCMTest.java
│ │ └── CoopItsTest.java
└── main
│ └── java
│ └── net
│ └── gcdc
│ └── camdenm
│ └── Iclcm.java
└── LICENSE.txt
/.gitignore:
--------------------------------------------------------------------------------
1 | # Eclipse
2 | .settings
3 | .project
4 | .classpath
5 |
6 | # IDEA
7 | .idea/
8 | *.iml
9 |
10 | # Build tool
11 | target
12 | project/target
13 | project/project/target
14 | bin/
15 |
16 | # OS generated files
17 | .DS_Store
18 | .DS_Store?
19 | ._*
20 | .Spotlight-V100
21 | .Trashes
22 | ehthumbs.db
23 | Thumbs.db
24 |
25 | doc/img/stack.aux
26 |
27 | doc/img/stack.log
28 |
29 | doc/img/stack.pdf
30 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CAM and DENM
2 |
3 | Basic Java classes to represent Cooperative Awareness Message (CAM, [ETSI EN 302 637-2](http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=37126)) and Decentralized Environment Notification Message (DENM, [ETSI EN 302 637-3](http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=37127)). CAM and DENM are built on top of Common Data Dictionary (CDD, [ETSI TS 102 894-2](http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=43353)). Classes are annoted with [asn1-datatypes](https://github.com/alexvoronov/gcdc-asn1), so that [asn1-uper](https://github.com/alexvoronov/gcdc-asn1) can pack the objects.
4 |
5 | ### Status
6 |
7 | CAM and DENM are complete (except for the getter methods). Usage examples for CAM and DENM are in [uppertester](https://github.com/alexvoronov/gn-uppertester).
8 |
9 |
10 | ### Acknowledgements
11 | This implementation was partly developed within [i-GAME](http://gcdc.net/i-game) project that has received funding from the European Union's Seventh Framework Programme for research, technological development and demonstration under grant agreement no [612035](http://cordis.europa.eu/project/rcn/110506_en.html).
12 |
13 |
14 | ### License
15 |
16 | This code is released under Apache 2.0 license.
17 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
151 | PosPillar ::= INTEGER {tenCentimeters(1), unavailable(30)} (1..30)
152 | PositionOfPillars ::= SEQUENCE (SIZE(1..3, ...)) OF PosPillar
153 | * GCDC
32 | *
33 | *
34 | * This implementation was partly developed within i-GAME project that has received funding from the
35 | * European Union's Seventh Framework Programme for research, technological development and demonstration
36 | * under grant agreement no 612035.
37 | *
38 | */
39 | public final class Iclcm {
40 | /**
41 | * MessageID of i-GAME cooperative lane change message
42 | */
43 | public static final int MessageID_iCLCM = 10;
44 | private Iclcm(){}
45 |
46 | @Sequence
47 | public static class IgameCooperativeLaneChangeMessage {
48 | ItsPduHeader header;
49 | IgameCooperativeLaneChangeMessageBody iclm;
50 |
51 | public IgameCooperativeLaneChangeMessage(ItsPduHeader itsPduHeader, IgameCooperativeLaneChangeMessageBody iclm) {
52 | this.header = itsPduHeader;
53 | this.iclm = iclm;
54 | }
55 |
56 | public IgameCooperativeLaneChangeMessage() {
57 | this(
58 | new ItsPduHeader(new ProtocolVersion(1),new MessageId(MessageID_iCLCM),new StationID()),
59 | new IgameCooperativeLaneChangeMessageBody()
60 | );
61 | }
62 |
63 | @Override public String toString() { return "IgameCooperativeLaneChangeMessage(" + header + ", " + iclm + ")"; }
64 |
65 | public ItsPduHeader getHeader() {
66 | return header;
67 | }
68 |
69 | public IgameCooperativeLaneChangeMessageBody getIclm() {
70 | return iclm;
71 | }
72 | }
73 | @Sequence
74 | public static class IgameCooperativeLaneChangeMessageBody {
75 | GenerationDeltaTime generationDeltaTime;
76 | IclmParameters iclmParameters;
77 |
78 | public IgameCooperativeLaneChangeMessageBody(GenerationDeltaTime generationDeltaTime,IclmParameters iclmParameters){
79 | this.generationDeltaTime = generationDeltaTime;
80 | this.iclmParameters = iclmParameters;
81 | }
82 | public IgameCooperativeLaneChangeMessageBody(){
83 | this(new GenerationDeltaTime(),new IclmParameters());
84 | }
85 | @Override public String toString() { return "IgameCooperativeLaneChangeMessageBody(" + generationDeltaTime + ", " + iclmParameters + ")"; }
86 | public GenerationDeltaTime getGenerationDeltaTime() {
87 | return generationDeltaTime;
88 | }
89 | public IclmParameters getIclmParameters() {
90 | return iclmParameters;
91 | }
92 | }
93 | @Sequence
94 | public static class IclmParameters {
95 | VehicleContainerHighFrequency vehicleContainerHighFrequency;
96 | @Asn1Optional VehicleContainerLowFrequency lowFrequencyContainer;
97 | MostImportantObjectContainer mostImportantObjectContainer;
98 | LaneObject laneObject;
99 | PairIdObject pairIdObject;
100 | MergeObject mergeObject;
101 | ScenarioObject scenarioObject;
102 |
103 | public IclmParameters(VehicleContainerHighFrequency vehicleContainerHighFrequency,
104 | VehicleContainerLowFrequency lowFrequencyContainer,
105 | MostImportantObjectContainer mostImportantObjectContainer,
106 | LaneObject laneObject,
107 | PairIdObject pairIdObject,
108 | MergeObject mergeObject,
109 | ScenarioObject scenarioObject){
110 | this.vehicleContainerHighFrequency=vehicleContainerHighFrequency;
111 | this.lowFrequencyContainer=lowFrequencyContainer;
112 | this.mostImportantObjectContainer=mostImportantObjectContainer;
113 | this.laneObject=laneObject;
114 | this.pairIdObject=pairIdObject;
115 | this.mergeObject=mergeObject;
116 | this.scenarioObject=scenarioObject;
117 | }
118 | public IclmParameters(){
119 | this(new VehicleContainerHighFrequency(),null,
120 | new MostImportantObjectContainer(),new LaneObject(),new PairIdObject(),
121 | new MergeObject(),new ScenarioObject());
122 | }
123 | @Override public String toString() { return "IclmParameters(" + vehicleContainerHighFrequency + ", "
124 | + lowFrequencyContainer + ", " + mostImportantObjectContainer + ", " + laneObject + ", "
125 | + pairIdObject + ", " + mergeObject + ", " + scenarioObject + ")"; }
126 | public VehicleContainerHighFrequency getVehicleContainerHighFrequency() {
127 | return vehicleContainerHighFrequency;
128 | }
129 | public boolean hasLowFrequencyContainer() {
130 | return lowFrequencyContainer != null;
131 | }
132 | public VehicleContainerLowFrequency getLowFrequencyContainer() {
133 | return lowFrequencyContainer;
134 | }
135 | public MostImportantObjectContainer getMostImportantObjectContainer() {
136 | return mostImportantObjectContainer;
137 | }
138 | public LaneObject getLaneObject() {
139 | return laneObject;
140 | }
141 | public PairIdObject getPairIdObject() {
142 | return pairIdObject;
143 | }
144 | public MergeObject getMergeObject() {
145 | return mergeObject;
146 | }
147 | public ScenarioObject getScenarioObject() {
148 | return scenarioObject;
149 | }
150 | }
151 | @Sequence
152 | public static class VehicleContainerHighFrequency{
153 | VehicleRearAxleLocation vehicleRearAxleLocation;
154 | ControllerType controllerType;
155 | VehicleResponseTime vehicleResponseTime;
156 | TargetLongitudonalAcceleration targetLongitudinalAcceleration;
157 | TimeHeadway timeHeadway;
158 | CruiseSpeed cruisespeed;
159 |
160 | public VehicleContainerHighFrequency(){
161 | this(new VehicleRearAxleLocation(),new ControllerType(),
162 | new VehicleResponseTime(), new TargetLongitudonalAcceleration(), new TimeHeadway(), new CruiseSpeed());
163 | }
164 |
165 | public VehicleContainerHighFrequency(VehicleRearAxleLocation vehicleRearAxleLocation,ControllerType controllerType,
166 | VehicleResponseTime vehicleResponseTime,TargetLongitudonalAcceleration targetLongitudinalAcceleration,
167 | TimeHeadway timeHeadway,CruiseSpeed cruisespeed){
168 | this.vehicleRearAxleLocation = vehicleRearAxleLocation;
169 | this.controllerType = controllerType;
170 | this.vehicleResponseTime = vehicleResponseTime;
171 | this.targetLongitudinalAcceleration = targetLongitudinalAcceleration;
172 | this.timeHeadway = timeHeadway;
173 | this.cruisespeed = cruisespeed;
174 | }
175 |
176 | @Override public String toString() { return "VehicleContainerHighFrequency(" + vehicleRearAxleLocation + ", "
177 | + controllerType + ", " + vehicleResponseTime + ", " + targetLongitudinalAcceleration + ", "
178 | + timeHeadway + ", " + cruisespeed + ")"; }
179 |
180 | public VehicleRearAxleLocation getVehicleRearAxleLocation() {
181 | return vehicleRearAxleLocation;
182 | }
183 |
184 | public ControllerType getControllerType() {
185 | return controllerType;
186 | }
187 |
188 | public VehicleResponseTime getVehicleResponseTime() {
189 | return vehicleResponseTime;
190 | }
191 |
192 | public TargetLongitudonalAcceleration getTargetLongitudinalAcceleration() {
193 | return targetLongitudinalAcceleration;
194 | }
195 |
196 | public TimeHeadway getTimeHeadway() {
197 | return timeHeadway;
198 | }
199 |
200 | public CruiseSpeed getCruisespeed() {
201 | return cruisespeed;
202 | }
203 | }
204 | @Sequence
205 | public static class VehicleContainerLowFrequency{
206 | @Asn1Optional ParticipantsReady participantsReady;
207 | @Asn1Optional StartPlatoon startPlatoon;
208 | @Asn1Optional EndOfScenario endOfScenario;
209 | public VehicleContainerLowFrequency(){}//Fully optional
210 | public VehicleContainerLowFrequency(ParticipantsReady participantsReady){this.participantsReady = participantsReady;}
211 | public VehicleContainerLowFrequency(StartPlatoon startPlatoon){this.startPlatoon = startPlatoon;}
212 | public VehicleContainerLowFrequency(EndOfScenario endOfScenario){this.endOfScenario = endOfScenario;}
213 |
214 | @Override public String toString() { return "VehicleContainerLowFrequency("
215 | +" participantsReady= "+(participantsReady!= null? participantsReady : "null")
216 | +", startPlatoon= "+(startPlatoon!= null? startPlatoon : "null")
217 | +", endOfScenario= "+(endOfScenario!= null? endOfScenario : "null")
218 | +")";};
219 |
220 | public static Builder builder() { return new Builder(); }
221 |
222 | public static class Builder{
223 | private VehicleContainerLowFrequency val = new VehicleContainerLowFrequency();
224 | private boolean created = false;
225 | private void checkCreated() {
226 | if (created) { throw new IllegalStateException("Already created"); }
227 | }
228 | public VehicleContainerLowFrequency create() { created = true; return val; }
229 |
230 | public Builder participantsReady(ParticipantsReady participantsReady) { checkCreated(); val.participantsReady = participantsReady; return this; }
231 | public Builder startPlatoon(StartPlatoon startPlatoon) { checkCreated(); val.startPlatoon = startPlatoon; return this; }
232 | public Builder endOfScenario(EndOfScenario endOfScenario) { checkCreated(); val.endOfScenario = endOfScenario; return this; }
233 | }
234 |
235 | public boolean hasParticipantsReady(){
236 | return participantsReady!=null;
237 | }
238 | public ParticipantsReady getParticipantsReady() {
239 | return participantsReady;
240 | }
241 | public boolean hasStartPlatoon(){
242 | return startPlatoon!=null;
243 | }
244 | public StartPlatoon getStartPlatoon() {
245 | return startPlatoon;
246 | }
247 | public boolean hasEndOfScenario(){
248 | return endOfScenario!=null;
249 | }
250 | public EndOfScenario getEndOfScenario() {
251 | return endOfScenario;
252 | }
253 | }
254 | @Sequence
255 | public static class MostImportantObjectContainer{
256 | StationID mioID;
257 | MioRange mioRange;
258 | MioBearing mioBearing;
259 | MioRangeRate mioRangeRate;
260 | public MostImportantObjectContainer(){this( new StationID(), new MioRange(), new MioBearing(), new MioRangeRate() );}
261 | public MostImportantObjectContainer(StationID mioID,MioRange mioRange,MioBearing mioBearing,MioRangeRate mioRangeRate){
262 | this.mioID = mioID;
263 | this.mioRange = mioRange;
264 | this.mioBearing = mioBearing;
265 | this.mioRangeRate = mioRangeRate;
266 | }
267 | public StationID getMioID() {
268 | return mioID;
269 | }
270 | public MioRange getMioRange() {
271 | return mioRange;
272 | }
273 | public MioBearing getMioBearing() {
274 | return mioBearing;
275 | }
276 | public MioRangeRate getMioRangeRate() {
277 | return mioRangeRate;
278 | }
279 |
280 | @Override public String toString() { return "MostImportantObjectContainer(" + mioID + ", " + mioRange + ", " + mioBearing + ", " +mioRangeRate + ")"; }
281 | }
282 | @Sequence
283 | public static class LaneObject{
284 | Lane lane;
285 | public LaneObject(){this(new Lane());}
286 | public LaneObject(Lane lane){this.lane = lane;}
287 | public Lane getLane() {
288 | return lane;
289 | }
290 | @Override public String toString() { return "LaneObject(" + lane + ")"; }
291 | }
292 |
293 | @Sequence
294 | public static class PairIdObject{
295 | StationID forwardID;
296 | StationID backwardID;
297 | AcknowledgeFlag acknowledgeFlag;
298 | public PairIdObject(){this(new StationID(),new StationID(), new AcknowledgeFlag());}
299 | public PairIdObject(StationID forwardID, StationID backwardID, AcknowledgeFlag acknowledgeFlag){
300 | this.forwardID = forwardID;
301 | this.backwardID = backwardID;
302 | this.acknowledgeFlag = acknowledgeFlag;
303 | }
304 | public StationID getForwardID() {
305 | return forwardID;
306 | }
307 | public StationID getBackwardID() {
308 | return backwardID;
309 | }
310 | public AcknowledgeFlag getAcknowledgeFlag() {
311 | return acknowledgeFlag;
312 | }
313 |
314 | @Override public String toString() { return "PairIdObject(" + forwardID +", "+backwardID+", "+acknowledgeFlag+ ")"; }
315 | }
316 |
317 | @Sequence
318 | public static class MergeObject{
319 | MergeRequest mergeRequest;
320 | MergeSafeToMerge mergeSafeToMerge;
321 | MergeFlag mergeFlag;
322 | MergeFlagTail mergeFlagTail;
323 | MergeFlagHead mergeFlagHead;
324 |
325 | public MergeObject(){this(new MergeRequest(),new MergeSafeToMerge(),new MergeFlag(),new MergeFlagTail(),new MergeFlagHead());}
326 | public MergeObject(MergeRequest mergeRequest,MergeSafeToMerge mergeSafeToMerge,MergeFlag mergeFlag,MergeFlagTail mergeFlagTail,MergeFlagHead mergeFlagHead){
327 | this.mergeRequest = mergeRequest;
328 | this.mergeSafeToMerge = mergeSafeToMerge;
329 | this.mergeFlag = mergeFlag;
330 | this.mergeFlagTail = mergeFlagTail;
331 | this.mergeFlagHead = mergeFlagHead;
332 | }
333 | public MergeRequest getMergeRequest() {
334 | return mergeRequest;
335 | }
336 | public MergeSafeToMerge getMergeSafeToMerge() {
337 | return mergeSafeToMerge;
338 | }
339 | public MergeFlag getMergeFlag() {
340 | return mergeFlag;
341 | }
342 | public MergeFlagTail getMergeFlagTail() {
343 | return mergeFlagTail;
344 | }
345 | public MergeFlagHead getMergeFlagHead() {
346 | return mergeFlagHead;
347 | }
348 | @Override public String toString() { return "MergeObject(" + mergeRequest +", "+mergeSafeToMerge+", "+mergeFlag+ ", "+mergeFlagTail+", "+mergeFlagHead+ ")"; }
349 |
350 | }
351 | @Sequence
352 | public static class ScenarioObject{
353 | PlatoonID platoonID;
354 | DistanceTravelledCZ distanceTravelledCZ;
355 | Intention intention;
356 | Counter counterIntersection;
357 |
358 | public ScenarioObject(){this(new PlatoonID(), new DistanceTravelledCZ(), new Intention(), new Counter());}
359 | public ScenarioObject(PlatoonID platoonID,DistanceTravelledCZ distanceTravelledCZ,Intention intention,Counter counterIntersection){
360 | this.platoonID = platoonID;
361 | this.distanceTravelledCZ = distanceTravelledCZ;
362 | this.intention = intention;
363 | this.counterIntersection = counterIntersection;
364 | }
365 | public PlatoonID getPlatoonID() {
366 | return platoonID;
367 | }
368 | public DistanceTravelledCZ getDistanceTravelledCZ() {
369 | return distanceTravelledCZ;
370 | }
371 | public Intention getIntention() {
372 | return intention;
373 | }
374 | public Counter getCounterIntersection() {
375 | return counterIntersection;
376 | }
377 | @Override public String toString() { return "ScenarioObject(" + platoonID +", "+distanceTravelledCZ+", "+intention+ ", "+counterIntersection+ ")"; }
378 | }
379 |
380 | @Sequence
381 | public static class VehicleResponseTime{
382 | VehicleResponseTimeConstant vehicleResponseTimeConstant;
383 | VehicleResponseTimeDelay vehicleResponseTimeDelay;
384 | public VehicleResponseTime(){this(new VehicleResponseTimeConstant(),new VehicleResponseTimeDelay());}
385 | public VehicleResponseTime(VehicleResponseTimeConstant vehicleResponseTimeConstant,VehicleResponseTimeDelay vehicleResponseTimeDelay ){
386 | this.vehicleResponseTimeConstant = vehicleResponseTimeConstant;
387 | this.vehicleResponseTimeDelay = vehicleResponseTimeDelay;
388 | }
389 | public VehicleResponseTimeConstant getVehicleResponseTimeConstant() {
390 | return vehicleResponseTimeConstant;
391 | }
392 | public VehicleResponseTimeDelay getVehicleResponseTimeDelay() {
393 | return vehicleResponseTimeDelay;
394 | }
395 | @Override public String toString() { return "VehicleResponseTime(" + vehicleResponseTimeConstant +", "+vehicleResponseTimeDelay+")"; }
396 | }
397 |
398 | @IntRange(minValue = 0, maxValue = 4095)
399 | public static class VehicleRearAxleLocation extends Asn1Integer {
400 | public static final int oneMeter = 100;
401 |
402 | public VehicleRearAxleLocation() { this(0); }
403 | public VehicleRearAxleLocation(int value) { super(value); }
404 | }
405 |
406 | @IntRange(minValue = 0, maxValue = 3)
407 | public static class ControllerType extends Asn1Integer {
408 | public static final int manual = 0;
409 | public static final int cc = 1;
410 | public static final int acc = 2;
411 | public static final int cacc = 3;
412 |
413 | public ControllerType() { this(manual); }
414 | public ControllerType(int value) { super(value); }
415 |
416 | @Override public String toString() {
417 | switch((int)value){
418 | case manual: return "manual";
419 | case cc: return "cc";
420 | case acc: return "acc";
421 | case cacc: return "cacc";
422 | default: return "Unkown";
423 | }
424 | }
425 | }
426 |
427 | @IntRange(minValue = 0, maxValue = 1001)
428 | public static class VehicleResponseTimeConstant extends Asn1Integer {
429 | public static final int oneSecond = 100;
430 | public static final int unavailable = 1001;
431 |
432 | public VehicleResponseTimeConstant() { this(unavailable); }
433 | public VehicleResponseTimeConstant(int value) { super(value); }
434 | }
435 |
436 | @IntRange(minValue = 0, maxValue = 1001)
437 | public static class VehicleResponseTimeDelay extends Asn1Integer {
438 | public static final int oneSecond = 100;
439 | public static final int unavailable = 1001;
440 |
441 | public VehicleResponseTimeDelay() { this(unavailable); }
442 | public VehicleResponseTimeDelay(int value) { super(value); }
443 | }
444 |
445 | @IntRange(minValue = -1000, maxValue = 1001)
446 | public static class TargetLongitudonalAcceleration extends Asn1Integer {
447 | public static final int oneMeterPerSecondSquared = 100;
448 | public static final int unavailable = 1001;
449 |
450 | public TargetLongitudonalAcceleration() { this(unavailable); }
451 | public TargetLongitudonalAcceleration(int value) { super(value); }
452 | }
453 |
454 | @IntRange(minValue = 0, maxValue = 65535)
455 | public static class MioRange extends Asn1Integer {
456 | public static final int oneMeter = 100;
457 | public static final int unavailable = 65535;
458 |
459 | public MioRange() { this(unavailable); }
460 | public MioRange(int value) { super(value); }
461 | }
462 |
463 | @IntRange(minValue = -1571, maxValue = 1572)
464 | public static class MioBearing extends Asn1Integer {
465 | public static final int zeroRadians = 0;
466 | public static final int oneRadianRight = 500;
467 | public static final int unavailable = 1572;
468 |
469 | public MioBearing() { this(unavailable); }
470 | public MioBearing(int value) { super(value); }
471 | }
472 |
473 | @IntRange(minValue = -32767, maxValue = 32767)
474 | public static class MioRangeRate extends Asn1Integer {
475 | public static final int zeroMeterPerSecond = 0;
476 | public static final int oneMeterPerSecond = 100;
477 | public static final int unavailable = 32767;
478 |
479 | public MioRangeRate() { this(unavailable); }
480 | public MioRangeRate(int value) { super(value); }
481 | }
482 |
483 | @IntRange(minValue = 0, maxValue = 361)
484 | public static class TimeHeadway extends Asn1Integer {
485 | public static final int oneSecond = 10;
486 | public static final int unavailable = 361;
487 |
488 | public TimeHeadway() { this(unavailable); }
489 | public TimeHeadway(int value) { super(value); }
490 | }
491 |
492 | @IntRange(minValue = 0, maxValue = 5001)
493 | public static class CruiseSpeed extends Asn1Integer {
494 | public static final int oneMeterPerSecond = 100;
495 | public static final int unavailable = 5001;
496 |
497 | public CruiseSpeed() { this(unavailable); }
498 | public CruiseSpeed(int value) { super(value); }
499 | }
500 |
501 | @IntRange(minValue = 0, maxValue = 1)
502 | public static class MergeRequest extends Asn1Integer {
503 | public static final int noMergeRequest = 0;
504 | public static final int mergeRequest = 1;
505 |
506 | public MergeRequest() { this(noMergeRequest); }
507 | public MergeRequest(int value) { super(value); }
508 | @Override public String toString(){ return value==noMergeRequest?"MergeRequest(no)":"MergeRequest(yes)";}
509 | }
510 |
511 | @IntRange(minValue = 0, maxValue = 1)
512 | public static class MergeSafeToMerge extends Asn1Integer {
513 | public static final int notSafe = 0;
514 | public static final int safe = 1;
515 |
516 | public MergeSafeToMerge() { this(notSafe); }
517 | public MergeSafeToMerge(int value) { super(value); }
518 |
519 | @Override public String toString(){ return value==notSafe?"MergeSafeToMerge(not safe)":"MergeSafeToMerge(safe)";}
520 | }
521 |
522 | @IntRange(minValue = 0, maxValue = 1)
523 | public static class MergeFlag extends Asn1Integer {
524 | public static final int notMergeReady = 0;
525 | public static final int mergeReady = 1;
526 |
527 | public MergeFlag() { this(notMergeReady); }
528 | public MergeFlag(int value) { super(value); }
529 | }
530 |
531 | @IntRange(minValue = 0, maxValue = 1)
532 | public static class MergeFlagTail extends Asn1Integer {
533 | public static final int notLastVehicle = 0;
534 | public static final int lastVehicle = 1;
535 |
536 | public MergeFlagTail() { this(notLastVehicle); }
537 | public MergeFlagTail(int value) { super(value); }
538 | }
539 |
540 | @IntRange(minValue = 0, maxValue = 1)
541 | public static class MergeFlagHead extends Asn1Integer {
542 | public static final int notFirstVehicle = 0;
543 | public static final int firstVehicle = 1;
544 |
545 | public MergeFlagHead() { this(notFirstVehicle); }
546 | public MergeFlagHead(int value) { super(value); }
547 | }
548 |
549 | @IntRange(minValue = 0, maxValue = 255)
550 | public static class PlatoonID extends Asn1Integer {
551 | public static final int platoonA = 1;
552 | public static final int platoonB = 2;
553 | public static final int notUsed = 3;
554 |
555 | public PlatoonID() { this(notUsed); }
556 | public PlatoonID(int value) { super(value); }
557 | }
558 |
559 | @IntRange(minValue = 0, maxValue = 10000)
560 | public static class DistanceTravelledCZ extends Asn1Integer {
561 | public static final int oneMeter = 10;
562 |
563 | public DistanceTravelledCZ() { this(0); }
564 | public DistanceTravelledCZ(int value) { super(value); }
565 | }
566 |
567 | @IntRange(minValue = 1, maxValue = 3)
568 | public static class Intention extends Asn1Integer {
569 | public static final int straightNoTurning = 1;
570 | public static final int turnLeft = 2;
571 | public static final int turnRight = 3;
572 |
573 | public Intention() { this(straightNoTurning); }
574 | public Intention(int value) { super(value); }
575 | }
576 |
577 | @IntRange(minValue = 1, maxValue = 4)
578 | public static class Lane extends Asn1Integer {
579 | public static final int laneOne = 1;
580 | public static final int laneTwo = 2;
581 | public static final int laneThree = 3;
582 | public static final int unavailable = 4;
583 |
584 | public Lane() { this(unavailable); }
585 | public Lane(int value) { super(value); }
586 | }
587 |
588 | @IntRange(minValue = 0, maxValue = 3)
589 | public static class Counter extends Asn1Integer {
590 | public static final int noVehicles = 0;
591 | public static final int oneVehicle = 1;
592 |
593 | public Counter() { this(noVehicles); }
594 | public Counter(int value) { super(value); }
595 | }
596 |
597 | @IntRange(minValue = 0, maxValue = 1)
598 | public static class AcknowledgeFlag extends Asn1Integer {
599 | public static final int acknowledged = 1;
600 | public static final int notAcknowledged = 0;
601 |
602 | public AcknowledgeFlag() { this(notAcknowledged); }
603 | public AcknowledgeFlag(int value) { super(value); }
604 | }
605 |
606 | @IntRange(minValue = 0, maxValue = 1)
607 | public static class ParticipantsReady extends Asn1Integer {
608 | public static final int notReady = 0;
609 | public static final int ready =1;
610 |
611 | public ParticipantsReady() { this(notReady); }
612 | public ParticipantsReady(int value) { super(value); }
613 | }
614 |
615 | @IntRange(minValue = 0, maxValue = 1)
616 | public static class StartPlatoon extends Asn1Integer {
617 | public static final int startPlatoonAAtSpeed80kph = 0;
618 | public static final int startPlatoonBAtSpeed60kph = 1;
619 |
620 | public StartPlatoon() { this(startPlatoonAAtSpeed80kph); }
621 | public StartPlatoon(int value) { super(value); }
622 | }
623 |
624 | @IntRange(minValue = 1, maxValue = 1)
625 | public static class EndOfScenario extends Asn1Integer {
626 | public static final int endOfScenario = 1;
627 |
628 | public EndOfScenario() { this(endOfScenario); }
629 | public EndOfScenario(int value) { super(value); }
630 | }
631 |
632 | }
633 |
634 |
--------------------------------------------------------------------------------
/src/test/java/net/gcdc/camdenm/CoopItsTest.java:
--------------------------------------------------------------------------------
1 | package net.gcdc.camdenm;
2 |
3 | import static org.junit.Assert.assertArrayEquals;
4 | import static org.junit.Assert.assertEquals;
5 | import static org.junit.Assert.fail;
6 |
7 | import java.util.Arrays;
8 |
9 | import net.gcdc.asn1.uper.UperEncoder;
10 | import net.gcdc.camdenm.CoopIts;
11 | import net.gcdc.camdenm.CoopIts.AccelerationControl;
12 | import net.gcdc.camdenm.CoopIts.ActionID;
13 | import net.gcdc.camdenm.CoopIts.AlacarteContainer;
14 | import net.gcdc.camdenm.CoopIts.Altitude;
15 | import net.gcdc.camdenm.CoopIts.AltitudeConfidence;
16 | import net.gcdc.camdenm.CoopIts.AltitudeValue;
17 | import net.gcdc.camdenm.CoopIts.BasicContainer;
18 | import net.gcdc.camdenm.CoopIts.BasicVehicleContainerHighFrequency;
19 | import net.gcdc.camdenm.CoopIts.BasicVehicleContainerLowFrequency;
20 | import net.gcdc.camdenm.CoopIts.CamParameters;
21 | import net.gcdc.camdenm.CoopIts.CauseCode;
22 | import net.gcdc.camdenm.CoopIts.CauseCodeType;
23 | import net.gcdc.camdenm.CoopIts.ClosedLanes;
24 | import net.gcdc.camdenm.CoopIts.CoopAwareness;
25 | import net.gcdc.camdenm.CoopIts.DangerousGoodsBasic;
26 | import net.gcdc.camdenm.CoopIts.DangerousGoodsExtended;
27 | import net.gcdc.camdenm.CoopIts.DecentralizedEnvironmentalNotificationMessage;
28 | import net.gcdc.camdenm.CoopIts.DeltaAltitude;
29 | import net.gcdc.camdenm.CoopIts.DeltaLatitude;
30 | import net.gcdc.camdenm.CoopIts.DeltaLongitude;
31 | import net.gcdc.camdenm.CoopIts.DeltaReferencePosition;
32 | import net.gcdc.camdenm.CoopIts.DrivingLaneStatus;
33 | import net.gcdc.camdenm.CoopIts.EnergyStorageType;
34 | import net.gcdc.camdenm.CoopIts.EventHistory;
35 | import net.gcdc.camdenm.CoopIts.EventPoint;
36 | import net.gcdc.camdenm.CoopIts.ExteriorLights;
37 | import net.gcdc.camdenm.CoopIts.HardShoulderStatus;
38 | import net.gcdc.camdenm.CoopIts.Heading;
39 | import net.gcdc.camdenm.CoopIts.HeadingConfidence;
40 | import net.gcdc.camdenm.CoopIts.HeadingValue;
41 | import net.gcdc.camdenm.CoopIts.HeightLonCarr;
42 | import net.gcdc.camdenm.CoopIts.HighFrequencyContainer;
43 | import net.gcdc.camdenm.CoopIts.ImpactReductionContainer;
44 | import net.gcdc.camdenm.CoopIts.InformationQuality;
45 | import net.gcdc.camdenm.CoopIts.ItineraryPath;
46 | import net.gcdc.camdenm.CoopIts.ItsPduHeader;
47 | import net.gcdc.camdenm.CoopIts.ItsPduHeader.MessageId;
48 | import net.gcdc.camdenm.CoopIts.LanePosition;
49 | import net.gcdc.camdenm.CoopIts.Latitude;
50 | import net.gcdc.camdenm.CoopIts.LightBarSirenInUse;
51 | import net.gcdc.camdenm.CoopIts.LocationContainer;
52 | import net.gcdc.camdenm.CoopIts.Longitude;
53 | import net.gcdc.camdenm.CoopIts.LowFrequencyContainer;
54 | import net.gcdc.camdenm.CoopIts.ManagementContainer;
55 | import net.gcdc.camdenm.CoopIts.NumberOfOccupants;
56 | import net.gcdc.camdenm.CoopIts.PathDeltaTime;
57 | import net.gcdc.camdenm.CoopIts.PathHistory;
58 | import net.gcdc.camdenm.CoopIts.PathPoint;
59 | import net.gcdc.camdenm.CoopIts.PosCentMass;
60 | import net.gcdc.camdenm.CoopIts.PosConfidenceEllipse;
61 | import net.gcdc.camdenm.CoopIts.PosFrontAx;
62 | import net.gcdc.camdenm.CoopIts.PosLonCarr;
63 | import net.gcdc.camdenm.CoopIts.PosPillar;
64 | import net.gcdc.camdenm.CoopIts.PositionOfOccupants;
65 | import net.gcdc.camdenm.CoopIts.PositionOfPillars;
66 | import net.gcdc.camdenm.CoopIts.PositioningSolutionType;
67 | import net.gcdc.camdenm.CoopIts.PtActivation;
68 | import net.gcdc.camdenm.CoopIts.PtActivationData;
69 | import net.gcdc.camdenm.CoopIts.PtActivationType;
70 | import net.gcdc.camdenm.CoopIts.PublicTransportContainer;
71 | import net.gcdc.camdenm.CoopIts.ReferenceDenms;
72 | import net.gcdc.camdenm.CoopIts.ReferencePosition;
73 | import net.gcdc.camdenm.CoopIts.RelevanceDistance;
74 | import net.gcdc.camdenm.CoopIts.RelevanceTrafficDirection;
75 | import net.gcdc.camdenm.CoopIts.RequestResponseIndication;
76 | import net.gcdc.camdenm.CoopIts.RestrictedTypes;
77 | import net.gcdc.camdenm.CoopIts.RoadType;
78 | import net.gcdc.camdenm.CoopIts.RoadWorksContainerBasic;
79 | import net.gcdc.camdenm.CoopIts.RoadWorksContainerExtended;
80 | import net.gcdc.camdenm.CoopIts.SemiAxisLength;
81 | import net.gcdc.camdenm.CoopIts.SequenceNumber;
82 | import net.gcdc.camdenm.CoopIts.SituationContainer;
83 | import net.gcdc.camdenm.CoopIts.SpecialVehicleContainer;
84 | import net.gcdc.camdenm.CoopIts.Speed;
85 | import net.gcdc.camdenm.CoopIts.SpeedConfidence;
86 | import net.gcdc.camdenm.CoopIts.SpeedLimit;
87 | import net.gcdc.camdenm.CoopIts.SpeedValue;
88 | import net.gcdc.camdenm.CoopIts.StationID;
89 | import net.gcdc.camdenm.CoopIts.StationType;
90 | import net.gcdc.camdenm.CoopIts.StationarySince;
91 | import net.gcdc.camdenm.CoopIts.StationaryVehicleContainer;
92 | import net.gcdc.camdenm.CoopIts.SubCauseCodeType;
93 | import net.gcdc.camdenm.CoopIts.Temperature;
94 | import net.gcdc.camdenm.CoopIts.Termination;
95 | import net.gcdc.camdenm.CoopIts.TimestampIts;
96 | import net.gcdc.camdenm.CoopIts.Traces;
97 | import net.gcdc.camdenm.CoopIts.TrafficRule;
98 | import net.gcdc.camdenm.CoopIts.TransmissionInterval;
99 | import net.gcdc.camdenm.CoopIts.TurningRadius;
100 | import net.gcdc.camdenm.CoopIts.VDS;
101 | import net.gcdc.camdenm.CoopIts.ValidityDuration;
102 | import net.gcdc.camdenm.CoopIts.VehicleIdentification;
103 | import net.gcdc.camdenm.CoopIts.VehicleMass;
104 | import net.gcdc.camdenm.CoopIts.VehicleRole;
105 | import net.gcdc.camdenm.CoopIts.WMInumber;
106 | import net.gcdc.camdenm.CoopIts.WheelBaseVehicle;
107 |
108 | import org.junit.Test;
109 | import org.slf4j.Logger;
110 | import org.slf4j.LoggerFactory;
111 |
112 | public class CoopItsTest {
113 | private final static Logger logger = LoggerFactory.getLogger(UperEncoder.class);
114 |
115 | @Test public void test() {
116 | //List