#include "modulecomm.h" #include "commif.h" #include #include 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 xgpsimu_ptr = std::shared_ptr(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; }