diff --git a/sensor-data-bridge/src/main/java/nl/bertriksikken/ttn/TtnUplinkMessage.java b/sensor-data-bridge/src/main/java/nl/bertriksikken/ttn/TtnUplinkMessage.java index 2fe24c1..babef90 100644 --- a/sensor-data-bridge/src/main/java/nl/bertriksikken/ttn/TtnUplinkMessage.java +++ b/sensor-data-bridge/src/main/java/nl/bertriksikken/ttn/TtnUplinkMessage.java @@ -55,7 +55,7 @@ public byte[] getRawPayload() { public String getDecodedFields() { return decodedFields; } - + public int getPort() { return port; } @@ -74,8 +74,8 @@ public int getSF() { @Override public String toString() { - return String.format(Locale.ROOT, "EUI %s, data %s, port %d, SF %d", devEui, HexConverter.toString(rawPayload), - port, sf); + return String.format(Locale.ROOT, "%s/%s: {data:'%s', fields:'%s'}", appId, devId, + HexConverter.toString(rawPayload), decodedFields); } } diff --git a/sensor-data-bridge/src/test/java/nl/bertriksikken/ttn/TtnUplinkMessageTest.java b/sensor-data-bridge/src/test/java/nl/bertriksikken/ttn/TtnUplinkMessageTest.java index 7d4e98e..018e30d 100644 --- a/sensor-data-bridge/src/test/java/nl/bertriksikken/ttn/TtnUplinkMessageTest.java +++ b/sensor-data-bridge/src/test/java/nl/bertriksikken/ttn/TtnUplinkMessageTest.java @@ -4,11 +4,12 @@ import org.junit.Test; public final class TtnUplinkMessageTest { - + @Test public void testString() { - TtnUplinkMessage message = new TtnUplinkMessage("app", "device", "eui", new byte[] {1, 2, 3}, "", 1); + TtnUplinkMessage message = new TtnUplinkMessage("app", "device", "eui", new byte[] { 1, 2, 3 }, "{}", 1); Assert.assertNotNull(message.toString()); + System.out.println(message); } }