using Application.Models; using IoT.Shared.DeviceServices.Onvif; using Microsoft.AspNetCore.Mvc; using Swashbuckle.AspNetCore.Annotations; using System; namespace IoT.Shared.Controllers.Onvif { [SwaggerTag("摄像头")] public class OnvifController : BaseDeviceController { private readonly OnvifService _deviceService; public OnvifController(IServiceProvider applicationServices, OnvifService deviceService) : base(applicationServices) { this._deviceService = deviceService; } [HttpGet, Route("/[controller]/[action]"), SwaggerOperation("主码流截屏")] public ApiResponse MainScreenShot([SwaggerParameter("网关编号")]string gateway, [SwaggerParameter("设备编号")]string number) { return this.AsyncAction(() => { this._deviceService.MainScreenShot(number); }); } [HttpGet, Route("/[controller]/[action]"), SwaggerOperation("子码流截屏")] public ApiResponse SubScreenShot([SwaggerParameter("网关编号")]string gateway, [SwaggerParameter("设备编号")]string number) { return this.AsyncAction(() => { this._deviceService.SubScreenShot(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); }); } } }