Parcourir la source

add:增加调焦和改变调焦模式接口

miloma93@163.com il y a 3 mois
Parent
commit
c7bfb6b2bd

+ 16 - 0
src/main/java/com/sw/patroleditor/controller/PTZController.java

@@ -2,6 +2,8 @@ package com.sw.patroleditor.controller;
 
 import com.sw.patroleditor.common.ResultData;
 import com.sw.patroleditor.component.rosBridge.RobotDataCallBack;
+import com.sw.patroleditor.domain.model.FocusConfiguration;
+import com.sw.patroleditor.domain.model.FocusData;
 import com.sw.patroleditor.domain.model.PTZData;
 import com.sw.patroleditor.domain.model.Position3D;
 import com.sw.patroleditor.service.HKService;
@@ -30,6 +32,20 @@ public class PTZController {
     }
 
 
+    @ApiOperation(value = "改变云台聚焦模式")
+    @PutMapping("/ptz/changeFocusMode")
+    public ResultData changeFocusMode(@RequestBody FocusConfiguration focusConfiguration) {
+        return hkService.changeFocusMode(focusConfiguration);
+    }
+
+
+    @ApiOperation(value = "云台聚焦")
+    @PutMapping("/ptz/focus")
+    public ResultData focus(@RequestBody FocusData focusData) {
+        return hkService.focusChanged(focusData);
+    }
+
+
     @ApiOperation(value = "3D定位")
     @PutMapping("/ptz/position3D")
     public ResultData position3D(@RequestBody Position3D position3D) {

+ 40 - 0
src/main/java/com/sw/patroleditor/domain/model/FocusConfiguration.java

@@ -0,0 +1,40 @@
+package com.sw.patroleditor.domain.model;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+
+@XmlRootElement(name = "FocusConfiguration")
+public class FocusConfiguration {
+
+    //MANUAL SEMIAUTOMATIC
+    @ApiModelProperty("聚焦模式:手动:MANUAL 半自动:SEMIAUTOMATIC")
+    @XmlElement(name = "focusStyle")
+    private String focusStyle;
+
+    @ApiModelProperty("聚焦限制:50(默认)")
+    @XmlElement(name = "focusLimited")
+    private String focusLimited;
+
+    @XmlTransient
+    public String getFocusStyle() {
+        return focusStyle;
+    }
+
+    public void setFocusStyle(String focusStyle) {
+        this.focusStyle = focusStyle;
+    }
+
+    @XmlTransient
+    public String getFocusLimited() {
+        return focusLimited;
+    }
+
+    public void setFocusLimited(String focusLimited) {
+        this.focusLimited = focusLimited;
+    }
+}

+ 3 - 0
src/main/java/com/sw/patroleditor/service/HKService.java

@@ -1,6 +1,7 @@
 package com.sw.patroleditor.service;
 
 import com.sw.patroleditor.common.ResultData;
+import com.sw.patroleditor.domain.model.FocusConfiguration;
 import com.sw.patroleditor.domain.model.FocusData;
 import com.sw.patroleditor.domain.model.PTZData;
 import com.sw.patroleditor.domain.model.Position3D;
@@ -15,4 +16,6 @@ public interface HKService {
     ResultData position3DCtrl(Position3D position);
 
     ResultData picture();
+
+    ResultData changeFocusMode(FocusConfiguration focusConfiguration);
 }

+ 18 - 0
src/main/java/com/sw/patroleditor/service/impl/HKServiceImpl.java

@@ -40,6 +40,7 @@ public class HKServiceImpl implements HKService {
 
     }
 
+
     /**
      * 改变焦距
      *
@@ -91,6 +92,23 @@ public class HKServiceImpl implements HKService {
         return ResultData.success(resp);
     }
 
+    /**
+     *
+     * 改变焦距模式
+     *
+     * @param focusConfiguration
+     * @return
+     */
+    @Override
+    public ResultData changeFocusMode(FocusConfiguration focusConfiguration) {
+        BodyRequestModel bodyRequestModel = new BodyRequestModel();
+
+        String uri = "/ISAPI/Image/channels/" + bodyRequestModel.getChannel() + "/focusConfiguration";
+        bodyRequestModel.setUri(uri);
+        return sendCtrlCMD2Hik(focusConfiguration, bodyRequestModel, FocusConfiguration.class);
+
+    }
+
 
     /**
      * 利用摘要认证并按照ISAPI协议向HIK发送控制指令