Closed KMax closed 7 years ago
Is there a good reason UplinkMessage doesn't have the app_id
, dev_id
fields? i can send a pull request with the changes (will add the missing fields), if there is no a good reason to ignore these fields.
@cambierr What do you say?
I'll do the change now in the 2.1.1 branch ;-) Those fields will be added. The UplinkMessage class was based on a now old version of the MQTT API
So, i fixed this and added those fields in UplinkMessage. To face eventual new API changes I added some relaxed deserialization to jackson
@KMax @martinbeentjes I did some testing but feel free to test more stuff before we release 2.1.1 :)
@cambierr Okay, but what about Metadata.Gateway
class, it also misses several fields? Did it work in your set up?
Well, from the tests I just ran, everything is fine.
The java sdk is conform to the API specs at https://www.thethingsnetwork.org/docs/applications/mqtt/api.html
To face eventual new API changes I added some relaxed deserialization to jackson
Ohh, okay. Then it should work even if Metdata.Gateway
class doesn't have some fields.
Okay, but what about Metadata.Gateway class, it also misses several fields?
At least the id
field in Metadat.Gateway
is gtw_id
in the message, so @JsonProperty("gtw_id")
should be added for the field, I guess.
Here is the message i receive:
{
"app_id":"testspb",
"dev_id":"testdevice-aaaaaaaaaaaaaaaa",
"hardware_serial":"AAAAAAAAAAAAAAAA",
"port":1,
"counter":647,
"payload_raw":"eyJ0IjoiOTkuNSIsImgiOiI5OS41In0AAAAAAAA=",
"metadata": {
"time":"2017-02-22T07:59:19.96654609Z",
"frequency":868.1,
"modulation":"LORA",
"data_rate":"SF7BW125",
"coding_rate":"4/5",
"gateways": [
{
"gtw_id":"eui-b827ebfffeaa9967",
"timestamp":1391443707,
"time":"2017-02-22T07:59:19.943604Z",
"channel":0,
"rssi":-21,
"snr":8.5,
"rf_chain":1,
"latitude":59.95694,
"longitude":30.30834,
"altitude": 69
}
]
}
}
Looks like the API spec is not up-to-date.
You are right. I just fixed gtw_id, longitude, altitude, and latitude ! From now on I will more focus on actual data received and less on the API doc :)
The last thing is the is_retry
field which you added in the first commit, it doesn't exist in the actual uplink message :)
Everything else looks fine for me and works on my side.
it's in the API specs. @johanstokking any info about this field ?
@cambierr it's here: https://github.com/thethingsnetwork/ttn/tree/master/mqtt. Also note the line just below, saying that fields can be omitted when they're default or empty.
Ah, the master
seems behind on docs, this is the one: https://github.com/thethingsnetwork/ttn/tree/develop/mqtt
This will be fixed asap
I tried to run the samples-mqtt, it connects to the MQTT broker, but when an uplink message received, it throws an error:
As I understand the problem in the mapping of a JSON message in an UplinkMessage instance.