windows 设置PTZ位置的必须的加 sleep
This commit is contained in:
parent
74dc0a574d
commit
3340171b66
19
Core.go
19
Core.go
@ -30,6 +30,12 @@ void sleep_seconds(int seconds) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void sys_sleep_seconds(int seconds) {
|
||||
#ifdef _WIN32
|
||||
Sleep(seconds * 1000); // Sleep 参数是毫秒
|
||||
#endif
|
||||
}
|
||||
|
||||
#include "HCNetSDK.h"
|
||||
|
||||
typedef struct DEVICEINFO
|
||||
@ -212,18 +218,31 @@ void SetPTZPOS(LONG lUserID,int action,char* P,char* T,char *Z)
|
||||
LONG lTranHandle = NET_DVR_SerialStart(lUserID, 2,g_fSerialDataCallBack,6);
|
||||
LONG lSerialChan = 0;
|
||||
if (action == 1) {
|
||||
sys_sleep_seconds(1);
|
||||
NET_DVR_SerialSend(lTranHandle, lSerialChan, P, 7);
|
||||
sys_sleep_seconds(1);
|
||||
NET_DVR_SerialSend(lTranHandle, lSerialChan, T, 7);
|
||||
sys_sleep_seconds(1);
|
||||
NET_DVR_SerialSend(lTranHandle, lSerialChan, Z, 7);
|
||||
sys_sleep_seconds(1);
|
||||
}else if (action == 2) {
|
||||
sys_sleep_seconds(1);
|
||||
NET_DVR_SerialSend(lTranHandle, lSerialChan, P, 7);
|
||||
sys_sleep_seconds(1);
|
||||
}else if (action == 3) {
|
||||
sys_sleep_seconds(1);
|
||||
NET_DVR_SerialSend(lTranHandle, lSerialChan, T, 7);
|
||||
sys_sleep_seconds(1);
|
||||
}else if (action == 4) {
|
||||
sys_sleep_seconds(1);
|
||||
NET_DVR_SerialSend(lTranHandle, lSerialChan, Z, 7);
|
||||
sys_sleep_seconds(1);
|
||||
}else {
|
||||
sys_sleep_seconds(1);
|
||||
NET_DVR_SerialSend(lTranHandle, lSerialChan, P, 7);
|
||||
sys_sleep_seconds(1);
|
||||
NET_DVR_SerialSend(lTranHandle, lSerialChan, T, 7);
|
||||
sys_sleep_seconds(1);
|
||||
}
|
||||
|
||||
NET_DVR_SerialStop(lTranHandle);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user