123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #include "modulecomm.h"
- #include "commif.h"
- #include <memory>
- #include <thread>
- static mcommCall gpgpscall;
- static int64_t gnLastFusionGPSUpdate = 0;
- void UpdateGPS(const char *strdata, const unsigned int nSize, const unsigned int index, const QDateTime *dt, const char *strmemname)
- {
- (void)index;
- (void)dt;
- (void)strmemname;
- int64_t nNow = std::chrono::system_clock::now().time_since_epoch().count()/1000000;
- if(strncmp(strmemname,"fusion_gpsimu",256)!= 0)
- {
- if(abs(nNow - gnLastFusionGPSUpdate)<1000)
- {
- return;
- }
- }
- else
- {
- gnLastFusionGPSUpdate = nNow;
- }
- (*gpgpscall)(strdata,nSize);
- // std::shared_ptr<iv::gps::gpsimu> xgpsimu_ptr = std::shared_ptr<iv::gps::gpsimu>(new iv::gps::gpsimu);
- // if(!xgpsimu_ptr->ParseFromArray(strdata,nSize))
- // {
- // qDebug("MainWindow::UpdateGPS Parse Error. nSize is ",nSize);
- // return;
- // }
- // mMutex.lock();
- // mgpsimu_ptr = xgpsimu_ptr;
- // mbUpdate = true;
- // mMutex.unlock();
- }
- void * RegisterSend(char * strmemname,const unsigned int nmemsize,const unsigned int nbufpacket)
- {
- void * pa = iv::modulecomm::RegisterSend(strmemname,nmemsize,nbufpacket);
- return pa;
- }
- void SendMsg(void * pa,char * strdata,unsigned int nsize)
- {
- iv::modulecomm::ModuleSendMsg(pa,strdata,nsize);
- }
- void * RegisterRecvGPS(char * strmemname,mcommCall pcall)
- {
- gpgpscall = pcall;
- void * pa = iv::modulecomm::RegisterRecv(strmemname,UpdateGPS);
- return pa;
- }
|