123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- #ifndef PROCSM_IF_H
- #define PROCSM_IF_H
- #include <QThread>
- #include <QTimer>
- #include <QWaitCondition>
- #include <QMutex>
- #include <functional>
- #ifdef USEDBUS
- #include <QtDBus/QDBusMessage>
- #include <QtDBus/QDBusConnection>
- #endif
- #include "procsm.h"
- typedef void (* SMCallBack)(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
- using namespace std::placeholders;
- typedef std::function<void(const char * ,const unsigned int , const unsigned int , QDateTime * ,const char *)> ModuleFun;
- class procsm_if_readthread:public QThread
- {
- Q_OBJECT
- public:
- #ifdef USELCM
- #endif
- procsm_if_readthread(procsm * pPSM,SMCallBack pCall,const char * strsmname);
- procsm_if_readthread(procsm * pPSM,ModuleFun xFun,const char * strsmname);
- void puaseread();
- void continueread();
- private slots:
- #ifdef USEDBUS
- void onNewMsg(int x);
- #endif
- private:
- #ifdef USELCM
- lcm::LCM mlcm;
- void handlerMethod(const lcm::ReceiveBuffer *rbuf,const std::string &channel);
- int mxindex = 0;
- #endif
- void run();
- procsm * mpPSM;
- SMCallBack mpCall;
- ModuleFun mFun;
- char mstrsmname[256];
- QWaitCondition mwc;
- QMutex mWaitMutex;
- bool mbFunPlus = false;
- bool mbRun = true;
- bool mbDBUSOK = true;
- };
- class procsm_if
- {
- public:
- procsm_if(const char * strsmname,const unsigned int nBufSize,const unsigned int nMaxPacCount,const int nMode);
- ~procsm_if();
- int writemsg(const char * str,const unsigned int nSize);
- int listenmsg(SMCallBack pCall);
- int listenmsg(ModuleFun xFun);
- void stoplisten();
- void pausecomm();
- void continuecomm();
- private:
- procsm * mpPSM;
- int mnType;
- procsm_if_readthread * mpReadThread;
- QTimer mTimer;
- char mstrsmname[256];
- bool mbRun = true;
- #ifdef USELCM
- lcm::LCM mlcm;
- void handlerMethod(const lcm::ReceiveBuffer *rbuf,const std::string &channel);
- #endif
- };
- #endif // PROCSM_IF_H
|