1. 增加聚焦模式切换接口
2. 增加短时录像接口
3. 增加目标引导接口
4. 增加预置点设置调取接口
| | |
| | | @ApiOperation("设置零方位角") |
| | | @PostMapping("/setZeroPTZ") |
| | | @Log(title = "设置零方位角", businessType = BusinessType.CONTROL) |
| | | @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.cmd.chanNo"}) |
| | | @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo"}) |
| | | public @ResponseBody |
| | | AjaxResult setZeroPTZ(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | |
| | | //异步登录 |
| | | void asyncLogin(ArdCameras cameras); |
| | | |
| | | //登录所有相机 |
| | | void loginAll(); |
| | | |
| | | //注销 |
| | | boolean logout(String cameraId); |
| | | |
| | |
| | | dhClientService.loginAll();//登录全部大华相机 |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void syncLogin(ArdCameras cameras) { |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void loginAll() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public boolean logout(String cameraId) { |
| | | return false; |
| | | } |
| | | |
| | | //在线检测 |
| | | @Override |
| | | public boolean isOnLine(CameraCmd cmd) { |
| | | try { |
| | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //云台控制 |
| | | @Override |
| | | public boolean pTZControl(CameraCmd cmd) { |
| | | try { |
| | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //设置聚焦值 |
| | | @Override |
| | | public boolean setFocusPos(CameraCmd cmd) { |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | //获取聚焦值 |
| | | @Override |
| | | public Map<String, Object> getFocusPos(CameraCmd cmd) { |
| | |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | //设置预置位 |
| | | @Override |
| | | public boolean setPreset(CameraCmd cmd) { |
| | |
| | | if (factory.equals("1")) { |
| | | result = hikClientService.setPreset(cmd); |
| | | } else if (factory.equals("2")) { |
| | | |
| | | result = dhClientService.setPreset(cmd); |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | //调用预置位 |
| | | @Override |
| | | public boolean gotoPreset(CameraCmd cmd) { |
| | |
| | | if (factory.equals("1")) { |
| | | result = hikClientService.gotoPreset(cmd); |
| | | } else if (factory.equals("2")) { |
| | | |
| | | result = dhClientService.gotoPreset(cmd); |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | //获取码流压缩参数 |
| | | @Override |
| | | public Map<String, String> getVideoCompressionCfg(CameraCmd cmd) { |
| | |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | //透雾开关 |
| | | @Override |
| | | public boolean controlDefogcfg(CameraCmd cmd) { |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | //红外开关 |
| | | @Override |
| | | public boolean controlInfrarecfg(CameraCmd cmd) { |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | //手动/自动聚焦 |
| | | @Override |
| | | public boolean controlFocusMode(CameraCmd cmd) { |
| | |
| | | if (factory.equals("1")) { |
| | | result = hikClientService.controlFocusMode(cmd); |
| | | } else if (factory.equals("2")) { |
| | | |
| | | result = dhClientService.controlFocusMode(cmd); |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | //获取聚焦模式 |
| | | @Override |
| | | public String getFocusMode(CameraCmd cmd) { |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | //云台加热 |
| | | @Override |
| | | public boolean controlPTHeateRpwron(CameraCmd cmd) { |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | //镜头加热 |
| | | @Override |
| | | public boolean controlCameraDeicing(CameraCmd cmd) { |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | //操控锁定 |
| | | @Override |
| | | public boolean controlLock(CameraCmd cmd) { |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | //设置解锁 |
| | | @Override |
| | | public boolean controlUnLock(CameraCmd cmd) { |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | //获取云台锁定信息 |
| | | @Override |
| | | public int getPTZLockInfo(CameraCmd cmd) { |
| | |
| | | public String captureJPEGPicture(CameraCmd cmd) { |
| | | return null; |
| | | } |
| | | |
| | | //抓图 |
| | | @Override |
| | | public String picCutCate(CameraCmd cmd) { |
| | | String url = ""; |
| | |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | //获取ptz范围 |
| | | @Override |
| | | public Map<String, Object> getPtzScope(CameraCmd cmd) { |
| | |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | //设置ptz |
| | | @Override |
| | | public boolean setPtz(CameraCmd cmd) { |
| | | boolean result = false; |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | //设置零方位角 |
| | | @Override |
| | | public boolean setZeroPtz(CameraCmd cmd) { |
| | | boolean result = false; |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | //引导指向目标 |
| | | @Override |
| | | public boolean guideTargetPosition(CameraCmd cmd) { |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | //开始录像 |
| | | @Override |
| | | public boolean recordStart(CameraCmd cmd) { |
| | | boolean result = false; |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | //停止录像并存入minio |
| | | @Override |
| | | public String recordStopToMinio(CameraCmd cmd) { |
| | | String url = ""; |
| | |
| | | } |
| | | return url; |
| | | } |
| | | |
| | | //停止录像并不存入minio |
| | | @Override |
| | | public void recordStopNotToMinio(CameraCmd cmd) { |
| | | |
| | |
| | | */ |
| | | public class CapturePictureModule { |
| | | |
| | | public static NetSDKLib netsdk = NetSDKLib.NETSDK_INSTANCE; |
| | | |
| | | /** |
| | | * \if ENGLISH_LANG |
| | | * Local Capture Picture |
| | |
| | | */ |
| | | public static boolean localCapturePicture(NetSDKLib.LLong hPlayHandle, String picFileName) { |
| | | |
| | | if (!LoginModule.netsdk.CLIENT_CapturePictureEx(hPlayHandle, picFileName, NetSDKLib.NET_CAPTURE_FORMATS.NET_CAPTURE_JPEG)) { |
| | | if (!netsdk.CLIENT_CapturePictureEx(hPlayHandle, picFileName, NetSDKLib.NET_CAPTURE_FORMATS.NET_CAPTURE_JPEG)) { |
| | | System.err.printf("CLIENT_CapturePicture Failed!" + ToolKits.getErrorCodePrint()); |
| | | return false; |
| | | } else { |
| | |
| | | import com.ruoyi.device.dhsdk.lib.NetSDKLib;
|
| | | import com.sun.jna.Structure;
|
| | | import com.sun.jna.ptr.IntByReference;
|
| | | import static com.ruoyi.device.dhsdk.lib.ToolKits.getErrorCodePrint;
|
| | |
|
| | | /**
|
| | | * @Description:
|
| | |
| | | **/
|
| | | public class ConfigModule {
|
| | | public static NetSDKLib netsdk = NetSDKLib.NETSDK_INSTANCE;
|
| | | public static NetSDKLib configsdk = NetSDKLib.CONFIG_INSTANCE;
|
| | | /**
|
| | | * 查询设备状态
|
| | | */
|
| | |
| | |
|
| | | IntByReference intRetLen = new IntByReference();
|
| | | stuInfo.write();
|
| | | if (!LoginModule.netsdk.CLIENT_QueryDevState(hLoginHandle, nType, stuInfo.getPointer(), stuInfo.size(), intRetLen, 3000)) {
|
| | | if (!netsdk.CLIENT_QueryDevState(hLoginHandle, nType, stuInfo.getPointer(), stuInfo.size(), intRetLen, 3000)) {
|
| | | return false;
|
| | | }
|
| | | stuInfo.read();
|
| | | return true;
|
| | | }
|
| | | /**
|
| | | * 设置单个配置
|
| | | * @param hLoginHandle 登陆句柄
|
| | | * @param nChn 通道号,-1 表示全通道
|
| | | * @param strCmd 配置名称
|
| | | * @param cmdObject 配置对应的结构体对象
|
| | | * @return 成功返回 true
|
| | | */
|
| | | public static boolean SetDevConfig(NetSDKLib.LLong hLoginHandle, int nChn, String strCmd, Structure cmdObject) {
|
| | | boolean result = false;
|
| | | int nBufferLen = 2*1024*1024;
|
| | | byte szBuffer[] = new byte[nBufferLen];
|
| | | for(int i=0; i<nBufferLen; i++)szBuffer[i]=0;
|
| | | IntByReference error = new IntByReference(0);
|
| | | IntByReference restart = new IntByReference(0);
|
| | | cmdObject.write();
|
| | | if (configsdk.CLIENT_PacketData(strCmd, cmdObject.getPointer(), cmdObject.size(), szBuffer, nBufferLen)) {
|
| | | cmdObject.read();
|
| | | if( configsdk.CLIENT_SetNewDevConfig(hLoginHandle, strCmd , nChn , szBuffer, nBufferLen, error, restart, 3000)) {
|
| | | result = true;
|
| | | } else {
|
| | | System.err.printf("Set %s Config Failed! Last Error = %s\n" , strCmd , getErrorCodePrint());
|
| | | result = false;
|
| | | }
|
| | | } else {
|
| | | System.err.println("Packet " + strCmd + " Config Failed!" + getErrorCodePrint());
|
| | | result = false;
|
| | | }
|
| | |
|
| | | return result;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.ruoyi.device.dhsdk.lib.NetSDKLib.LLong; |
| | | import com.ruoyi.device.dhsdk.lib.NetSDKLib.NET_IN_LOGIN_WITH_HIGHLEVEL_SECURITY; |
| | | import com.ruoyi.device.dhsdk.lib.NetSDKLib.NET_OUT_LOGIN_WITH_HIGHLEVEL_SECURITY; |
| | | import com.ruoyi.device.dhsdk.lib.ToolKits; |
| | | import com.sun.jna.Structure; |
| | | import com.sun.jna.ptr.IntByReference; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.io.File; |
| | | |
| | | import static com.ruoyi.device.dhsdk.lib.ToolKits.getErrorCodePrint; |
| | | |
| | | /** |
| | |
| | | public class LoginModule { |
| | | |
| | | public static NetSDKLib netsdk = NetSDKLib.NETSDK_INSTANCE; |
| | | public static NetSDKLib configsdk = NetSDKLib.CONFIG_INSTANCE; |
| | | |
| | | // 设备信息 |
| | | public static NetSDKLib.NET_DEVICEINFO_Ex m_stDeviceInfo = new NetSDKLib.NET_DEVICEINFO_Ex(); |
| | |
| | | * 主要有 :八个方向控制、变倍、变焦、光圈功能 |
| | | */ |
| | | public class PtzControlModule { |
| | | public static NetSDKLib netsdk = NetSDKLib.NETSDK_INSTANCE; |
| | | |
| | | /** |
| | | * 向上 |
| | | */ |
| | | public static boolean ptzControlUpStart(NetSDKLib.LLong lLoginID,int nChannelID, int lParam1, int lParam2) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_UP_CONTROL, |
| | | lParam1, lParam2, 0, 0); |
| | | } |
| | | public static boolean ptzControlUpEnd(int nChannelID) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_UP_CONTROL, |
| | | 0, 0, 0, 1); |
| | | } |
| | | |
| | | /** |
| | | * 向下 |
| | | */ |
| | | public static boolean ptzControlDownStart(int nChannelID, int lParam1, int lParam2) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_DOWN_CONTROL, |
| | | lParam1, lParam2, 0, 0); |
| | | } |
| | | public static boolean ptzControlDownEnd(int nChannelID) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_DOWN_CONTROL, |
| | | 0, 0, 0, 1); |
| | | } |
| | | |
| | | /** |
| | | * 向左 |
| | | */ |
| | | public static boolean ptzControlLeftStart(int nChannelID, int lParam1, int lParam2) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_LEFT_CONTROL, |
| | | lParam1, lParam2, 0, 0); |
| | | } |
| | | public static boolean ptzControlLeftEnd(int nChannelID) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_LEFT_CONTROL, |
| | | 0, 0, 0, 1); |
| | | } |
| | | |
| | | /** |
| | | * 向右 |
| | | */ |
| | | public static boolean ptzControlRightStart(int nChannelID, int lParam1,int lParam2) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_RIGHT_CONTROL, |
| | | lParam1, lParam2, 0, 0); |
| | | } |
| | | public static boolean ptzControlRightEnd(int nChannelID) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_RIGHT_CONTROL, |
| | | 0, 0, 0, 1); |
| | | } |
| | | |
| | | /** |
| | | * 向左上 |
| | | */ |
| | | public static boolean ptzControlLeftUpStart(int nChannelID, int lParam1, int lParam2) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTTOP, |
| | | lParam1, lParam2, 0, 0); |
| | | } |
| | | public static boolean ptzControlLeftUpEnd(int nChannelID) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTTOP, |
| | | 0, 0, 0, 1); |
| | | } |
| | | |
| | | /** |
| | | * 向右上 |
| | | */ |
| | | public static boolean ptzControlRightUpStart(int nChannelID, int lParam1, int lParam2) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTTOP, |
| | | lParam1, lParam2, 0, 0); |
| | | } |
| | | public static boolean ptzControlRightUpEnd(int nChannelID) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTTOP, |
| | | 0, 0, 0, 1); |
| | | } |
| | | /** |
| | | * 向上 |
| | | */ |
| | | public static boolean ptzControlUpStart(NetSDKLib.LLong lLoginID, int nChannelID, int lParam1, int lParam2) { |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_UP_CONTROL, |
| | | lParam1, lParam2, 0, 0); |
| | | } |
| | | |
| | | /** |
| | | * 向左下 |
| | | */ |
| | | public static boolean ptzControlLeftDownStart(int nChannelID, int lParam1, int lParam2) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTDOWN, |
| | | lParam1, lParam2, 0, 0); |
| | | } |
| | | public static boolean ptzControlLeftDownEnd(int nChannelID) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTDOWN, |
| | | 0, 0, 0, 1); |
| | | } |
| | | |
| | | /** |
| | | * 向右下 |
| | | */ |
| | | public static boolean ptzControlRightDownStart(int nChannelID, int lParam1, int lParam2) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTDOWN, |
| | | lParam1, lParam2, 0, 0); |
| | | } |
| | | public static boolean ptzControlRightDownEnd(int nChannelID) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTDOWN, |
| | | 0, 0, 0, 1); |
| | | } |
| | | |
| | | public static boolean ptzControlUpEnd(int nChannelID) { |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_UP_CONTROL, |
| | | 0, 0, 0, 1); |
| | | } |
| | | |
| | | /** |
| | | * 向下 |
| | | */ |
| | | public static boolean ptzControlDownStart(int nChannelID, int lParam1, int lParam2) { |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_DOWN_CONTROL, |
| | | lParam1, lParam2, 0, 0); |
| | | } |
| | | |
| | | public static boolean ptzControlDownEnd(int nChannelID) { |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_DOWN_CONTROL, |
| | | 0, 0, 0, 1); |
| | | } |
| | | |
| | | /** |
| | | * 向左 |
| | | */ |
| | | public static boolean ptzControlLeftStart(int nChannelID, int lParam1, int lParam2) { |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_LEFT_CONTROL, |
| | | lParam1, lParam2, 0, 0); |
| | | } |
| | | |
| | | public static boolean ptzControlLeftEnd(int nChannelID) { |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_LEFT_CONTROL, |
| | | 0, 0, 0, 1); |
| | | } |
| | | |
| | | /** |
| | | * 向右 |
| | | */ |
| | | public static boolean ptzControlRightStart(int nChannelID, int lParam1, int lParam2) { |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_RIGHT_CONTROL, |
| | | lParam1, lParam2, 0, 0); |
| | | } |
| | | |
| | | public static boolean ptzControlRightEnd(int nChannelID) { |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_RIGHT_CONTROL, |
| | | 0, 0, 0, 1); |
| | | } |
| | | |
| | | /** |
| | | * 向左上 |
| | | */ |
| | | public static boolean ptzControlLeftUpStart(int nChannelID, int lParam1, int lParam2) { |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTTOP, |
| | | lParam1, lParam2, 0, 0); |
| | | } |
| | | |
| | | public static boolean ptzControlLeftUpEnd(int nChannelID) { |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTTOP, |
| | | 0, 0, 0, 1); |
| | | } |
| | | |
| | | /** |
| | | * 向右上 |
| | | */ |
| | | public static boolean ptzControlRightUpStart(int nChannelID, int lParam1, int lParam2) { |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTTOP, |
| | | lParam1, lParam2, 0, 0); |
| | | } |
| | | |
| | | public static boolean ptzControlRightUpEnd(int nChannelID) { |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTTOP, |
| | | 0, 0, 0, 1); |
| | | } |
| | | |
| | | /** |
| | | * 向左下 |
| | | */ |
| | | public static boolean ptzControlLeftDownStart(int nChannelID, int lParam1, int lParam2) { |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTDOWN, |
| | | lParam1, lParam2, 0, 0); |
| | | } |
| | | |
| | | public static boolean ptzControlLeftDownEnd(int nChannelID) { |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTDOWN, |
| | | 0, 0, 0, 1); |
| | | } |
| | | |
| | | /** |
| | | * 向右下 |
| | | */ |
| | | public static boolean ptzControlRightDownStart(int nChannelID, int lParam1, int lParam2) { |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTDOWN, |
| | | lParam1, lParam2, 0, 0); |
| | | } |
| | | |
| | | public static boolean ptzControlRightDownEnd(int nChannelID) { |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTDOWN, |
| | | 0, 0, 0, 1); |
| | | } |
| | | |
| | | /** |
| | | * 变倍+ |
| | | */ |
| | | public static boolean ptzControlZoomAddStart(int nChannelID, int lParam2) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_ADD_CONTROL, |
| | | 0, lParam2, 0, 0); |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_ADD_CONTROL, |
| | | 0, lParam2, 0, 0); |
| | | } |
| | | |
| | | public static boolean ptzControlZoomAddEnd(int nChannelID) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_ADD_CONTROL, |
| | | 0, 0, 0, 1); |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_ADD_CONTROL, |
| | | 0, 0, 0, 1); |
| | | } |
| | | |
| | | /** |
| | | * 变倍- |
| | | */ |
| | | public static boolean ptzControlZoomDecStart(int nChannelID, int lParam2) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_DEC_CONTROL, |
| | | 0, lParam2, 0, 0); |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_DEC_CONTROL, |
| | | 0, lParam2, 0, 0); |
| | | } |
| | | |
| | | public static boolean ptzControlZoomDecEnd(int nChannelID) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_DEC_CONTROL, |
| | | 0, 0, 0, 1); |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_DEC_CONTROL, |
| | | 0, 0, 0, 1); |
| | | } |
| | | |
| | | /** |
| | | * 变焦+ |
| | | */ |
| | | public static boolean ptzControlFocusAddStart(int nChannelID, int lParam2) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_ADD_CONTROL, |
| | | 0, lParam2, 0, 0); |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_ADD_CONTROL, |
| | | 0, lParam2, 0, 0); |
| | | } |
| | | |
| | | public static boolean ptzControlFocusAddEnd(int nChannelID) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_ADD_CONTROL, |
| | | 0, 0, 0, 1); |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_ADD_CONTROL, |
| | | 0, 0, 0, 1); |
| | | } |
| | | |
| | | /** |
| | | * 变焦- |
| | | */ |
| | | public static boolean ptzControlFocusDecStart(int nChannelID, int lParam2) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_DEC_CONTROL, |
| | | 0, lParam2, 0, 0); |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_DEC_CONTROL, |
| | | 0, lParam2, 0, 0); |
| | | } |
| | | |
| | | public static boolean ptzControlFocusDecEnd(int nChannelID) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_DEC_CONTROL, |
| | | 0, 0, 0, 1); |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_DEC_CONTROL, |
| | | 0, 0, 0, 1); |
| | | } |
| | | |
| | | /** |
| | | * 光圈+ |
| | | */ |
| | | public static boolean ptzControlIrisAddStart(int nChannelID, int lParam2) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_ADD_CONTROL, |
| | | 0, lParam2, 0, 0); |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_ADD_CONTROL, |
| | | 0, lParam2, 0, 0); |
| | | } |
| | | |
| | | public static boolean ptzControlIrisAddEnd(int nChannelID) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_ADD_CONTROL, |
| | | 0, 0, 0, 1); |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_ADD_CONTROL, |
| | | 0, 0, 0, 1); |
| | | } |
| | | |
| | | /** |
| | | * 光圈- |
| | | */ |
| | | public static boolean ptzControlIrisDecStart(int nChannelID, int lParam2) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_DEC_CONTROL, |
| | | 0, lParam2, 0, 0); |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_DEC_CONTROL, |
| | | 0, lParam2, 0, 0); |
| | | } |
| | | |
| | | public static boolean ptzControlIrisDecEnd(int nChannelID) { |
| | | return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_DEC_CONTROL, |
| | | 0, 0, 0, 1); |
| | | return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID, |
| | | NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_DEC_CONTROL, |
| | | 0, 0, 0, 1); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ruoyi.device.dhsdk.lib.NetSDKLib; |
| | | import com.ruoyi.device.dhsdk.lib.ToolKits; |
| | | import com.sun.jna.Pointer; |
| | | |
| | | import static com.ruoyi.device.dhsdk.module.LoginModule.netsdk; |
| | | |
| | | /** |
| | | * 实时预览接口实现 |
| | | * 主要有 :开始拉流、停止拉流功能 |
| | |
| | | * \endif |
| | | */ |
| | | public static NetSDKLib.LLong startRealPlay(NetSDKLib.LLong m_hLoginHandle, int channel, int stream) { |
| | | NetSDKLib.LLong m_hPlayHandle = LoginModule.netsdk.CLIENT_RealPlayEx(m_hLoginHandle, channel, null, stream); |
| | | NetSDKLib.LLong m_hPlayHandle = netsdk.CLIENT_RealPlayEx(m_hLoginHandle, channel, null, stream); |
| | | if (m_hPlayHandle.longValue() == 0) { |
| | | System.err.println("开始实时预览失败,错误码" + ToolKits.getErrorCodePrint()); |
| | | } else { |
| | | System.out.println("Success to start realplay"); |
| | | // netsdk.CLIENT_SetRealDataCallBackEx(m_hPlayHandle, CbfRealDataCallBackEx.getInstance(),null, 0x0000001f); |
| | | } |
| | | return m_hPlayHandle; |
| | | } |
| | | |
| | | public static NetSDKLib.LLong startRealPlay1(NetSDKLib.LLong m_hLoginHandle, int channel, String path) { |
| | | NetSDKLib.NET_IN_REALPLAY_BY_DATA_TYPE net_in_realplay_by_data_type = new NetSDKLib.NET_IN_REALPLAY_BY_DATA_TYPE(); |
| | | net_in_realplay_by_data_type.nChannelID = channel; |
| | | net_in_realplay_by_data_type.hWnd = null; |
| | | net_in_realplay_by_data_type.rType = 0; |
| | | net_in_realplay_by_data_type.emDataType = NetSDKLib.EM_REAL_DATA_TYPE.EM_REAL_DATA_TYPE_MP4; |
| | | net_in_realplay_by_data_type.szSaveFileName = path; |
| | | //net_in_realplay_by_data_type.cbRealData = CbfRealDataCallBackEx.getInstance(); |
| | | NetSDKLib.NET_OUT_REALPLAY_BY_DATA_TYPE net_out_realplay_by_data_type = new NetSDKLib.NET_OUT_REALPLAY_BY_DATA_TYPE(); |
| | | NetSDKLib.LLong m_hPlayHandle = netsdk.CLIENT_RealPlayByDataType(m_hLoginHandle, net_in_realplay_by_data_type, net_out_realplay_by_data_type, 5000); |
| | | if (m_hPlayHandle.longValue() == 0) { |
| | | System.err.println("开始实时预览失败,错误码" + ToolKits.getErrorCodePrint()); |
| | | } else { |
| | |
| | | if (m_hPlayHandle.longValue() == 0) { |
| | | return; |
| | | } |
| | | |
| | | boolean bRet = LoginModule.netsdk.CLIENT_StopRealPlayEx(m_hPlayHandle); |
| | | boolean bRet = netsdk.CLIENT_StopRealPlayEx(m_hPlayHandle); |
| | | if (bRet) { |
| | | m_hPlayHandle.setValue(0); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 实时预览数据回调函数--扩展(pBuffer内存由SDK内部申请释放) |
| | | */ |
| | | private static class CbfRealDataCallBackEx implements NetSDKLib.fRealDataCallBackEx { |
| | | private CbfRealDataCallBackEx() { |
| | | } |
| | | |
| | | private static class CallBackHolder { |
| | | private static CbfRealDataCallBackEx instance = new CbfRealDataCallBackEx(); |
| | | } |
| | | |
| | | public static CbfRealDataCallBackEx getInstance() { |
| | | return CallBackHolder.instance; |
| | | } |
| | | |
| | | @Override |
| | | public void invoke(NetSDKLib.LLong lRealHandle, int dwDataType, Pointer pBuffer, |
| | | int dwBufSize, int param, Pointer dwUser) { |
| | | int bInput = 0; |
| | | if (0 != lRealHandle.longValue()) { |
| | | switch (dwDataType) { |
| | | case 0: |
| | | System.out.println("码流大小为" + dwBufSize + "\n" + "码流类型为原始音视频混合数据"); |
| | | break; |
| | | case 1: |
| | | //标准视频数据 |
| | | System.out.println("码流大小为" + dwBufSize + "\n" + "码流类型为标准视频数据"); |
| | | break; |
| | | case 2: |
| | | //yuv 数据 |
| | | System.out.println("码流大小为" + dwBufSize + "\n" + "码流类型为yuv数据"); |
| | | break; |
| | | case 3: |
| | | //pcm 音频数据 |
| | | System.out.println("码流大小为" + dwBufSize + "\n" + "码流类型为音频数据"); |
| | | break; |
| | | case 4: |
| | | //原始音频数据 |
| | | System.out.println("码流大小为" + dwBufSize + "\n" + "码流类型为原始音频数据"); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | |
|
| | | //引导目标位置
|
| | | boolean guideTargetPosition(CameraCmd cmd);
|
| | |
|
| | | //调用预置位
|
| | | boolean gotoPreset(CameraCmd cmd);
|
| | | //设置预置位
|
| | | boolean setPreset(CameraCmd cmd);
|
| | | //聚焦模式
|
| | | boolean controlFocusMode(CameraCmd cmd);
|
| | | }
|
| | |
| | | import com.ruoyi.device.dhsdk.common.Res;
|
| | | import com.ruoyi.device.dhsdk.lib.NetSDKLib;
|
| | | import com.ruoyi.device.dhsdk.lib.NetSDKLib.LLong;
|
| | | import com.ruoyi.device.dhsdk.lib.structure.CFG_VIDEO_IN_FOCUS;
|
| | | import com.ruoyi.device.dhsdk.lib.structure.CFG_VIDEO_IN_FOCUS_UNIT;
|
| | | import com.ruoyi.device.dhsdk.module.CapturePictureModule;
|
| | | import com.ruoyi.device.dhsdk.module.ConfigModule;
|
| | | import com.ruoyi.device.dhsdk.module.LoginModule;
|
| | |
| | |
|
| | | import static com.ruoyi.device.dhsdk.lib.NetSDKLib.NET_DEVSTATE_ONLINE;
|
| | | import static com.ruoyi.device.dhsdk.lib.NetSDKLib.NET_DEVSTATE_PTZ_LOCATION;
|
| | | import static com.ruoyi.device.dhsdk.lib.NetSDKLib.NET_PTZ_ControlType.NET_PTZ_POINT_MOVE_CONTROL;
|
| | | import static com.ruoyi.device.dhsdk.lib.NetSDKLib.NET_PTZ_ControlType.NET_PTZ_POINT_SET_CONTROL;
|
| | | import static com.ruoyi.device.dhsdk.lib.ToolKits.getErrorCodePrint;
|
| | | import static com.ruoyi.device.dhsdk.module.LoginModule.netsdk;
|
| | | import static com.ruoyi.device.hiksdk.sdk.HCNetSDK.NET_DVR_SET_PTZPOS;
|
| | |
| | | // 网络连接恢复
|
| | | private static HaveReConnect haveReConnect = new HaveReConnect();
|
| | |
|
| | |
|
| | | /**
|
| | | * 登录所有相机
|
| | | * 刘苏义
|
| | | * 2023/10/17 8:28:13
|
| | | */
|
| | | @Override
|
| | | public void loginAll() {
|
| | | try {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * sdk初始化
|
| | | * 刘苏义
|
| | | * 2023/10/17 8:28:13
|
| | | */
|
| | | @Override
|
| | | public Boolean init() {
|
| | | return LoginModule.init(disConnect, haveReConnect); // 打开工程,初始化
|
| | | }
|
| | |
|
| | | /**
|
| | | * 登录
|
| | | * 刘苏义
|
| | | * 2023/10/17 8:28:13
|
| | | */
|
| | | @Override
|
| | | @Async
|
| | | public Boolean login(ArdCameras camera) {
|
| | |
| | | return true;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 注销
|
| | | * 刘苏义
|
| | | * 2023/10/17 8:28:13
|
| | | */
|
| | | @Override
|
| | | public Boolean logout(String cameraId) {
|
| | | if (!GlobalVariable.loginMap.containsKey(cameraId)) {
|
| | |
| | | return LoginModule.logout(loginId);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 是否在线检测
|
| | | * 刘苏义
|
| | | * 2023/10/17 8:28:13
|
| | | */
|
| | | @Override
|
| | | public boolean isOnLine(CameraCmd cmd) {
|
| | | try {
|
| | |
| | | return true;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 云台控制
|
| | | * 刘苏义
|
| | | * 2023/10/17 8:28:13
|
| | | */
|
| | | @Override
|
| | | public boolean pTZControl(CameraCmd cmd) {
|
| | | String cameraId = cmd.getCameraId();
|
| | |
| | | dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_LEFT_CONTROL;
|
| | | break;
|
| | | case 5:
|
| | | dwPTZCommand = HCNetSDK.RUN_SEQ;
|
| | | dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_POINT_LOOP_CONTROL;
|
| | | break;
|
| | | case 6:
|
| | | dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_RIGHT_CONTROL;
|
| | |
| | | case 15:
|
| | | dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_DEC_CONTROL;
|
| | | break;
|
| | | case 16:
|
| | | dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_LAMP_CONTROL;
|
| | | break;
|
| | | }
|
| | | boolean bool = netsdk.CLIENT_DHPTZControlEx(loginId, chanNo - 1, dwPTZCommand, speed, speed, 0, dwStop);
|
| | | if (!bool) {
|
| | |
| | | return bool;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取PTZ值
|
| | | * 刘苏义
|
| | | * 2023/10/17 8:28:13
|
| | | */
|
| | | @Override
|
| | | public Map<String, Object> getPtz(CameraCmd cmd) {
|
| | | Map<String, Object> ptzMap = new HashMap<>();
|
| | |
| | | int p = (int) (ptz.get("p") * 10);
|
| | | int t = (int) (ptz.get("t") * 10);
|
| | | int z = ptz.get("z").intValue();
|
| | | if (z == 0) {
|
| | | z = 1;
|
| | | }
|
| | | boolean bool = netsdk.CLIENT_DHPTZControlEx(loginId, chanNo - 1, NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_EXACTGOTO, p, t, z, 0);
|
| | | if (!bool) {
|
| | | log.error("控制失败,请稍后重试" + getErrorCodePrint());
|
| | |
| | | return false;
|
| | | }
|
| | | LLong loginId = (LLong) GlobalVariable.loginMap.get(cameraId);
|
| | | boolean bool = NetSDKLib.NETSDK_INSTANCE.CLIENT_DHPTZControlEx(loginId, chanNo - 1, NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RESETZERO, 0, 0, 1, 0);
|
| | | boolean bool = NetSDKLib.NETSDK_INSTANCE.CLIENT_DHPTZControlEx(loginId, chanNo - 1, NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RESETZERO, 0, 0, 0, 0);
|
| | | if (!bool) {
|
| | | log.error("控制失败,请稍后重试" + getErrorCodePrint());
|
| | | }
|
| | |
| | | @Override
|
| | | public String record(CameraCmd cmd) {
|
| | | try {
|
| | | String url="";
|
| | | String url = "";
|
| | | String cameraId = cmd.getCameraId();
|
| | | Integer chanNo = cmd.getChanNo();
|
| | | String path = FileUtils.createFile("D:/recordTemp/" + cameraId + ".mp4");
|
| | |
| | | return "";
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public boolean recordStart(CameraCmd cmd) {
|
| | | try {
|
| | |
| | | if (!GlobalVariable.loginMap.containsKey(cameraId)) {
|
| | | return false;
|
| | | }
|
| | | LLong loginId = (LLong)GlobalVariable.loginMap.get(cameraId);
|
| | | LLong loginId = (LLong) GlobalVariable.loginMap.get(cameraId);
|
| | | LLong lRealHandle;
|
| | | if (GlobalVariable.previewMap.containsKey(cameraId)) {
|
| | | lRealHandle = new LLong(GlobalVariable.previewMap.get(cameraId));
|
| | | netsdk.CLIENT_StopSaveRealData(lRealHandle);
|
| | | netsdk.CLIENT_StopRealPlayEx(lRealHandle);
|
| | | GlobalVariable.previewMap.remove(cameraId);
|
| | | log.debug("停止当前录像");
|
| | | }
|
| | | lRealHandle = RealPlayModule.startRealPlay(loginId, chanNo-1, 0);
|
| | | lRealHandle = RealPlayModule.startRealPlay1(loginId, chanNo - 1, path);
|
| | | if (lRealHandle.longValue() <= 0) {
|
| | | log.error("取流失败" + getErrorCodePrint());
|
| | | }
|
| | | log.debug("取流成功");
|
| | | GlobalVariable.previewMap.put(cameraId, lRealHandle.intValue());
|
| | | GlobalVariable.threadMap.put(cameraId, Thread.currentThread().getName());
|
| | | if (!netsdk.CLIENT_SaveRealData(lRealHandle, path)) {
|
| | | log.error("保存视频文件到临时文件夹失败 错误码为: " +getErrorCodePrint());
|
| | | return false;
|
| | | }
|
| | | //if (!netsdk.CLIENT_SaveRealData(lRealHandle, path)) {
|
| | | // log.error("保存视频文件到临时文件夹失败 错误码为: " +getErrorCodePrint());
|
| | | // return false;
|
| | | //}
|
| | | log.debug("录像开始");
|
| | | return true;
|
| | | } catch (Exception ex) {
|
| | |
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public String recordStopToMinio(CameraCmd cmd) {
|
| | | String url = "";
|
| | |
| | | LLong lRealHandle;
|
| | | if (GlobalVariable.previewMap.containsKey(cameraId)) {
|
| | | lRealHandle = new LLong(GlobalVariable.previewMap.get(cameraId));
|
| | | netsdk.CLIENT_StopSaveRealData(lRealHandle);
|
| | | netsdk.CLIENT_StopRealPlayEx(lRealHandle);
|
| | | GlobalVariable.previewMap.remove(cameraId);
|
| | | log.debug("停止当前录像");
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 引导目标位置
|
| | | * 刘苏义
|
| | | * 2023/10/17 8:27:48
|
| | | */
|
| | | @Override
|
| | | public boolean guideTargetPosition(CameraCmd cmd) {
|
| | | String cameraId = cmd.getCameraId();
|
| | |
| | | if (!GlobalVariable.loginMap.containsKey(cameraId)) {
|
| | | return false;
|
| | | }
|
| | | LLong loginId = (LLong)GlobalVariable.loginMap.get(cameraId);
|
| | | LLong loginId = (LLong) GlobalVariable.loginMap.get(cameraId);
|
| | | try {
|
| | | ArdCameras cameras = ardCamerasService.selectArdCamerasById(cameraId);
|
| | | double[] cameraPositon = new double[]{cameras.getLongitude(), cameras.getLatitude(), cameras.getAltitude()};
|
| | |
| | | double[] cameraPTZ = GisUtil.getCameraPTZ(cameraPositon, targetPositions, 20, 150);
|
| | | int p = (int) (cameraPTZ[0] * 10);
|
| | | int t = (int) (cameraPTZ[1] * 10);
|
| | | int z = (int)(cameraPTZ[2]);
|
| | | int z = (int) (cameraPTZ[2]);
|
| | | boolean bool = netsdk.CLIENT_DHPTZControlEx(loginId, chanNo - 1, NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_EXACTGOTO, p, t, z, 0);
|
| | | if (!bool) {
|
| | | log.error("控制失败,请稍后重试" + getErrorCodePrint());
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | // 设备断线回调: 通过 CLIENT_Init 设置该回调函数,当设备出现断线时,SDK会调用该函数
|
| | | //转至预置点
|
| | | @Override
|
| | | public boolean gotoPreset(CameraCmd cmd) {
|
| | | String cameraId = cmd.getCameraId();
|
| | | Integer chanNo = cmd.getChanNo();
|
| | | Integer PresetIndex = cmd.getPresetIndex();
|
| | | if (!GlobalVariable.loginMap.containsKey(cameraId)) {
|
| | | return false;
|
| | | }
|
| | | LLong loginId = (LLong) GlobalVariable.loginMap.get(cameraId);
|
| | | try {
|
| | |
|
| | | boolean bool = netsdk.CLIENT_DHPTZControlEx(loginId, chanNo - 1, NET_PTZ_POINT_MOVE_CONTROL, 0, PresetIndex, 0, 0);
|
| | | if (!bool) {
|
| | | log.error("控制失败,请稍后重试" + getErrorCodePrint());
|
| | | }
|
| | | return bool;
|
| | | } catch (Exception ex) {
|
| | | log.error("转至预置点异常:" + ex.getMessage());
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | //设置预置位
|
| | | public boolean setPreset(CameraCmd cmd) {
|
| | | String cameraId = cmd.getCameraId();
|
| | | Integer chanNo = cmd.getChanNo();
|
| | | Integer PresetIndex = cmd.getPresetIndex();
|
| | | if (!GlobalVariable.loginMap.containsKey(cameraId)) {
|
| | | return false;
|
| | | }
|
| | | LLong loginId = (LLong) GlobalVariable.loginMap.get(cameraId);
|
| | | try {
|
| | |
|
| | | boolean bool = netsdk.CLIENT_DHPTZControlEx(loginId, chanNo - 1, NET_PTZ_POINT_SET_CONTROL, 0, PresetIndex, 0, 0);
|
| | | if (!bool) {
|
| | | log.error("控制失败,请稍后重试" + getErrorCodePrint());
|
| | | }
|
| | | return bool;
|
| | | } catch (Exception ex) {
|
| | | log.error("设置预置点异常:" + ex.getMessage());
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | //切换聚焦模式
|
| | | @Override
|
| | | public boolean controlFocusMode(CameraCmd cmd) {
|
| | | String cameraId = cmd.getCameraId();
|
| | | Integer chanNo = cmd.getChanNo();
|
| | | boolean enable = cmd.isEnable();
|
| | | if (!GlobalVariable.loginMap.containsKey(cameraId)) {
|
| | | return false;
|
| | | }
|
| | | LLong loginId = (LLong) GlobalVariable.loginMap.get(cameraId);
|
| | | try {
|
| | | CFG_VIDEO_IN_FOCUS cfg_video_in_focus = new CFG_VIDEO_IN_FOCUS();
|
| | | CFG_VIDEO_IN_FOCUS_UNIT[] stVideoInFocusUnit = new CFG_VIDEO_IN_FOCUS_UNIT[32];
|
| | | if (enable) {
|
| | | stVideoInFocusUnit[0].nMode = 4;//手动聚焦
|
| | | } else {
|
| | | stVideoInFocusUnit[0].nMode = 2;//手动聚焦
|
| | | }
|
| | | cfg_video_in_focus.nChannelIndex = chanNo - 1;
|
| | | cfg_video_in_focus.stVideoInFocusUnit = stVideoInFocusUnit;
|
| | | boolean bool = ConfigModule.SetDevConfig(loginId, chanNo - 1, NetSDKLib.CFG_CMD_VIDEOIN_FOCUS, cfg_video_in_focus);
|
| | | if (!bool) {
|
| | | log.error("控制失败,请稍后重试" + getErrorCodePrint());
|
| | | }
|
| | | return bool;
|
| | | } catch (Exception ex) {
|
| | | log.error("切换聚焦模式异常:" + ex.getMessage());
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | // 设备断线回调: 当设备出现断线时,SDK会调用该函数
|
| | | private static class DisConnect implements NetSDKLib.fDisConnect {
|
| | | public void invoke(LLong m_hLoginHandle, String pchDVRIP, int nDVRPort, Pointer dwUser) {
|
| | | System.out.printf("Device[%s] Port[%d] DisConnect!\n", pchDVRIP, nDVRPort);
|
| | | }
|
| | | }
|
| | |
|
| | | // 网络连接恢复,设备重连成功回调
|
| | | // 通过 CLIENT_SetAutoReconnect 设置该回调函数,当已断线的设备重连成功时,SDK会调用该函数
|
| | | // 网络连接恢复回调:设备重连成功回调,当已断线的设备重连成功时,SDK会调用该函数
|
| | | private static class HaveReConnect implements NetSDKLib.fHaveReConnect {
|
| | | @Override
|
| | | public void invoke(LLong lLoginID, String pchDVRIP, int nDVRPort, Pointer dwUser) {
|
| | | System.out.printf("ReConnect Device[%s] Port[%d]\n", pchDVRIP, nDVRPort);
|
| | | }
|
| | | }
|
| | | // 抓图接收回调
|
| | |
|
| | | // 抓图接收回调:当抓图成功,sdk会调用该函数
|
| | | public static class fCaptureReceiveCB implements NetSDKLib.fSnapRev {
|
| | | private String minioEndPoint;
|
| | | private String ObjectName;
|