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