From c66b0c84a2401ba6595f05d1c5fff118e87a6a44 Mon Sep 17 00:00:00 2001 From: Mathieu Lefebvre Date: Fri, 25 Oct 2024 09:41:06 +0200 Subject: [PATCH] java/iot3mobility: fix topic root for mobility messages publication Signed-off-by: Mathieu LEFEBVRE --- .../main/java/com/orange/iot3mobility/IoT3Mobility.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/java/iot3/mobility/src/main/java/com/orange/iot3mobility/IoT3Mobility.java b/java/iot3/mobility/src/main/java/com/orange/iot3mobility/IoT3Mobility.java index 3457b6fc..514bade3 100644 --- a/java/iot3/mobility/src/main/java/com/orange/iot3mobility/IoT3Mobility.java +++ b/java/iot3/mobility/src/main/java/com/orange/iot3mobility/IoT3Mobility.java @@ -44,6 +44,7 @@ public class IoT3Mobility { private final RoIManager roIManager; private final String uuid; + private final String context; private final int stationId; /** @@ -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); @@ -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()); @@ -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()); @@ -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());