drogue-iot / drogue-ttn

Rust mappings for APIs of *The Things Network*
Apache License 2.0
3 stars 1 forks source link

rx_metadata: Sometimes time field is missing #3

Closed dbrgn closed 2 years ago

dbrgn commented 2 years ago

Here's the rx_metadata of an uplink:

"rx_metadata": [
    {
        "gateway_ids": {
            "gateway_id": "hidden-gateway",
            "eui": "BECE5599FFBECEFE"
        },
        "timestamp": 2683985228,
        "rssi": -131,
        "channel_rssi": -131,
        "snr": -11.2,
        "location": {
            "latitude": 47.04018544513147,
            "longitude": 8.314836024874241,
            "source": "SOURCE_REGISTRY"
        },
        "uplink_token": "ChwKGgoOaGlkZGVuLWdhdGV3YXkSCL7OVZn/vs7+EMy66f8JGgwI+si/lgYQlNvGzQIg4OHxz47PzQI=",
        "channel_index": 4
    },
    {
        "gateway_ids": {
            "gateway_id": "hslu-lora-hote21-outdoor01",
            "eui": "689E19FFFE85CAB3"
        },
        "time": "2022-07-14T09:40:10.658369Z",
        "timestamp": 3221410004,
        "rssi": -119,
        "channel_rssi": -119,
        "snr": -6.5,
        "location": {
            "latitude": 47.01332,
            "longitude": 8.30602,
            "altitude": 445,
            "source": "SOURCE_REGISTRY"
        },
        "uplink_token": "CigKJgoaaHNsdS1sb3JhLWhvdGUyMS1vdXRkb29yMDESCGieGf/+hcqzENShi4AMGgwI+si/lgYQoq6N0AIgoPj+1+DezQIqDAj6yL+WBhDo0/e5Ag==",
        "channel_index": 4
    },
    {
        "gateway_ids": {
            "gateway_id": "lora-gw-stans-1",
            "eui": "B827EBFFFE73D35D"
        },
        "time": "2022-07-14T09:40:07.646980Z",
        "timestamp": 2170207492,
        "rssi": -119,
        "channel_rssi": -119,
        "snr": -10.8,
        "location": {
            "latitude": 46.95768434248715,
            "longitude": 8.372563719749452,
            "altitude": 462,
            "source": "SOURCE_REGISTRY"
        },
        "uplink_token": "Ch0KGwoPbG9yYS1ndy1zdGFucy0xEgi4J+v//nPTXRCE+uqKCBoMCPrIv5YGEPa789ICIKCvydOUxKUBKgwI98i/lgYQoMPAtAI=",
        "channel_index": 4
    }
]

For some reason, the first entry doesn't have a time field. Maybe because it's a hidden gateway? I don't know.

The timestamp field looks like an alternative form of the same data at first glance, but I think it's not actually a unix timestamp, but something else. So the best way forward would probably be to make the time field optional. What do you think?

dbrgn commented 2 years ago

The docs say:

  "time": "2020-02-12T15:15:45.787Z",    // ISO 8601 UTC timestamp at which the uplink has been received by the gateway
  "timestamp": 2463457000,               // Timestamp of the gateway concentrator when the message has been received

I'm still not sure what the difference is.