From bd903c2ac65389760f46dffd3d9736011e11bc69 Mon Sep 17 00:00:00 2001
From: houxiao <houxiao@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期一, 19 十二月 2016 15:06:52 +0800
Subject: [PATCH] bugfix for alarmout overlap
---
ProxyConsole/proxyconsole-hc.cpp | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/ProxyConsole/proxyconsole-hc.cpp b/ProxyConsole/proxyconsole-hc.cpp
index df62d2e..fa10555 100644
--- a/ProxyConsole/proxyconsole-hc.cpp
+++ b/ProxyConsole/proxyconsole-hc.cpp
@@ -41,6 +41,8 @@
#define MAX 1024
#define fileread_buf 128
+volatile time_t last_alarmout;
+
typedef std::map<std::string, int> hcnetsdk_user_t; // decoder_ip, userid
hcnetsdk_user_t g_hcnetsdk_user;
@@ -311,11 +313,15 @@
if(NET_DVR_SetAlarmOut(lUserID,camConfig.lAlarmOutPort,1) == FALSE){
printf("NET_DVR_SetAlarmOut failed, err: %d\n", NET_DVR_GetLastError());
}
+ last_alarmout = time(NULL);
sleep(3);
- //瑙i櫎璀︽姤
- NET_DVR_SetAlarmOut(lUserID,camConfig.lAlarmOutPort,0);
+ if (time(NULL) - last_alarmout >= 3)
+ {
+ //瑙i櫎璀︽姤
+ NET_DVR_SetAlarmOut(lUserID,camConfig.lAlarmOutPort,0);
+ }
}
int hcnetsdk_alarm_popwin(LONG lUserID, const HCNetCameraConfig& camConfig)
@@ -496,13 +502,16 @@
timer.it_interval.tv_usec=250000;
/*Start a virtual timer.It counts down whenever this process is executing.*/
- setitimer(ITIMER_VIRTUAL,&timer,NULL);
+ //setitimer(ITIMER_VIRTUAL,&timer,NULL);
- while(1)
- sleep(1);
+ while ( 1 )
+ {
+ zclock_sleep(250);
+ timer_handler(0);
+ }
}
void* createServerthread_hcnetsdk(void* arg)
--
Gitblit v1.8.0