using JiShe.IoT.DeviceAggregation;
using JiShe.IoT.DeviceAggregation.Dto;
using JiShe.ServicePro.Core;
using JiShe.ServicePro.DeviceManagement.DeviceInfos;
namespace JiShe.IoT.Controllers
{
///
/// 设备聚合服务
///
[Route("/Aggregation/Device")]
public class DeviceAggregationController : IoTController
{
private readonly IDeviceAggregationService _deviceAggregationService;
public DeviceAggregationController(IDeviceAggregationService deviceAggregationService)
{
_deviceAggregationService = deviceAggregationService;
}
///
/// 创建设备信息
///
///
///
[HttpPost(nameof(CreateAsync))]
[SwaggerOperation(summary: "创建设备信息", Tags = new[] { "AggregationDevice" })]
public async Task CreateAsync(CreateDeviceAggregationInput input)
{
return await _deviceAggregationService.CreateDeviceForApiAsync(input);
}
///
/// 批量创建设备信息
///
///
///
[HttpPost(nameof(BatchCreateAsync))]
[SwaggerOperation(summary: "批量创建设备信息", Tags = new[] { "AggregationDevice" })]
public async Task BatchCreateAsync(BatchCreateDeviceAggregationInput input)
{
return await _deviceAggregationService.BatchCreateDeviceForApiAsync(input);
}
///
/// 删除设备信息
///
[HttpPost(nameof(DeleteAsync))]
[SwaggerOperation(summary: "删除设备信息", Tags = new[] { "AggregationDevice" })]
public async Task DeleteAsync(IdInput input)
{
return await _deviceAggregationService.DeleteAsync(input);
}
///
/// 根据设备ID查询设备信息
///
[HttpPost(nameof(FindByIdAsync))]
[SwaggerOperation(summary: "根据设备ID查询设备信息", Tags = new[] { "AggregationDevice" })]
public async Task FindByIdAsync(IdInput input)
{
return await _deviceAggregationService.FindByIdAsync(input);
}
///
/// 重新推送设备信息到物联网平台
///
///
///
[HttpPost(nameof(RepushDeviceInfoToIoTPlatform))]
[SwaggerOperation(summary: "重新推送设备信息到物联网平台", Tags = new[] { "AggregationDevice" })]
public Task RepushDeviceInfoToIoTPlatform(IdInput input)
{
return _deviceAggregationService.RepushDeviceInfoToIoTPlatform(input);
}
///
/// 发送设备指令信息
///
///
///
[HttpPost(nameof(DeviceCommandForApiAsync))]
[SwaggerOperation(summary: "发送设备指令信息", Tags = new[] { "AggregationDevice" })]
public Task DeviceCommandForApiAsync(DeviceCommandForApiInput input)
{
return _deviceAggregationService.DeviceCommandForApiAsync(input);
}
}
}