yaoqiang 4 лет назад
Родитель
Сommit
a79dc915cb
3 измененных файлов с 21 добавлено и 9 удалено
  1. 15 4
      CamCore/coreobject.cpp
  2. 1 0
      CamCore/coreobject.h
  3. 5 5
      YtCam.pro.user

+ 15 - 4
CamCore/coreobject.cpp

@@ -1,7 +1,10 @@
 #include "coreobject.h"
 
-#define iServerIP "172.19.198.166"
-#define oServerIP "47.103.74.123"
+//#define iServerIP "172.19.198.166"
+//#define oServerIP "47.103.74.123"
+
+#define iServerIP "172.19.198.168"
+#define oServerIP "101.133.214.75"
 
 #define UN_REFERENCED_PARAMETER(x) {(x) = (x);}
 
@@ -27,6 +30,7 @@ CoreObject::CoreObject(QObject *parent) :
     reportList.clear();
     companyphoneList.clear();
     isWorking = false;
+    alarmListenHandle = -1;
     start_time = QDateTime::currentDateTime().toTime_t();
     had_reg = false;
     timer = new QTimer();
@@ -92,7 +96,13 @@ CoreObject::~CoreObject()
     for(int i=0;i<processList.length();i++){
         if(processList.at(i)->pid()>0)
             processList.at(i)->close();
+
+        if(ytShm->eHomeDevice[i].listen_preview_handle>=-1){
+            NET_ESTREAM_StopListenPreview(ytShm->eHomeDevice[i].listen_preview_handle);
+        }
     }
+    if(alarmListenHandle>-1)
+        NET_EALARM_StopListen(alarmListenHandle);
     NET_ECMS_Fini();
     NET_ESTREAM_Fini();
     NET_EALARM_Fini();
@@ -260,7 +270,8 @@ BOOL CALLBACK fnPREVIEW_NEWLINK_CB(LONG lPreviewHandle, NET_EHOME_NEWLINK_CB_MSG
 {
     for(int i=0;i<DEVICES_COUNT;i++){
         if((ytShm->eHomeDevice[i].LoginId>-1)&&(ytShm->eHomeDevice[i].listen_preview_handle>-1)){
-            if(ytShm->eHomeDevice[i].SessionId == pNewLinkCBMsg->iSessionID){
+            if(strcmp(ytShm->eHomeDevice[i].deviceID,QString((char *)pNewLinkCBMsg->szDeviceID).replace(" ","_").toUtf8().data())==0){
+//            if(ytShm->eHomeDevice[i].SessionId == pNewLinkCBMsg->iSessionID){
 //                printf("fnPREVIEW_NEWLINK_CB:%s\n",ytShm->eHomeDevice[i].deviceID);
                 ytShm->eHomeDevice[i].lLinkHandle = lPreviewHandle;
                 NET_EHOME_PREVIEW_DATA_CB_PARAM struDataCB = {0};
@@ -512,7 +523,7 @@ void CoreObject::start()
     struTcpAlarmListenParam.pUserData = this;
     struTcpAlarmListenParam.byUseCmsPort = 0;
     struTcpAlarmListenParam.byUseThreadPool = 0;
-    if(NET_EALARM_StartListen(&struTcpAlarmListenParam)<-1){
+    if((alarmListenHandle=NET_EALARM_StartListen(&struTcpAlarmListenParam))<-1){
 //        printf("NET_EALARM_StartListen TCP failed, error code: %d\n", NET_EALARM_GetLastError());
         NET_ECMS_Fini();
         NET_ESTREAM_Fini();

+ 1 - 0
CamCore/coreobject.h

@@ -106,6 +106,7 @@ private:
     int repcur,wxcur;
     int synchour;
     uint alarmTime[DEVICES_COUNT];
+    long alarmListenHandle;
 };
 
 #endif // COREOBJECT_H

+ 5 - 5
YtCam.pro.user

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.7.2, 2021-05-20T15:24:52. -->
+<!-- Written by QtCreator 4.7.2, 2021-05-27T08:28:02. -->
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>
@@ -192,7 +192,7 @@
     <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
     <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">CamCore/CamCore.pro</value>
     <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
-    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">/home/yt/Qt2/build-YtCam-Qt_5_9_7-Release/CamCore</value>
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default"></value>
     <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
     <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
     <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
@@ -249,7 +249,7 @@
     <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
     <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">CamDog/CamDog.pro</value>
     <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
-    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">/home/yt/Qt2/build-YtCam-Qt_5_9_7-Release/CamDog</value>
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default"></value>
     <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
     <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
     <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
@@ -306,7 +306,7 @@
     <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
     <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">cgi/cgi.pro</value>
     <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
-    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">/home/yt/Qt2/build-YtCam-Qt_5_9_7-Release/cgi</value>
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default"></value>
     <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
     <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
     <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
@@ -363,7 +363,7 @@
     <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
     <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">ytDHCamCore/ytDHCamCore.pro</value>
     <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
-    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">/home/yt/Qt2/build-YtCam-Qt_5_9_7-Release/ytDHCamCore</value>
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default"></value>
     <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
     <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
     <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>