nvcan.h 743 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef NVCAN_H
  2. #define NVCAN_H
  3. #include "basecan.h"
  4. #include <vector>
  5. #include <mutex>
  6. #include <thread>
  7. class nvcan : public basecan
  8. {
  9. public:
  10. nvcan();
  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. bool IsOpen();
  18. //private slots:
  19. // void onMsg(bool bCAN,int nR,const char * strres);
  20. private:
  21. void threadrun();
  22. std::vector<basecan_msg> mMsgRecvBuf[2];
  23. std::vector<basecan_msg> mMsgSendBuf[2];
  24. std::mutex mMutex;
  25. bool mbCANOpen = false;
  26. bool mbRunning = false;
  27. int mnDevNum;
  28. bool mbRun = true;
  29. std::thread * mpthreadnvcan;
  30. };
  31. #endif // NVCAN_H