using Application.Models; using IoTNode.DeviceServices.FBee; using Microsoft.AspNetCore.Mvc; using Swashbuckle.AspNetCore.Annotations; using System; using System.ComponentModel; using System.ComponentModel.DataAnnotations; namespace IoTNode.Controllers { [SwaggerTag("红外转发器")] public class IrController : BaseDeviceController { private readonly FBeeService _deviceService; public IrController(IServiceProvider applicationServices, FBeeService deviceService) : base(applicationServices) { this._deviceService = deviceService; } [HttpGet, Route("/[controller]/[action]"), SwaggerOperation("发送指令")] public ApiResponse Send([SwaggerParameter("设备编号")]string number, [SwaggerParameter("按键类型")]byte type, [SwaggerParameter("键值")]ushort code) { return this.AsyncAction(() => { var values = number.Split('-'); this._deviceService.XA70082(values[0], values[1], type, code); }); } [HttpGet, Route("/[controller]/[action]"), SwaggerOperation("学习")] public ApiResponse Study([SwaggerParameter("设备编号")]string number, [SwaggerParameter("按键类型")]byte type, [SwaggerParameter("键值"), Required, Range(1, 10)]ushort code) { return this.AsyncAction(() => { var values = number.Split('-'); this._deviceService.XA70083(values[0], values[1], type, code); }); } } }