海康相机
获取相机当前水平、垂直和变焦倍数值
HCNetSDK.NET_DVR_PTZPOS ptzPos = new HCNetSDK.NET_DVR_PTZPOS();
ptzPos.write();
Pointer lpOutBuffer = ptzPos.getPointer();
IntByReference lpBytesReturned = new IntByReference(0);
boolean pointInfo = hcNetSDK.NET_DVR_GetDVRConfig(lUserID, HCNetSDK.NET_DVR_GET_PTZPOS, channel(), lpOutBuffer, ptzPos.size(), lpBytesReturned);
if (!pointInfo) {
System.out.println("失败,错误码:" + hcNetSDK.NET_DVR_GetLastError());
} else {
System.out.println("成功!");
ptzPos.read();
Integer.valueOf(Integer.toHexString(ptzPos.wTiltPos));
Integer.valueOf(Integer.toHexString(ptzPos.wPanPos));
Integer.valueOf(Integer.toHexString(ptzPos.wZoomPos));
}
大华相机
NetSDKLib.NET_PTZ_LOCATION_INFO netPtzLocationInfo = new NetSDKLib.NET_PTZ_LOCATION_INFO();
netPtzLocationInfo.nChannelID = channel();
netPtzLocationInfo.write();
Pointer pBuf = netPtzLocationInfo.getPointer();
IntByReference pRetLen = new IntByReference(0);
boolean pointInfo = netSDKLib.CLIENT_QueryDevState(loginUserId, NetSDKLib.NET_DEVSTATE_PTZ_LOCATION, pBuf, netPtzLocationInfo.size(), pRetLen, 1000);
if (!pointInfo) {
System.out.println("失败,错误码:" + ToolKits.getErrorCodePrint(netSDKLib.CLIENT_GetLastError()));
} else {
System.out.println("成功!");
netPtzLocationInfo.read();
netPtzLocationInfo.nPTZTilt;
netPtzLocationInfo.nPTZPan;
netPtzLocationInfo.nPTZZoom;
}
提示:使用的相关相机,请先确认相机通道是否可以使用
###谢谢观看! 希望对您有帮助。