|
@@ -1,71 +0,0 @@
|
|
|
-#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;
|
|
|
-
|
|
|
-}
|