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.
40 lines
1.4 KiB
40 lines
1.4 KiB
using IoTNode.DeviceServices.FBee;
|
|
using IoT.Shared.Application.Models;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Swashbuckle.AspNetCore.Annotations;
|
|
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace IoTNode.Controllers
|
|
{
|
|
public class DoorController : BaseDeviceController
|
|
{
|
|
private readonly FBeeService _deviceService;
|
|
|
|
public DoorController(IServiceProvider applicationServices, FBeeService deviceService) : base(applicationServices)
|
|
{
|
|
this._deviceService = deviceService;
|
|
}
|
|
|
|
[HttpGet, Route("/[controller]/[action]"), SwaggerOperation("开")]
|
|
public ApiResponse Open([SwaggerParameter("设备编号"), Required] string number, [SwaggerParameter("密码"), Required] string password)
|
|
{
|
|
return this.AsyncAction(() =>
|
|
{
|
|
var values = number.Split('-');
|
|
this._deviceService.X82OpenDoor(values[0], values[1], password, 0x01);
|
|
});
|
|
}
|
|
|
|
[HttpGet, Route("/[controller]/[action]"), SwaggerOperation("关")]
|
|
public ApiResponse Close([SwaggerParameter("设备编号"), Required] string number, [SwaggerParameter("密码"), Required] string password)
|
|
{
|
|
return this.AsyncAction(() =>
|
|
{
|
|
var values = number.Split('-');
|
|
this._deviceService.X82OpenDoor(values[0], values[1], password, 0x00);
|
|
});
|
|
}
|
|
}
|
|
}
|