Kaynağa Gözat

Merge branch 'master' of http://192.168.14.36:3000/adc_pilot/modularization
ok
# Conflicts:
# src/tool/map_lanetoxodr/main.cpp

yuchuli 3 yıl önce
ebeveyn
işleme
adb9788356

+ 7 - 0
src/common/common/license/adclicense.pri

@@ -0,0 +1,7 @@
+HEADERS += \
+    $$PWD/adclicenseserv.h \
+    $$PWD/adclicensewithwin.h
+
+SOURCES += \
+    $$PWD/adclicenseserv.cpp \
+    $$PWD/adclicensewithwin.cpp

+ 71 - 0
src/common/common/license/adclicenseserv.cpp

@@ -0,0 +1,71 @@
+#include "adclicenseserv.h"
+
+#include <QProcess>
+#include "modulecomm.h"
+#include <thread>
+#include <iostream>
+
+namespace iv {
+struct ivlicensekey
+{
+    bool linshikey;
+    bool yongjiukey;
+};
+}
+
+
+iv::ivlicensekey gkey;
+void * gpa;
+bool gbHaveRecvKey = false;
+
+
+
+ADCLicenseServ::ADCLicenseServ()
+{
+
+}
+
+void ListenKey(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
+{
+
+    std::cout<<"key len is "<<nSize<<std::endl;
+    if(nSize >= sizeof (iv::ivlicensekey))
+    {
+        memcpy(&gkey,strdata,sizeof(iv::ivlicensekey));
+        std::cout<<" key 1:"<<gkey.linshikey<<"key 2:"<<gkey.yongjiukey<<std::endl;
+        gbHaveRecvKey = true;
+    }
+
+}
+
+
+int ADCLicenseServ::CheckLincese()
+{
+    gpa = iv::modulecomm::RegisterRecv("keyfeedback",ListenKey);
+    std::this_thread::sleep_for(std::chrono::milliseconds(100));
+    QProcess * pProc = new QProcess();
+//    pProc->start("adc_key_win_exe.exe");
+    QTime xTime;
+    xTime.start();
+    while(gbHaveRecvKey == false)
+    {
+        std::this_thread::sleep_for(std::chrono::milliseconds(1));
+        if(xTime.elapsed()>10000)
+        {
+            break;
+        }
+    }
+    if(gbHaveRecvKey)
+    {
+        if((gkey.yongjiukey == true)||(gkey.linshikey == true))
+        {
+            return  0;
+        }
+        else
+        {
+            return  -1;
+        }
+    }
+    return -2;
+
+}

+ 14 - 0
src/common/common/license/adclicenseserv.h

@@ -0,0 +1,14 @@
+#ifndef ADCLICENSESERV_H
+#define ADCLICENSESERV_H
+
+
+class ADCLicenseServ
+{
+public:
+    ADCLicenseServ();
+
+public:
+    static int CheckLincese();
+};
+
+#endif // ADCLICENSESERV_H

+ 22 - 0
src/common/common/license/adclicensewithwin.cpp

@@ -0,0 +1,22 @@
+
+#include <QMessageBox>
+#include "adclicenseserv.h"
+
+int ADCLicenseCheckWithWin()
+{
+    int nRtn = ADCLicenseServ::CheckLincese();
+    if(nRtn == -1)
+    {
+        QMessageBox::warning(NULL,"Warning","License 错误,请申请Lincense",QMessageBox::YesAll);
+        return nRtn;
+    }
+    else
+    {
+        if(nRtn == -2)
+        {
+            QMessageBox::warning(NULL,"Warning","License服务启动失败",QMessageBox::YesAll);
+            return nRtn;
+        }
+    }
+    return nRtn;
+}

+ 5 - 0
src/common/common/license/adclicensewithwin.h

@@ -0,0 +1,5 @@
+#ifndef ADCLICENSEWITHWIN_H
+#define ADCLICENSEWITHWIN_H
+
+int ADCLicenseCheckWithWin();
+#endif // ADCLICENSEWITHWIN_H

+ 23 - 2
src/tool/map_lanetoxodr/main.cpp

@@ -14,7 +14,11 @@
 #include <QApplication>
 #include <QApplication>
 #include <QMessageBox>
 #include <QMessageBox>
 
 
+<<<<<<< .mine
 #include "adclicenseserv.h"
 #include "adclicenseserv.h"
+=======
+#include "adclicensewithwin.h"
+>>>>>>> .theirs
 
 
 
 
 #ifdef ANDROID
 #ifdef ANDROID
@@ -78,20 +82,37 @@ int main(int argc, char *argv[])
 #ifdef XODRViewer
 #ifdef XODRViewer
     XVMainWindow w;
     XVMainWindow w;
 #else
 #else
+<<<<<<< .mine
     int nRtn = ADCLicenseServ::CheckLincese();
     int nRtn = ADCLicenseServ::CheckLincese();
     if(nRtn == -1)
     if(nRtn == -1)
     {
     {
-        QMessageBox::warning(NULL,"Warning","License 閿欒�锛岃�鐢宠�Lincense",QMessageBox::YesAll);
+        QMessageBox::warning(NULL,"Warning","License 错误,请申请Lincense",QMessageBox::YesAll);
         return 0;
         return 0;
     }
     }
     else
     else
     {
     {
         if(nRtn == -2)
         if(nRtn == -2)
         {
         {
-            QMessageBox::warning(NULL,"Warning","License鏈嶅姟鍚�姩澶辫触",QMessageBox::YesAll);
+            QMessageBox::warning(NULL,"Warning","License服务启动失败",QMessageBox::YesAll);
             return 0;
             return 0;
         }
         }
     }
     }
+=======
+    if(ADCLicenseCheckWithWin() != 0)
+    {
+//        return 0;
+    }
+
+
+
+
+
+
+
+
+
+
+>>>>>>> .theirs
     MainWindow w;
     MainWindow w;
 #endif
 #endif
     w.show();
     w.show();

+ 5 - 0
src/tool/map_lanetoxodr/map_lanetoxodr.pro

@@ -148,6 +148,10 @@ FORMS += \
     error( "Couldn't find the OpenDrive.pri file!" )
     error( "Couldn't find the OpenDrive.pri file!" )
 }
 }
 
 
+!include(../../common/common/license/adclicense.pri ) {
+    error( "Couldn't find the adclicense.pri file!" )
+}
+
 unix:LIBS += -lboost_thread -lboost_system -lboost_serialization -lprotobuf
 unix:LIBS += -lboost_thread -lboost_system -lboost_serialization -lprotobuf
 
 
 
 
@@ -164,6 +168,7 @@ LIBS += -L$$PWD/../../../bin/ -lxmlparam -lmodulecomm -livlog -livfault -livback
 INCLUDEPATH += $$PWD/../../include/msgtype
 INCLUDEPATH += $$PWD/../../include/msgtype
 
 
 INCLUDEPATH += $$PWD/../../common/common/xodr
 INCLUDEPATH += $$PWD/../../common/common/xodr
+INCLUDEPATH += $$PWD/../../common/common/license
 
 
 
 
 DEFINES += OPENDRIVE_EDITONLY
 DEFINES += OPENDRIVE_EDITONLY