From 92f9ab8d35ed8770c3a32ee8902b4179b52841a2 Mon Sep 17 00:00:00 2001 From: cambierr Date: Wed, 22 Feb 2017 09:09:20 +0100 Subject: [PATCH 1/2] fix #46 --- .gitignore | 3 +- account/pom.xml | 2 +- data/data-amqp/pom.xml | 2 +- data/data-common/pom.xml | 2 +- .../data/common/AbstractClient.java | 4 +- .../data/common/messages/UplinkMessage.java | 42 +++++++++++++++++++ data/data-mqtt/pom.xml | 2 +- data/pom.xml | 2 +- management/pom.xml | 2 +- pom.xml | 2 +- samples/pom.xml | 2 +- samples/samples-account/pom.xml | 2 +- samples/samples-amqp/pom.xml | 2 +- samples/samples-management/pom.xml | 2 +- samples/samples-mqtt/pom.xml | 2 +- 15 files changed, 59 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 12b4571..ce9334a 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,5 @@ /samples/samples-account/target/ /data/data-common/target/ /samples/ttnmgmt/target/ -/samples/samples-management/target/ \ No newline at end of file +/samples/samples-management/target/ +/samples/samples-amqp/target/ \ No newline at end of file diff --git a/account/pom.xml b/account/pom.xml index beb0913..34cb81f 100644 --- a/account/pom.xml +++ b/account/pom.xml @@ -4,7 +4,7 @@ org.thethingsnetwork app-sdk - 2.1.0 + 2.1.1 account jar diff --git a/data/data-amqp/pom.xml b/data/data-amqp/pom.xml index 39f0a3b..714cc17 100644 --- a/data/data-amqp/pom.xml +++ b/data/data-amqp/pom.xml @@ -4,7 +4,7 @@ org.thethingsnetwork data - 2.1.0 + 2.1.1 data-amqp jar diff --git a/data/data-common/pom.xml b/data/data-common/pom.xml index 6103922..ef3f7da 100644 --- a/data/data-common/pom.xml +++ b/data/data-common/pom.xml @@ -4,7 +4,7 @@ org.thethingsnetwork data - 2.1.0 + 2.1.1 data-common jar diff --git a/data/data-common/src/main/java/org/thethingsnetwork/data/common/AbstractClient.java b/data/data-common/src/main/java/org/thethingsnetwork/data/common/AbstractClient.java index 733bdd9..a4b5d49 100644 --- a/data/data-common/src/main/java/org/thethingsnetwork/data/common/AbstractClient.java +++ b/data/data-common/src/main/java/org/thethingsnetwork/data/common/AbstractClient.java @@ -25,6 +25,7 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.PropertyNamingStrategy; import java.util.function.BiConsumer; @@ -47,7 +48,8 @@ public abstract class AbstractClient { MAPPER .setVisibility(PropertyAccessor.ALL, Visibility.NONE) .setVisibility(PropertyAccessor.FIELD, Visibility.ANY) - .setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); + .setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE) + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); } /** diff --git a/data/data-common/src/main/java/org/thethingsnetwork/data/common/messages/UplinkMessage.java b/data/data-common/src/main/java/org/thethingsnetwork/data/common/messages/UplinkMessage.java index 73a332c..f6b083a 100644 --- a/data/data-common/src/main/java/org/thethingsnetwork/data/common/messages/UplinkMessage.java +++ b/data/data-common/src/main/java/org/thethingsnetwork/data/common/messages/UplinkMessage.java @@ -35,6 +35,10 @@ */ public class UplinkMessage implements DataMessage { + private String appId; + private String devId; + private String hardwareSerial; + private boolean isRetry; private int port; private int counter; private String payloadRaw; @@ -74,6 +78,7 @@ public byte[] getPayloadRaw() { /** * Get the payload fields. Only if you have a decoder function + * * @return the payload fields as a Map where keys are strings, and values are any json-valid entity */ public Map getPayloadFields() { @@ -82,10 +87,47 @@ public Map getPayloadFields() { /** * Get the metadata of this uplink packet + * * @return the metadata */ public Metadata getMetadata() { return metadata; } + /** + * Get the application id + * + * @return the application id + */ + public String getAppId() { + return appId; + } + + /** + * Get the device id + * + * @return the device id + */ + public String getDevId() { + return devId; + } + + /** + * Get the hardware serial + * + * @return the hardware serial + */ + public String getHardwareSerial() { + return hardwareSerial; + } + + /** + * Check if this message is a retry + * + * @return true if the message is a retry + */ + public boolean isRetry() { + return isRetry; + } + } diff --git a/data/data-mqtt/pom.xml b/data/data-mqtt/pom.xml index 4379cdd..ab40b9d 100644 --- a/data/data-mqtt/pom.xml +++ b/data/data-mqtt/pom.xml @@ -4,7 +4,7 @@ org.thethingsnetwork data - 2.1.0 + 2.1.1 data-mqtt jar diff --git a/data/pom.xml b/data/pom.xml index 8eb5b9b..991add6 100644 --- a/data/pom.xml +++ b/data/pom.xml @@ -4,7 +4,7 @@ org.thethingsnetwork app-sdk - 2.1.0 + 2.1.1 data pom diff --git a/management/pom.xml b/management/pom.xml index 31b4baf..69ef970 100644 --- a/management/pom.xml +++ b/management/pom.xml @@ -4,7 +4,7 @@ org.thethingsnetwork app-sdk - 2.1.0 + 2.1.1 management jar diff --git a/pom.xml b/pom.xml index 27626e1..2ab6b2c 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.thethingsnetwork app-sdk - 2.1.0 + 2.1.1 pom diff --git a/samples/pom.xml b/samples/pom.xml index 6517590..9a212d0 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.thethingsnetwork samples - 2.1.0 + 2.1.1 pom The Things Network SDK Samples diff --git a/samples/samples-account/pom.xml b/samples/samples-account/pom.xml index d0756ec..9227819 100644 --- a/samples/samples-account/pom.xml +++ b/samples/samples-account/pom.xml @@ -4,7 +4,7 @@ org.thethingsnetwork samples - 2.1.0 + 2.1.1 samples-account jar diff --git a/samples/samples-amqp/pom.xml b/samples/samples-amqp/pom.xml index 84ea2d7..87075e4 100644 --- a/samples/samples-amqp/pom.xml +++ b/samples/samples-amqp/pom.xml @@ -4,7 +4,7 @@ org.thethingsnetwork samples - 2.1.0 + 2.1.1 samples-amqp jar diff --git a/samples/samples-management/pom.xml b/samples/samples-management/pom.xml index 2928aa1..c8a14a6 100644 --- a/samples/samples-management/pom.xml +++ b/samples/samples-management/pom.xml @@ -4,7 +4,7 @@ org.thethingsnetwork samples - 2.1.0 + 2.1.1 samples-management jar diff --git a/samples/samples-mqtt/pom.xml b/samples/samples-mqtt/pom.xml index 23cb761..1153a55 100644 --- a/samples/samples-mqtt/pom.xml +++ b/samples/samples-mqtt/pom.xml @@ -4,7 +4,7 @@ org.thethingsnetwork samples - 2.1.0 + 2.1.1 samples-mqtt jar From 6246af4f75a95df74187f945324d33710e8b7c1e Mon Sep 17 00:00:00 2001 From: cambierr Date: Wed, 22 Feb 2017 09:29:34 +0100 Subject: [PATCH 2/2] #46 - more gateway metadata --- .../data/common/Metadata.java | 45 +++++++++++++++++-- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/data/data-common/src/main/java/org/thethingsnetwork/data/common/Metadata.java b/data/data-common/src/main/java/org/thethingsnetwork/data/common/Metadata.java index e853967..d3f3306 100644 --- a/data/data-common/src/main/java/org/thethingsnetwork/data/common/Metadata.java +++ b/data/data-common/src/main/java/org/thethingsnetwork/data/common/Metadata.java @@ -54,7 +54,7 @@ public String getTime() { } /** - * Get the frequency of this packet + * Get the frequency of this packet * * @return the frequency, in MHz */ @@ -100,6 +100,7 @@ public String getCodingRate() { /** * Get the list of gateways that received this packet + * * @return a List of Gateway */ public List getGateways() { @@ -109,16 +110,18 @@ public List getGateways() { return Collections.unmodifiableList(gateways); } - public static class Gateway { - private String id; + private String gtwId; private long timestamp; private String time; private int channel; private double rssi; private double snr; private int rfChain; + private double latitude; + private double longitude; + private double altitude; private Gateway() { @@ -126,14 +129,16 @@ private Gateway() { /** * Get the Gateway ID as registered in TheThingsNetwork + * * @return the gateway id */ public String getId() { - return id; + return gtwId; } /** * Get the Gateway internal reception time + * * @return the gateway internal reception time */ public long getTimestamp() { @@ -142,6 +147,7 @@ public long getTimestamp() { /** * Get the Gateway absolute reception time + * * @return the gateway absolute reception time */ public String getTime() { @@ -150,6 +156,7 @@ public String getTime() { /** * Get the channel this packet was sent on + * * @return the channel this packet was sent on */ public int getChannel() { @@ -158,6 +165,7 @@ public int getChannel() { /** * Get the RX rssi of this packet + * * @return the RX rssi of this packet */ public double getRssi() { @@ -166,6 +174,7 @@ public double getRssi() { /** * Get the RX snr of this packet + * * @return the RX snr of this packet */ public double getSnr() { @@ -174,10 +183,38 @@ public double getSnr() { /** * Get the RF chain of this packet + * * @return the RF chain of this packet */ public int getRfChain() { return rfChain; } + + /** + * Get the gateway latitude + * + * @return the gateway latitude + */ + public double getLatitude() { + return latitude; + } + + /** + * Get the gateway longitude + * + * @return the gateway longitude + */ + public double getLongitude() { + return longitude; + } + + /** + * Get the gateway altitude + * + * @return the gateway altitude + */ + public double getAltitude() { + return altitude; + } } }