You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.2 KiB
37 lines
1.2 KiB
using Application.Models;
|
|
using IoT.Shared.Controllers;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Swashbuckle.AspNetCore.Annotations;
|
|
using System;
|
|
|
|
namespace FBeeService.Controllers
|
|
{
|
|
[SwaggerTag("1路开关")]
|
|
public class SwitchController : BaseDeviceController
|
|
{
|
|
private readonly DeviceService _deviceService;
|
|
|
|
public SwitchController(IServiceProvider applicationServices, DeviceService deviceService) : base(applicationServices)
|
|
{
|
|
this._deviceService = deviceService;
|
|
}
|
|
|
|
[HttpGet, Route("/[controller]/[action]"), SwaggerOperation("开")]
|
|
public ApiResponse On([SwaggerParameter("网关编号")]string gateway, [SwaggerParameter("设备编号")]string number)
|
|
{
|
|
return this.AsyncAction(() =>
|
|
{
|
|
this._deviceService.X82(gateway, number, 1);
|
|
});
|
|
}
|
|
|
|
[HttpGet, Route("/[controller]/[action]"), SwaggerOperation("关")]
|
|
public ApiResponse Off([SwaggerParameter("网关编号")]string gateway, [SwaggerParameter("设备编号")]string number)
|
|
{
|
|
return this.AsyncAction(() =>
|
|
{
|
|
this._deviceService.X82(gateway, number, 0);
|
|
});
|
|
}
|
|
}
|
|
} |