canctrl.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef CANCTRL_H
  2. #define CANCTRL_H
  3. #include <QThread>
  4. #include <QMutex>
  5. #include <memory>
  6. #include <QTimer>
  7. #include <array>
  8. #include <vector>
  9. #include <iostream>
  10. #include "vcican.h"
  11. #include "modulecomm.h"
  12. #include "canmsg.pb.h"
  13. #include "canraw.pb.h"
  14. #include "canstate.pb.h"
  15. class canctrl : public QThread
  16. {
  17. Q_OBJECT
  18. public:
  19. canctrl(const char * strmemsend0,const char * strmemsend1,const char * strmemrecv0,const char * strmemrecv1,const char * strdevnum = "0",
  20. const char * strbaud0="500k",const char * strbaud1="500k");
  21. private slots:
  22. void onCANState(bool bCAN,int nR,const char * strres);
  23. private:
  24. void run();
  25. basecan * mpcan;
  26. std::shared_ptr<basecan> mspcan;
  27. bool mbCANOpen = false;
  28. std::vector<basecan_msg> msendmsgvector1;
  29. std::vector<basecan_msg> msendmsgvector2;
  30. const int SENDMSGBUFSIZE = 3000;
  31. QMutex mMutexcan1;
  32. QMutex mMutexcan2;
  33. void * mpasend0,*mpcanState, * mpasend1, * mparecv0, * mparecv1;
  34. int mindex[2];
  35. char mstrmemsend0[256],mstrmemsend1[256],mstrmemrecv0[256],mstrmemrecv1[256];
  36. public:
  37. void sendmsg(int index,iv::can::canmsg xmsg);
  38. void sharecanmsg(void * xpa,basecan_msg * pxmsg,int ncount,int nch);
  39. };
  40. #endif // CANCTRL_H