using Application.Models; using IoT.Shared.Controllers; using Microsoft.AspNetCore.Mvc; using Swashbuckle.AspNetCore.Annotations; using System; namespace ONVIFService.Controllers { [SwaggerTag("摄像头")] public class CameraController : BaseDeviceController { private readonly DeviceService _deviceService; public CameraController(IServiceProvider applicationServices, DeviceService deviceService) : base(applicationServices) { this._deviceService = deviceService; } [HttpGet, Route("/[controller]/[action]"), SwaggerOperation("截屏")] public ApiResponse ScreenShot([SwaggerParameter("网关编号")]string gateway, [SwaggerParameter("设备编号")]string number) { return this.AsyncAction(() => { this._deviceService.ScreenShot(number); }); } [HttpGet, Route("/[controller]/[action]"), SwaggerOperation("上")] public ApiResponse Up([SwaggerParameter("网关编号")]string gateway, [SwaggerParameter("设备编号")]string number) { return this.AsyncAction(() => { this._deviceService.Up(number, 0.5f); }); } [HttpGet, Route("/[controller]/[action]"), SwaggerOperation("下")] public ApiResponse Down([SwaggerParameter("网关编号")]string gateway, [SwaggerParameter("设备编号")]string number) { return this.AsyncAction(() => { this._deviceService.Down(number, 0.5f); }); } [HttpGet, Route("/[controller]/[action]"), SwaggerOperation("左")] public ApiResponse Left([SwaggerParameter("网关编号")]string gateway, [SwaggerParameter("设备编号")]string number) { return this.AsyncAction(() => { this._deviceService.Left(number, 0.5f); }); } [HttpGet, Route("/[controller]/[action]"), SwaggerOperation("右")] public ApiResponse Right([SwaggerParameter("网关编号")]string gateway, [SwaggerParameter("设备编号")]string number) { return this.AsyncAction(() => { this._deviceService.Right(number, 0.5f); }); } [HttpGet, Route("/[controller]/[action]"), SwaggerOperation("大")] public ApiResponse Zoomin([SwaggerParameter("网关编号")]string gateway, [SwaggerParameter("设备编号")]string number) { return this.AsyncAction(() => { this._deviceService.ZoomIn(number, 0.5f); }); } [HttpGet, Route("/[controller]/[action]"), SwaggerOperation("小")] public ApiResponse Zoomout([SwaggerParameter("网关编号")]string gateway, [SwaggerParameter("设备编号")]string number) { return this.AsyncAction(() => { this._deviceService.ZoomOut(number, 0.5f); }); } [HttpGet, Route("/[controller]/[action]"), SwaggerOperation("停")] public ApiResponse Stop([SwaggerParameter("网关编号")]string gateway, [SwaggerParameter("设备编号")]string number) { return this.AsyncAction(() => { this._deviceService.Stop(number); }); } } }