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/IoT/IoT.Shared/Controllers/FBee/IrController.cs

140 lines
5.5 KiB

using Application.Models;
using IoT.Shared.DeviceServices.FBee;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using System;
namespace IoT.Shared.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("键值")]ushort code)
{
return this.AsyncAction(() =>
{
var values = number.Split('-');
this._deviceService.XA70083(values[0], values[1], type, code);
});
}
[HttpGet, Route("/[controller]/[action]"), SwaggerOperation("")]
public ApiResponse KeyCodeType1On([SwaggerParameter("设备编号")]string number)
{
return this.AsyncAction(() =>
{
var values = number.Split('-');
this._deviceService.SetKeyCodeType(values[0], values[1], "KeyCodeType1", "开");
});
}
[HttpGet, Route("/[controller]/[action]"), SwaggerOperation("")]
public ApiResponse KeyCodeType1Off([SwaggerParameter("设备编号")]string number)
{
return this.AsyncAction(() =>
{
var values = number.Split('-');
this._deviceService.SetKeyCodeType(values[0], values[1], "KeyCodeType1", "关");
});
}
[HttpGet, Route("/[controller]/[action]"), SwaggerOperation("")]
public ApiResponse KeyCodeType2On([SwaggerParameter("设备编号")]string number)
{
return this.AsyncAction(() =>
{
var values = number.Split('-');
this._deviceService.SetKeyCodeType(values[0], values[1], "KeyCodeType2", "开");
});
}
[HttpGet, Route("/[controller]/[action]"), SwaggerOperation("")]
public ApiResponse KeyCodeType2Off([SwaggerParameter("设备编号")]string number)
{
return this.AsyncAction(() =>
{
var values = number.Split('-');
this._deviceService.SetKeyCodeType(values[0], values[1], "KeyCodeType2", "关");
});
}
[HttpGet, Route("/[controller]/[action]"), SwaggerOperation("")]
public ApiResponse KeyCodeType3On([SwaggerParameter("设备编号")]string number)
{
return this.AsyncAction(() =>
{
var values = number.Split('-');
this._deviceService.SetKeyCodeType(values[0], values[1], "KeyCodeType3", "开");
});
}
[HttpGet, Route("/[controller]/[action]"), SwaggerOperation("")]
public ApiResponse KeyCodeType3Off([SwaggerParameter("设备编号")]string number)
{
return this.AsyncAction(() =>
{
var values = number.Split('-');
this._deviceService.SetKeyCodeType(values[0], values[1], "KeyCodeType3", "关");
});
}
[HttpGet, Route("/[controller]/[action]"), SwaggerOperation("")]
public ApiResponse KeyCodeType4On([SwaggerParameter("设备编号")]string number)
{
return this.AsyncAction(() =>
{
var values = number.Split('-');
this._deviceService.SetKeyCodeType(values[0], values[1], "KeyCodeType4", "开");
});
}
[HttpGet, Route("/[controller]/[action]"), SwaggerOperation("")]
public ApiResponse KeyCodeType4Off([SwaggerParameter("设备编号")]string number)
{
return this.AsyncAction(() =>
{
var values = number.Split('-');
this._deviceService.SetKeyCodeType(values[0], values[1], "KeyCodeType4", "关");
});
}
[HttpGet, Route("/[controller]/[action]"), SwaggerOperation("")]
public ApiResponse KeyCodeType5On([SwaggerParameter("设备编号")]string number)
{
return this.AsyncAction(() =>
{
var values = number.Split('-');
this._deviceService.SetKeyCodeType(values[0], values[1], "KeyCodeType5", "开");
});
}
[HttpGet, Route("/[controller]/[action]"), SwaggerOperation("")]
public ApiResponse KeyCodeType5Off([SwaggerParameter("设备编号")]string number)
{
return this.AsyncAction(() =>
{
var values = number.Split('-');
this._deviceService.SetKeyCodeType(values[0], values[1], "KeyCodeType5", "关");
});
}
}
}