Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#3557] Implement LoRa Actility triangulated device location support #3553

Merged
merged 1 commit into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@
abstract class ActilityBaseProvider extends JsonBasedLoraProvider {
protected static final String FIELD_ACTILITY_CHANNEL = "Channel";
protected static final String FIELD_ACTILITY_FPORT = "FPort";
protected static final String FIELD_ACTILITY_DEV_ALTITUDE = "DevAlt";
protected static final String FIELD_ACTILITY_DEV_LATITUDE = "DevLAT";
protected static final String FIELD_ACTILITY_DEV_LONGITUDE = "DevLON";
protected static final String FIELD_ACTILITY_FRAME_COUNT_UPLINK = "FCntUp";
protected static final String FIELD_ACTILITY_LATITUTDE = "LrrLAT";
protected static final String FIELD_ACTILITY_LONGITUDE = "LrrLON";
protected static final String FIELD_ACTILITY_LRR = "Lrr";
protected static final String FIELD_ACTILITY_LRR_ID = "Lrrid";
protected static final String FIELD_ACTILITY_LRR_LATITUDE = "LrrLAT";
protected static final String FIELD_ACTILITY_LRR_LONGITUDE = "LrrLON";
protected static final String FIELD_ACTILITY_LRR_RSSI = "LrrRSSI";
protected static final String FIELD_ACTILITY_LRR_SNR = "LrrSNR";
protected static final String FIELD_ACTILITY_LRRS = "Lrrs";
Expand Down
sophokles73 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020, 2022 Contributors to the Eclipse Foundation
* Copyright (c) 2020, 2023 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand Down Expand Up @@ -54,6 +54,11 @@ protected LoraMetaData extractMetaData(final JsonObject rootObject) {
LoraUtils.getChildObject(rootObject, FIELD_ACTILITY_CHANNEL, String.class)
.map(this::getFrequency)
.ifPresent(data::setFrequency);
Optional.ofNullable(LoraUtils.newLocation(
LoraUtils.getChildObject(rootObject, FIELD_ACTILITY_DEV_LONGITUDE, Double.class),
LoraUtils.getChildObject(rootObject, FIELD_ACTILITY_DEV_LATITUDE, Double.class),
LoraUtils.getChildObject(rootObject, FIELD_ACTILITY_DEV_ALTITUDE, Double.class)))
.ifPresent(data::setLocation);

LoraUtils.getChildObject(rootObject, FIELD_ACTILITY_LRRS, JsonObject.class)
.map(lrrs -> lrrs.getValue(FIELD_ACTILITY_LRR))
Expand All @@ -70,8 +75,8 @@ protected LoraMetaData extractMetaData(final JsonObject rootObject) {
.ifPresent(s -> gwId.ifPresent(id -> {
if (id.equals(s)) {
Optional.ofNullable(LoraUtils.newLocation(
LoraUtils.getChildObject(rootObject, FIELD_ACTILITY_LONGITUDE, Double.class),
LoraUtils.getChildObject(rootObject, FIELD_ACTILITY_LATITUTDE, Double.class),
LoraUtils.getChildObject(rootObject, FIELD_ACTILITY_LRR_LONGITUDE, Double.class),
LoraUtils.getChildObject(rootObject, FIELD_ACTILITY_LRR_LATITUDE, Double.class),
Optional.empty()))
.ifPresent(gateway::setLocation);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2022 Contributors to the Eclipse Foundation
* Copyright (c) 2019, 2023 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand Down Expand Up @@ -58,6 +58,11 @@ protected LoraMetaData extractMetaData(final JsonObject rootObject) {
LoraUtils.getChildObject(rootObject, FIELD_ACTILITY_CHANNEL, String.class)
.map(this::getFrequency)
.ifPresent(data::setFrequency);
Optional.ofNullable(LoraUtils.newLocationFromString(
LoraUtils.getChildObject(rootObject, FIELD_ACTILITY_DEV_LONGITUDE, String.class),
LoraUtils.getChildObject(rootObject, FIELD_ACTILITY_DEV_LATITUDE, String.class),
LoraUtils.getChildObject(rootObject, FIELD_ACTILITY_DEV_ALTITUDE, String.class)))
.ifPresent(data::setLocation);

LoraUtils.getChildObject(rootObject, FIELD_ACTILITY_LRRS, JsonObject.class)
.map(lrrs -> lrrs.getValue(FIELD_ACTILITY_LRR))
Expand All @@ -74,8 +79,8 @@ protected LoraMetaData extractMetaData(final JsonObject rootObject) {
.ifPresent(s -> gwId.ifPresent(id -> {
if (id.equals(s)) {
Optional.ofNullable(LoraUtils.newLocationFromString(
LoraUtils.getChildObject(rootObject, FIELD_ACTILITY_LONGITUDE, String.class),
LoraUtils.getChildObject(rootObject, FIELD_ACTILITY_LATITUTDE, String.class),
LoraUtils.getChildObject(rootObject, FIELD_ACTILITY_LRR_LONGITUDE, String.class),
LoraUtils.getChildObject(rootObject, FIELD_ACTILITY_LRR_LATITUDE, String.class),
Optional.empty()))
.ifPresent(gateway::setLocation);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2020 Contributors to the Eclipse Foundation
* Copyright (c) 2019, 2023 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand Down Expand Up @@ -51,5 +51,9 @@ protected void assertMetaDataForUplinkMessage(final UplinkLoraMessage loraMessag
assertThat(data.getFunctionPort()).isEqualTo(2);
assertThat(data.getFrameCount()).isEqualTo(57);
assertThat(data.getFrequency()).isEqualTo(868.5);

assertThat(data.getLocation().getLatitude()).isEqualTo(61.499146);
assertThat(data.getLocation().getLongitude()).isEqualTo(23.765516);
assertThat(data.getLocation().getAltitude()).isEqualTo(0.000001);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2020 Contributors to the Eclipse Foundation
* Copyright (c) 2019, 2023 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand Down Expand Up @@ -44,8 +44,15 @@ protected void assertMetaDataForUplinkMessage(final UplinkLoraMessage loraMessag
assertThat(data.getGatewayInfo().get(0).getGatewayId()).isEqualTo("18035559");
assertThat(data.getGatewayInfo().get(0).getRssi()).isEqualTo(-48);
assertThat(data.getGatewayInfo().get(0).getSnr()).isEqualTo(3.0);
assertThat(data.getGatewayInfo().get(0).getLocation().getLatitude()).isEqualTo(53.108805);
assertThat(data.getGatewayInfo().get(0).getLocation().getLongitude()).isEqualTo(9.193430);
assertThat(data.getGatewayInfo().get(1).getGatewayId()).isEqualTo("18035560");
assertThat(data.getGatewayInfo().get(1).getRssi()).isEqualTo(-49);
assertThat(data.getGatewayInfo().get(1).getSnr()).isEqualTo(4.0);
assertThat(data.getGatewayInfo().get(1).getLocation()).isNull();

assertThat(data.getLocation().getLatitude()).isEqualTo(61.499146);
assertThat(data.getLocation().getLongitude()).isEqualTo(23.765516);
assertThat(data.getLocation().getAltitude()).isEqualTo(0.000001);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"DevLrrCnt": 1,
"Lrrid": "10000001",
"Late": 0,
"DevLAT": 61.499146,
"DevLON": 23.765516,
"DevAlt": 0.000001,
"LrrLAT": 27.831039,
"LrrLON": -97.534576,
"Lrrs": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"DevLrrCnt": "1",
"Lrrid": "18035559",
"Late": "0",
"DevLAT": "61.499146",
"DevLON": "23.765516",
"DevAlt": "0.000001",
"LrrLAT": "53.108805",
"LrrLON": "9.193430",
"Lrrs": {
Expand Down
1 change: 1 addition & 0 deletions legal/src/main/resources/legal/NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/
* Copyright 2020 Lari Hotari
* Copyright 2022-2023 SOTEC GmbH & Co KG
* Copyright 2023 Controlant hf.
* Copyright 2023 Harri Smått

# Third-party Content

Expand Down