Skip to content

Commit

Permalink
Fix #554 - Remove unecessary device desired properties that are provi…
Browse files Browse the repository at this point in the history
…ded by a device model configuration (#602)
  • Loading branch information
kbeaugrand authored Apr 15, 2022
1 parent a52dbbf commit 88ab4d2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,7 @@ public void UpdateTwinStateUnderTestExpectedBehavior()
Assert.AreEqual(item.Tags[tagName], DeviceHelper.RetrieveTagValue(twin, tagName));
}

Assert.AreEqual(item.AppEUI, twin.Properties.Desired[nameof(LoRaDeviceDetails.AppEUI)].ToString());
Assert.AreEqual(item.AppKey, twin.Properties.Desired[nameof(LoRaDeviceDetails.AppKey)].ToString());
Assert.AreEqual(item.SensorDecoder, twin.Properties.Desired[nameof(LoRaDeviceDetails.SensorDecoder)].ToString());

this.mockRepository.VerifyAll();
}
Expand Down Expand Up @@ -286,7 +284,6 @@ public void UpdateTwinUseOTAAIsFalseExpectedBehavior()
Assert.AreEqual(item.AppSKey, twin.Properties.Desired[nameof(LoRaDeviceDetails.AppSKey)].ToString());
Assert.AreEqual(item.DevAddr, twin.Properties.Desired[nameof(LoRaDeviceDetails.DevAddr)].ToString());
Assert.AreEqual(item.GatewayID, twin.Properties.Desired[nameof(LoRaDeviceDetails.GatewayID)].ToString());
Assert.AreEqual(item.SensorDecoder, twin.Properties.Desired[nameof(LoRaDeviceDetails.SensorDecoder)].ToString());

this.mockRepository.VerifyAll();
}
Expand Down
16 changes: 0 additions & 16 deletions src/AzureIoTHub.Portal/Server/Mappers/LoRaDeviceMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ public void UpdateTwin(Twin twin, LoRaDeviceDetails item)
Helpers.DeviceHelper.SetTagValue(twin, nameof(item.ModelId), item.ModelId);

// Update OTAA settings
Helpers.DeviceHelper.SetDesiredProperty(twin, nameof(item.AppEUI), item.AppEUI); // TODO : Remove if provided by the model
Helpers.DeviceHelper.SetDesiredProperty(twin, nameof(item.AppKey), item.AppKey);

// Update ABP settings
Expand All @@ -117,21 +116,6 @@ public void UpdateTwin(Twin twin, LoRaDeviceDetails item)
Helpers.DeviceHelper.SetDesiredProperty(twin, nameof(item.DevAddr), item.DevAddr);

Helpers.DeviceHelper.SetDesiredProperty(twin, nameof(item.GatewayID), item.GatewayID);
Helpers.DeviceHelper.SetDesiredProperty(twin, nameof(item.SensorDecoder), item.SensorDecoder); // TODO : Remove if provided by the model

// Updates device properties
Helpers.DeviceHelper.SetDesiredProperty(twin, nameof(item.Supports32BitFCnt), item.Supports32BitFCnt); // TODO : Remove if provided by the model
Helpers.DeviceHelper.SetDesiredProperty(twin, nameof(item.RXDelay), item.RXDelay); // TODO : Remove if provided by the model
Helpers.DeviceHelper.SetDesiredProperty(twin, nameof(item.RX2DataRate), item.RX2DataRate); // TODO : Remove if provided by the model
Helpers.DeviceHelper.SetDesiredProperty(twin, nameof(item.RX1DROffset), item.RX1DROffset); // TODO : Remove if provided by the model
Helpers.DeviceHelper.SetDesiredProperty(twin, nameof(item.ABPRelaxMode), item.ABPRelaxMode); // TODO : Remove if provided by the model
Helpers.DeviceHelper.SetDesiredProperty(twin, nameof(item.KeepAliveTimeout), item.KeepAliveTimeout); // TODO : Remove if provided by the model
Helpers.DeviceHelper.SetDesiredProperty(twin, nameof(item.FCntDownStart), item.FCntDownStart); // TODO : Remove if provided by the model
Helpers.DeviceHelper.SetDesiredProperty(twin, nameof(item.FCntResetCounter), item.FCntResetCounter); // TODO : Remove if provided by the model
Helpers.DeviceHelper.SetDesiredProperty(twin, nameof(item.FCntUpStart), item.FCntUpStart); // TODO : Remove if provided by the model
Helpers.DeviceHelper.SetDesiredProperty(twin, nameof(item.Deduplication), item.Deduplication); // TODO : Remove if provided by the model
Helpers.DeviceHelper.SetDesiredProperty(twin, nameof(item.Downlink), item.Downlink); // TODO : Remove if provided by the model
Helpers.DeviceHelper.SetDesiredProperty(twin, nameof(item.PreferredWindow), item.PreferredWindow); // TODO : Remove if provided by the model

if (item.Tags != null)
{
Expand Down

0 comments on commit 88ab4d2

Please sign in to comment.