old mode 100644
new mode 100755
 |  |  | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson2.JSONObject; | 
 |  |  | import com.genersoft.iot.vmp.conf.exception.ControllerException; | 
 |  |  | import com.genersoft.iot.vmp.conf.security.JwtUtils; | 
 |  |  | import com.genersoft.iot.vmp.gb28181.bean.Device; | 
 |  |  | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 
 |  |  | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | 
 |  |  | 
 |  |  | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; | 
 |  |  | import io.swagger.v3.oas.annotations.Operation; | 
 |  |  | import io.swagger.v3.oas.annotations.Parameter; | 
 |  |  | import io.swagger.v3.oas.annotations.security.SecurityRequirement; | 
 |  |  | import io.swagger.v3.oas.annotations.tags.Tag; | 
 |  |  | import org.slf4j.Logger; | 
 |  |  | import org.slf4j.LoggerFactory; | 
 |  |  | 
 |  |  | import java.util.UUID; | 
 |  |  |  | 
 |  |  | @Tag(name  = "国标设备控制") | 
 |  |  | @CrossOrigin | 
 |  |  |  | 
 |  |  | @RestController | 
 |  |  | @RequestMapping("/api/device/control") | 
 |  |  | public class DeviceControl { | 
 |  |  | 
 |  |  |      *  | 
 |  |  |      * @param deviceId 设备ID | 
 |  |  |      */ | 
 |  |  |    @Operation(summary = "远程启动控制命令") | 
 |  |  |    @Operation(summary = "远程启动控制命令", security = @SecurityRequirement(name = JwtUtils.HEADER)) | 
 |  |  |    @Parameter(name = "deviceId", description = "设备国标编号", required = true) | 
 |  |  |     @GetMapping("/teleboot/{deviceId}") | 
 |  |  |     public void teleBootApi(@PathVariable String deviceId) { | 
 |  |  | 
 |  |  |      * @param recordCmdStr  Record:手动录像,StopRecord:停止手动录像 | 
 |  |  |      * @param channelId     通道编码(可选) | 
 |  |  |      */ | 
 |  |  |    @Operation(summary = "录像控制") | 
 |  |  |    @Operation(summary = "录像控制", security = @SecurityRequirement(name = JwtUtils.HEADER)) | 
 |  |  |    @Parameter(name = "deviceId", description = "设备国标编号", required = true) | 
 |  |  |    @Parameter(name = "channelId", description = "通道国标编号", required = true) | 
 |  |  |    @Parameter(name = "recordCmdStr", description = "命令, 可选值:Record(手动录像),StopRecord(停止手动录像)", required = true) | 
 |  |  | 
 |  |  |             msg.setKey(key); | 
 |  |  |             msg.setData(String.format("开始/停止录像操作失败,错误码: %s, %s", event.statusCode, event.msg)); | 
 |  |  |             resultHolder.invokeAllResult(msg); | 
 |  |  |          }); | 
 |  |  |          },null); | 
 |  |  |       } catch (InvalidArgumentException | SipException | ParseException e) { | 
 |  |  |          logger.error("[命令发送失败] 开始/停止录像: {}", e.getMessage()); | 
 |  |  |          throw new ControllerException(ErrorCode.ERROR100.getCode(), "命令发送失败: " + e.getMessage()); | 
 |  |  | 
 |  |  |     * @param   deviceId 设备ID | 
 |  |  |     * @param   guardCmdStr SetGuard:布防,ResetGuard:撤防 | 
 |  |  |     */ | 
 |  |  |    @Operation(summary = "布防/撤防命令") | 
 |  |  |    @Operation(summary = "布防/撤防命令", security = @SecurityRequirement(name = JwtUtils.HEADER)) | 
 |  |  |    @Parameter(name = "deviceId", description = "设备国标编号", required = true) | 
 |  |  |    @Parameter(name = "guardCmdStr", description = "命令, 可选值:SetGuard(布防),ResetGuard(撤防)", required = true) | 
 |  |  |    @GetMapping("/guard/{deviceId}/{guardCmdStr}") | 
 |  |  | 
 |  |  |             msg.setKey(key); | 
 |  |  |             msg.setData(String.format("布防/撤防操作失败,错误码: %s, %s", event.statusCode, event.msg)); | 
 |  |  |             resultHolder.invokeResult(msg); | 
 |  |  |          }); | 
 |  |  |          },null); | 
 |  |  |       } catch (InvalidArgumentException | SipException | ParseException e) { | 
 |  |  |          logger.error("[命令发送失败] 布防/撤防操作: {}", e.getMessage()); | 
 |  |  |          throw new ControllerException(ErrorCode.ERROR100.getCode(), "命令发送: " + e.getMessage()); | 
 |  |  | 
 |  |  |     * @param   alarmMethod 报警方式(可选) | 
 |  |  |     * @param   alarmType   报警类型(可选) | 
 |  |  |     */ | 
 |  |  |    @Operation(summary = "报警复位") | 
 |  |  |    @Operation(summary = "报警复位", security = @SecurityRequirement(name = JwtUtils.HEADER)) | 
 |  |  |    @Parameter(name = "deviceId", description = "设备国标编号", required = true) | 
 |  |  |    @Parameter(name = "channelId", description = "通道国标编号", required = true) | 
 |  |  |    @Parameter(name = "alarmMethod", description = "报警方式") | 
 |  |  | 
 |  |  |             msg.setKey(key); | 
 |  |  |             msg.setData(String.format("报警复位操作失败,错误码: %s, %s", event.statusCode, event.msg)); | 
 |  |  |             resultHolder.invokeResult(msg); | 
 |  |  |          }); | 
 |  |  |          },null); | 
 |  |  |       } catch (InvalidArgumentException | SipException | ParseException e) { | 
 |  |  |          logger.error("[命令发送失败] 报警复位: {}", e.getMessage()); | 
 |  |  |          throw new ControllerException(ErrorCode.ERROR100.getCode(), "命令发送失败: " + e.getMessage()); | 
 |  |  | 
 |  |  |     * @param   deviceId 设备ID | 
 |  |  |     * @param   channelId  通道ID | 
 |  |  |     */ | 
 |  |  |    @Operation(summary = "强制关键帧") | 
 |  |  |    @Operation(summary = "强制关键帧", security = @SecurityRequirement(name = JwtUtils.HEADER)) | 
 |  |  |    @Parameter(name = "deviceId", description = "设备国标编号", required = true) | 
 |  |  |    @Parameter(name = "channelId", description = "通道国标编号") | 
 |  |  |    @GetMapping("/i_frame/{deviceId}") | 
 |  |  | 
 |  |  |      * @param presetIndex   调用预置位编号(可选) | 
 |  |  |      * @param channelId     通道编码(可选) | 
 |  |  |     */ | 
 |  |  |    @Operation(summary = "看守位控制") | 
 |  |  |    @Operation(summary = "看守位控制", security = @SecurityRequirement(name = JwtUtils.HEADER)) | 
 |  |  |    @Parameter(name = "deviceId", description = "设备国标编号", required = true) | 
 |  |  |    @Parameter(name = "channelId", description = "通道国标编号", required = true) | 
 |  |  |    @Parameter(name = "enabled", description = "是否开启看守位 1:开启,0:关闭", required = true) | 
 |  |  | 
 |  |  |             msg.setKey(key); | 
 |  |  |             msg.setData(String.format("看守位控制操作失败,错误码: %s, %s", event.statusCode, event.msg)); | 
 |  |  |             resultHolder.invokeResult(msg); | 
 |  |  |          }); | 
 |  |  |          },null); | 
 |  |  |       } catch (InvalidArgumentException | SipException | ParseException e) { | 
 |  |  |          logger.error("[命令发送失败] 看守位控制: {}", e.getMessage()); | 
 |  |  |          throw new ControllerException(ErrorCode.ERROR100.getCode(), "命令发送失败: " + e.getMessage()); | 
 |  |  | 
 |  |  |     * @param lengthy 拉框宽度像素值 | 
 |  |  |     * @return | 
 |  |  |     */ | 
 |  |  |    @Operation(summary = "拉框放大") | 
 |  |  |    @Operation(summary = "拉框放大", security = @SecurityRequirement(name = JwtUtils.HEADER)) | 
 |  |  |    @Parameter(name = "deviceId", description = "设备国标编号", required = true) | 
 |  |  |    @Parameter(name = "channelId", description = "通道国标编号", required = true) | 
 |  |  |    @Parameter(name = "length", description = "播放窗口长度像素值", required = true) | 
 |  |  | 
 |  |  |     * @param lengthy 拉框宽度像素值 | 
 |  |  |     * @return | 
 |  |  |     */ | 
 |  |  |    @Operation(summary = "拉框放大") | 
 |  |  |    @Operation(summary = "拉框缩小", security = @SecurityRequirement(name = JwtUtils.HEADER)) | 
 |  |  |    @Parameter(name = "deviceId", description = "设备国标编号", required = true) | 
 |  |  |    @Parameter(name = "channelId", description = "通道国标编号") | 
 |  |  |    @Parameter(name = "length", description = "播放窗口长度像素值", required = true) |