nvcan.h 682 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef NVCAN_H
  2. #define NVCAN_H
  3. #include "basecan.h"
  4. #include <vector>
  5. #include <QMutex>
  6. #include <thread>
  7. class nvcan : public basecan
  8. {
  9. Q_OBJECT
  10. public:
  11. nvcan();
  12. public:
  13. void startdev();
  14. void stopdev();
  15. int GetMessage(const int nch,basecan_msg * pMsg,const int nCap);
  16. int SetMessage(const int nch,basecan_msg * pMsg);
  17. virtual bool IsOpen();
  18. private slots:
  19. void onMsg(bool bCAN,int nR,const char * strres);
  20. private:
  21. void run();
  22. std::vector<basecan_msg> mMsgRecvBuf[2];
  23. std::vector<basecan_msg> mMsgSendBuf[2];
  24. QMutex mMutex;
  25. bool mbCANOpen = false;
  26. bool mbRunning = false;
  27. int mnDevNum;
  28. };
  29. #endif // NVCAN_H