Skip to content

Commit

Permalink
java/iot3mobility: fix topic root for mobility messages publication
Browse files Browse the repository at this point in the history
Signed-off-by: Mathieu LEFEBVRE <mathieu1.lefebvre@orange.com>
  • Loading branch information
mathieu1fb committed Oct 25, 2024
1 parent 59d2902 commit c66b0c8
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class IoT3Mobility {
private final RoIManager roIManager;

private final String uuid;
private final String context;
private final int stationId;

/**
Expand Down Expand Up @@ -77,6 +78,7 @@ private IoT3Mobility(String uuid,
String telemetryUsername,
String telemetryPassword) {
this.uuid = uuid;
this.context = context;
// random stationId at the moment, will be an option to set it later on
this.stationId = Utils.randomBetween(999, 99999999);

Expand Down Expand Up @@ -291,7 +293,7 @@ public void sendCam(CAM cam) {
String quadkey = QuadTileHelper.latLngToQuadKey(cam.getBasicContainer().getPosition().getLatitudeDegree(),
cam.getBasicContainer().getPosition().getLongitudeDegree(), 22);
String geoExtension = QuadTileHelper.quadKeyToQuadTopic(quadkey);
String topic = "SWR/inQueue/v2x/cam/" + uuid + geoExtension;
String topic = context + "/inQueue/v2x/cam/" + uuid + geoExtension;

// send the message
if(ioT3Core != null) ioT3Core.mqttPublish(topic, cam.getJsonCAM().toString());
Expand Down Expand Up @@ -358,7 +360,7 @@ public void sendDenm(DENM denm) {
denm.getManagementContainer().getEventPosition().getLongitudeDegree(),
22);
String geoExtension = QuadTileHelper.quadKeyToQuadTopic(quadkey);
String topic = "SWR/inQueue/v2x/denm/" + uuid + geoExtension;
String topic = context + "/inQueue/v2x/denm/" + uuid + geoExtension;

// send the message
if(ioT3Core != null) ioT3Core.mqttPublish(topic, denm.getJsonDENM().toString());
Expand All @@ -376,7 +378,7 @@ public void sendCpm(CPM cpm) {
cpm.getManagementContainer().getReferencePosition().getLongitudeDegree(),
22);
String geoExtension = QuadTileHelper.quadKeyToQuadTopic(quadkey);
String topic = "SWR/inQueue/v2x/cpm/" + uuid + geoExtension;
String topic = context + "/inQueue/v2x/cpm/" + uuid + geoExtension;

// send the message
if(ioT3Core != null) ioT3Core.mqttPublish(topic, cpm.getJson().toString());
Expand Down

0 comments on commit c66b0c8

Please sign in to comment.