From f1a532942e0f825cb7b07e8d2cc353b5398d036a Mon Sep 17 00:00:00 2001 From: Kevin BEAUGRAND <9513635+kbeaugrand@users.noreply.github.com> Date: Sat, 12 Mar 2022 12:48:40 +0100 Subject: [PATCH] Update lora device model properties and layout --- .../DeviceModelCommandsControllerTests.cs | 2 +- .../DeviceModelPropertiesControllerTests.cs | 2 +- .../v1.0/DeviceModelsControllerTests.cs | 2 +- .../v1.0/DeviceTagSettingsControllerTest.cs | 2 +- .../v1.0/DevicesControllerTests.cs | 14 +- .../v1.0/EdgeDevicesControllerTests.cs | 2 +- .../LoRaWANConcentratorsControllerTest.cs | 2 +- ...WANDeviceModelPropertiesControllerTests.cs | 2 +- .../LoRaWAN/LoRaWANDevicesControllerTests.cs | 10 +- .../v1.0/SettingsControllerTest.cs | 2 +- .../Helpers/DeviceHelperTests.cs | 10 +- .../DeviceModelCommandsManagerTests.cs | 4 +- .../Mappers/ConcentratorTwinMapperTests.cs | 2 +- .../Mappers/DeviceModelCommandMapperTests.cs | 2 +- .../Mappers/DeviceModelMapperTests.cs | 2 +- .../Mappers/DeviceTagMapperTests.cs | 2 +- .../Mappers/DeviceTwinMapperTests.cs | 2 +- .../Mappers/LoRaDeviceModelMapperTests.cs | 2 +- .../Mappers/LoRaDeviceTwinMapperTests.cs | 2 +- .../Pages/Devices/DevicesListPageTests.cs | 4 +- .../CreateDeviceModelPageTests.cs | 4 +- .../DeviceModelDetailsPageTests.cs | 6 +- .../DevicesModels/DeviceModelListPageTests.cs | 5 +- .../Services/DeviceTagServiceTest.cs | 2 +- .../Pages/Configurations/ConfigDetail.razor | 2 +- .../Client/Pages/Configurations/Configs.razor | 2 +- .../Pages/Configurations/ModuleDetail.razor | 2 +- .../DeviceModels/CreateDeviceModelPage.razor | 6 +- .../DeviceModels/DeleteDeviceModelPage.razor | 2 +- .../DeviceModels/DeviceModelDetailPage.razor | 6 +- .../DeviceModels/DeviceModelListPage.razor | 5 +- .../LoRaWAN/CreateLoraDeviceModel.razor | 252 +++++++++--------- .../LoRaWAN/EditLoraDeviceModel.razor | 81 +++--- .../Devices/ConnectionStringDialog.razor | 2 +- .../Pages/Devices/CreateDevicePage.razor | 8 +- .../Pages/Devices/DeleteDevicePage.razor | 2 +- .../Pages/Devices/DeviceDetailPage.razor | 8 +- .../Client/Pages/Devices/DeviceListPage.razor | 6 +- .../Devices/LoRaWAN/CreateLoraDevice.razor | 6 +- .../Devices/LoRaWAN/EditLoraDevice.razor | 40 +-- .../Edge_Devices/ConnectionStringDialog.razor | 2 +- .../Edge_Devices/CreateEdgeDeviceDialog.razor | 2 +- .../EdgeDeviceDeleteConfirmationDialog.razor | 2 +- .../Edge_Devices/EdgeDeviceDetailPage.razor | 2 +- .../Edge_Devices/EdgeDeviceListPage.razor | 2 +- .../Pages/Edge_Devices/ModuleLogsDialog.razor | 2 +- .../Concentrator/ConcentratorDetailPage.razor | 2 +- .../Concentrator/ConcentratorListPage.razor | 2 +- .../Concentrator/CreateConcentratorPage.razor | 2 +- .../Concentrator/DeleteConcentratorPage.razor | 2 +- .../Pages/Settings/DeviceTagsPage.razor | 2 +- src/AzureIoTHub.Portal/Client/Program.cs | 2 +- .../Client/Shared/MainLayout.razor | 2 +- .../Client/Shared/NavMenu.razor | 2 +- .../Validators/DeviceDetailsValidator.cs | 8 +- .../Client/Validators/DeviceModelValidator.cs | 6 +- .../Validators/DevicePropertyValidator.cs | 2 +- .../Validators/LoRaDeviceDetailsValidator.cs | 10 +- .../Validators/LoRaDeviceModelValidator.cs | 6 +- .../v1.0/DeviceModelControllerBase.cs | 2 +- .../v1.0/DeviceModelPropertiesController.cs | 2 +- .../DeviceModelPropertiesControllerBase.cs | 2 +- .../v1.0/DeviceModelsController.cs | 2 +- .../v1.0/DeviceTagSettingsController.cs | 2 +- .../Controllers/v1.0/DevicesController.cs | 4 +- .../Controllers/v1.0/DevicesControllerBase.cs | 8 +- .../v1.0/EdgeConfigurationsController.cs | 30 +-- .../Controllers/v1.0/EdgeDevicesController.cs | 4 +- .../v1.0/LoRaWAN/LoRaWANCommandsController.cs | 2 +- .../LoRaWAN/LoRaWANConcentratorsController.cs | 2 +- .../LoRaWANDeviceModelPropertiesController.cs | 2 +- .../LoRaWAN/LoRaWANDeviceModelsController.cs | 4 +- .../v1.0/LoRaWAN/LoRaWANDevicesController.cs | 6 +- .../Controllers/v1.0/SettingsController.cs | 2 +- .../Server/Helpers/ConfigHelper.cs | 14 +- .../Server/Helpers/DeviceHelper.cs | 18 +- .../Managers/DeviceModelCommandsManager.cs | 4 +- .../DeviceProvisioningServiceManager.cs | 2 +- .../Managers/IDeviceModelCommandsManager.cs | 4 +- .../IDeviceProvisioningServiceManager.cs | 2 +- .../Managers/ILoraDeviceMethodManager.cs | 2 +- .../Server/Managers/IRouterConfigManager.cs | 2 +- .../Managers/LoraDeviceMethodManager.cs | 6 +- .../Server/Managers/RouterConfigManager.cs | 2 +- .../Server/Mappers/ConcentratorTwinMapper.cs | 2 +- .../Mappers/DeviceModelCommandMapper.cs | 2 +- .../Server/Mappers/DeviceModelMapper.cs | 2 +- .../Server/Mappers/DevicePropertyProfile.cs | 8 +- .../Server/Mappers/DeviceTagMapper.cs | 8 +- .../Server/Mappers/DeviceTwinMapper.cs | 14 +- .../Server/Mappers/IConcentratorTwinMapper.cs | 2 +- .../Mappers/IDeviceModelCommandMapper.cs | 2 +- .../Server/Mappers/IDeviceModelMapper.cs | 2 +- .../Server/Mappers/IDeviceTagMapper.cs | 7 +- .../Server/Mappers/IDeviceTwinMapper.cs | 8 +- .../Server/Mappers/LoRaDeviceMapper.cs | 10 +- .../Server/Mappers/LoRaDeviceModelMapper.cs | 11 +- .../Server/Services/DeviceTagService.cs | 2 +- .../Server/Services/IDeviceTagService.cs | 9 +- src/AzureIoTHub.Portal/Server/Startup.cs | 8 +- .../Shared/Models/v1.0/C2Dresult.cs | 2 +- .../Shared/Models/v1.0/ConfigItem.cs | 9 +- .../Shared/Models/v1.0/ConfigListItem.cs | 2 +- .../Models/v1.0/Device/DeviceDetails.cs | 2 +- .../Models/v1.0/Device/DeviceListItem.cs | 2 +- .../Shared/Models/v1.0/Device/DeviceTag.cs | 2 +- .../Models/v1.0/DeviceModel/DeviceModel.cs | 2 +- .../Shared/Models/v1.0/DeviceProperty.cs | 8 +- .../Models/v1.0/EnrollmentCredentials.cs | 9 +- .../Shared/Models/v1.0/IoTEdgeDevice.cs | 4 +- .../Shared/Models/v1.0/IoTEdgeListItem.cs | 8 +- .../Shared/Models/v1.0/IoTEdgeModule.cs | 2 +- .../Shared/Models/v1.0/LoRaWAN/ClassType.cs | 1 - .../v1.0/LoRaWAN/Concentrator/Channel.cs | 2 +- .../v1.0/LoRaWAN/Concentrator/Concentrator.cs | 2 +- .../v1.0/LoRaWAN/Concentrator/RouterConfig.cs | 2 +- .../Models/v1.0/LoRaWAN/DeduplicationMode.cs | 15 ++ .../Models/v1.0/LoRaWAN/LoRaDevice/Command.cs | 2 +- .../LoRaWAN/LoRaDevice/LoRaDeviceDetails.cs | 8 +- .../Models/v1.0/LoRaWAN/LoRaDeviceBase.cs | 17 +- .../LoRaDeviceModel/DeviceModelCommand.cs | 2 +- .../LoRaDeviceModel/LoRaDeviceModel.cs | 7 +- .../v1.0/LoRaWAN/LoRaDeviceModelBase.cs | 8 +- .../Shared/Models/v1.0/PortalSettings.cs | 2 +- .../Shared/Models/v1.0/SearchModel.cs | 8 +- 125 files changed, 488 insertions(+), 446 deletions(-) create mode 100644 src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/DeduplicationMode.cs diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/DeviceModelCommandsControllerTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/DeviceModelCommandsControllerTests.cs index f88b39c18..ce7c95db2 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/DeviceModelCommandsControllerTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/DeviceModelCommandsControllerTests.cs @@ -8,7 +8,7 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Controllers.V10 using AzureIoTHub.Portal.Server.Controllers.V10.LoRaWAN; using AzureIoTHub.Portal.Server.Factories; using AzureIoTHub.Portal.Server.Mappers; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/DeviceModelPropertiesControllerTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/DeviceModelPropertiesControllerTests.cs index 1467fe8d0..2466c179d 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/DeviceModelPropertiesControllerTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/DeviceModelPropertiesControllerTests.cs @@ -13,7 +13,7 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Controllers.V10 using AzureIoTHub.Portal.Server.Controllers.V10; using AzureIoTHub.Portal.Server.Entities; using AzureIoTHub.Portal.Server.Factories; - using AzureIoTHub.Portal.Shared.Models.V10; + using AzureIoTHub.Portal.Shared.Models.v10; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/DeviceModelsControllerTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/DeviceModelsControllerTests.cs index 3f09c45f5..4f96e743e 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/DeviceModelsControllerTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/DeviceModelsControllerTests.cs @@ -18,7 +18,7 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Controllers.V10 using AzureIoTHub.Portal.Server.Managers; using AzureIoTHub.Portal.Server.Mappers; using AzureIoTHub.Portal.Server.Services; - using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.Devices.Provisioning.Service; diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/DeviceTagSettingsControllerTest.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/DeviceTagSettingsControllerTest.cs index 4860cc2d8..4763b45a2 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/DeviceTagSettingsControllerTest.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/DeviceTagSettingsControllerTest.cs @@ -8,7 +8,7 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Controllers.V10 using System.Threading.Tasks; using AzureIoTHub.Portal.Server.Controllers.V10; using AzureIoTHub.Portal.Server.Services; - using AzureIoTHub.Portal.Shared.Models.V10.Device; + using AzureIoTHub.Portal.Shared.Models.v10.Device; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Moq; diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/DevicesControllerTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/DevicesControllerTests.cs index 3c3418868..0bdcb4339 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/DevicesControllerTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/DevicesControllerTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) CGI France. All rights reserved. +// Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace AzureIoTHub.Portal.Server.Tests.Unit.Controllers.V10 @@ -15,9 +15,9 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Controllers.V10 using AzureIoTHub.Portal.Server.Managers; using AzureIoTHub.Portal.Server.Mappers; using AzureIoTHub.Portal.Server.Services; - using AzureIoTHub.Portal.Shared.Models.V10; - using AzureIoTHub.Portal.Shared.Models.V10.Device; - using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10; + using AzureIoTHub.Portal.Shared.Models.v10.Device; + using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.Devices; using Microsoft.Azure.Devices.Shared; @@ -79,13 +79,13 @@ public async Task GetListStateUnderTestExpectedBehavior() Tags = twinCollection })); - _ = this.mockDeviceTwinMapper.Setup(c => c.CreateDeviceListItem(It.IsAny(),It.IsAny>())) - .Returns>((x,y) => new DeviceListItem + _ = this.mockDeviceTwinMapper.Setup(c => c.CreateDeviceListItem(It.IsAny(), It.IsAny>())) + .Returns>((x, y) => new DeviceListItem { DeviceID = x.DeviceId }); - this.mockDeviceTagService.Setup(c => c.GetAllSearchableTagsNames()) + _ = this.mockDeviceTagService.Setup(c => c.GetAllSearchableTagsNames()) .Returns(new List()); // Act diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/EdgeDevicesControllerTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/EdgeDevicesControllerTests.cs index 61fe2a5da..9bb3cdeae 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/EdgeDevicesControllerTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/EdgeDevicesControllerTests.cs @@ -9,7 +9,7 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Controllers.V10 using AzureIoTHub.Portal.Server.Controllers.V10; using AzureIoTHub.Portal.Server.Managers; using AzureIoTHub.Portal.Server.Services; - using AzureIoTHub.Portal.Shared.Models.V10; + using AzureIoTHub.Portal.Shared.Models.v10; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.Devices; using Microsoft.Azure.Devices.Common.Exceptions; diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/LoRaWAN/LoRaWANConcentratorsControllerTest.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/LoRaWAN/LoRaWANConcentratorsControllerTest.cs index 9181e1a12..25b0f1f1d 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/LoRaWAN/LoRaWANConcentratorsControllerTest.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/LoRaWAN/LoRaWANConcentratorsControllerTest.cs @@ -11,7 +11,7 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Controllers.V10.LoRaWAN using AzureIoTHub.Portal.Server.Managers; using AzureIoTHub.Portal.Server.Mappers; using AzureIoTHub.Portal.Server.Services; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.Concentrator; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.Concentrator; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.Devices; using Microsoft.Azure.Devices.Shared; diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/LoRaWAN/LoRaWANDeviceModelPropertiesControllerTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/LoRaWAN/LoRaWANDeviceModelPropertiesControllerTests.cs index 6bbca73de..c1a6a1f55 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/LoRaWAN/LoRaWANDeviceModelPropertiesControllerTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/LoRaWAN/LoRaWANDeviceModelPropertiesControllerTests.cs @@ -13,7 +13,7 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Controllers.V10 using AzureIoTHub.Portal.Server.Controllers.V10; using AzureIoTHub.Portal.Server.Entities; using AzureIoTHub.Portal.Server.Factories; - using AzureIoTHub.Portal.Shared.Models.V10; + using AzureIoTHub.Portal.Shared.Models.v10; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/LoRaWAN/LoRaWANDevicesControllerTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/LoRaWAN/LoRaWANDevicesControllerTests.cs index b6799a10e..5d1b85bdb 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/LoRaWAN/LoRaWANDevicesControllerTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/LoRaWAN/LoRaWANDevicesControllerTests.cs @@ -10,9 +10,9 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Controllers.V10.LoRaWAN using AzureIoTHub.Portal.Server.Managers; using AzureIoTHub.Portal.Server.Mappers; using AzureIoTHub.Portal.Server.Services; - using AzureIoTHub.Portal.Shared.Models.V10.Device; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDevice; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.Device; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDevice; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.Devices; using Microsoft.Azure.Devices.Shared; @@ -233,12 +233,12 @@ public async Task GetListStateUnderTestExpectedBehavior() })); _ = this.mockDeviceTwinMapper.Setup(c => c.CreateDeviceListItem(It.IsAny(), It.IsAny>())) - .Returns>((x,y) => new DeviceListItem + .Returns>((x, y) => new DeviceListItem { DeviceID = x.DeviceId }); - this.mockDeviceTagService.Setup(c => c.GetAllSearchableTagsNames()) + _ = this.mockDeviceTagService.Setup(c => c.GetAllSearchableTagsNames()) .Returns(new List()); // Act diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/SettingsControllerTest.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/SettingsControllerTest.cs index c638df447..a3f836975 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/SettingsControllerTest.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Controllers/v1.0/SettingsControllerTest.cs @@ -6,7 +6,7 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Controllers.V10 using System; using AzureIoTHub.Portal.Server.Controllers.V10; using AzureIoTHub.Portal.Server.Identity; - using AzureIoTHub.Portal.Shared.Models.V10; + using AzureIoTHub.Portal.Shared.Models.v10; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; using Moq; diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Helpers/DeviceHelperTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Helpers/DeviceHelperTests.cs index cf523059d..3a3a9d53e 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Helpers/DeviceHelperTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Helpers/DeviceHelperTests.cs @@ -241,10 +241,8 @@ public void RetrieveRuntimeResponseShouldReturnEdgeAgentSystemModuleRuntimeStatu } }; - string deviceId = null; - // Act - var result = DeviceHelper.RetrieveRuntimeResponse(twin, deviceId); + var result = DeviceHelper.RetrieveRuntimeResponse(twin); // Assert Assert.AreEqual(runtimeStatus, result); @@ -257,7 +255,7 @@ public void WhenSystemModulesNotExistRetrieveRuntimeResponseShouldReturnEmptyStr var twin = new Twin(); // Act - var result = DeviceHelper.RetrieveRuntimeResponse(twin, "aaa"); + var result = DeviceHelper.RetrieveRuntimeResponse(twin); // Assert Assert.IsEmpty(result); @@ -272,7 +270,7 @@ public void WhenEdgeAgentNotExistRetrieveRuntimeResponseShouldReturnEmptyString( { }; // Act - var result = DeviceHelper.RetrieveRuntimeResponse(twin, "aaa"); + var result = DeviceHelper.RetrieveRuntimeResponse(twin); // Assert Assert.IsEmpty(result); @@ -291,7 +289,7 @@ public void WhenRuntimeStatusNotExistRetrieveRuntimeResponseShouldReturnEmptyStr }; // Act - var result = DeviceHelper.RetrieveRuntimeResponse(twin, "aaa"); + var result = DeviceHelper.RetrieveRuntimeResponse(twin); // Assert Assert.IsEmpty(result); diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Managers/DeviceModelCommandsManagerTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Managers/DeviceModelCommandsManagerTests.cs index 7555fd469..cea8f474b 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Managers/DeviceModelCommandsManagerTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Managers/DeviceModelCommandsManagerTests.cs @@ -10,8 +10,8 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Managers using AzureIoTHub.Portal.Server.Factories; using AzureIoTHub.Portal.Server.Managers; using AzureIoTHub.Portal.Server.Mappers; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDevice; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDevice; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel; using Moq; using NUnit.Framework; diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/ConcentratorTwinMapperTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/ConcentratorTwinMapperTests.cs index 785147b4f..11b13b1b4 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/ConcentratorTwinMapperTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/ConcentratorTwinMapperTests.cs @@ -6,7 +6,7 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Mappers using AzureIoTHub.Portal.Server.Extensions; using AzureIoTHub.Portal.Server.Helpers; using AzureIoTHub.Portal.Server.Mappers; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.Concentrator; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.Concentrator; using Microsoft.Azure.Devices.Shared; using Microsoft.Extensions.Configuration; using Moq; diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/DeviceModelCommandMapperTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/DeviceModelCommandMapperTests.cs index e3b1afd2c..a43ad2dfd 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/DeviceModelCommandMapperTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/DeviceModelCommandMapperTests.cs @@ -5,7 +5,7 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Mappers { using Azure.Data.Tables; using AzureIoTHub.Portal.Server.Mappers; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel; using Moq; using NUnit.Framework; diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/DeviceModelMapperTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/DeviceModelMapperTests.cs index 6d659b216..d48a3fad0 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/DeviceModelMapperTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/DeviceModelMapperTests.cs @@ -7,7 +7,7 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Mappers using Azure.Data.Tables; using AzureIoTHub.Portal.Server.Managers; using AzureIoTHub.Portal.Server.Mappers; - using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel; using Moq; using NUnit.Framework; diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/DeviceTagMapperTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/DeviceTagMapperTests.cs index 3874aaeed..e22b56663 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/DeviceTagMapperTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/DeviceTagMapperTests.cs @@ -5,7 +5,7 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Mappers { using Azure.Data.Tables; using AzureIoTHub.Portal.Server.Mappers; - using AzureIoTHub.Portal.Shared.Models.V10.Device; + using AzureIoTHub.Portal.Shared.Models.v10.Device; using Moq; using NUnit.Framework; diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/DeviceTwinMapperTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/DeviceTwinMapperTests.cs index 01df4757c..10836bbc8 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/DeviceTwinMapperTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/DeviceTwinMapperTests.cs @@ -10,7 +10,7 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Mappers using AzureIoTHub.Portal.Server.Helpers; using AzureIoTHub.Portal.Server.Managers; using AzureIoTHub.Portal.Server.Mappers; - using AzureIoTHub.Portal.Shared.Models.V10.Device; + using AzureIoTHub.Portal.Shared.Models.v10.Device; using Microsoft.Azure.Devices.Shared; using Moq; using NUnit.Framework; diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/LoRaDeviceModelMapperTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/LoRaDeviceModelMapperTests.cs index 764008a49..db0804a50 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/LoRaDeviceModelMapperTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/LoRaDeviceModelMapperTests.cs @@ -7,7 +7,7 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Mappers using Azure.Data.Tables; using AzureIoTHub.Portal.Server.Managers; using AzureIoTHub.Portal.Server.Mappers; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel; using Moq; using NUnit.Framework; diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/LoRaDeviceTwinMapperTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/LoRaDeviceTwinMapperTests.cs index 2900040d9..e72241401 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/LoRaDeviceTwinMapperTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/LoRaDeviceTwinMapperTests.cs @@ -6,7 +6,7 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Mappers using AzureIoTHub.Portal.Server.Helpers; using AzureIoTHub.Portal.Server.Managers; using AzureIoTHub.Portal.Server.Mappers; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDevice; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDevice; using Microsoft.Azure.Devices.Shared; using Moq; using NUnit.Framework; diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Pages/Devices/DevicesListPageTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Pages/Devices/DevicesListPageTests.cs index ceddf2747..7a5cedb5e 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Pages/Devices/DevicesListPageTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Pages/Devices/DevicesListPageTests.cs @@ -8,8 +8,8 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Pages using System.Threading.Tasks; using AzureIoTHub.Portal.Client.Pages.Devices; using AzureIoTHub.Portal.Server.Tests.Unit.Helpers; - using AzureIoTHub.Portal.Shared.Models.V10; - using AzureIoTHub.Portal.Shared.Models.V10.Device; + using AzureIoTHub.Portal.Shared.Models.v10; + using AzureIoTHub.Portal.Shared.Models.v10.Device; using Bunit; using Bunit.TestDoubles; using FluentAssertions.Extensions; diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Pages/DevicesModels/CreateDeviceModelPageTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Pages/DevicesModels/CreateDeviceModelPageTests.cs index e7d0b1e15..4058407f6 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Pages/DevicesModels/CreateDeviceModelPageTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Pages/DevicesModels/CreateDeviceModelPageTests.cs @@ -11,8 +11,8 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Pages using AzureIoTHub.Portal.Client.Pages.DeviceModels; using AzureIoTHub.Portal.Server.Tests.Unit.Helpers; using AzureIoTHub.Portal.Shared.Models; - using AzureIoTHub.Portal.Shared.Models.V10; - using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10; + using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel; using Bunit; using Bunit.TestDoubles; using Microsoft.AspNetCore.Components; diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Pages/DevicesModels/DeviceModelDetailsPageTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Pages/DevicesModels/DeviceModelDetailsPageTests.cs index f627a187c..1e6be0a1e 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Pages/DevicesModels/DeviceModelDetailsPageTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Pages/DevicesModels/DeviceModelDetailsPageTests.cs @@ -13,9 +13,9 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Pages using AzureIoTHub.Portal.Client.Pages.DeviceModels; using AzureIoTHub.Portal.Server.Tests.Unit.Helpers; using AzureIoTHub.Portal.Shared.Models; - using AzureIoTHub.Portal.Shared.Models.V10; - using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10; + using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel; using Bunit; using Bunit.TestDoubles; using FluentAssertions.Extensions; diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Pages/DevicesModels/DeviceModelListPageTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Pages/DevicesModels/DeviceModelListPageTests.cs index f4a43f0a0..2ea025a0d 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Pages/DevicesModels/DeviceModelListPageTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Pages/DevicesModels/DeviceModelListPageTests.cs @@ -7,10 +7,9 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Pages using System.Net.Http; using AzureIoTHub.Portal.Client.Pages.DeviceModels; using AzureIoTHub.Portal.Server.Tests.Unit.Helpers; - using AzureIoTHub.Portal.Shared.Models.V10; - using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10; + using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel; using Bunit; - using Bunit.TestDoubles; using Microsoft.AspNetCore.Components; using Microsoft.Extensions.DependencyInjection; using Moq; diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Services/DeviceTagServiceTest.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Services/DeviceTagServiceTest.cs index a0c0f4696..a0be055c0 100644 --- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Services/DeviceTagServiceTest.cs +++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Services/DeviceTagServiceTest.cs @@ -13,7 +13,7 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Services using AzureIoTHub.Portal.Server.Factories; using AzureIoTHub.Portal.Server.Mappers; using AzureIoTHub.Portal.Server.Services; - using AzureIoTHub.Portal.Shared.Models.V10.Device; + using AzureIoTHub.Portal.Shared.Models.v10.Device; using Moq; using NUnit.Framework; diff --git a/src/AzureIoTHub.Portal/Client/Pages/Configurations/ConfigDetail.razor b/src/AzureIoTHub.Portal/Client/Pages/Configurations/ConfigDetail.razor index 620b0a9d8..0d1be486e 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Configurations/ConfigDetail.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Configurations/ConfigDetail.razor @@ -1,7 +1,7 @@ @page "/edge/configurations/{ConfigurationID}" @using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Components.WebAssembly.Authentication -@using AzureIoTHub.Portal.Shared.Models.V10 +@using AzureIoTHub.Portal.Shared.Models.v10 @using System.Text.RegularExpressions; @using System.Collections.Generic; @attribute [Authorize] diff --git a/src/AzureIoTHub.Portal/Client/Pages/Configurations/Configs.razor b/src/AzureIoTHub.Portal/Client/Pages/Configurations/Configs.razor index 6ef207252..95e177a45 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Configurations/Configs.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Configurations/Configs.razor @@ -1,7 +1,7 @@ @page "/edge/configurations" @using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Components.WebAssembly.Authentication -@using AzureIoTHub.Portal.Shared.Models.V10 +@using AzureIoTHub.Portal.Shared.Models.v10 @attribute [Authorize] @inject HttpClient Http @inject IDialogService DialogService diff --git a/src/AzureIoTHub.Portal/Client/Pages/Configurations/ModuleDetail.razor b/src/AzureIoTHub.Portal/Client/Pages/Configurations/ModuleDetail.razor index f28e92f80..1639d0119 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Configurations/ModuleDetail.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Configurations/ModuleDetail.razor @@ -1,4 +1,4 @@ -@using AzureIoTHub.Portal.Shared.Models.V10 +@using AzureIoTHub.Portal.Shared.Models.v10 @inject HttpClient Http @inject IJSRuntime JS @inject ISnackbar Snackbar diff --git a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/CreateDeviceModelPage.razor b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/CreateDeviceModelPage.razor index 864803d3d..3591e1749 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/CreateDeviceModelPage.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/CreateDeviceModelPage.razor @@ -6,9 +6,9 @@ @using AzureIoTHub.Portal.Client.Pages.DeviceModels.LoRaWAN @using AzureIoTHub.Portal.Client.Validators @using AzureIoTHub.Portal.Shared.Models -@using AzureIoTHub.Portal.Shared.Models.V10 -@using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel -@using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel +@using AzureIoTHub.Portal.Shared.Models.v10 +@using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel +@using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel @using Blazored.Modal @using Blazored.Modal.Services @using Microsoft.AspNetCore.Authorization diff --git a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/DeleteDeviceModelPage.razor b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/DeleteDeviceModelPage.razor index e5c724a6f..88bffe1ed 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/DeleteDeviceModelPage.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/DeleteDeviceModelPage.razor @@ -1,4 +1,4 @@ -@using AzureIoTHub.Portal.Shared.Models.V10.Device +@using AzureIoTHub.Portal.Shared.Models.v10.Device @inject HttpClient Http @inject IJSRuntime JS @inject ISnackbar Snackbar diff --git a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/DeviceModelDetailPage.razor b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/DeviceModelDetailPage.razor index 45e801026..34ad5f23f 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/DeviceModelDetailPage.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/DeviceModelDetailPage.razor @@ -7,9 +7,9 @@ @using AzureIoTHub.Portal.Client.Pages.DeviceModels.LoRaWAN @using AzureIoTHub.Portal.Client.Validators @using AzureIoTHub.Portal.Shared.Models -@using AzureIoTHub.Portal.Shared.Models.V10 -@using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel -@using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel +@using AzureIoTHub.Portal.Shared.Models.v10 +@using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel +@using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel @using Blazored.Modal @using Blazored.Modal.Services @using Microsoft.AspNetCore.Authorization diff --git a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/DeviceModelListPage.razor b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/DeviceModelListPage.razor index 93deb645a..fda971528 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/DeviceModelListPage.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/DeviceModelListPage.razor @@ -1,9 +1,8 @@ @page "/device-models" -@using AzureIoTHub.Portal.Shared.Models.V10 -@using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel +@using AzureIoTHub.Portal.Shared.Models.v10 +@using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel @using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Components.WebAssembly.Authentication -@using AzureIoTHub.Portal.Shared.Models.V10 @using System.Net.Http.Json @using Blazored.Modal @using Blazored.Modal.Services diff --git a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/LoRaWAN/CreateLoraDeviceModel.razor b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/LoRaWAN/CreateLoraDeviceModel.razor index 3ca0491b3..de8e6a4fe 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/LoRaWAN/CreateLoraDeviceModel.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/LoRaWAN/CreateLoraDeviceModel.razor @@ -1,4 +1,5 @@ -@using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel +@using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel +@using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN @@ -9,148 +10,151 @@ - - - @(LoRaDeviceModel.UseOTAA ? "OTAA setting enable" : "APB setting enable") - - - - - @if (LoRaDeviceModel.UseOTAA) - { - - + + + @(LoRaDeviceModel.UseOTAA ? "OTAA setting enable" : "APB setting enable") - } - else - { - - + + - } - - - - + + + @foreach (ClassType item in Enum.GetValues(typeof(ClassType))) + { + @item + } + + + + + @foreach (DeduplicationMode item in Enum.GetValues(typeof(DeduplicationMode))) + { + @item + } + + + - - - - - - - - - - - - - + + + @if (LoRaDeviceModel.UseOTAA) + { + + + + } + + + + - - - - - - - - - + + + + + + - - - - + - Test RX Thingy - - - - - - - - - - - - - + Receive Windows + + + + + @if (LoRaDeviceModel.Downlink.HasValue && LoRaDeviceModel.Downlink.Value) + { + + + + + + + + + + + + + } + - Test Counter Thingy - - - - - - - - - - - - - - - - - + Frame Counters + + + + + + + + @if (LoRaDeviceModel.Downlink.HasValue && LoRaDeviceModel.Downlink.Value) + { + + + + + + + } + - - - - - Commands - - - - - - - - - - Name - Frame - Port - Delete - - - - - - - - - - - - - - - - - - - - - - - Add Command - - - + + @if (LoRaDeviceModel.Downlink.HasValue && LoRaDeviceModel.Downlink.Value) + { + + + + Commands + + + + + + + + + + Name + Frame + Port + Delete + + + + + + + + + + + + + + + + + Add Command + + + + } Save Changes diff --git a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/LoRaWAN/EditLoraDeviceModel.razor b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/LoRaWAN/EditLoraDeviceModel.razor index f88ed2bab..2f5320ccf 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/LoRaWAN/EditLoraDeviceModel.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/LoRaWAN/EditLoraDeviceModel.razor @@ -1,4 +1,5 @@ -@using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel +@using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel +@using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN @@ -10,40 +11,55 @@ - @(LoRaDeviceModel.UseOTAA ? "OTAA setting enable" : "APB setting enable") + + + @(LoRaDeviceModel.UseOTAA ? "OTAA setting enable" : "APB setting enable") + + + + + + + @foreach (ClassType item in Enum.GetValues(typeof(ClassType))) + { + @item + } + + + + + @foreach (DeduplicationMode item in Enum.GetValues(typeof(DeduplicationMode))) + { + @item + } + + + - @if (LoRaDeviceModel.UseOTAA) { - - - } - else - { - - + } - + - - - - - - - - + + @@ -60,16 +76,19 @@ @if (LoRaDeviceModel.Downlink.HasValue && LoRaDeviceModel.Downlink.Value) { - + + 1 + 2 + - + - + - + } @@ -79,24 +98,24 @@ Frame Counters - + - + @if (LoRaDeviceModel.Downlink.HasValue && LoRaDeviceModel.Downlink.Value) { - + - + } - + @if (LoRaDeviceModel.Downlink.HasValue && LoRaDeviceModel.Downlink.Value) @@ -121,13 +140,13 @@ - + - + - + diff --git a/src/AzureIoTHub.Portal/Client/Pages/Devices/ConnectionStringDialog.razor b/src/AzureIoTHub.Portal/Client/Pages/Devices/ConnectionStringDialog.razor index 5c8805f6c..8a06c2a27 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Devices/ConnectionStringDialog.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Devices/ConnectionStringDialog.razor @@ -1,6 +1,6 @@ @using AzureIoTHub.Portal.Client.Services @using Microsoft.AspNetCore.Authorization -@using AzureIoTHub.Portal.Shared.Models.V10 +@using AzureIoTHub.Portal.Shared.Models.v10 @inject HttpClient Http @inject ISnackbar Snackbar diff --git a/src/AzureIoTHub.Portal/Client/Pages/Devices/CreateDevicePage.razor b/src/AzureIoTHub.Portal/Client/Pages/Devices/CreateDevicePage.razor index f33c092b5..a1cc8d26b 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Devices/CreateDevicePage.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Devices/CreateDevicePage.razor @@ -1,10 +1,10 @@ @page "/devices/new" @using AzureIoTHub.Portal.Client.Pages.Devices.LoRaWAN @using AzureIoTHub.Portal.Client.Validators -@using AzureIoTHub.Portal.Shared.Models.V10.Device -@using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel -@using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDevice -@using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel +@using AzureIoTHub.Portal.Shared.Models.v10.Device +@using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel +@using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDevice +@using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel @using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Components.WebAssembly.Authentication diff --git a/src/AzureIoTHub.Portal/Client/Pages/Devices/DeleteDevicePage.razor b/src/AzureIoTHub.Portal/Client/Pages/Devices/DeleteDevicePage.razor index 08767580d..195b08f5b 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Devices/DeleteDevicePage.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Devices/DeleteDevicePage.razor @@ -1,4 +1,4 @@ -@using AzureIoTHub.Portal.Shared.Models.V10.Device +@using AzureIoTHub.Portal.Shared.Models.v10.Device @inject HttpClient Http @inject IJSRuntime JS diff --git a/src/AzureIoTHub.Portal/Client/Pages/Devices/DeviceDetailPage.razor b/src/AzureIoTHub.Portal/Client/Pages/Devices/DeviceDetailPage.razor index d6d84bf8d..4113dd8ad 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Devices/DeviceDetailPage.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Devices/DeviceDetailPage.razor @@ -1,10 +1,10 @@ @page "/devices/{DeviceID}" @using AzureIoTHub.Portal.Client.Pages.Devices.LoRaWAN @using AzureIoTHub.Portal.Client.Validators -@using AzureIoTHub.Portal.Shared.Models.V10.Device -@using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel -@using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDevice -@using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel +@using AzureIoTHub.Portal.Shared.Models.v10.Device +@using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel +@using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDevice +@using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel @using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Components.WebAssembly.Authentication diff --git a/src/AzureIoTHub.Portal/Client/Pages/Devices/DeviceListPage.razor b/src/AzureIoTHub.Portal/Client/Pages/Devices/DeviceListPage.razor index 662eab742..9fc7aa2ae 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Devices/DeviceListPage.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Devices/DeviceListPage.razor @@ -1,7 +1,7 @@ @page "/devices" -@using AzureIoTHub.Portal.Shared.Models.V10 -@using AzureIoTHub.Portal.Shared.Models.V10.Device -@using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel +@using AzureIoTHub.Portal.Shared.Models.v10 +@using AzureIoTHub.Portal.Shared.Models.v10.Device +@using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel @using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Components.WebAssembly.Authentication diff --git a/src/AzureIoTHub.Portal/Client/Pages/Devices/LoRaWAN/CreateLoraDevice.razor b/src/AzureIoTHub.Portal/Client/Pages/Devices/LoRaWAN/CreateLoraDevice.razor index b6f12ea31..7336fe88f 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Devices/LoRaWAN/CreateLoraDevice.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Devices/LoRaWAN/CreateLoraDevice.razor @@ -1,7 +1,7 @@ @using AzureIoTHub.Portal.Client.Validators -@using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDevice -@using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel -@using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel +@using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDevice +@using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel +@using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel diff --git a/src/AzureIoTHub.Portal/Client/Pages/Devices/LoRaWAN/EditLoraDevice.razor b/src/AzureIoTHub.Portal/Client/Pages/Devices/LoRaWAN/EditLoraDevice.razor index 1403208a7..11652773e 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Devices/LoRaWAN/EditLoraDevice.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Devices/LoRaWAN/EditLoraDevice.razor @@ -1,6 +1,7 @@ @using AzureIoTHub.Portal.Client.Validators -@using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDevice -@using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel +@using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN +@using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDevice +@using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel @inject HttpClient Http @inject ISnackbar Snackbar @@ -16,12 +17,12 @@ @if (LoRaDevice.UseOTAA) { - - - - - - + + + + + + } else { @@ -33,7 +34,7 @@ - + } @@ -41,10 +42,10 @@ - - + + - + @@ -52,10 +53,11 @@ - - - - + + @foreach (DeduplicationMode item in Enum.GetValues(typeof(DeduplicationMode))) + { + @item + } @@ -72,11 +74,11 @@ - + - + @@ -146,7 +148,7 @@ @if (!LoRaDevice.AlreadyLoggedInOnce) { - Device hasn't joined the network. You cannot send command at this moment. + Device hasn't joined the network. You cannot send command at this moment. } diff --git a/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/ConnectionStringDialog.razor b/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/ConnectionStringDialog.razor index e3ca1b9e3..50edf2b5a 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/ConnectionStringDialog.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/ConnectionStringDialog.razor @@ -1,6 +1,6 @@ @using AzureIoTHub.Portal.Client.Services @using Microsoft.AspNetCore.Authorization -@using AzureIoTHub.Portal.Shared.Models.V10 +@using AzureIoTHub.Portal.Shared.Models.v10 @inject HttpClient Http @inject ISnackbar Snackbar diff --git a/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/CreateEdgeDeviceDialog.razor b/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/CreateEdgeDeviceDialog.razor index 80663ddba..94885180e 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/CreateEdgeDeviceDialog.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/CreateEdgeDeviceDialog.razor @@ -1,6 +1,6 @@ @page "/edge/devices/add" @using Microsoft.AspNetCore.Authorization -@using AzureIoTHub.Portal.Shared.Models.V10; +@using AzureIoTHub.Portal.Shared.Models.v10; @inject HttpClient Http @inject ISnackbar Snackbar diff --git a/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/EdgeDeviceDeleteConfirmationDialog.razor b/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/EdgeDeviceDeleteConfirmationDialog.razor index 27f4db72a..8603c0843 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/EdgeDeviceDeleteConfirmationDialog.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/EdgeDeviceDeleteConfirmationDialog.razor @@ -1,4 +1,4 @@ -@using AzureIoTHub.Portal.Shared.Models.V10.Device +@using AzureIoTHub.Portal.Shared.Models.v10.Device @inject HttpClient Http @inject IJSRuntime JS @inject ISnackbar Snackbar diff --git a/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/EdgeDeviceDetailPage.razor b/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/EdgeDeviceDetailPage.razor index c3403fef5..be9c1dccc 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/EdgeDeviceDetailPage.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/EdgeDeviceDetailPage.razor @@ -1,7 +1,7 @@ @page "/edge/devices/{deviceId}" @using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Components.WebAssembly.Authentication -@using AzureIoTHub.Portal.Shared.Models.V10 +@using AzureIoTHub.Portal.Shared.Models.v10 @using System.Net.Http.Json @attribute [Authorize] diff --git a/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/EdgeDeviceListPage.razor b/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/EdgeDeviceListPage.razor index 3a7885698..68783c808 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/EdgeDeviceListPage.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/EdgeDeviceListPage.razor @@ -1,7 +1,7 @@ @page "/edge/devices" @using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Components.WebAssembly.Authentication -@using AzureIoTHub.Portal.Shared.Models.V10 +@using AzureIoTHub.Portal.Shared.Models.v10 @using System.Net.Http.Json @using Blazored.Modal @using Blazored.Modal.Services diff --git a/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/ModuleLogsDialog.razor b/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/ModuleLogsDialog.razor index 93714093c..dc00c1e97 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/ModuleLogsDialog.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/ModuleLogsDialog.razor @@ -1,5 +1,5 @@ @page "/edge/devices/logs" -@using AzureIoTHub.Portal.Shared.Models.V10 +@using AzureIoTHub.Portal.Shared.Models.v10 @using Newtonsoft.Json; diff --git a/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/ConcentratorDetailPage.razor b/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/ConcentratorDetailPage.razor index 3ac112fbb..8bb227d89 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/ConcentratorDetailPage.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/ConcentratorDetailPage.razor @@ -1,6 +1,6 @@ @page "/lorawan/concentrators/{DeviceID}" @using System.Text.Json; -@using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.Concentrator +@using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.Concentrator @using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Components.WebAssembly.Authentication @using Newtonsoft.Json diff --git a/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/ConcentratorListPage.razor b/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/ConcentratorListPage.razor index 6b788278c..a983671f3 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/ConcentratorListPage.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/ConcentratorListPage.razor @@ -1,5 +1,5 @@ @page "/lorawan/concentrators" -@using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.Concentrator +@using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.Concentrator @using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Components.WebAssembly.Authentication diff --git a/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/CreateConcentratorPage.razor b/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/CreateConcentratorPage.razor index 5975e9edc..ccb4668b3 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/CreateConcentratorPage.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/CreateConcentratorPage.razor @@ -1,5 +1,5 @@ @page "/lorawan/concentrators/new" -@using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.Concentrator +@using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.Concentrator @using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Components.WebAssembly.Authentication diff --git a/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/DeleteConcentratorPage.razor b/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/DeleteConcentratorPage.razor index 180de5cb5..11b9dd1a3 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/DeleteConcentratorPage.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/DeleteConcentratorPage.razor @@ -1,5 +1,5 @@  -@using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.Concentrator +@using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.Concentrator @inject HttpClient Http @inject IJSRuntime JS diff --git a/src/AzureIoTHub.Portal/Client/Pages/Settings/DeviceTagsPage.razor b/src/AzureIoTHub.Portal/Client/Pages/Settings/DeviceTagsPage.razor index 6c27fc94e..bad8fa029 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Settings/DeviceTagsPage.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Settings/DeviceTagsPage.razor @@ -1,5 +1,5 @@ @page "/settings/device-tag" -@using AzureIoTHub.Portal.Shared.Models.V10.Device +@using AzureIoTHub.Portal.Shared.Models.v10.Device @using System.ComponentModel.DataAnnotations @using System.IO @using Microsoft.AspNetCore.Authorization diff --git a/src/AzureIoTHub.Portal/Client/Program.cs b/src/AzureIoTHub.Portal/Client/Program.cs index 72293d1ab..786a3157d 100644 --- a/src/AzureIoTHub.Portal/Client/Program.cs +++ b/src/AzureIoTHub.Portal/Client/Program.cs @@ -14,7 +14,7 @@ namespace AzureIoTHub.Portal.Client using Microsoft.Extensions.DependencyInjection; using MudBlazor.Services; using Tewr.Blazor.FileReader; - using AzureIoTHub.Portal.Shared.Models.V10; + using AzureIoTHub.Portal.Shared.Models.v10; public class Program { diff --git a/src/AzureIoTHub.Portal/Client/Shared/MainLayout.razor b/src/AzureIoTHub.Portal/Client/Shared/MainLayout.razor index 9aad714d8..0b769ba7e 100644 --- a/src/AzureIoTHub.Portal/Client/Shared/MainLayout.razor +++ b/src/AzureIoTHub.Portal/Client/Shared/MainLayout.razor @@ -1,6 +1,6 @@ @inherits LayoutComponentBase -@using AzureIoTHub.Portal.Shared.Models.V10 +@using AzureIoTHub.Portal.Shared.Models.v10 @using Microsoft.AspNetCore.Components.Authorization @using Microsoft.AspNetCore.Components.WebAssembly.Authentication diff --git a/src/AzureIoTHub.Portal/Client/Shared/NavMenu.razor b/src/AzureIoTHub.Portal/Client/Shared/NavMenu.razor index 53d102f1c..c248d3f14 100644 --- a/src/AzureIoTHub.Portal/Client/Shared/NavMenu.razor +++ b/src/AzureIoTHub.Portal/Client/Shared/NavMenu.razor @@ -1,6 +1,6 @@ @using AzureIoTHub.Portal.Shared.Security; @using Microsoft.AspNetCore.Components.Authorization -@using AzureIoTHub.Portal.Shared.Models.V10 +@using AzureIoTHub.Portal.Shared.Models.v10 @inject NavigationManager navigationManager @inject PortalSettings Portal diff --git a/src/AzureIoTHub.Portal/Client/Validators/DeviceDetailsValidator.cs b/src/AzureIoTHub.Portal/Client/Validators/DeviceDetailsValidator.cs index 0dd2a8587..d704eb8dd 100644 --- a/src/AzureIoTHub.Portal/Client/Validators/DeviceDetailsValidator.cs +++ b/src/AzureIoTHub.Portal/Client/Validators/DeviceDetailsValidator.cs @@ -1,9 +1,9 @@ -// Copyright (c) CGI France. All rights reserved. +// Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace AzureIoTHub.Portal.Client.Validators { - using AzureIoTHub.Portal.Shared.Models.V10.Device; + using AzureIoTHub.Portal.Shared.Models.v10.Device; using FluentValidation; using System; using System.Collections.Generic; @@ -14,10 +14,10 @@ public class DeviceDetailsValidator : AbstractValidator { public DeviceDetailsValidator() { - RuleFor(x => x.DeviceName) + _ = RuleFor(x => x.DeviceName) .NotEmpty(); - RuleFor(x => x.ModelId) + _ = RuleFor(x => x.ModelId) .NotEmpty(); } diff --git a/src/AzureIoTHub.Portal/Client/Validators/DeviceModelValidator.cs b/src/AzureIoTHub.Portal/Client/Validators/DeviceModelValidator.cs index cb2d83a0c..837e2b48e 100644 --- a/src/AzureIoTHub.Portal/Client/Validators/DeviceModelValidator.cs +++ b/src/AzureIoTHub.Portal/Client/Validators/DeviceModelValidator.cs @@ -1,16 +1,16 @@ -// Copyright (c) CGI France. All rights reserved. +// Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace AzureIoTHub.Portal.Client.Validators { - using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel; using FluentValidation; public class DeviceModelValidator : AbstractValidator { public DeviceModelValidator() { - RuleFor(x => x.Name) + _ = RuleFor(x => x.Name) .NotEmpty(); } } diff --git a/src/AzureIoTHub.Portal/Client/Validators/DevicePropertyValidator.cs b/src/AzureIoTHub.Portal/Client/Validators/DevicePropertyValidator.cs index 324aada32..232241961 100644 --- a/src/AzureIoTHub.Portal/Client/Validators/DevicePropertyValidator.cs +++ b/src/AzureIoTHub.Portal/Client/Validators/DevicePropertyValidator.cs @@ -3,7 +3,7 @@ namespace AzureIoTHub.Portal.Client.Validators { - using AzureIoTHub.Portal.Shared.Models.V10; + using AzureIoTHub.Portal.Shared.Models.v10; using FluentValidation; using System.Collections.Generic; using System.Linq; diff --git a/src/AzureIoTHub.Portal/Client/Validators/LoRaDeviceDetailsValidator.cs b/src/AzureIoTHub.Portal/Client/Validators/LoRaDeviceDetailsValidator.cs index 1901d36d6..aa59a7fcd 100644 --- a/src/AzureIoTHub.Portal/Client/Validators/LoRaDeviceDetailsValidator.cs +++ b/src/AzureIoTHub.Portal/Client/Validators/LoRaDeviceDetailsValidator.cs @@ -1,9 +1,9 @@ -// Copyright (c) CGI France. All rights reserved. +// Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace AzureIoTHub.Portal.Client.Validators { - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDevice; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDevice; using FluentValidation; using System; using System.Collections.Generic; @@ -14,15 +14,15 @@ public class LoRaDeviceDetailsValidator : AbstractValidator { public LoRaDeviceDetailsValidator() { - RuleFor(x => x.AppEUI) + _ = RuleFor(x => x.AppEUI) .NotEmpty() .When(x => x.UseOTAA); - RuleFor(x => x.AppKey) + _ = RuleFor(x => x.AppKey) .NotEmpty() .When(x => x.UseOTAA); - RuleFor(x => x.ModelId) + _ = RuleFor(x => x.ModelId) .NotEmpty(); } diff --git a/src/AzureIoTHub.Portal/Client/Validators/LoRaDeviceModelValidator.cs b/src/AzureIoTHub.Portal/Client/Validators/LoRaDeviceModelValidator.cs index 22c1adb31..dd90c18b3 100644 --- a/src/AzureIoTHub.Portal/Client/Validators/LoRaDeviceModelValidator.cs +++ b/src/AzureIoTHub.Portal/Client/Validators/LoRaDeviceModelValidator.cs @@ -1,16 +1,16 @@ -// Copyright (c) CGI France. All rights reserved. +// Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace AzureIoTHub.Portal.Client.Validators { - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel; using FluentValidation; public class LoRaDeviceModelValidator : AbstractValidator { public LoRaDeviceModelValidator() { - RuleFor(x => x.AppEUI) + _ = RuleFor(x => x.AppEUI) .NotEmpty() .Length(1, 100) .When(x => x.UseOTAA); diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelControllerBase.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelControllerBase.cs index 70376842e..fc9b91d57 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelControllerBase.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelControllerBase.cs @@ -13,7 +13,7 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10 using AzureIoTHub.Portal.Server.Helpers; using AzureIoTHub.Portal.Server.Managers; using AzureIoTHub.Portal.Server.Services; - using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.Devices.Shared; diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelPropertiesController.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelPropertiesController.cs index a20912af2..116edcdef 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelPropertiesController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelPropertiesController.cs @@ -7,7 +7,7 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10 using System.Threading.Tasks; using AutoMapper; using AzureIoTHub.Portal.Server.Factories; - using AzureIoTHub.Portal.Shared.Models.V10; + using AzureIoTHub.Portal.Shared.Models.v10; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelPropertiesControllerBase.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelPropertiesControllerBase.cs index f4f427b1c..ff7b386c6 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelPropertiesControllerBase.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelPropertiesControllerBase.cs @@ -10,7 +10,7 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10 using Azure.Data.Tables; using AzureIoTHub.Portal.Server.Entities; using AzureIoTHub.Portal.Server.Factories; - using AzureIoTHub.Portal.Shared.Models.V10; + using AzureIoTHub.Portal.Shared.Models.v10; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelsController.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelsController.cs index cdefd32f2..4d047e3ec 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelsController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelsController.cs @@ -6,7 +6,7 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10 using AzureIoTHub.Portal.Server.Factories; using AzureIoTHub.Portal.Server.Managers; using AzureIoTHub.Portal.Server.Services; - using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceTagSettingsController.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceTagSettingsController.cs index 61a767905..9054bb59c 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceTagSettingsController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceTagSettingsController.cs @@ -4,7 +4,7 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10 { using AzureIoTHub.Portal.Server.Services; - using AzureIoTHub.Portal.Shared.Models.V10.Device; + using AzureIoTHub.Portal.Shared.Models.v10.Device; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using System.Collections.Generic; diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DevicesController.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DevicesController.cs index 1e2b5e840..942dcdc4f 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DevicesController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DevicesController.cs @@ -7,8 +7,8 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10 using AzureIoTHub.Portal.Server.Managers; using AzureIoTHub.Portal.Server.Mappers; using AzureIoTHub.Portal.Server.Services; - using AzureIoTHub.Portal.Shared.Models.V10; - using AzureIoTHub.Portal.Shared.Models.V10.Device; + using AzureIoTHub.Portal.Shared.Models.v10; + using AzureIoTHub.Portal.Shared.Models.v10.Device; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using System.Collections.Generic; diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DevicesControllerBase.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DevicesControllerBase.cs index d7a19c106..1aef3884c 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DevicesControllerBase.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DevicesControllerBase.cs @@ -13,9 +13,9 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10 using AzureIoTHub.Portal.Server.Managers; using AzureIoTHub.Portal.Server.Mappers; using AzureIoTHub.Portal.Server.Services; - using AzureIoTHub.Portal.Shared.Models.V10; - using AzureIoTHub.Portal.Shared.Models.V10.Device; - using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10; + using AzureIoTHub.Portal.Shared.Models.v10.Device; + using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.Devices; using Microsoft.Azure.Devices.Common.Exceptions; @@ -58,7 +58,7 @@ public virtual async Task> GetItems() var items = await this.devicesService.GetAllDevice(excludeDeviceType: "LoRa Concentrator"); var tagList = this.deviceTagService.GetAllSearchableTagsNames(); - return items.Select(c => this.deviceTwinMapper.CreateDeviceListItem(c,tagList)); + return items.Select(c => this.deviceTwinMapper.CreateDeviceListItem(c, tagList)); } /// diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/EdgeConfigurationsController.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/EdgeConfigurationsController.cs index abcf01227..1b0750340 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/EdgeConfigurationsController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/EdgeConfigurationsController.cs @@ -1,4 +1,4 @@ -// Copyright (c) CGI France. All rights reserved. +// Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace AzureIoTHub.Portal.Server.Controllers.V10 @@ -9,10 +9,9 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10 using System.Threading.Tasks; using AzureIoTHub.Portal.Server.Helpers; using AzureIoTHub.Portal.Server.Services; - using AzureIoTHub.Portal.Shared.Models.V10; + using AzureIoTHub.Portal.Shared.Models.v10; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; - using Microsoft.Azure.Devices; using Newtonsoft.Json.Linq; [ApiController] @@ -43,7 +42,7 @@ public async Task> Get() var results = new List(); // Azure Configurations may have different types: "Configuration", "Deployment" or "LayeredDeployment" - foreach (Configuration config in configList) + foreach (var config in configList) { var moduleList = new List(); @@ -55,7 +54,7 @@ public async Task> Get() ModuleName = x.Key })); - ConfigListItem result = ConfigHelper.CreateConfigListItem(config, moduleList); + var result = ConfigHelper.CreateConfigListItem(config, moduleList); results.Add(result); } } @@ -69,7 +68,7 @@ public async Task> Get() /// The configuration identifier. /// /// Could not parse properties.desired. - [HttpGet("{configurationID}", Name ="GET IoT Edge configuration")] + [HttpGet("{configurationID}", Name = "GET IoT Edge configuration")] public async Task Get(string configurationID) { var config = await this.configService.GetConfigItem(configurationID); @@ -77,40 +76,37 @@ public async Task Get(string configurationID) // Details of every modules are stored within the EdgeAgent module data if (config.Content.ModulesContent != null - && config.Content.ModulesContent.TryGetValue("$edgeAgent", out IDictionary edgeAgentModule) - && edgeAgentModule.TryGetValue("properties.desired", out object edgeAgentDesiredProperties)) + && config.Content.ModulesContent.TryGetValue("$edgeAgent", out var edgeAgentModule) + && edgeAgentModule.TryGetValue("properties.desired", out var edgeAgentDesiredProperties)) { // Converts the object to a JObject to access its properties more easily - JObject modObject = edgeAgentDesiredProperties as JObject; - - if (modObject == null) + if (edgeAgentDesiredProperties is not JObject modObject) { throw new InvalidOperationException("Could not parse properties.desired."); } // Adds regular modules to the list of modules - if (modObject.TryGetValue("modules", out JToken modules)) + if (modObject.TryGetValue("modules", out var modules)) { foreach (var m in modules.Values()) { - IoTEdgeModule newModule = ConfigHelper.CreateGatewayModule(config, m); + var newModule = ConfigHelper.CreateGatewayModule(config, m); moduleList.Add(newModule); } } // Adds system modules to the list of modules - if (modObject.TryGetValue("systemModules", out JToken systemModulesToken)) + if (modObject.TryGetValue("systemModules", out var systemModulesToken)) { foreach (var sm in systemModulesToken.Values()) { - IoTEdgeModule newModule = ConfigHelper.CreateGatewayModule(config, sm); + var newModule = ConfigHelper.CreateGatewayModule(config, sm); moduleList.Add(newModule); } } } - ConfigListItem result = ConfigHelper.CreateConfigListItem(config, moduleList); - return result; + return ConfigHelper.CreateConfigListItem(config, moduleList); } } } diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/EdgeDevicesController.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/EdgeDevicesController.cs index fd81fccb4..bdbd9d4c5 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/EdgeDevicesController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/EdgeDevicesController.cs @@ -10,7 +10,7 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10 using AzureIoTHub.Portal.Server.Helpers; using AzureIoTHub.Portal.Server.Managers; using AzureIoTHub.Portal.Server.Services; - using AzureIoTHub.Portal.Shared.Models.V10; + using AzureIoTHub.Portal.Shared.Models.v10; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.Devices; @@ -133,7 +133,7 @@ public async Task Get(string deviceId) NbDevices = await this.RetrieveNbConnectedDevice(deviceTwin.DeviceId), // récupération des informations sur le modules de la gateways² NbModules = DeviceHelper.RetrieveNbModuleCount(deviceWithModules, deviceId), - RuntimeResponse = DeviceHelper.RetrieveRuntimeResponse(deviceWithModules, deviceId), + RuntimeResponse = DeviceHelper.RetrieveRuntimeResponse(deviceWithModules), Modules = DeviceHelper.RetrieveModuleList(deviceWithModules), // recup du dernier deployment LastDeployment = await this.RetrieveLastConfiguration(deviceWithModules) diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANCommandsController.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANCommandsController.cs index 682264f73..e6c36c90a 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANCommandsController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANCommandsController.cs @@ -10,7 +10,7 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10.LoRaWAN using AzureIoTHub.Portal.Server.Factories; using AzureIoTHub.Portal.Server.Filters; using AzureIoTHub.Portal.Server.Mappers; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANConcentratorsController.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANConcentratorsController.cs index 85347453f..1873ca8f3 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANConcentratorsController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANConcentratorsController.cs @@ -11,7 +11,7 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10.LoRaWAN using AzureIoTHub.Portal.Server.Managers; using AzureIoTHub.Portal.Server.Mappers; using AzureIoTHub.Portal.Server.Services; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.Concentrator; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.Concentrator; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.Devices; diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANDeviceModelPropertiesController.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANDeviceModelPropertiesController.cs index 3581ca16c..bd5055246 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANDeviceModelPropertiesController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANDeviceModelPropertiesController.cs @@ -8,7 +8,7 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10 using AutoMapper; using AzureIoTHub.Portal.Server.Factories; using AzureIoTHub.Portal.Server.Filters; - using AzureIoTHub.Portal.Shared.Models.V10; + using AzureIoTHub.Portal.Shared.Models.v10; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANDeviceModelsController.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANDeviceModelsController.cs index d7e877189..e64da0925 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANDeviceModelsController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANDeviceModelsController.cs @@ -7,8 +7,8 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10.LoRaWAN using AzureIoTHub.Portal.Server.Filters; using AzureIoTHub.Portal.Server.Managers; using AzureIoTHub.Portal.Server.Services; - using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANDevicesController.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANDevicesController.cs index 25fc9dabe..9cda6f23c 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANDevicesController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANDevicesController.cs @@ -9,9 +9,9 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10 using AzureIoTHub.Portal.Server.Managers; using AzureIoTHub.Portal.Server.Mappers; using AzureIoTHub.Portal.Server.Services; - using AzureIoTHub.Portal.Shared.Models.V10; - using AzureIoTHub.Portal.Shared.Models.V10.Device; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDevice; + using AzureIoTHub.Portal.Shared.Models.v10; + using AzureIoTHub.Portal.Shared.Models.v10.Device; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDevice; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using System.Collections.Generic; diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/SettingsController.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/SettingsController.cs index 0ee3f5693..ca19d4469 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/SettingsController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/SettingsController.cs @@ -5,7 +5,7 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10 { using System.Reflection; using AzureIoTHub.Portal.Server.Identity; - using AzureIoTHub.Portal.Shared.Models.V10; + using AzureIoTHub.Portal.Shared.Models.v10; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; diff --git a/src/AzureIoTHub.Portal/Server/Helpers/ConfigHelper.cs b/src/AzureIoTHub.Portal/Server/Helpers/ConfigHelper.cs index 7034be631..cada34760 100644 --- a/src/AzureIoTHub.Portal/Server/Helpers/ConfigHelper.cs +++ b/src/AzureIoTHub.Portal/Server/Helpers/ConfigHelper.cs @@ -1,11 +1,11 @@ -// Copyright (c) CGI France. All rights reserved. +// Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace AzureIoTHub.Portal.Server.Helpers { using System; using System.Collections.Generic; - using AzureIoTHub.Portal.Shared.Models.V10; + using AzureIoTHub.Portal.Shared.Models.v10; using Microsoft.Azure.Devices; using Newtonsoft.Json.Linq; @@ -20,7 +20,7 @@ public static class ConfigHelper /// Corresponding metric value, or 0 if it doesn't exist. public static long RetrieveMetricValue(Configuration item, string metricName) { - if (item.SystemMetrics.Results.TryGetValue(metricName, out long result)) + if (item.SystemMetrics.Results.TryGetValue(metricName, out var result)) { return result; } @@ -79,7 +79,7 @@ private static Dictionary GetModuleIdentityTwinSettings(Configur var twinSettings = new Dictionary(); if (config.Content.ModulesContent != null - && config.Content.ModulesContent.TryGetValue(module.Path, out IDictionary modulesContent)) + && config.Content.ModulesContent.TryGetValue(module.Path, out var modulesContent)) { foreach (var setting in modulesContent) { @@ -99,15 +99,13 @@ private static Dictionary GetEnvironmentVariables(JProperty modu { var envVariables = new Dictionary(); - var moduleProperties = module.Value as JObject; - - if (moduleProperties == null) + if (module.Value is not JObject moduleProperties) { throw new InvalidOperationException($"Unable to parse {module.Name} module properties."); } // Only exists if the module contains environment variables - if (moduleProperties.TryGetValue("env", out JToken environmentVariables)) + if (moduleProperties.TryGetValue("env", out var environmentVariables)) { foreach (JProperty val in environmentVariables) { diff --git a/src/AzureIoTHub.Portal/Server/Helpers/DeviceHelper.cs b/src/AzureIoTHub.Portal/Server/Helpers/DeviceHelper.cs index adcd58756..b5e8a0f32 100644 --- a/src/AzureIoTHub.Portal/Server/Helpers/DeviceHelper.cs +++ b/src/AzureIoTHub.Portal/Server/Helpers/DeviceHelper.cs @@ -1,4 +1,4 @@ -// Copyright (c) CGI France. All rights reserved. +// Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace AzureIoTHub.Portal.Server.Helpers @@ -8,7 +8,7 @@ namespace AzureIoTHub.Portal.Server.Helpers using System.Security.Cryptography; using System.Text; using AzureIoTHub.Portal.Server.Extensions; - using AzureIoTHub.Portal.Shared.Models.V10; + using AzureIoTHub.Portal.Shared.Models.v10; using Microsoft.Azure.Devices.Provisioning.Service; using Microsoft.Azure.Devices.Shared; using Newtonsoft.Json.Linq; @@ -130,13 +130,13 @@ public static int RetrieveNbModuleCount(Twin twin, string deviceId) /// the twin of the device we want. /// the device id we get. /// string. - public static string RetrieveRuntimeResponse(Twin twin, string deviceId) + public static string RetrieveRuntimeResponse(Twin twin) { var reportedProperties = JObject.Parse(twin.Properties.Reported.ToJson()); - if (reportedProperties.TryGetValue("systemModules", out JToken systemModules) - && systemModules.Value().TryGetValue("edgeAgent", out JToken edgeAgentModule) - && edgeAgentModule.Value().TryGetValue("runtimeStatus", out JToken runtimeStatus)) + if (reportedProperties.TryGetValue("systemModules", out var systemModules) + && systemModules.Value().TryGetValue("edgeAgent", out var edgeAgentModule) + && edgeAgentModule.Value().TryGetValue("runtimeStatus", out var runtimeStatus)) { return runtimeStatus.Value(); } @@ -154,7 +154,7 @@ public static List RetrieveModuleList(Twin twin) var list = new List(); var reportedProperties = JObject.Parse(twin.Properties.Reported.ToJson()); - if (!reportedProperties.TryGetValue("modules", out JToken modules)) + if (!reportedProperties.TryGetValue("modules", out var modules)) { return list; } @@ -168,12 +168,12 @@ public static List RetrieveModuleList(Twin twin) ModuleName = property.Key }; - if (propertyObject.TryGetValue("status", out JToken status)) + if (propertyObject.TryGetValue("status", out var status)) { module.Status = status.Value(); } - if (propertyObject.TryGetValue("version", out JToken version)) + if (propertyObject.TryGetValue("version", out var version)) { module.Status = version.Value(); } diff --git a/src/AzureIoTHub.Portal/Server/Managers/DeviceModelCommandsManager.cs b/src/AzureIoTHub.Portal/Server/Managers/DeviceModelCommandsManager.cs index d69d9b40a..7870cdbea 100644 --- a/src/AzureIoTHub.Portal/Server/Managers/DeviceModelCommandsManager.cs +++ b/src/AzureIoTHub.Portal/Server/Managers/DeviceModelCommandsManager.cs @@ -8,8 +8,8 @@ namespace AzureIoTHub.Portal.Server.Managers using Azure.Data.Tables; using AzureIoTHub.Portal.Server.Factories; using AzureIoTHub.Portal.Server.Mappers; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDevice; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDevice; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel; public class DeviceModelCommandsManager : IDeviceModelCommandsManager { diff --git a/src/AzureIoTHub.Portal/Server/Managers/DeviceProvisioningServiceManager.cs b/src/AzureIoTHub.Portal/Server/Managers/DeviceProvisioningServiceManager.cs index e71e07119..c25613936 100644 --- a/src/AzureIoTHub.Portal/Server/Managers/DeviceProvisioningServiceManager.cs +++ b/src/AzureIoTHub.Portal/Server/Managers/DeviceProvisioningServiceManager.cs @@ -9,7 +9,7 @@ namespace AzureIoTHub.Portal.Server.Managers using System.Threading.Tasks; using AzureIoTHub.Portal.Server.Helpers; using AzureIoTHub.Portal.Server.Wrappers; - using AzureIoTHub.Portal.Shared.Models.V10; + using AzureIoTHub.Portal.Shared.Models.v10; using Microsoft.Azure.Devices.Provisioning.Service; using Microsoft.Azure.Devices.Shared; using static AzureIoTHub.Portal.Server.Startup; diff --git a/src/AzureIoTHub.Portal/Server/Managers/IDeviceModelCommandsManager.cs b/src/AzureIoTHub.Portal/Server/Managers/IDeviceModelCommandsManager.cs index e3c4330f7..b85cd9c00 100644 --- a/src/AzureIoTHub.Portal/Server/Managers/IDeviceModelCommandsManager.cs +++ b/src/AzureIoTHub.Portal/Server/Managers/IDeviceModelCommandsManager.cs @@ -4,8 +4,8 @@ namespace AzureIoTHub.Portal.Server.Managers { using System.Collections.Generic; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDevice; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDevice; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel; public interface IDeviceModelCommandsManager { diff --git a/src/AzureIoTHub.Portal/Server/Managers/IDeviceProvisioningServiceManager.cs b/src/AzureIoTHub.Portal/Server/Managers/IDeviceProvisioningServiceManager.cs index 5977700d7..46778fc5e 100644 --- a/src/AzureIoTHub.Portal/Server/Managers/IDeviceProvisioningServiceManager.cs +++ b/src/AzureIoTHub.Portal/Server/Managers/IDeviceProvisioningServiceManager.cs @@ -4,7 +4,7 @@ namespace AzureIoTHub.Portal.Server.Managers { using System.Threading.Tasks; - using AzureIoTHub.Portal.Shared.Models.V10; + using AzureIoTHub.Portal.Shared.Models.v10; using Microsoft.Azure.Devices.Provisioning.Service; using Microsoft.Azure.Devices.Shared; diff --git a/src/AzureIoTHub.Portal/Server/Managers/ILoraDeviceMethodManager.cs b/src/AzureIoTHub.Portal/Server/Managers/ILoraDeviceMethodManager.cs index bc853da9a..6732e4bf0 100644 --- a/src/AzureIoTHub.Portal/Server/Managers/ILoraDeviceMethodManager.cs +++ b/src/AzureIoTHub.Portal/Server/Managers/ILoraDeviceMethodManager.cs @@ -5,7 +5,7 @@ namespace AzureIoTHub.Portal.Server.Managers { using System.Net.Http; using System.Threading.Tasks; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel; public interface ILoraDeviceMethodManager { diff --git a/src/AzureIoTHub.Portal/Server/Managers/IRouterConfigManager.cs b/src/AzureIoTHub.Portal/Server/Managers/IRouterConfigManager.cs index 124127c09..691eb4fd9 100644 --- a/src/AzureIoTHub.Portal/Server/Managers/IRouterConfigManager.cs +++ b/src/AzureIoTHub.Portal/Server/Managers/IRouterConfigManager.cs @@ -3,7 +3,7 @@ namespace AzureIoTHub.Portal.Server.Managers { - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.Concentrator; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.Concentrator; using System.Threading.Tasks; public interface IRouterConfigManager diff --git a/src/AzureIoTHub.Portal/Server/Managers/LoraDeviceMethodManager.cs b/src/AzureIoTHub.Portal/Server/Managers/LoraDeviceMethodManager.cs index 87a451608..acf96eb85 100644 --- a/src/AzureIoTHub.Portal/Server/Managers/LoraDeviceMethodManager.cs +++ b/src/AzureIoTHub.Portal/Server/Managers/LoraDeviceMethodManager.cs @@ -1,4 +1,4 @@ -// Copyright (c) CGI France. All rights reserved. +// Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace AzureIoTHub.Portal.Server.Managers @@ -9,7 +9,7 @@ namespace AzureIoTHub.Portal.Server.Managers using System.Net.Http.Json; using System.Text; using System.Threading.Tasks; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel; public class LoraDeviceMethodManager : ILoraDeviceMethodManager { @@ -22,7 +22,7 @@ public LoraDeviceMethodManager(HttpClient httpClient) public async Task ExecuteLoRaDeviceMessage(string deviceId, DeviceModelCommand command) { - JsonContent commandContent = JsonContent.Create(new + var commandContent = JsonContent.Create(new { rawPayload = Convert.ToBase64String(Encoding.UTF8.GetBytes(command.Frame)), fport = command.Port diff --git a/src/AzureIoTHub.Portal/Server/Managers/RouterConfigManager.cs b/src/AzureIoTHub.Portal/Server/Managers/RouterConfigManager.cs index 609640843..cd8534792 100644 --- a/src/AzureIoTHub.Portal/Server/Managers/RouterConfigManager.cs +++ b/src/AzureIoTHub.Portal/Server/Managers/RouterConfigManager.cs @@ -6,7 +6,7 @@ namespace AzureIoTHub.Portal.Server.Managers using System.Net.Http; using System.Net.Http.Json; using System.Threading.Tasks; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.Concentrator; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.Concentrator; public class RouterConfigManager : IRouterConfigManager { diff --git a/src/AzureIoTHub.Portal/Server/Mappers/ConcentratorTwinMapper.cs b/src/AzureIoTHub.Portal/Server/Mappers/ConcentratorTwinMapper.cs index 082598c95..f3a8b5f85 100644 --- a/src/AzureIoTHub.Portal/Server/Mappers/ConcentratorTwinMapper.cs +++ b/src/AzureIoTHub.Portal/Server/Mappers/ConcentratorTwinMapper.cs @@ -4,7 +4,7 @@ namespace AzureIoTHub.Portal.Server.Mappers { using AzureIoTHub.Portal.Server.Helpers; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.Concentrator; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.Concentrator; using Microsoft.Azure.Devices; using Microsoft.Azure.Devices.Shared; diff --git a/src/AzureIoTHub.Portal/Server/Mappers/DeviceModelCommandMapper.cs b/src/AzureIoTHub.Portal/Server/Mappers/DeviceModelCommandMapper.cs index 115ce6552..dc868ef0a 100644 --- a/src/AzureIoTHub.Portal/Server/Mappers/DeviceModelCommandMapper.cs +++ b/src/AzureIoTHub.Portal/Server/Mappers/DeviceModelCommandMapper.cs @@ -5,7 +5,7 @@ namespace AzureIoTHub.Portal.Server.Mappers { using System.Globalization; using Azure.Data.Tables; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel; public class DeviceModelCommandMapper : IDeviceModelCommandMapper { diff --git a/src/AzureIoTHub.Portal/Server/Mappers/DeviceModelMapper.cs b/src/AzureIoTHub.Portal/Server/Mappers/DeviceModelMapper.cs index 48dcf5727..333236711 100644 --- a/src/AzureIoTHub.Portal/Server/Mappers/DeviceModelMapper.cs +++ b/src/AzureIoTHub.Portal/Server/Mappers/DeviceModelMapper.cs @@ -5,7 +5,7 @@ namespace AzureIoTHub.Portal.Server.Mappers { using Azure.Data.Tables; using AzureIoTHub.Portal.Server.Managers; - using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel; using System.Collections.Generic; public class DeviceModelMapper : IDeviceModelMapper diff --git a/src/AzureIoTHub.Portal/Server/Mappers/DevicePropertyProfile.cs b/src/AzureIoTHub.Portal/Server/Mappers/DevicePropertyProfile.cs index 9ce46cc31..b383d6c3b 100644 --- a/src/AzureIoTHub.Portal/Server/Mappers/DevicePropertyProfile.cs +++ b/src/AzureIoTHub.Portal/Server/Mappers/DevicePropertyProfile.cs @@ -1,19 +1,19 @@ -// Copyright (c) CGI France. All rights reserved. +// Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace AzureIoTHub.Portal.Server.Mappers { using AutoMapper; using AzureIoTHub.Portal.Server.Entities; - using AzureIoTHub.Portal.Shared.Models.V10; + using AzureIoTHub.Portal.Shared.Models.v10; public class DevicePropertyProfile : Profile { public DevicePropertyProfile() { - CreateMap(); + _ = CreateMap(); - CreateMap() + _ = CreateMap() .ForMember(c => c.RowKey, opts => opts.MapFrom(c => c.Name)) .ForMember(c => c.PartitionKey, opts => opts.MapFrom((src, dst, _, context) => context.Items[nameof(DeviceModelProperty.PartitionKey)])); } diff --git a/src/AzureIoTHub.Portal/Server/Mappers/DeviceTagMapper.cs b/src/AzureIoTHub.Portal/Server/Mappers/DeviceTagMapper.cs index abb6f2f1a..afc3dd83f 100644 --- a/src/AzureIoTHub.Portal/Server/Mappers/DeviceTagMapper.cs +++ b/src/AzureIoTHub.Portal/Server/Mappers/DeviceTagMapper.cs @@ -1,11 +1,13 @@ -using Azure.Data.Tables; -using AzureIoTHub.Portal.Shared.Models.V10.Device; +// Copyright (c) CGI France. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace AzureIoTHub.Portal.Server.Mappers { + using Azure.Data.Tables; + using AzureIoTHub.Portal.Shared.Models.v10.Device; + public class DeviceTagMapper : IDeviceTagMapper { - /// /// Gets a device tag setting. /// diff --git a/src/AzureIoTHub.Portal/Server/Mappers/DeviceTwinMapper.cs b/src/AzureIoTHub.Portal/Server/Mappers/DeviceTwinMapper.cs index b21451817..5f9147cd9 100644 --- a/src/AzureIoTHub.Portal/Server/Mappers/DeviceTwinMapper.cs +++ b/src/AzureIoTHub.Portal/Server/Mappers/DeviceTwinMapper.cs @@ -6,7 +6,7 @@ namespace AzureIoTHub.Portal.Server.Mappers using System; using System.Collections.Generic; using AzureIoTHub.Portal.Server.Managers; - using AzureIoTHub.Portal.Shared.Models.V10.Device; + using AzureIoTHub.Portal.Shared.Models.v10.Device; using Microsoft.Azure.Devices; using Microsoft.Azure.Devices.Shared; @@ -74,12 +74,14 @@ public void UpdateTwin(Twin twin, DeviceDetails item) Helpers.DeviceHelper.SetTagValue(twin, nameof(item.DeviceName), item.DeviceName); Helpers.DeviceHelper.SetTagValue(twin, nameof(item.ModelId), item.ModelId); - if(item.Tags != null) + if (item.Tags == null) { - foreach (var customTag in item.Tags) - { - Helpers.DeviceHelper.SetTagValue(twin, customTag.Key, customTag.Value); - } + return; + } + + foreach (var customTag in item.Tags) + { + Helpers.DeviceHelper.SetTagValue(twin, customTag.Key, customTag.Value); } } } diff --git a/src/AzureIoTHub.Portal/Server/Mappers/IConcentratorTwinMapper.cs b/src/AzureIoTHub.Portal/Server/Mappers/IConcentratorTwinMapper.cs index da6f55ad7..3fe1a4675 100644 --- a/src/AzureIoTHub.Portal/Server/Mappers/IConcentratorTwinMapper.cs +++ b/src/AzureIoTHub.Portal/Server/Mappers/IConcentratorTwinMapper.cs @@ -3,7 +3,7 @@ namespace AzureIoTHub.Portal.Server.Mappers { - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.Concentrator; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.Concentrator; using Microsoft.Azure.Devices.Shared; public interface IConcentratorTwinMapper diff --git a/src/AzureIoTHub.Portal/Server/Mappers/IDeviceModelCommandMapper.cs b/src/AzureIoTHub.Portal/Server/Mappers/IDeviceModelCommandMapper.cs index 299d677f6..13986e625 100644 --- a/src/AzureIoTHub.Portal/Server/Mappers/IDeviceModelCommandMapper.cs +++ b/src/AzureIoTHub.Portal/Server/Mappers/IDeviceModelCommandMapper.cs @@ -4,7 +4,7 @@ namespace AzureIoTHub.Portal.Server.Mappers { using Azure.Data.Tables; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel; public interface IDeviceModelCommandMapper { diff --git a/src/AzureIoTHub.Portal/Server/Mappers/IDeviceModelMapper.cs b/src/AzureIoTHub.Portal/Server/Mappers/IDeviceModelMapper.cs index a877c2f4b..b509cb685 100644 --- a/src/AzureIoTHub.Portal/Server/Mappers/IDeviceModelMapper.cs +++ b/src/AzureIoTHub.Portal/Server/Mappers/IDeviceModelMapper.cs @@ -4,7 +4,7 @@ namespace AzureIoTHub.Portal.Server.Managers { using Azure.Data.Tables; - using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel; using System.Collections.Generic; public interface IDeviceModelMapper diff --git a/src/AzureIoTHub.Portal/Server/Mappers/IDeviceTagMapper.cs b/src/AzureIoTHub.Portal/Server/Mappers/IDeviceTagMapper.cs index 902a9bc06..0629f2cb2 100644 --- a/src/AzureIoTHub.Portal/Server/Mappers/IDeviceTagMapper.cs +++ b/src/AzureIoTHub.Portal/Server/Mappers/IDeviceTagMapper.cs @@ -1,8 +1,11 @@ -using Azure.Data.Tables; -using AzureIoTHub.Portal.Shared.Models.V10.Device; +// Copyright (c) CGI France. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace AzureIoTHub.Portal.Server.Mappers { + using Azure.Data.Tables; + using AzureIoTHub.Portal.Shared.Models.v10.Device; + public interface IDeviceTagMapper { public DeviceTag GetDeviceTag(TableEntity entity); diff --git a/src/AzureIoTHub.Portal/Server/Mappers/IDeviceTwinMapper.cs b/src/AzureIoTHub.Portal/Server/Mappers/IDeviceTwinMapper.cs index 9bc79f034..15a5c0a46 100644 --- a/src/AzureIoTHub.Portal/Server/Mappers/IDeviceTwinMapper.cs +++ b/src/AzureIoTHub.Portal/Server/Mappers/IDeviceTwinMapper.cs @@ -1,15 +1,15 @@ -// Copyright (c) CGI France. All rights reserved. +// Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace AzureIoTHub.Portal.Server.Mappers { - using AzureIoTHub.Portal.Shared.Models.V10.Device; + using AzureIoTHub.Portal.Shared.Models.v10.Device; using Microsoft.Azure.Devices.Shared; using System.Collections.Generic; public interface IDeviceTwinMapper - where TListItem: DeviceListItem - where TDevice: DeviceDetails + where TListItem : DeviceListItem + where TDevice : DeviceDetails { TDevice CreateDeviceDetails(Twin twin, IEnumerable tags); diff --git a/src/AzureIoTHub.Portal/Server/Mappers/LoRaDeviceMapper.cs b/src/AzureIoTHub.Portal/Server/Mappers/LoRaDeviceMapper.cs index 43824ea39..de1935e95 100644 --- a/src/AzureIoTHub.Portal/Server/Mappers/LoRaDeviceMapper.cs +++ b/src/AzureIoTHub.Portal/Server/Mappers/LoRaDeviceMapper.cs @@ -7,8 +7,8 @@ namespace AzureIoTHub.Portal.Server.Mappers using System.Collections.Generic; using AzureIoTHub.Portal.Server.Managers; using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN; - using AzureIoTHub.Portal.Shared.Models.V10.Device; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDevice; + using AzureIoTHub.Portal.Shared.Models.v10.Device; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDevice; using Microsoft.Azure.Devices; using Microsoft.Azure.Devices.Shared; @@ -52,9 +52,9 @@ public LoRaDeviceDetails CreateDeviceDetails(Twin twin, IEnumerable tags AppSKey = Helpers.DeviceHelper.RetrieveDesiredPropertyValue(twin, nameof(LoRaDeviceDetails.AppSKey)), NwkSKey = Helpers.DeviceHelper.RetrieveDesiredPropertyValue(twin, nameof(LoRaDeviceDetails.NwkSKey)), UseOTAA = bool.Parse(Helpers.DeviceHelper.RetrieveTagValue(twin, nameof(LoRaDeviceDetails.UseOTAA)) ?? "True"), - Deduplication = Helpers.DeviceHelper.RetrieveDesiredPropertyValue(twin, nameof(LoRaDeviceBase.Deduplication)), - PreferredWindow = int.TryParse(Helpers.DeviceHelper.RetrieveDesiredPropertyValue(twin, nameof(LoRaDeviceBase.PreferredWindow)), out int result) ? result : null, - Supports32BitFCnt = bool.TryParse(Helpers.DeviceHelper.RetrieveDesiredPropertyValue(twin, nameof(LoRaDeviceBase.Supports32BitFCnt)), out bool boolResult) ? boolResult : null, + Deduplication = Enum.TryParse(Helpers.DeviceHelper.RetrieveDesiredPropertyValue(twin, nameof(LoRaDeviceBase.Deduplication)), out var deduplication) ? deduplication : DeduplicationMode.None, + PreferredWindow = int.TryParse(Helpers.DeviceHelper.RetrieveDesiredPropertyValue(twin, nameof(LoRaDeviceBase.PreferredWindow)), out var result) ? result : null, + Supports32BitFCnt = bool.TryParse(Helpers.DeviceHelper.RetrieveDesiredPropertyValue(twin, nameof(LoRaDeviceBase.Supports32BitFCnt)), out var boolResult) ? boolResult : null, ABPRelaxMode = bool.TryParse(Helpers.DeviceHelper.RetrieveDesiredPropertyValue(twin, nameof(LoRaDeviceBase.ABPRelaxMode)), out boolResult) ? boolResult : null, KeepAliveTimeout = int.TryParse(Helpers.DeviceHelper.RetrieveDesiredPropertyValue(twin, nameof(LoRaDeviceBase.KeepAliveTimeout)), out result) ? result : null, Downlink = bool.TryParse(Helpers.DeviceHelper.RetrieveDesiredPropertyValue(twin, nameof(LoRaDeviceBase.Downlink)), out boolResult) ? boolResult : null, diff --git a/src/AzureIoTHub.Portal/Server/Mappers/LoRaDeviceModelMapper.cs b/src/AzureIoTHub.Portal/Server/Mappers/LoRaDeviceModelMapper.cs index d87449cf4..d51326aa8 100644 --- a/src/AzureIoTHub.Portal/Server/Mappers/LoRaDeviceModelMapper.cs +++ b/src/AzureIoTHub.Portal/Server/Mappers/LoRaDeviceModelMapper.cs @@ -6,9 +6,10 @@ namespace AzureIoTHub.Portal.Server.Mappers using Azure.Data.Tables; using AzureIoTHub.Portal.Server.Managers; using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN; - using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel; using System.Collections.Generic; + using System; public class LoRaDeviceModelMapper : IDeviceModelMapper { @@ -47,11 +48,11 @@ public LoRaDeviceModel CreateDeviceModel(TableEntity entity) SensorDecoder = entity[nameof(LoRaDeviceModel.SensorDecoder)]?.ToString(), SupportLoRaFeatures = true, UseOTAA = bool.Parse(entity[nameof(LoRaDeviceModel.UseOTAA)]?.ToString() ?? "true"), - PreferredWindow = int.TryParse(entity[nameof(LoRaDeviceBase.PreferredWindow)]?.ToString(), out var intResult) ? intResult : null, + PreferredWindow = int.TryParse(entity[nameof(LoRaDeviceBase.PreferredWindow)]?.ToString(), out var intResult) ? intResult : 1, Supports32BitFCnt = bool.TryParse(entity[nameof(LoRaDeviceBase.Supports32BitFCnt)]?.ToString(), out var boolResult) ? boolResult : null, ABPRelaxMode = bool.TryParse(entity[nameof(LoRaDeviceBase.ABPRelaxMode)]?.ToString(), out boolResult) ? boolResult : null, KeepAliveTimeout = int.TryParse(entity[nameof(LoRaDeviceBase.KeepAliveTimeout)]?.ToString(), out intResult) ? intResult : null, - Deduplication = entity[nameof(LoRaDeviceBase.Deduplication)]?.ToString(), + Deduplication = Enum.TryParse(entity[nameof(LoRaDeviceBase.Deduplication)]?.ToString(), out var deduplication) ? deduplication : DeduplicationMode.None, Downlink = bool.TryParse(entity[nameof(LoRaDeviceBase.Downlink)]?.ToString(), out boolResult) ? boolResult : null, FCntDownStart = int.TryParse(entity[nameof(LoRaDeviceBase.FCntDownStart)]?.ToString(), out intResult) ? intResult : null, FCntResetCounter = int.TryParse(entity[nameof(LoRaDeviceBase.FCntResetCounter)]?.ToString(), out intResult) ? intResult : null, @@ -83,7 +84,7 @@ public Dictionary UpdateTableEntity(TableEntity entity, LoRaDevi AddOptionnalProperties(entity, nameof(LoRaDeviceBase.KeepAliveTimeout), model.KeepAliveTimeout, desiredProperties); AddOptionnalProperties(entity, nameof(LoRaDeviceBase.PreferredWindow), model.PreferredWindow, desiredProperties); AddOptionnalProperties(entity, nameof(LoRaDeviceBase.Downlink), model.Downlink, desiredProperties); - AddOptionnalProperties(entity, nameof(LoRaDeviceBase.Deduplication), model.Deduplication, desiredProperties); + AddOptionnalProperties(entity, nameof(LoRaDeviceBase.Deduplication), model.Deduplication.ToString(), desiredProperties); AddOptionnalProperties(entity, nameof(LoRaDeviceBase.FCntDownStart), model.FCntDownStart, desiredProperties); AddOptionnalProperties(entity, nameof(LoRaDeviceBase.FCntResetCounter), model.FCntResetCounter, desiredProperties); AddOptionnalProperties(entity, nameof(LoRaDeviceBase.FCntUpStart), model.FCntUpStart, desiredProperties); diff --git a/src/AzureIoTHub.Portal/Server/Services/DeviceTagService.cs b/src/AzureIoTHub.Portal/Server/Services/DeviceTagService.cs index 3928c4f16..a53982112 100644 --- a/src/AzureIoTHub.Portal/Server/Services/DeviceTagService.cs +++ b/src/AzureIoTHub.Portal/Server/Services/DeviceTagService.cs @@ -6,7 +6,7 @@ namespace AzureIoTHub.Portal.Server.Services using Azure.Data.Tables; using AzureIoTHub.Portal.Server.Factories; using AzureIoTHub.Portal.Server.Mappers; - using AzureIoTHub.Portal.Shared.Models.V10.Device; + using AzureIoTHub.Portal.Shared.Models.v10.Device; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; diff --git a/src/AzureIoTHub.Portal/Server/Services/IDeviceTagService.cs b/src/AzureIoTHub.Portal/Server/Services/IDeviceTagService.cs index 159cc6558..dcc53df83 100644 --- a/src/AzureIoTHub.Portal/Server/Services/IDeviceTagService.cs +++ b/src/AzureIoTHub.Portal/Server/Services/IDeviceTagService.cs @@ -1,9 +1,12 @@ -using AzureIoTHub.Portal.Shared.Models.V10.Device; -using System.Collections.Generic; -using System.Threading.Tasks; +// Copyright (c) CGI France. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace AzureIoTHub.Portal.Server.Services { + using AzureIoTHub.Portal.Shared.Models.v10.Device; + using System.Collections.Generic; + using System.Threading.Tasks; + public interface IDeviceTagService { IEnumerable GetAllTags(); diff --git a/src/AzureIoTHub.Portal/Server/Startup.cs b/src/AzureIoTHub.Portal/Server/Startup.cs index 20eb8e1cd..4cf6a411c 100644 --- a/src/AzureIoTHub.Portal/Server/Startup.cs +++ b/src/AzureIoTHub.Portal/Server/Startup.cs @@ -17,10 +17,10 @@ namespace AzureIoTHub.Portal.Server using AzureIoTHub.Portal.Server.Mappers; using AzureIoTHub.Portal.Server.Services; using AzureIoTHub.Portal.Server.Wrappers; - using AzureIoTHub.Portal.Shared.Models.V10.Device; - using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDevice; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.Device; + using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDevice; + using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/C2Dresult.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/C2Dresult.cs index 4c08a28cc..0edd66500 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/C2Dresult.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/C2Dresult.cs @@ -1,7 +1,7 @@ // Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace AzureIoTHub.Portal.Shared.Models.V10 +namespace AzureIoTHub.Portal.Shared.Models.v10 { public class C2Dresult { diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/ConfigItem.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/ConfigItem.cs index eaa6ba55f..48c0601ba 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/ConfigItem.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/ConfigItem.cs @@ -1,11 +1,12 @@ -// Copyright (c) CGI France. All rights reserved. +// Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System; -using System.ComponentModel.DataAnnotations; -namespace AzureIoTHub.Portal.Shared.Models.V10 +namespace AzureIoTHub.Portal.Shared.Models.v10 { + using System; + using System.ComponentModel.DataAnnotations; + public class ConfigItem { /// diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/ConfigListItem.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/ConfigListItem.cs index 1dc2e55b3..acd513d33 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/ConfigListItem.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/ConfigListItem.cs @@ -1,7 +1,7 @@ // Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace AzureIoTHub.Portal.Shared.Models.V10 +namespace AzureIoTHub.Portal.Shared.Models.v10 { using System; using System.Collections.Generic; diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/Device/DeviceDetails.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/Device/DeviceDetails.cs index 1632a6386..3d23267bb 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/Device/DeviceDetails.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/Device/DeviceDetails.cs @@ -1,7 +1,7 @@ // Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace AzureIoTHub.Portal.Shared.Models.V10.Device +namespace AzureIoTHub.Portal.Shared.Models.v10.Device { using System; using System.Collections.Generic; diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/Device/DeviceListItem.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/Device/DeviceListItem.cs index b05879224..e54ca9978 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/Device/DeviceListItem.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/Device/DeviceListItem.cs @@ -1,7 +1,7 @@ // Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace AzureIoTHub.Portal.Shared.Models.V10.Device +namespace AzureIoTHub.Portal.Shared.Models.v10.Device { using System; using System.Collections.Generic; diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/Device/DeviceTag.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/Device/DeviceTag.cs index 2cba676ed..fab4f4909 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/Device/DeviceTag.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/Device/DeviceTag.cs @@ -2,7 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace AzureIoTHub.Portal.Shared.Models.V10.Device +namespace AzureIoTHub.Portal.Shared.Models.v10.Device { using System.ComponentModel.DataAnnotations; diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/DeviceModel/DeviceModel.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/DeviceModel/DeviceModel.cs index 0d7381eb8..9a230783e 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/DeviceModel/DeviceModel.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/DeviceModel/DeviceModel.cs @@ -1,7 +1,7 @@ // Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace AzureIoTHub.Portal.Shared.Models.V10.DeviceModel +namespace AzureIoTHub.Portal.Shared.Models.v10.DeviceModel { using System.ComponentModel.DataAnnotations; diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/DeviceProperty.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/DeviceProperty.cs index d0e7f33f0..bade2100e 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/DeviceProperty.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/DeviceProperty.cs @@ -1,10 +1,10 @@ -// Copyright (c) CGI France. All rights reserved. +// Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System.ComponentModel.DataAnnotations; - -namespace AzureIoTHub.Portal.Shared.Models.V10 +namespace AzureIoTHub.Portal.Shared.Models.v10 { + using System.ComponentModel.DataAnnotations; + public class DeviceProperty { /// diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/EnrollmentCredentials.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/EnrollmentCredentials.cs index 76c52b5e5..c19a2a673 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/EnrollmentCredentials.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/EnrollmentCredentials.cs @@ -1,10 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +// Copyright (c) CGI France. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace AzureIoTHub.Portal.Shared.Models.V10 +namespace AzureIoTHub.Portal.Shared.Models.v10 { public class EnrollmentCredentials { diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/IoTEdgeDevice.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/IoTEdgeDevice.cs index 65dbbc3d2..b8604207b 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/IoTEdgeDevice.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/IoTEdgeDevice.cs @@ -1,7 +1,7 @@ -// Copyright (c) CGI France. All rights reserved. +// Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace AzureIoTHub.Portal.Shared.Models.V10 +namespace AzureIoTHub.Portal.Shared.Models.v10 { using System.Collections.Generic; using System.ComponentModel.DataAnnotations; diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/IoTEdgeListItem.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/IoTEdgeListItem.cs index 008da73d2..4d9281770 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/IoTEdgeListItem.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/IoTEdgeListItem.cs @@ -1,10 +1,10 @@ -// Copyright (c) CGI France. All rights reserved. +// Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System.ComponentModel.DataAnnotations; - -namespace AzureIoTHub.Portal.Shared.Models.V10 +namespace AzureIoTHub.Portal.Shared.Models.v10 { + using System.ComponentModel.DataAnnotations; + public class IoTEdgeListItem { /// diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/IoTEdgeModule.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/IoTEdgeModule.cs index 8874b82f6..b0afd03e8 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/IoTEdgeModule.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/IoTEdgeModule.cs @@ -1,7 +1,7 @@ // Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace AzureIoTHub.Portal.Shared.Models.V10 +namespace AzureIoTHub.Portal.Shared.Models.v10 { using System.Collections.Generic; using System.ComponentModel.DataAnnotations; diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/ClassType.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/ClassType.cs index f882cb3dc..a84353b37 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/ClassType.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/ClassType.cs @@ -9,7 +9,6 @@ namespace AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN public enum ClassType { A, - B, C } } diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/Concentrator/Channel.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/Concentrator/Channel.cs index a08db9bfc..38c759e7e 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/Concentrator/Channel.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/Concentrator/Channel.cs @@ -1,7 +1,7 @@ // Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.Concentrator +namespace AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.Concentrator { using Newtonsoft.Json; diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/Concentrator/Concentrator.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/Concentrator/Concentrator.cs index 8807572df..a51269f5d 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/Concentrator/Concentrator.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/Concentrator/Concentrator.cs @@ -1,7 +1,7 @@ // Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.Concentrator +namespace AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.Concentrator { using System.ComponentModel.DataAnnotations; diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/Concentrator/RouterConfig.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/Concentrator/RouterConfig.cs index a8fbda416..9549df470 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/Concentrator/RouterConfig.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/Concentrator/RouterConfig.cs @@ -1,7 +1,7 @@ // Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.Concentrator +namespace AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.Concentrator { using System.Collections.Generic; using Newtonsoft.Json; diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/DeduplicationMode.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/DeduplicationMode.cs new file mode 100644 index 000000000..917241bf0 --- /dev/null +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/DeduplicationMode.cs @@ -0,0 +1,15 @@ +// Copyright (c) CGI France. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN +{ + using System.Text.Json.Serialization; + + [JsonConverter(typeof(JsonStringEnumConverter))] + public enum DeduplicationMode + { + None, + Drop, + Mark + } +} diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDevice/Command.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDevice/Command.cs index 063b0be6d..a9221b761 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDevice/Command.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDevice/Command.cs @@ -1,7 +1,7 @@ // Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDevice +namespace AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDevice { public class Command { diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDevice/LoRaDeviceDetails.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDevice/LoRaDeviceDetails.cs index 188bdf76c..de4b4de27 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDevice/LoRaDeviceDetails.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDevice/LoRaDeviceDetails.cs @@ -1,11 +1,9 @@ -// Copyright (c) CGI France. All rights reserved. +// Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDevice +namespace AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDevice { using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN; - using AzureIoTHub.Portal.Shared.Models.V10.Device; - using System.ComponentModel.DataAnnotations; public class LoRaDeviceDetails : LoRaDeviceBase { @@ -70,4 +68,4 @@ public class LoRaDeviceDetails : LoRaDeviceBase /// public string ReportedRXDelay { get; set; } } -} \ No newline at end of file +} diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceBase.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceBase.cs index e17bb73e3..74074718e 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceBase.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceBase.cs @@ -1,12 +1,18 @@ -// Copyright (c) CGI France. All rights reserved. +// Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN { - using AzureIoTHub.Portal.Shared.Models.V10.Device; + using System.ComponentModel.DataAnnotations; + using AzureIoTHub.Portal.Shared.Models.v10.Device; public class LoRaDeviceBase : DeviceDetails { + /// + /// The LoRa device class. + /// + public ClassType ClassType { get; set; } + /// /// The status of OTAA setting. /// @@ -44,7 +50,7 @@ public class LoRaDeviceBase : DeviceDetails /// Allows controlling the handling of duplicate messages received by multiple gateways. /// The default is None. /// - public string Deduplication { get; set; } + public DeduplicationMode Deduplication { get; set; } /// /// Allows setting an offset between received Datarate and retransmit datarate as specified in the LoRa Specifiations. @@ -75,11 +81,13 @@ public class LoRaDeviceBase : DeviceDetails /// Allows to explicitly specify a frame counter up start value. /// If the device joins, this value will be used to validate the first frame and initialize the server state for the device. /// + [Range(0, 4294967295)] public int? FCntUpStart { get; set; } /// /// Allows to explicitly specify a frame counter down start value. /// + [Range(0, 4294967295)] public int? FCntDownStart { get; set; } /// @@ -90,6 +98,7 @@ public class LoRaDeviceBase : DeviceDetails /// /// Allows to reset the frame counters to the FCntUpStart/FCntDownStart values respectively. /// + [Range(0, 4294967295)] public int? FCntResetCounter { get; set; } /// @@ -102,7 +111,7 @@ public LoRaDeviceBase() { this.Downlink = true; this.PreferredWindow = 1; - this.Deduplication = "None"; + this.Deduplication = DeduplicationMode.None; this.ABPRelaxMode = true; } } diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceModel/DeviceModelCommand.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceModel/DeviceModelCommand.cs index 5ea6a6884..6f2ec8528 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceModel/DeviceModelCommand.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceModel/DeviceModelCommand.cs @@ -1,7 +1,7 @@ // Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel +namespace AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel { using System.ComponentModel.DataAnnotations; diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceModel/LoRaDeviceModel.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceModel/LoRaDeviceModel.cs index bc5fac213..71aec374a 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceModel/LoRaDeviceModel.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceModel/LoRaDeviceModel.cs @@ -1,12 +1,9 @@ -// Copyright (c) CGI France. All rights reserved. +// Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDeviceModel +namespace AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN.LoRaDeviceModel { using AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN; - using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDevice; - using System.Collections.Generic; - using System.ComponentModel.DataAnnotations; public class LoRaDeviceModel : LoRaDeviceModelBase { diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceModelBase.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceModelBase.cs index b089478c9..84f564517 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceModelBase.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceModelBase.cs @@ -4,7 +4,7 @@ namespace AzureIoTHub.Portal.Shared.Models.v10.LoRaWAN { using System.ComponentModel.DataAnnotations; - using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel; + using AzureIoTHub.Portal.Shared.Models.v10.DeviceModel; public class LoRaDeviceModelBase : DeviceModel { @@ -39,13 +39,13 @@ public class LoRaDeviceModelBase : DeviceModel /// Allows setting the device preferred receive window (RX1 or RX2). /// The default preferred receive window is 1. /// - public int? PreferredWindow { get; set; } + public int PreferredWindow { get; set; } /// /// Allows controlling the handling of duplicate messages received by multiple gateways. /// The default is None. /// - public string Deduplication { get; set; } + public DeduplicationMode Deduplication { get; set; } /// /// Allows setting an offset between received Datarate and retransmit datarate as specified in the LoRa Specifiations. @@ -107,7 +107,7 @@ public LoRaDeviceModelBase() this.ClassType = ClassType.A; this.Downlink = true; this.PreferredWindow = 1; - this.Deduplication = "None"; + this.Deduplication = DeduplicationMode.None; this.ABPRelaxMode = true; } } diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/PortalSettings.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/PortalSettings.cs index c15bc988c..87ef0c798 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/PortalSettings.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/PortalSettings.cs @@ -1,7 +1,7 @@ // Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace AzureIoTHub.Portal.Shared.Models.V10 +namespace AzureIoTHub.Portal.Shared.Models.v10 { public class PortalSettings { diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/SearchModel.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/SearchModel.cs index b481b4716..8eea324d1 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/SearchModel.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/SearchModel.cs @@ -1,10 +1,10 @@ -// Copyright (c) CGI France. All rights reserved. +// Copyright (c) CGI France. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System.ComponentModel.DataAnnotations; - -namespace AzureIoTHub.Portal.Shared.Models.V10 +namespace AzureIoTHub.Portal.Shared.Models.v10 { + using System.ComponentModel.DataAnnotations; + public class SearchModel { ///