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.
iot/projects/IoTNode/DeviceServices/FBee/Controllers/SwitchController.cs

39 lines
1.2 KiB

using Application.Models;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using System;
using IoTNode.DeviceServices.FBee;
namespace IoTNode.Controllers
{
[SwaggerTag("1路开关")]
public class SwitchController : BaseDeviceController
{
private readonly FBeeService _deviceService;
public SwitchController(IServiceProvider applicationServices, FBeeService deviceService) : base(applicationServices)
{
this._deviceService = deviceService;
}
[HttpGet, Route("/[controller]/[action]"), SwaggerOperation("")]
public ApiResponse On([SwaggerParameter("设备编号")]string number)
{
return this.AsyncAction(() =>
{
var values = number.Split('-');
this._deviceService.X82(values[0], values[1], 1);
});
}
[HttpGet, Route("/[controller]/[action]"), SwaggerOperation("")]
public ApiResponse Off([SwaggerParameter("设备编号")]string number)
{
return this.AsyncAction(() =>
{
var values = number.Split('-');
this._deviceService.X82(values[0], values[1], 0);
});
}
}
}