From 3f0d156b96ed4d362b2c1e710034789b4dca0823 Mon Sep 17 00:00:00 2001 From: Kevin BEAUGRAND <9513635+kbeaugrand@users.noreply.github.com> Date: Sat, 12 Mar 2022 11:15:17 +0100 Subject: [PATCH] Re-order lora device properties in model --- .../LoRaWAN/EditLoraDeviceModel.razor | 160 +++++++++--------- .../Shared/Models/v1.0/LoRaWAN/ClassType.cs | 15 ++ .../v1.0/LoRaWAN/LoRaDeviceModelBase.cs | 25 +-- 3 files changed, 107 insertions(+), 93 deletions(-) create mode 100644 src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/ClassType.cs diff --git a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/LoRaWAN/EditLoraDeviceModel.razor b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/LoRaWAN/EditLoraDeviceModel.razor index 78f783531..f88ed2bab 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/LoRaWAN/EditLoraDeviceModel.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/LoRaWAN/EditLoraDeviceModel.razor @@ -8,105 +8,99 @@ - - - - @(LoRaDeviceModel.UseOTAA ? "OTAA setting enable" : "APB setting enable") + + + @(LoRaDeviceModel.UseOTAA ? "OTAA setting enable" : "APB setting enable") - - - - @if (LoRaDeviceModel.UseOTAA) - { - + + + @if (LoRaDeviceModel.UseOTAA) + { + - } - else - { - + } + else + { + - } - - - - + } + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - + - Test RX Thingy - - - - - - - - - - - - - + Receive Windows + + + + + @if (LoRaDeviceModel.Downlink.HasValue && LoRaDeviceModel.Downlink.Value) + { + + + + + + + + + + + + + } + - Test Counter Thingy - - - - - - - - - - - - - - - - - + Frame Counters + + + + + + + + @if (LoRaDeviceModel.Downlink.HasValue && LoRaDeviceModel.Downlink.Value) + { + + + + + + + } + - + + + @if (LoRaDeviceModel.Downlink.HasValue && LoRaDeviceModel.Downlink.Value) + { @@ -130,10 +124,10 @@ - + - + @@ -144,7 +138,7 @@ - + } Save Changes diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/ClassType.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/ClassType.cs new file mode 100644 index 000000000..f882cb3dc --- /dev/null +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/ClassType.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 ClassType + { + A, + B, + C + } +} 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 a80d8f4ed..b089478c9 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceModelBase.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceModelBase.cs @@ -1,17 +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 System.ComponentModel.DataAnnotations; using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel; - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; public class LoRaDeviceModelBase : DeviceModel { + /// + /// The LoRa device class. + /// + public ClassType ClassType { get; set; } + /// /// The status of OTAA setting. /// @@ -75,22 +76,25 @@ public class LoRaDeviceModelBase : DeviceModel /// 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; } /// - /// Allow the usage of 32bit counters on your device. + /// Allows to reset the frame counters to the FCntUpStart/FCntDownStart values respectively. /// - public bool? Supports32BitFCnt { get; set; } + [Range(0, 4294967295)] + public int? FCntResetCounter { get; set; } /// - /// Allows to reset the frame counters to the FCntUpStart/FCntDownStart values respectively. + /// Allow the usage of 32bit counters on your device. /// - public int? FCntResetCounter { get; set; } + public bool? Supports32BitFCnt { get; set; } /// /// Allows defining a sliding expiration to the connection between the leaf device and IoT/Edge Hub. @@ -100,6 +104,7 @@ public class LoRaDeviceModelBase : DeviceModel public LoRaDeviceModelBase() { + this.ClassType = ClassType.A; this.Downlink = true; this.PreferredWindow = 1; this.Deduplication = "None";