Copy of my comment on Github:
Here are the rules for gateway location:
For the gateway:
- If the gateway has a GPS and has a GPS fix:
- The gateway must add the location calculated from GPS to status messages as
status.gps
- The gateway must add the
time
field to uplink messages asmessage.gateway_metadata.gps.time
- The gateway may add the
gps
field to uplink messages asmessage.gateway_metadata.gps
- The gateway must add the location calculated from GPS to status messages as
- In all other cases:
- The gateway must not add a location to the status messages.
- The gateway must not add a
time
field to uplink messages.
For the backend:
- Each time the gateway sends a status message, a location is cached as “latest”
- If the status message contains a location, the location from the status message must be cached.
- If the status message does not contain a location, but the gateway location is set in its registration, the registered location must be cached.
- In all other cases, the location must be stored as “empty”.
- Each time the gateway sends an uplink message:
- If the metadata of the uplink message contains a
gps
field, this field must not be changed - If the metadata of the uplink message does not contain a
gps
field and the “latest” status message from the gateway contains a location, the “latest” location must be inserted. - In all other cases, the location must remain “empty”
- If the metadata of the uplink message contains a
Note: The fake_gps
option must only be used if the gateway has some other means to determine an accurate location