kopia lustrzana https://github.com/bertrik/ttnhabbridge
Remove isRetry() from TTN uplink message, it no longer exists.
rodzic
7199758e63
commit
fb19695a85
|
@ -97,13 +97,6 @@ public final class TtnHabBridge {
|
|||
private void handleTTNMessage(LoraWanUplinkMessage message) {
|
||||
Instant now = Instant.now();
|
||||
try {
|
||||
// decode from JSON
|
||||
if (message.isRetry()) {
|
||||
// skip "retry" messages, they contain duplicate data with a misleading time
|
||||
// stamp
|
||||
LOG.warn("Ignoring 'retry' message");
|
||||
return;
|
||||
}
|
||||
Sentence sentence = decoder.decode(message);
|
||||
String line = sentence.format();
|
||||
|
||||
|
|
|
@ -22,18 +22,15 @@ public final class LoraWanUplinkMessage {
|
|||
private final int port;
|
||||
private final Map<String, Object> payloadFields = new HashMap<>();
|
||||
private final byte[] payloadRaw;
|
||||
private final boolean isRetry;
|
||||
private final List<GatewayInfo> gateways = new ArrayList<>();
|
||||
|
||||
public LoraWanUplinkMessage(Instant time, String appId, String deviceId, int counter, int port, byte[] payloadRaw,
|
||||
boolean isRetry) {
|
||||
public LoraWanUplinkMessage(Instant time, String appId, String deviceId, int counter, int port, byte[] payloadRaw) {
|
||||
this.time = Instant.from(time);
|
||||
this.appId = appId;
|
||||
this.deviceId = deviceId;
|
||||
this.counter = counter;
|
||||
this.port = port;
|
||||
this.payloadRaw = payloadRaw.clone();
|
||||
this.isRetry = isRetry;
|
||||
}
|
||||
|
||||
public void addField(String name, Object value) {
|
||||
|
@ -64,10 +61,6 @@ public final class LoraWanUplinkMessage {
|
|||
return new HashMap<>(payloadFields);
|
||||
}
|
||||
|
||||
public boolean isRetry() {
|
||||
return isRetry;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ public final class Ttnv3UplinkMessage {
|
|||
public LoraWanUplinkMessage toUplinkMessage() {
|
||||
LoraWanUplinkMessage uplink = new LoraWanUplinkMessage(Instant.parse(receivedAt),
|
||||
endDeviceIds.applicationIds.applicationId, endDeviceIds.deviceId, uplinkMessage.fcnt,
|
||||
uplinkMessage.fport, uplinkMessage.payload, false);
|
||||
uplinkMessage.fport, uplinkMessage.payload);
|
||||
for (RxMetadata metadata : uplinkMessage.rxMetadata) {
|
||||
String id = metadata.gatewayIds.gatewayId.trim();
|
||||
if (id.isEmpty()) {
|
||||
|
|
|
@ -30,7 +30,7 @@ public final class PayloadDecoderTest {
|
|||
@Test
|
||||
public void testCayenne2() throws DecodeException {
|
||||
LoraWanUplinkMessage message = new LoraWanUplinkMessage(Instant.parse("2020-02-05T22:00:58.930936Z"), "test", "test",
|
||||
123, 1, Base64.getDecoder().decode("AYgH1ecAzV4AC7gCZwArAwIBhg=="), false);
|
||||
123, 1, Base64.getDecoder().decode("AYgH1ecAzV4AC7gCZwArAwIBhg=="));
|
||||
// decode payload
|
||||
PayloadDecoder decoder = new PayloadDecoder(EPayloadEncoding.CAYENNE);
|
||||
Sentence sentence = decoder.decode(message);
|
||||
|
|
|
@ -9,8 +9,6 @@ import org.junit.Test;
|
|||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import nl.sikken.bertrik.hab.lorawan.LoraWanUplinkMessage;
|
||||
import nl.sikken.bertrik.hab.lorawan.Ttnv3UplinkMessage;
|
||||
import nl.sikken.bertrik.hab.lorawan.LoraWanUplinkMessage.GatewayInfo;
|
||||
|
||||
public final class Ttnv3UplinkMessageTest {
|
||||
|
|
Ładowanie…
Reference in New Issue