diff --git a/src/AzureIoTHub.Portal.Server.Tests/Controllers/ConcentratorsControllerTests.cs b/src/AzureIoTHub.Portal.Server.Tests/Controllers/ConcentratorsControllerTests.cs index 94070ce05..30f51dd12 100644 --- a/src/AzureIoTHub.Portal.Server.Tests/Controllers/ConcentratorsControllerTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests/Controllers/ConcentratorsControllerTests.cs @@ -72,12 +72,12 @@ public async Task GetAllDeviceConcentrator_WithNoArgument_ReturnConcentratorList var concentratorController = this.CreateController(); // Act - var result = await concentratorController.GetAllDeviceConcentrator(); + var response = await concentratorController.GetAllDeviceConcentrator(); // Assert - Assert.IsNotNull(result); - Assert.IsAssignableFrom(result); - var okObjectResult = result as ObjectResult; + Assert.IsNotNull(response); + Assert.IsAssignableFrom(response.Result); + var okObjectResult = response.Result as ObjectResult; Assert.IsNotNull(okObjectResult); Assert.AreEqual(200, okObjectResult.StatusCode); @@ -114,12 +114,12 @@ public async Task GetDeviceConcentrator_With_Valid_Argument_Should_Return_Concen var concentratorController = this.CreateController(); // Act - var result = await concentratorController.GetDeviceConcentrator(twin.DeviceId); + var response = await concentratorController.GetDeviceConcentrator(twin.DeviceId); // Assert - Assert.IsNotNull(result); - Assert.IsAssignableFrom(result); - var okObjectResult = result as ObjectResult; + Assert.IsNotNull(response); + Assert.IsAssignableFrom(response.Result); + var okObjectResult = response.Result as OkObjectResult; Assert.IsNotNull(okObjectResult); Assert.AreEqual(200, okObjectResult.StatusCode); diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelControllerBase.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelControllerBase.cs index b5abc1331..63566f1c8 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelControllerBase.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelControllerBase.cs @@ -19,7 +19,7 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10 using Microsoft.Extensions.Logging; public abstract class DeviceModelsControllerBase : ControllerBase - where TModel: DeviceModel + where TModel : DeviceModel where TListItemModel : DeviceModel { /// @@ -71,7 +71,7 @@ public DeviceModelsControllerBase( IDeviceModelImageManager deviceModelImageManager, IDeviceModelMapper deviceModelMapper, IDeviceService devicesService, - ITableClientFactory tableClientFactory, + ITableClientFactory tableClientFactory, string filter) { this.log = log; @@ -86,9 +86,7 @@ public DeviceModelsControllerBase( /// Gets the device models. /// /// The list of device models. - [HttpGet()] - [ProducesResponseType(StatusCodes.Status200OK)] - public ActionResult> Get() + public virtual ActionResult> Get() { // PartitionKey 0 contains all device models var entities = this.tableClientFactory @@ -106,10 +104,7 @@ public ActionResult> Get() /// /// The model identifier. /// The corresponding model. - [HttpGet("{id}")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status404NotFound)] - public ActionResult Get(string id) + public virtual ActionResult Get(string id) { try { @@ -137,10 +132,7 @@ public ActionResult Get(string id) /// /// The model identifier. /// The avatar. - [HttpGet("{id}/avatar")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status404NotFound)] - public ActionResult GetAvatar(string id) + public virtual ActionResult GetAvatar(string id) { try { @@ -169,10 +161,7 @@ public ActionResult GetAvatar(string id) /// The model identifier. /// The file. /// The avatar. - [HttpPost("{id}/avatar")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status404NotFound)] - public async Task> ChangeAvatar(string id, IFormFile file) + public virtual async Task> ChangeAvatar(string id, IFormFile file) { try { @@ -199,10 +188,7 @@ public async Task> ChangeAvatar(string id, IFormFile file) /// Deletes the avatar. /// /// The model identifier. - [HttpDelete("{id}/avatar")] - [ProducesResponseType(StatusCodes.Status204NoContent)] - [ProducesResponseType(StatusCodes.Status404NotFound)] - public async Task DeleteAvatar(string id) + public virtual async Task DeleteAvatar(string id) { try { @@ -232,10 +218,7 @@ public async Task DeleteAvatar(string id) /// /// The device model. /// The action result. - [HttpPost] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status400BadRequest)] - public async Task Post(TModel deviceModel) + public virtual async Task Post(TModel deviceModel) { if (!string.IsNullOrEmpty(deviceModel.ModelId)) { @@ -274,11 +257,7 @@ public async Task Post(TModel deviceModel) /// /// The device model. /// The action result. - [HttpPut("{id}")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status400BadRequest)] - [ProducesResponseType(StatusCodes.Status404NotFound)] - public async Task Put(TModel deviceModel) + public virtual async Task Put(TModel deviceModel) { if (string.IsNullOrEmpty(deviceModel.ModelId)) { @@ -315,11 +294,7 @@ public async Task Put(TModel deviceModel) /// /// The device model identifier. /// The action result. - [HttpDelete("{id}")] - [ProducesResponseType(StatusCodes.Status204NoContent)] - [ProducesResponseType(StatusCodes.Status400BadRequest)] - [ProducesResponseType(StatusCodes.Status404NotFound)] - public async Task Delete(string id) + public virtual async Task Delete(string id) { // we get all devices var deviceList = await this.devicesService.GetAllDevice(); diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelsController.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelsController.cs index a10a06fbf..0910eb5b1 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelsController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DeviceModelsController.cs @@ -5,11 +5,13 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10 { using AzureIoTHub.Portal.Server.Factories; using AzureIoTHub.Portal.Server.Managers; - using AzureIoTHub.Portal.Server.Mappers; using AzureIoTHub.Portal.Server.Services; using AzureIoTHub.Portal.Shared.Models.V10.DeviceModel; + using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; + using System.Collections.Generic; + using System.Threading.Tasks; [ApiController] [ApiVersion("1.0")] @@ -33,5 +35,109 @@ public DeviceModelsController(ILogger + /// Gets the device model list. + /// + /// An array representing the device models. + [HttpGet(Name = "GET Device model list")] + [ProducesResponseType(StatusCodes.Status200OK)] + public override ActionResult> Get() + { + return base.Get(); + } + + /// + /// Get the device model details. + /// + /// The devic emodel identifier. + /// The device model details. + [HttpGet("{id}", Name = "GET Device model")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public override ActionResult Get(string id) + { + return base.Get(id); + } + + /// + /// Gets the device model avatar. + /// + /// The device model identifier + /// + [HttpGet("{id}/avatar", Name = "GET Device model avatar URL")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public override ActionResult GetAvatar(string id) + { + return base.GetAvatar(id); + } + + /// + /// Changes the avatar. + /// + /// The model identifier. + /// The file. + /// The avatar. + [HttpPost("{id}/avatar", Name = "POST Update the device model avatar")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public override Task> ChangeAvatar(string id, IFormFile file) + { + return base.ChangeAvatar(id, file); + } + + /// + /// Deletes the avatar. + /// + /// The model identifier. + [HttpDelete("{id}/avatar", Name = "DELETE Remove the device model avatar")] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public override Task DeleteAvatar(string id) + { + return base.DeleteAvatar(id); + } + + /// + /// Creates the specified device model. + /// + /// The device model. + /// The action result. + [HttpPost(Name = "POST Create a new device model")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + public override Task Post(DeviceModel deviceModel) + { + return base.Post(deviceModel); + } + + /// + /// Updates the specified device model. + /// + /// The device model. + /// The action result. + [HttpPut("{id}", Name = "PUT Update the device model")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public override Task Put(DeviceModel deviceModel) + { + return base.Put(deviceModel); + } + + /// + /// Deletes the specified device model. + /// + /// The device model identifier. + /// The action result. + [HttpDelete("{id}", Name = "DELETE Remove the device model")] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public override Task Delete(string id) + { + return base.Delete(id); + } } } \ No newline at end of file diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DevicesController.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DevicesController.cs index 7f61af7c5..f3813e10d 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DevicesController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DevicesController.cs @@ -8,6 +8,8 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10 using AzureIoTHub.Portal.Shared.Models.V10.Device; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; + using System.Collections.Generic; + using System.Threading.Tasks; [ApiController] [ApiVersion("1.0")] @@ -23,5 +25,59 @@ public DevicesController( { } + + /// + /// Gets the device list. + /// + /// + [HttpGet(Name = "GET Device list")] + public override Task> Get() + { + return base.Get(); + } + + /// + /// Gets the specified device. + /// + /// The device identifier. + /// + [HttpGet("{deviceID}", Name = "GET Device details")] + public override Task Get(string deviceID) + { + return base.Get(deviceID); + } + + /// + /// Creates the device. + /// + /// The device. + /// + [HttpPost(Name = "POST Create device")] + public override Task CreateDeviceAsync(DeviceDetails device) + { + return base.CreateDeviceAsync(device); + } + + /// + /// Updates the device. + /// + /// The device. + /// + [HttpPut(Name = "PUT Update device")] + public override Task UpdateDeviceAsync(DeviceDetails device) + { + return base.UpdateDeviceAsync(device); + } + + /// + /// Deletes the specified device. + /// + /// The device identifier. + /// + [HttpDelete("{deviceID}", Name = "DELETE Remove device")] + public override Task Delete(string deviceID) + { + return base.Delete(deviceID); + } } } diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DevicesControllerBase.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DevicesControllerBase.cs index 9db5b4662..0eb4d7012 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DevicesControllerBase.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/DevicesControllerBase.cs @@ -6,15 +6,10 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10 using System; using System.Collections.Generic; using System.Linq; - using System.Net.Http.Json; using System.Threading.Tasks; - using Azure.Data.Tables; - using AzureIoTHub.Portal.Server.Factories; - using AzureIoTHub.Portal.Server.Managers; using AzureIoTHub.Portal.Server.Mappers; using AzureIoTHub.Portal.Server.Services; using AzureIoTHub.Portal.Shared.Models.V10.Device; - using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.Devices; using Microsoft.Azure.Devices.Common.Exceptions; @@ -40,12 +35,10 @@ public DevicesControllerBase( } /// - /// Gets a list of devices as DeviceListItem from Azure IoT Hub. - /// Fields that do not appear in the device list are not defined here. + /// Gets the device list. /// - /// A list of DeviceListItem. - [HttpGet] - public async Task> Get() + /// + public virtual async Task> Get() { var items = await this.devicesService.GetAllDevice(excludeDeviceType: "LoRa Concentrator"); @@ -53,21 +46,23 @@ public async Task> Get() } /// - /// Retrieve a specific device and from the IoT Hub. - /// Converts it to a DeviceListItem. + /// Gets the specified device. /// - /// ID of the device to retrieve. - /// The DeviceListItem corresponding to the given ID. - [HttpGet("{deviceID}")] - public async Task Get(string deviceID) + /// The device identifier. + /// + public virtual async Task Get(string deviceID) { var item = await this.devicesService.GetDeviceTwin(deviceID); return this.deviceTwinMapper.CreateDeviceDetails(item); } - [HttpPost] - public async Task CreateDeviceAsync(TModel device) + /// + /// Creates the device. + /// + /// The device. + /// + public virtual async Task CreateDeviceAsync(TModel device) { try { @@ -103,12 +98,11 @@ public async Task CreateDeviceAsync(TModel device) } /// - /// this function update the twin and the device. + /// Updates the device. /// - /// the device object. - /// the update twin. - [HttpPut] - public async Task UpdateDeviceAsync(TModel device) + /// The device. + /// + public virtual async Task UpdateDeviceAsync(TModel device) { if (!this.ModelState.IsValid) { @@ -132,13 +126,13 @@ public async Task UpdateDeviceAsync(TModel device) return this.Ok(); } + /// - /// this function delete a device. + /// Deletes the specified device. /// - /// the device id. - /// ok status on success. - [HttpDelete("{deviceID}")] - public async Task Delete(string deviceID) + /// The device identifier. + /// + public virtual async Task Delete(string deviceID) { await this.devicesService.DeleteDevice(deviceID); return this.Ok(); diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/EdgeConfigurationsController.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/EdgeConfigurationsController.cs index 58dff21eb..aeb8841cc 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/EdgeConfigurationsController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/EdgeConfigurationsController.cs @@ -10,6 +10,7 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10 using AzureIoTHub.Portal.Server.Helpers; using AzureIoTHub.Portal.Server.Services; using AzureIoTHub.Portal.Shared.Models.V10; + using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.Devices; using Newtonsoft.Json.Linq; @@ -28,10 +29,11 @@ public EdgeConfigurationsController(ConfigsServices configService) } /// - /// Gets a list of deployments as ConfigListItem from Azure IoT Hub. + /// Gets the IoT Edge deployment configurations. /// - /// A list of ConfigListItem. - [HttpGet] + /// + [HttpGet(Name = "GET IoT Edge config list")] + [ProducesResponseType(StatusCodes.Status200OK)] public async Task> Get() { // Retrieve every Configurations, regardless of the parameter given... Why? @@ -62,12 +64,12 @@ public async Task> Get() } /// - /// Retrieve a specific deployment and its modules from the IoT Hub. - /// Converts it to a ConfigListItem. + /// Gets the specified configuration. /// - /// ID of the deployment to retrieve. - /// The ConfigListItem corresponding to the given ID. - [HttpGet("{configurationID}")] + /// The configuration identifier. + /// + /// Could not parse properties.desired. + [HttpGet("{configurationID}", Name ="GET IoT Edge configuration")] public async Task Get(string configurationID) { var config = await this.configService.GetConfigItem(configurationID); diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/EdgeDevicesController.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/EdgeDevicesController.cs index 20e26cff8..130ef4c49 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/EdgeDevicesController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/EdgeDevicesController.cs @@ -27,13 +27,39 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10 [ApiExplorerSettings(GroupName = "IoT Edge")] public class EdgeDevicesController : ControllerBase { + /// + /// The device edge devices controller. + /// private readonly ILogger logger; + /// + /// The device registry manager. + /// private readonly RegistryManager registryManager; + + /// + /// The device iconfiguration. + /// private readonly IConfiguration configuration; + + /// + /// The device idevice service. + /// private readonly IDeviceService devicesService; + + /// + /// The device iconnection string manager. + /// private readonly IConnectionStringManager connectionStringManager; + /// + /// Initializes a new instance of the class. + /// + /// The logger. + /// The configuration. + /// The registry manager. + /// The connection string manager. + /// The service. public EdgeDevicesController( IConfiguration configuration, ILogger logger, @@ -49,19 +75,17 @@ public EdgeDevicesController( } /// - /// Fonction permettant de récupèrer la liste des appareils Edge . - /// Après avoir éxecuté la query du registryManager on récupère le resultat - /// sous la forme d'une liste de Twin. + /// Gets the IoT Edge device list. /// - /// List of GatewayListItem. - [HttpGet] + /// + [HttpGet(Name = "GET IoT Edge devices")] [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(List))] public async Task Get() { // don't contain tags IEnumerable edgeDevices = await this.devicesService.GetAllEdgeDevice(); - List newGatewayList = new (); + List newGatewayList = new(); foreach (Twin deviceTwin in edgeDevices) { @@ -69,7 +93,7 @@ public async Task Get() if (twin != null) { - GatewayListItem gateway = new () + GatewayListItem gateway = new() { DeviceId = deviceTwin.DeviceId, Status = twin.Status?.ToString(), @@ -85,12 +109,11 @@ public async Task Get() } /// - /// This function return all the information we want of - /// a device. + /// Gets the specified device. /// - /// the device id. - /// Gateway. - [HttpGet("{deviceId}")] + /// The device identifier. + /// + [HttpGet("{deviceId}", Name = "GET IoT Edge device")] [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(Gateway))] public async Task Get(string deviceId) { @@ -99,7 +122,7 @@ public async Task Get(string deviceId) Twin deviceTwin = await this.devicesService.GetDeviceTwin(deviceId); Twin deviceWithModules = await this.devicesService.GetDeviceTwinWithModule(deviceId); - Gateway gateway = new () + Gateway gateway = new() { DeviceId = deviceTwin.DeviceId, Status = deviceTwin.Status?.ToString(), @@ -127,23 +150,32 @@ public async Task Get(string deviceId) } } - [HttpGet("{deviceId}/{deviceType}/ConnectionString")] + /// + /// Gets the IoT Edge device symmetric key. + /// + /// The device identifier. + /// Type of the device. + /// + [HttpGet("{deviceId}/{deviceType}/ConnectionString", Name = "GET Device symmetric key")] + [ProducesResponseType(StatusCodes.Status200OK)] public async Task GetSymmetricKey(string deviceId, string deviceType) { return this.Ok(await this.connectionStringManager.GetSymmetricKey(deviceId, deviceType)); } /// - /// this function create a device with the twin information. + /// Creates the IoT Edge device. /// - /// the gateway object. - /// Bulk registry operation result. - [HttpPost] + /// The IoT Edge device. + /// + [HttpPost(Name = "POST Gateway")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] public async Task CreateGatewayAsync(Gateway gateway) { try { - Twin deviceTwin = new (gateway.DeviceId); + Twin deviceTwin = new(gateway.DeviceId); deviceTwin.Tags["env"] = gateway.Environment; deviceTwin.Tags["purpose"] = gateway.Type; @@ -161,11 +193,12 @@ public async Task CreateGatewayAsync(Gateway gateway) } /// - /// This function update the properties of a device. + /// Updates the device. /// - /// a gateways object. - /// the twin of the device. - [HttpPut("{gateway}")] + /// The IoT Edge device. + /// + [HttpPut(Name = "PUT")] + [ProducesResponseType(StatusCodes.Status200OK)] public async Task UpdateDeviceAsync(Gateway gateway) { Device device = await this.devicesService.GetDevice(gateway.DeviceId); @@ -186,11 +219,12 @@ public async Task UpdateDeviceAsync(Gateway gateway) } /// - /// this function delete a device. + /// Deletes the device. /// - /// the device id to delete. - /// message. - [HttpDelete("{deviceId}")] + /// The device identifier. + /// + [HttpDelete(Name = "{deviceId}")] + [ProducesResponseType(StatusCodes.Status200OK)] public async Task DeleteDeviceAsync(string deviceId) { await this.devicesService.DeleteDevice(deviceId); @@ -199,10 +233,17 @@ public async Task DeleteDeviceAsync(string deviceId) return this.Ok($"iot hub device was delete {deviceId}"); } - [HttpPost("{deviceId}/{moduleId}/{methodName}")] + /// + /// Executes the module method on the IoT Edge device. + /// + /// The module. + /// The device identifier. + /// Name of the method. + /// + [HttpPost("{deviceId}/{moduleId}/{methodName}", Name = "POST Execute module command")] public async Task ExecuteMethode(GatewayModule module, string deviceId, string methodName) { - CloudToDeviceMethod method = new (methodName); + CloudToDeviceMethod method = new(methodName); string payload = string.Empty; if (methodName == "RestartModule") @@ -248,11 +289,10 @@ public async Task ExecuteMethode(GatewayModule module, string deviceI } /// - /// this function get and return the number of device connected - /// to a gateway. + /// Retrieves the connected devices number on the IoT Edge. /// - /// id of the device. - /// int. + /// The device identifier. + /// private async Task RetrieveNbConnectedDevice(string deviceId) { IQuery query = this.registryManager.CreateQuery($"SELECT * FROM devices.modules WHERE devices.modules.moduleId = '$edgeHub' AND deviceId in ['{deviceId}']", 1); @@ -268,13 +308,13 @@ private async Task RetrieveNbConnectedDevice(string deviceId) } /// - /// This function found the last conguration deployed on the device. + /// Retrieves the last configuration of the IoT Edge. /// - /// the twin of the device we want. - /// ConfigItem. + /// The twin. + /// private async Task RetrieveLastConfiguration(Twin twin) { - ConfigItem item = new (); + ConfigItem item = new(); if (twin.Configurations != null && twin.Configurations.Count > 0) { 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 d0f7f4ba6..dd0b0446b 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANCommandsController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANCommandsController.cs @@ -53,12 +53,12 @@ public LoRaWANCommandsController( } /// - /// Sets the device model's commands. + /// Updates the device model's commands. /// /// The model identifier. /// The commands. /// The action result. - [HttpPost(Name = "POST Device model commands")] + [HttpPost(Name = "POST Set device model commands")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task Post(string id, DeviceModelCommand[] commands) @@ -115,7 +115,7 @@ await this.tableClientFactory } /// - /// Sets the device model's commands. + /// Gets the device model's commands. /// /// The model identifier. /// The action result. 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 f76d8a538..0234d5bf2 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANConcentratorsController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANConcentratorsController.cs @@ -11,6 +11,7 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10.LoRaWAN using AzureIoTHub.Portal.Server.Mappers; using AzureIoTHub.Portal.Server.Services; using AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.Concentrator; + using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.Devices; using Microsoft.Azure.Devices.Common.Exceptions; @@ -23,11 +24,33 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10.LoRaWAN [ApiExplorerSettings(GroupName = "LoRa WAN")] public class LoRaWANConcentratorsController : ControllerBase { + /// + /// The device Idevice service. + /// private readonly IDeviceService devicesService; + + /// + /// The device IConcentrator twin mapper. + /// private readonly IConcentratorTwinMapper concentratorTwinMapper; + + /// + /// The device IRouter config manager. + /// private readonly IRouterConfigManager routerConfigManager; + + /// + /// The device Lora wan concentrators controller. + /// private readonly ILogger logger; + /// + /// Initializes a new instance of the class. + /// + /// The logger. + /// The devices service. + /// The router config manager. + /// The concentrator twin mapper. public LoRaWANConcentratorsController( ILogger logger, IDeviceService devicesService, @@ -40,8 +63,13 @@ public LoRaWANConcentratorsController( this.routerConfigManager = routerConfigManager; } - [HttpGet] - public async Task GetAllDeviceConcentrator() + /// + /// Gets all device concentrators. + /// + /// + [HttpGet(Name = "GET LoRaWAN Concentrator list")] + [ProducesResponseType(StatusCodes.Status200OK)] + public async Task>> GetAllDeviceConcentrator() { // Gets all the twins from this devices var items = await this.devicesService.GetAllDevice(filterDeviceType: "LoRa Concentrator"); @@ -51,14 +79,27 @@ public async Task GetAllDeviceConcentrator() return this.Ok(result); } - [HttpGet("{deviceId}")] - public async Task GetDeviceConcentrator(string deviceId) + /// + /// Gets the device concentrator. + /// + /// The device identifier. + /// + [HttpGet("{deviceId}", Name = "GET LoRaWAN Concentrator")] + [ProducesResponseType(StatusCodes.Status200OK)] + public async Task> GetDeviceConcentrator(string deviceId) { var item = await this.devicesService.GetDeviceTwin(deviceId); return this.Ok(this.concentratorTwinMapper.CreateDeviceDetails(item)); } - [HttpPost] + /// + /// Creates the device. + /// + /// The device. + /// + [HttpPost(Name = "POST Create LoRaWAN concentrator")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] public async Task CreateDeviceAsync(Concentrator device) { try @@ -96,7 +137,14 @@ public async Task CreateDeviceAsync(Concentrator device) } } - [HttpPut] + /// + /// Updates the device. + /// + /// The device. + /// + [HttpPut(Name = "PUT Update LoRaWAN concentrator")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] public async Task UpdateDeviceAsync(Concentrator device) { if (!this.ModelState.IsValid) @@ -123,11 +171,12 @@ public async Task UpdateDeviceAsync(Concentrator device) } /// - /// this function delete a device. + /// Deletes the specified device. /// - /// the device id. - /// ok status on success. - [HttpDelete("{deviceId}")] + /// The device identifier. + /// + [HttpDelete("{deviceId}", Name = "DELETE Remove LoRaWAN concentrator")] + [ProducesResponseType(StatusCodes.Status200OK)] public async Task Delete(string deviceId) { await this.devicesService.DeleteDevice(deviceId); 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 eff5c712f..bd4f293fc 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANDeviceModelsController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANDeviceModelsController.cs @@ -5,12 +5,14 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10.LoRaWAN { using AzureIoTHub.Portal.Server.Factories; 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.LoRaWAN.LoRaDeviceModel; + using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; + using System.Collections.Generic; + using System.Threading.Tasks; [ApiController] [ApiVersion("1.0")] @@ -36,5 +38,109 @@ public LoRaWANDeviceModelsController( $"{nameof(DeviceModel.SupportLoRaFeatures)} eq true") { } + + /// + /// Gets the device model list. + /// + /// An array representing the device models. + [HttpGet(Name = "GET LoRaWAN device model list")] + [ProducesResponseType(StatusCodes.Status200OK)] + public override ActionResult> Get() + { + return base.Get(); + } + + /// + /// Get the device model details. + /// + /// The devic emodel identifier. + /// The device model details. + [HttpGet("{id}", Name = "GET LoRaWAN device model")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public override ActionResult Get(string id) + { + return base.Get(id); + } + + /// + /// Gets the device model avatar. + /// + /// The device model identifier + /// + [HttpGet("{id}/avatar", Name = "GET LoRaWAN device model avatar URL")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public override ActionResult GetAvatar(string id) + { + return base.GetAvatar(id); + } + + /// + /// Changes the avatar. + /// + /// The model identifier. + /// The file. + /// The avatar. + [HttpPost("{id}/avatar", Name = "POST Update the LoRaWAN device model avatar")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public override Task> ChangeAvatar(string id, IFormFile file) + { + return base.ChangeAvatar(id, file); + } + + /// + /// Deletes the avatar. + /// + /// The model identifier. + [HttpDelete("{id}/avatar", Name = "DELETE Remove the LoRaWAN device model avatar")] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public override Task DeleteAvatar(string id) + { + return base.DeleteAvatar(id); + } + + /// + /// Creates the specified device model. + /// + /// The device model. + /// The action result. + [HttpPost(Name = "POST Create a new LoRaWAN device model")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + public override Task Post(LoRaDeviceModel deviceModel) + { + return base.Post(deviceModel); + } + + /// + /// Updates the specified device model. + /// + /// The device model. + /// The action result. + [HttpPut("{id}", Name = "PUT Update the LoRaWAN device model")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public override Task Put(LoRaDeviceModel deviceModel) + { + return base.Put(deviceModel); + } + + /// + /// Deletes the specified device model. + /// + /// The device model identifier. + /// The action result. + [HttpDelete("{id}", Name = "DELETE Remove the LoRaWAN device model")] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public override Task Delete(string id) + { + return base.Delete(id); + } } } 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 a071618ec..14273cd4c 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANDevicesController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/LoRaWAN/LoRaWANDevicesController.cs @@ -13,9 +13,9 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10 using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using System; + using System.Collections.Generic; using System.Linq; using System.Net; - using System.Net.Http.Json; using System.Threading.Tasks; [ApiController] @@ -43,12 +43,67 @@ public LoRaWANDevicesController( } /// - /// Permit to execute cloud to device message. + /// Gets the device list. /// - /// id of the device. - /// the command who contain the name and the trame. - /// a CloudToDeviceMethodResult . - [HttpPost("{deviceId}/_command/{commandId}")] + /// + [HttpGet(Name = "GET LoRaWAN device list")] + public override Task> Get() + { + return base.Get(); + } + + /// + /// Gets the specified device. + /// + /// The device identifier. + /// + [HttpGet("{deviceID}", Name = "GET LoRaWAN device details")] + public override Task Get(string deviceID) + { + return base.Get(deviceID); + } + + /// + /// Creates the device. + /// + /// The device. + /// + [HttpPost(Name = "POST Create LoRaWAN device")] + public override Task CreateDeviceAsync(LoRaDeviceDetails device) + { + return base.CreateDeviceAsync(device); + } + + /// + /// Updates the device. + /// + /// The device. + /// + [HttpPut(Name = "PUT Update LoRaWAN device")] + public override Task UpdateDeviceAsync(LoRaDeviceDetails device) + { + return base.UpdateDeviceAsync(device); + } + + /// + /// Deletes the specified device. + /// + /// The device identifier. + /// + [HttpDelete("{deviceID}", Name = "DELETE Remove LoRaWAN device")] + public override Task Delete(string deviceID) + { + return base.Delete(deviceID); + } + + /// + /// Executes the command on the device.. + /// + /// The device identifier. + /// The command identifier. + /// + /// Incorrect port or invalid DevEui Format. + [HttpPost("{deviceId}/_command/{commandId}", Name ="POST Execute LoRaWAN command")] public async Task ExecuteCommand(string deviceId, string commandId) { try diff --git a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/SettingsController.cs b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/SettingsController.cs index 7231cd1e0..ac2541fe6 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/v1.0/SettingsController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/v1.0/SettingsController.cs @@ -17,8 +17,15 @@ namespace AzureIoTHub.Portal.Server.Controllers.V10 [ApiExplorerSettings(GroupName = "Portal Settings")] public class SettingsController : ControllerBase { + /// + /// The device client api indentity options. + /// private readonly ClientApiIndentityOptions configuration; + /// + /// Initializes a new instance of the class. + /// + /// The configuration. public SettingsController(IOptions configuration) { this.configuration = configuration.Value; @@ -30,7 +37,7 @@ public SettingsController(IOptions configuration) /// The portal OIDC settnigs. /// Returns the OIDC settings. /// Internal server error. - [HttpGet("oidc", Name = "GET OIDC")] + [HttpGet("oidc", Name = "GET Open ID settings")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status500InternalServerError)] public IActionResult GetOIDCSettings() diff --git a/src/AzureIoTHub.Portal/Shared/AzureIoTHub.Portal.Shared.csproj b/src/AzureIoTHub.Portal/Shared/AzureIoTHub.Portal.Shared.csproj index 6defebf9b..85ea01272 100644 --- a/src/AzureIoTHub.Portal/Shared/AzureIoTHub.Portal.Shared.csproj +++ b/src/AzureIoTHub.Portal/Shared/AzureIoTHub.Portal.Shared.csproj @@ -27,6 +27,8 @@ + + diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/C2Dresult.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/C2Dresult.cs index 62abb77b7..4c08a28cc 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/C2Dresult.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/C2Dresult.cs @@ -5,8 +5,14 @@ namespace AzureIoTHub.Portal.Shared.Models.V10 { public class C2Dresult { + /// + /// The C2D result payload. + /// public string Payload { get; set; } + /// + /// The C2D status. + /// public int Status { get; set; } } } diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/ConfigItem.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/ConfigItem.cs index 25c477b45..eaa6ba55f 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/ConfigItem.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/ConfigItem.cs @@ -1,18 +1,32 @@ // 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 { - using System; - public class ConfigItem { + /// + /// The IoT Edge configuration name. + /// + [Required(ErrorMessage = "The configuration model name is required.")] public string Name { get; set; } + /// + /// The IoT Edge configuration creation date. + /// public DateTime DateCreation { get; set; } + /// + /// The IoT Edge configuration status. + /// public string Status { get; set; } + /// + /// Initializes a new instance of the class. + /// public ConfigItem() { this.DateCreation = new DateTime(1999, 1, 1); diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/ConfigListItem.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/ConfigListItem.cs index 42c1c6d19..2457c1d86 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/ConfigListItem.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/ConfigListItem.cs @@ -8,27 +8,57 @@ namespace AzureIoTHub.Portal.Shared.Models.V10 public class ConfigListItem { + /// + /// Initializes a new instance of the class. + /// public ConfigListItem() { this.Modules = new List(); } + /// + /// The IoT Edge configuration identifier. + /// public string ConfigurationID { get; set; } + /// + /// The IoT Edge configuration target conditions. + /// public string Conditions { get; set; } + /// + /// The IoT Edge configuration targeted metrics. + /// public long MetricsTargeted { get; set; } + /// + /// The IoT Edge configuration applied metrics. + /// public long MetricsApplied { get; set; } + /// + /// The IoT Edge configuration success metrics. + /// public long MetricsSuccess { get; set; } + /// + /// The IoT Edge configuration failure metrics. + /// public long MetricsFailure { get; set; } + /// + /// The IoT Edge configuration priority. + /// public int Priority { get; set; } + /// + /// The IoT Edge configuration creation date. + /// public DateTime CreationDate { get; set; } + /// + /// The IoT Edge modules configuration. + /// public List Modules { get; set; } } } 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 7e902bcde..860b5b912 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/Device/DeviceDetails.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/Device/DeviceDetails.cs @@ -8,25 +8,52 @@ namespace AzureIoTHub.Portal.Shared.Models.V10.Device public class DeviceDetails { + /// + /// The device identifier. + /// [Required(ErrorMessage = "The device should have a unique identifier.")] public string DeviceID { get; set; } + /// + /// The name of the device. + /// [Required(ErrorMessage = "The device should have a name.")] public string DeviceName { get; set; } + /// + /// The model identifier. + /// [Required(ErrorMessage = "The device should use a model.")] public string ModelId { get; set; } + /// + /// The device model image Url. + /// public string ImageUrl { get; set; } + /// + /// true if this instance is connected; otherwise, false. + /// public bool IsConnected { get; set; } + /// + /// true if this instance is enabled; otherwise, false. + /// public bool IsEnabled { get; set; } + /// + /// The status updated time. + /// public DateTime StatusUpdatedTime { get; set; } + /// + /// The location code. + /// public string LocationCode { get; set; } + /// + /// The asset identifier. + /// public string AssetId { get; set; } } } 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 19cab7f0f..0fa5e8a31 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/DeviceModel/DeviceModel.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/DeviceModel/DeviceModel.cs @@ -4,8 +4,7 @@ namespace AzureIoTHub.Portal.Shared.Models.V10.DeviceModel { using System.ComponentModel.DataAnnotations; - using Newtonsoft.Json; - + public class DeviceModel { /// @@ -14,7 +13,7 @@ public class DeviceModel public string ModelId { get; set; } /// - /// The device model image URL. + /// The device model image Url. /// public string ImageUrl { get; set; } diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/Gateway.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/Gateway.cs index 89aa87619..fcb497904 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/Gateway.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/Gateway.cs @@ -8,34 +8,76 @@ namespace AzureIoTHub.Portal.Shared.Models.V10 public class Gateway { - [Required] + /// + /// The IoT Edge identifier. + /// + [Required(ErrorMessage = "The device identifier is required.")] public string DeviceId { get; set; } + /// + /// The IoT Edge device symmetric key. + /// public string SymmetricKey { get; set; } + /// + /// The IoT Edge connection state. + /// public string ConnectionState { get; set; } + /// + /// The IoT Edge scope tag value. + /// public string Scope { get; set; } + /// + /// The IoT Edge end point. + /// public string EndPoint { get; set; } - [Required] + /// + /// The IoT Edge device type. + /// + [Required(ErrorMessage = "The device type is required.")] public string Type { get; set; } + /// + /// The IoT Edge device status. + /// public string Status { get; set; } + /// + /// The IoT Edge runtime response. + /// public string RuntimeResponse { get; set; } + /// + /// The number of connected devices on IoT Edge device. + /// public int NbDevices { get; set; } + /// + /// The number of modules on IoT Edge device. + /// public int NbModules { get; set; } + /// + /// The IoT Edge environment tag value. + /// public string Environment { get; set; } + /// + /// The IoT Edge configuraton. + /// public ConfigItem LastDeployment { get; set; } + /// + /// The IoT Edge modules. + /// public List Modules { get; set; } + /// + /// Initializes a new instance of the class. + /// public Gateway() { this.Modules = new List(); diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/GatewayListItem.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/GatewayListItem.cs index cdd46f543..6cbe239c7 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/GatewayListItem.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/GatewayListItem.cs @@ -1,16 +1,31 @@ // 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 { public class GatewayListItem { + /// + /// The device identifier. + /// + [Required(ErrorMessage = "The device identifier is required.")] public string DeviceId { get; set; } + /// + /// The device status. + /// public string Status { get; set; } + /// + /// The device type. + /// public string Type { get; set; } + /// + /// The number of devices connected on the IoT Edge. + /// public int NbDevices { get; set; } } } diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/GatewayModule.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/GatewayModule.cs index c9f08412b..88849e7d8 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/GatewayModule.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/GatewayModule.cs @@ -4,17 +4,34 @@ namespace AzureIoTHub.Portal.Shared.Models.V10 { using System.Collections.Generic; + using System.ComponentModel.DataAnnotations; public class GatewayModule { + /// + /// The module name. + /// + [Required(ErrorMessage = "The device model name is required.")] public string ModuleName { get; set; } + /// + /// The module configuration version. + /// public string Version { get; set; } + /// + /// The module status. + /// public string Status { get; set; } + /// + /// The module environment variables. + /// public Dictionary EnvironmentVariables { get; set; } + /// + /// The module identity twin settings. + /// public Dictionary ModuleIdentityTwinSettings { get; set; } } } 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 9c59e21d3..0722aa832 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 @@ -5,16 +5,34 @@ namespace AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.Concentrator { public class Channel { + /// + /// A value indicating whether the channel is enabled. + /// public bool? Enable { get; set; } + /// + /// The frequency. + /// public int Freq { get; set; } + /// + /// The radio. + /// public int Radio { get; set; } + /// + /// The interface. + /// public int If { get; set; } + /// + /// The bandwidth. + /// public int Bandwidth { get; set; } + /// + /// The spread factor. + /// public int Spread_factor { get; set; } } } 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 71d3d7419..8807572df 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 @@ -7,26 +7,53 @@ namespace AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.Concentrator public class Concentrator { + /// + /// The device identifier. + /// [Required] [RegularExpression("^[A-F0-9]{16}$", ErrorMessage = "DeviceID must contain 16 hexadecimal characters (numbers from 0 to 9 and/or letters from A to F)")] public string DeviceId { get; set; } + /// + /// The name of the device. + /// [Required] public string DeviceName { get; set; } + /// + /// The lora region. + /// [Required] public string LoraRegion { get; set; } + /// + /// The type of the device. + /// public string DeviceType { get; set; } + /// + /// The client certificate thumbprint. + /// public string ClientCertificateThumbprint { get; set; } + /// + /// true if this instance is connected; otherwise, false. + /// public bool IsConnected { get; set; } + /// + /// true if this instance is enabled; otherwise, false. + /// public bool IsEnabled { get; set; } + /// + /// true if [already logged in once]; otherwise, false. + /// public bool AlreadyLoggedInOnce { get; set; } + /// + /// The router configuration. + /// public RouterConfig RouterConfig { get; set; } } } 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 b54acaa6d..26dddec0c 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 @@ -7,26 +7,59 @@ namespace AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.Concentrator public class RouterConfig { + /// + /// The network identifier. + /// public List NetID { get; set; } + /// + /// The join eui. + /// public List> JoinEui { get; set; } + /// + /// The region. + /// public string Region { get; set; } + /// + /// The hardware specifications. + /// public string Hwspec { get; set; } + /// + /// The frequency range. + /// public List Freq_range { get; set; } + /// + /// The DRs. + /// public List> DRs { get; set; } + /// + /// The SX1301 conf. + /// public List> Sx1301_conf { get; set; } + /// + /// true if nocca; otherwise, false. + /// public bool Nocca { get; set; } + /// + /// true if nodc; otherwise, false. + /// public bool Nodc { get; set; } + /// + /// true if nodwell; otherwise, false. + /// public bool Nodwell { get; set; } + /// + /// Initializes a new instance of the class. + /// public RouterConfig() { this.Region = string.Empty; 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 e3d71ba45..063b0be6d 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 @@ -5,8 +5,14 @@ namespace AzureIoTHub.Portal.Shared.Models.V10.LoRaWAN.LoRaDevice { public class Command { + /// + /// The command identifier. + /// public string CommandId { get; set; } + /// + /// The frame. + /// public string Frame { get; set; } } } 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 f51e2e2d0..cc1eeaf05 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 @@ -21,7 +21,7 @@ public class LoRaDeviceDetails : DeviceDetails public string AppKey { get; set; } /// - /// The sensor decoder API url. + /// The sensor decoder API Url. /// public string SensorDecoder { get; set; } 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 8f1e40e31..f0d3e7f22 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 @@ -15,7 +15,7 @@ public class LoRaDeviceModel : DeviceModel.DeviceModel public string AppEUI { get; set; } /// - /// The sensor decoder URL. + /// The sensor decoder Url. /// public string SensorDecoderURL { get; set; } @@ -32,7 +32,6 @@ public LoRaDeviceModel(DeviceModel.DeviceModel from) this.ImageUrl = from.ImageUrl; } - /// /// Initializes a new instance of the class. /// diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/RequestPayload.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/RequestPayload.cs deleted file mode 100644 index bd4980b13..000000000 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/RequestPayload.cs +++ /dev/null @@ -1,9 +0,0 @@ -// 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 -{ - class RequestPayload - { - } -} diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/SearchModel.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/SearchModel.cs index 793a843dc..b481b4716 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/SearchModel.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/SearchModel.cs @@ -1,16 +1,34 @@ // 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 { public class SearchModel { + /// + /// The device identifier. + /// + [Required(ErrorMessage = "The device identifier is required.")] public string DeviceId { get; set; } + /// + /// The device status. + /// public string Status { get; set; } + /// + /// The device type. + /// public string Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// The id. + /// The device status. + /// The device type. public SearchModel(string id = null, string status = null, string type = null) { this.DeviceId = id;