kopia lustrzana https://github.com/bertrik/ttnhabbridge
Use Double.NaN to indicate that a Helium gateway does not send altitude
rodzic
18404110a9
commit
6a01360214
|
@ -33,7 +33,9 @@ public final class ListenerTelemetryDoc extends ListenerDoc {
|
|||
node.set("callsign", factory().textNode(receiver.getCallsign()));
|
||||
node.set("latitude", factory().numberNode(receiver.getLocation().getLat()));
|
||||
node.set("longitude", factory().numberNode(receiver.getLocation().getLon()));
|
||||
node.set("altitude", factory().numberNode(receiver.getLocation().getAlt()));
|
||||
if (Double.isFinite(receiver.getLocation().getAlt())) {
|
||||
node.set("altitude", factory().numberNode(receiver.getLocation().getAlt()));
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public final class HeliumUplinkMessage {
|
|||
LoraWanUplinkMessage uplink = new LoraWanUplinkMessage(Instant.ofEpochMilli(reportedAt), appEui, name, fcnt,
|
||||
port, payload);
|
||||
for (HotSpot hotSpot : hotSpots) {
|
||||
uplink.addGateway(hotSpot.name.trim(), hotSpot.latitude, hotSpot.longitude, 0.0);
|
||||
uplink.addGateway(hotSpot.name.trim(), hotSpot.latitude, hotSpot.longitude, Double.NaN);
|
||||
}
|
||||
return uplink;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.junit.Test;
|
|||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import nl.sikken.bertrik.hab.lorawan.HeliumUplinkMessage.HotSpot;
|
||||
import nl.sikken.bertrik.hab.lorawan.LoraWanUplinkMessage.GatewayInfo;
|
||||
|
||||
public final class HeliumUplinkMessageTest {
|
||||
|
||||
|
@ -46,6 +47,10 @@ public final class HeliumUplinkMessageTest {
|
|||
Assert.assertEquals(0, lorawan.getFcnt());
|
||||
Assert.assertEquals(1, lorawan.getPort());
|
||||
Assert.assertArrayEquals(new byte[] {3}, lorawan.getPayloadRaw());
|
||||
GatewayInfo gw = lorawan.getGateways().get(0);
|
||||
Assert.assertEquals(52.01745, gw.getLocation().getLat(), 0.00001);
|
||||
Assert.assertEquals(4.729876, gw.getLocation().getLon(), 0.00001);
|
||||
Assert.assertFalse(Double.isFinite(gw.getLocation().getAlt()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue