Skip to content
New issue

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

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

Already on GitHub? # to your account

Don't use rx1droffset during join accept #1729

Merged
merged 2 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -267,7 +267,8 @@ internal async Task ProcessJoinRequestAsync(LoRaRequest request)
var joinAcceptBytes = loRaPayloadJoinAccept.Serialize(appKey);

var rx1 = windowToUse is not ReceiveWindow2
? new ReceiveWindow(loraRegion.GetDownstreamDataRate(request.RadioMetadata.DataRate, loRaDevice.ReportedRX1DROffset), freq)
// For join accept messages the RX1DROffsetvalue is ignored as the join accept message carry the settings to the device.
? new ReceiveWindow(loraRegion.GetDownstreamDataRate(request.RadioMetadata.DataRate), freq)
: (ReceiveWindow?)null;

var rx2 = new ReceiveWindow(loraRegion.GetDownstreamRX2DataRate(this.configuration.Rx2DataRate, null, deviceJoinInfo, this.logger),
Expand Down
18 changes: 9 additions & 9 deletions Tests/Unit/NetworkServer/MessageProcessorJoinTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -639,16 +639,16 @@ public async Task When_Join_With_Custom_Join_Update_Old_Desired_Properties()
[Theory]
// Base dr is 2
// In case the offset is invalid, we rollback to offset 0. for europe that means = to upstream
[InlineData(0, DR2)]
[InlineData(1, DR1)]
[InlineData(2, DR0)]
[InlineData(3, DR0)]
[InlineData(4, DR0)]
[InlineData(6, DR2)]
[InlineData(12, DR2)]
[InlineData(-2, DR2)]
public async Task When_Getting_RX1_Offset_From_Twin_Returns_JoinAccept_With_Correct_Settings_And_Behaves_Correctly(int rx1offset, DataRateIndex expectedDR)
[InlineData(0)]
[InlineData(1)]
[InlineData(2)]
[InlineData(3)]
[InlineData(4)]
[InlineData(6)]
[InlineData(-2)]
public async Task When_Getting_RX1_Offset_From_Twin_Returns_JoinAccept_With_Correct_Settings_And_Behaves_Correctly(int rx1offset)
{
var expectedDR = DR2;
var deviceGatewayID = ServerGatewayID;
var simulatedDevice = new SimulatedDevice(TestDeviceInfo.CreateOTAADevice(1, gatewayID: deviceGatewayID));
var joinRequest = simulatedDevice.CreateJoinRequest();
Expand Down