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.
81 lines
2.8 KiB
81 lines
2.8 KiB
using Application.Models;
|
|
using IoTNode.DeviceServices.FBee;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Swashbuckle.AspNetCore.Annotations;
|
|
using System;
|
|
|
|
namespace IoTNode.Controllers
|
|
{
|
|
[SwaggerTag("2路开关")]
|
|
public class Switch2Controller : BaseDeviceController
|
|
{
|
|
private readonly FBeeService _deviceService;
|
|
|
|
public Switch2Controller(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, 0x10);
|
|
this._deviceService.X82(values[0], values[1], 1, 0x11);
|
|
});
|
|
}
|
|
|
|
[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, 0x10);
|
|
this._deviceService.X82(values[0], values[1], 0, 0x11);
|
|
});
|
|
}
|
|
|
|
[HttpGet, Route("/[controller]/[action]"), SwaggerOperation("L1开")]
|
|
public ApiResponse L1On([SwaggerParameter("设备编号")]string number)
|
|
{
|
|
return this.AsyncAction(() =>
|
|
{
|
|
var values = number.Split('-');
|
|
this._deviceService.X82(values[0], values[1], 1, 0x10);
|
|
});
|
|
}
|
|
|
|
[HttpGet, Route("/[controller]/[action]"), SwaggerOperation("L1关")]
|
|
public ApiResponse L1Off([SwaggerParameter("设备编号")]string number)
|
|
{
|
|
return this.AsyncAction(() =>
|
|
{
|
|
var values = number.Split('-');
|
|
this._deviceService.X82(values[0], values[1], 0, 0x10);
|
|
});
|
|
}
|
|
|
|
[HttpGet, Route("/[controller]/[action]"), SwaggerOperation("L2开")]
|
|
public ApiResponse L2On([SwaggerParameter("设备编号")]string number)
|
|
{
|
|
return this.AsyncAction(() =>
|
|
{
|
|
var values = number.Split('-');
|
|
this._deviceService.X82(values[0], values[1], 1, 0x11);
|
|
});
|
|
}
|
|
|
|
[HttpGet, Route("/[controller]/[action]"), SwaggerOperation("L2关")]
|
|
public ApiResponse L2Off([SwaggerParameter("设备编号")]string number)
|
|
{
|
|
return this.AsyncAction(() =>
|
|
{
|
|
var values = number.Split('-');
|
|
this._deviceService.X82(values[0], values[1], 0, 0x11);
|
|
});
|
|
}
|
|
}
|
|
} |