Skip to content

Commit

Permalink
ODE-844 added handling of other content types to TIM input data.
Browse files Browse the repository at this point in the history
  • Loading branch information
hmusavi committed Feb 11, 2019
1 parent a9f10c1 commit 86fb797
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 83 deletions.
14 changes: 2 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@




Master: [![Build Status](https://travis-ci.org/usdot-jpo-ode/jpo-ode.svg?branch=master)](https://travis-ci.org/usdot-jpo-ode/jpo-ode) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=usdot.jpo.ode%3Ajpo-ode%3Amaster&metric=alert_status)](https://sonarcloud.io/dashboard?id=usdot.jpo.ode%3Ajpo-ode%3Amaster)

Dev: [![Build Status](https://travis-ci.org/usdot-jpo-ode/jpo-ode.svg?branch=develop)](https://travis-ci.org/usdot-jpo-ode/jpo-ode) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=usdot.jpo.ode%3Ajpo-ode%3Adev&metric=alert_status)](https://sonarcloud.io/dashboard?id=usdot.jpo.ode%3Ajpo-ode%3Adev)
Expand Down Expand Up @@ -296,18 +297,7 @@ a. [Wyoming CV Pilot Log File Design](data/Wyoming_CV_Pilot_Log_File_Design.docx
b. [WYDOT Log Records](data/wydotLogRecords.h)
3. Press `Upload` button to upload the file to ODE.

Upload records within the files must be embedding BSM and/or TIM messages wrapped in J2735 MessageFrame and ASN.1 UPER encoded, wrapped in IEEE 1609.2 envelope and ASN.1 COER encoded binary format. The following files are a samples of each supported type. Uploading any of the files below will you will observe the decoded messages returned to the web UI page while connected to the WebSocket interface:

- [data/bsmLogDuringEvent.bin](data/bsmLogDuringEvent.bin)
- [data/bsmLogDuringEvent.gz](data/bsmLogDuringEvent.gz)
- [data/bsmTx.bin](data/bsmTx.bin)
- [data/bsmTx.gz](data/bsmTx.gz)
- [data/dnMsg.bin](data/dnMsg.bin)
- [data/dnMsg.gz](data/dnMsg.gz)
- [data/rxMsg_BSM.bin](data/rxMsg_BSM.bin)
- [data/rxMsg_BSM.gz](data/rxMsg_BSM.gz)
- [data/rxMsg_TIM.bin](data/rxMsg_TIM.bin)
- [data/rxMsg_TIM.gz](data/rxMsg_TIM.gz)
Upload records within the files must be embedding BSM and/or TIM messages wrapped in J2735 MessageFrame and ASN.1 UPER encoded, wrapped in IEEE 1609.2 envelope and ASN.1 COER encoded binary format. Please review the files in the [data](data) folder for samples of each supported type. By uploading a valid data file, you will be able to observe the decoded messages contained within the file appear in the web UI page while connected to the WebSocket interface.

Another way data can be uploaded to the ODE is through copying the file to the location specified by the `ode.uploadLocationRoot/ode.uploadLocationObuLog`property. If not specified, Default locations would be `uploads/bsmlog`sub-directory off of the location where ODE is launched.

Expand Down
3 changes: 1 addition & 2 deletions docs/ODESwagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,7 @@ definitions:
content:
type: string
description: >-
Part III content type, one of "Advisory", "Work Zone", "Generic
Signage", "Speed Limit", or "Exit Service".
Part III content type, one of "advisory", "workZone", "genericSign", "speedLimit", or "exitService".
items:
type: array
items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public static void replaceDataFrame(ObjectNode dataFrame) throws JsonUtilsExcept
// "regions": []
// "sspMsgTypes": "2",
// "sspMsgContent": "3",
// "content": "Advisory",
// "content": "advisory",
// "items": [
// "513"
// ],
Expand All @@ -210,6 +210,10 @@ public static void replaceDataFrame(ObjectNode dataFrame) throws JsonUtilsExcept

// sspTimRights does not need replacement

// set frameType value
dataFrame.set("frameType",
JsonUtils.newNode().put(dataFrame.get("frameType").asText(), EMPTY_FIELD_FLAG));

// replace sspMsgContent with sspMsgRights2
dataFrame.put("sspMsgRights2", dataFrame.get(SSP_MSG_CONTENT).asInt());
dataFrame.remove(SSP_MSG_CONTENT);
Expand Down Expand Up @@ -296,29 +300,10 @@ public static void replaceContent(ObjectNode dataFrame) {

// EXPECTED INPUT:
////////
// "content": "Advisory",
// "content": "advisory",
// "items":["513", "Text you need to send", "'1234567'", "255"]},

// step 1, figure out the name of the content
String contentName = dataFrame.get("content").asText();
String replacedContentName;
if ("Work Zone".equalsIgnoreCase(contentName) || "workZone".equalsIgnoreCase(contentName)) {
replacedContentName = "workZone";
} else if ("Speed Limit".equalsIgnoreCase(contentName) || "speedLimit".equalsIgnoreCase(contentName)) {
replacedContentName = "speedLimit";
} else if ("Exit Service".equalsIgnoreCase(contentName) || "exitService".equalsIgnoreCase(contentName)) {
replacedContentName = "exitService";
} else if ("Generic Signage".equalsIgnoreCase(contentName) || "genericSign".equalsIgnoreCase(contentName)) {
replacedContentName = "genericSign";
} else {
// default
replacedContentName = "advisory";
}
dataFrame.remove("content");
dataFrame.set("frameType",
JsonUtils.newNode().put(dataFrame.get("frameType").asText(), EMPTY_FIELD_FLAG));

// step 2, reformat item list
// step 1, reformat item list
ArrayNode items = (ArrayNode) dataFrame.get("items");
ArrayNode newItems = JsonUtils.newNode().arrayNode();
if (items.isArray()) {
Expand All @@ -335,12 +320,19 @@ public static void replaceContent(ObjectNode dataFrame) {

JsonNode sequence = JsonUtils.newNode().set(SEQUENCE_STRING, newItems);

dataFrame.remove("items");

// step 2, set the content CHOICE
String replacedContentName = dataFrame.get("content").asText();
if (replacedContentName.equals("Advisory"))
replacedContentName = "advisory";

// The following field is called "content" but this results in a
// failed conversion to XML
// see @us.dot.its.jpo.ode.traveler.TimController.publish
dataFrame.set(TCONTENT_STRING, JsonUtils.newNode().set(replacedContentName, sequence));
dataFrame.remove("items");
}
dataFrame.remove("content");
}

public static JsonNode buildItem(String itemStr) {
JsonNode item = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,41 @@

public class Content extends Asn1Object {
private static final long serialVersionUID = 1L;
private Advisory advisory;
private ITIS_CodesAndText advisory;
private ITIS_CodesAndText workZone;
private ITIS_CodesAndText genericSign;
private ITIS_CodesAndText speedLimit;
private ITIS_CodesAndText exitService;

public ITIS_CodesAndText getAdvisory() {
return advisory;
}
public void setAdvisory(ITIS_CodesAndText advisory) {
this.advisory = advisory;
}
public ITIS_CodesAndText getWorkZone() {
return workZone;
}
public void setWorkZone(ITIS_CodesAndText workZone) {
this.workZone = workZone;
}
public ITIS_CodesAndText getGenericSign() {
return genericSign;
}
public void setGenericSign(ITIS_CodesAndText genericSign) {
this.genericSign = genericSign;
}
public ITIS_CodesAndText getSpeedLimit() {
return speedLimit;
}
public void setSpeedLimit(ITIS_CodesAndText speedLimit) {
this.speedLimit = speedLimit;
}
public ITIS_CodesAndText getExitService() {
return exitService;
}
public void setExitService(ITIS_CodesAndText exitService) {
this.exitService = exitService;
}

public Advisory getAdvisory ()
{
return advisory;
}

public void setAdvisory (Advisory advisory)
{
this.advisory = advisory;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
******************************************************************************/
package us.dot.its.jpo.ode.plugin.j2735.timstorage;

import java.util.Arrays;

import com.fasterxml.jackson.annotation.JsonProperty;

import us.dot.its.jpo.ode.plugin.asn1.Asn1Object;

public class Advisory extends Asn1Object {
public class ITIS_CodesAndText extends Asn1Object {
private static final long serialVersionUID = 1L;
@JsonProperty("SEQUENCE")
private Items[] SEQUENCE;
Expand All @@ -31,24 +29,4 @@ public Items[] getSEQUENCE() {
public void setSEQUENCE(Items[] sEQUENCE) {
SEQUENCE = sEQUENCE;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + Arrays.hashCode(SEQUENCE);
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Advisory other = (Advisory) obj;
if (!Arrays.equals(SEQUENCE, other.SEQUENCE))
return false;
return true;
}
}
Loading

0 comments on commit 86fb797

Please sign in to comment.