Skip to content

Commit

Permalink
Updated BSM-related POJOs to address field renamings in J2735 2024
Browse files Browse the repository at this point in the history
Signed-off-by: dmccoystephenson <dmccoystephenson@gmail.com>
  • Loading branch information
dmccoystephenson committed Jan 19, 2025
1 parent 6839a93 commit 3428ed1
Show file tree
Hide file tree
Showing 21 changed files with 175 additions and 352 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,64 +15,19 @@
******************************************************************************/
package us.dot.its.jpo.ode.plugin.j2735;

import lombok.Data;
import lombok.EqualsAndHashCode;
import us.dot.its.jpo.ode.plugin.asn1.Asn1Object;

@EqualsAndHashCode(callSuper = true)
@Data
public class J2735EmergencyDetails extends Asn1Object {
private static final long serialVersionUID = 1L;

private Integer sspRights;
private Integer doNotUse;
private J2735PrivilegedEvents events;
private J2735LightbarInUse lightsUse;
private J2735MultiVehicleResponse multi;
private J2735ResponseType responseType;
private J2735SirenInUse sirenUse;

public Integer getSspRights() {
return sspRights;
}

public void setSspRights(Integer sspRights) {
this.sspRights = sspRights;
}

public J2735PrivilegedEvents getEvents() {
return events;
}

public void setEvents(J2735PrivilegedEvents events) {
this.events = events;
}

public J2735LightbarInUse getLightsUse() {
return lightsUse;
}

public void setLightsUse(J2735LightbarInUse lightsUse) {
this.lightsUse = lightsUse;
}

public J2735MultiVehicleResponse getMulti() {
return multi;
}

public void setMulti(J2735MultiVehicleResponse multi) {
this.multi = multi;
}

public J2735ResponseType getResponseType() {
return responseType;
}

public void setResponseType(J2735ResponseType responseType) {
this.responseType = responseType;
}

public J2735SirenInUse getSirenUse() {
return sirenUse;
}

public void setSirenUse(J2735SirenInUse sirenUse) {
this.sirenUse = sirenUse;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,15 @@
******************************************************************************/
package us.dot.its.jpo.ode.plugin.j2735;

import lombok.Data;
import lombok.EqualsAndHashCode;
import us.dot.its.jpo.ode.plugin.asn1.Asn1Object;

@EqualsAndHashCode(callSuper = true)
@Data
public class J2735PrivilegedEvents extends Asn1Object {

private static final long serialVersionUID = 1L;

private J2735BitString event;
private Integer sspRights;

public J2735BitString getEvent() {
return event;
}

public void setEvent(J2735BitString event) {
this.event = event;
}

public Integer getSspRights() {
return sspRights;
}

public void setSspRights(Integer sspRights) {
this.sspRights = sspRights;
}

private Integer doNotUse;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,15 @@
******************************************************************************/
package us.dot.its.jpo.ode.plugin.j2735;

import lombok.Data;
import lombok.EqualsAndHashCode;

@EqualsAndHashCode(callSuper = true)
@Data
public class J2735SpecialVehicleExtensions extends J2735BsmPart2ExtensionBase {
private static final long serialVersionUID = 1L;

private J2735EmergencyDetails vehicleAlerts;
private J2735EventDescription description;
private J2735TrailerData trailers;

public J2735EmergencyDetails getVehicleAlerts() {
return vehicleAlerts;
}

public void setVehicleAlerts(J2735EmergencyDetails vehicleAlerts) {
this.vehicleAlerts = vehicleAlerts;
}

public J2735EventDescription getDescription() {
return description;
}

public void setDescription(J2735EventDescription description) {
this.description = description;
}

public J2735TrailerData getTrailers() {
return trailers;
}

public void setTrailers(J2735TrailerData trailers) {
this.trailers = trailers;
}

private J2735TrailerData doNotUse;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public class J2735SupplementalVehicleExtensions extends J2735BsmPart2ExtensionBa
private Integer classification;
private J2735VehicleClassification classDetails;
private J2735VehicleData vehicleData;
private J2735WeatherReport weatherReport;
private J2735WeatherProbe weatherProbe;
private J2735ObstacleDetection obstacle;
private J2735WeatherReport doNotUse1;
private J2735WeatherProbe doNotUse2;
private J2735ObstacleDetection doNotUse3;
private J2735DisabledVehicle status;
private J2735SpeedProfile speedProfile;
private J2735RTCMPackage theRTCM;
private J2735SpeedProfile doNotUse4;
private J2735RTCMPackage doNotUse5;

public Integer getClassification() {
return classification;
Expand All @@ -52,28 +52,28 @@ public void setVehicleData(J2735VehicleData vehicleData) {
this.vehicleData = vehicleData;
}

public J2735WeatherReport getWeatherReport() {
return weatherReport;
public J2735WeatherReport getDoNotUse1() {
return doNotUse1;
}

public void setWeatherReport(J2735WeatherReport weatherReport) {
this.weatherReport = weatherReport;
public void setDoNotUse1(J2735WeatherReport doNotUse1) {
this.doNotUse1 = doNotUse1;
}

public J2735WeatherProbe getWeatherProbe() {
return weatherProbe;
public J2735WeatherProbe getDoNotUse2() {
return doNotUse2;
}

public void setWeatherProbe(J2735WeatherProbe weatherProbe) {
this.weatherProbe = weatherProbe;
public void setDoNotUse2(J2735WeatherProbe doNotUse2) {
this.doNotUse2 = doNotUse2;
}

public J2735ObstacleDetection getObstacle() {
return obstacle;
public J2735ObstacleDetection getDoNotUse3() {
return doNotUse3;
}

public void setObstacle(J2735ObstacleDetection obstacle) {
this.obstacle = obstacle;
public void setDoNotUse3(J2735ObstacleDetection doNotUse3) {
this.doNotUse3 = doNotUse3;
}

public J2735DisabledVehicle getStatus() {
Expand All @@ -84,20 +84,20 @@ public void setStatus(J2735DisabledVehicle status) {
this.status = status;
}

public J2735SpeedProfile getSpeedProfile() {
return speedProfile;
public J2735SpeedProfile getDoNotUse4() {
return doNotUse4;
}

public void setSpeedProfile(J2735SpeedProfile speedProfile) {
this.speedProfile = speedProfile;
public void setDoNotUse4(J2735SpeedProfile doNotUse4) {
this.doNotUse4 = doNotUse4;
}

public J2735RTCMPackage getTheRTCM() {
return theRTCM;
public J2735RTCMPackage getDoNotUse5() {
return doNotUse5;
}

public void setTheRTCM(J2735RTCMPackage theRTCM) {
this.theRTCM = theRTCM;
public void setDoNotUse5(J2735RTCMPackage doNotUse5) {
this.doNotUse5 = doNotUse5;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,16 @@

import java.util.ArrayList;
import java.util.List;

import lombok.Data;
import lombok.EqualsAndHashCode;
import us.dot.its.jpo.ode.plugin.asn1.Asn1Object;

@EqualsAndHashCode(callSuper = true)
@Data
public class J2735TrailerData extends Asn1Object {
private static final long serialVersionUID = 1L;

private J2735PivotPointDescription connection;
private Integer sspRights;
private Integer doNotUse;
private List<J2735TrailerUnitDescription> units = new ArrayList<>();

public J2735PivotPointDescription getConnection() {
return connection;
}

public void setConnection(J2735PivotPointDescription connection) {
this.connection = connection;
}

public Integer getSspRights() {
return sspRights;
}

public void setSspRights(Integer sspRights) {
this.sspRights = sspRights;
}

public List<J2735TrailerUnitDescription> getUnits() {
return units;
}

public void setUnits(List<J2735TrailerUnitDescription> units) {
this.units = units;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,44 +17,15 @@

import java.io.Serializable;
import java.math.BigDecimal;
import lombok.Data;
import lombok.EqualsAndHashCode;

@EqualsAndHashCode()
@Data
public class J2735VehicleData implements Serializable{
private static final long serialVersionUID = 1L;
private J2735BumperHeights bumpers;
private BigDecimal height;
private Integer mass;
private Integer trailerWeight;

public J2735BumperHeights getBumpers() {
return bumpers;
}

public void setBumpers(J2735BumperHeights bumpers) {
this.bumpers = bumpers;
}

public BigDecimal getHeight() {
return height;
}

public void setHeight(BigDecimal height) {
this.height = height;
}

public Integer getMass() {
return mass;
}

public void setMass(Integer mass) {
this.mass = mass;
}

public Integer getTrailerWeight() {
return trailerWeight;
}

public void setTrailerWeight(Integer trailerWeight) {
this.trailerWeight = trailerWeight;
}

private Integer doNotUse;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package us.dot.its.jpo.ode.plugin.j2735.builders;

import com.fasterxml.jackson.databind.JsonNode;

import us.dot.its.jpo.ode.plugin.j2735.J2735EmergencyDetails;
import us.dot.its.jpo.ode.plugin.j2735.J2735LightbarInUse;
import us.dot.its.jpo.ode.plugin.j2735.J2735MultiVehicleResponse;
Expand All @@ -33,7 +32,7 @@ public static J2735EmergencyDetails genericEmergencyDetails(JsonNode vehicleAler
J2735EmergencyDetails va = new J2735EmergencyDetails();

// Required elements
va.setSspRights(vehicleAlerts.get("sspRights").asInt());
va.setDoNotUse(vehicleAlerts.get("doNotUse").asInt());
va.setSirenUse(J2735SirenInUse.valueOf(vehicleAlerts.get("sirenUse").fields().next().getKey().replaceAll("-", "_").toUpperCase()));
va.setLightsUse(J2735LightbarInUse.valueOf(vehicleAlerts.get("lightsUse").fields().next().getKey().replaceAll("-", "_").toUpperCase()));
va.setMulti(J2735MultiVehicleResponse.valueOf(vehicleAlerts.get("multi").fields().next().getKey().replaceAll("-", "_").toUpperCase()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@
package us.dot.its.jpo.ode.plugin.j2735.builders;

import com.fasterxml.jackson.databind.JsonNode;

import us.dot.its.jpo.ode.plugin.j2735.J2735PrivilegedEvents;

public class PrivilegedEventsBuilder {

private static final String SSP_RIGHTS = "sspRights";
private static final String DO_NOT_USE = "doNotUse";

public enum J2735PrivilegedEventFlagsNames {
peUnavailable, peEmergencyResponse, peEmergencyLightsActive, peEmergencySoundActive, peNonEmergencyLightsActive,
Expand All @@ -37,14 +36,14 @@ private PrivilegedEventsBuilder() {

public static J2735PrivilegedEvents genericPrivilegedEvents(JsonNode events) {

if (events.get(SSP_RIGHTS).asInt() < SSP_LOWER_BOUND || events.get(SSP_RIGHTS).asInt() > SSP_UPPER_BOUND) {
if (events.get(DO_NOT_USE).asInt() < SSP_LOWER_BOUND || events.get(DO_NOT_USE).asInt() > SSP_UPPER_BOUND) {
throw new IllegalArgumentException("SSPindex value out of bounds [0..31]");
}

J2735PrivilegedEvents pe = new J2735PrivilegedEvents();

pe.setEvent(BitStringBuilder.genericBitString(events.get("event"), J2735PrivilegedEventFlagsNames.values()));
pe.setSspRights(events.get(SSP_RIGHTS).asInt());
pe.setDoNotUse(events.get(DO_NOT_USE).asInt());

return pe;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package us.dot.its.jpo.ode.plugin.j2735.builders;

import com.fasterxml.jackson.databind.JsonNode;

import us.dot.its.jpo.ode.plugin.j2735.J2735BsmPart2Content;
import us.dot.its.jpo.ode.plugin.j2735.J2735SpecialVehicleExtensions;

Expand All @@ -38,9 +37,9 @@ public static void evaluateSpecialVehicleExt(J2735BsmPart2Content part2Content,
if (desc != null) {
specVeh.setDescription(EventDescriptionBuilder.genericEventDescription(desc));
}
JsonNode tr = specVehExt.get("trailers");
JsonNode tr = specVehExt.get("doNotUse");
if (tr != null) {
specVeh.setTrailers(TrailerDataBuilder.genericTrailerData(tr));
specVeh.setDoNotUse(TrailerDataBuilder.genericTrailerData(tr));
}
}

Expand Down
Loading

0 comments on commit 3428ed1

Please sign in to comment.