#ifndef NVCAN_H
#define NVCAN_H
#include "basecan.h"

#include <vector>
#include <QMutex>

#include <thread>

class nvcan : public basecan
{
    Q_OBJECT
public:
    nvcan();
public:
    void startdev();
    void stopdev();

    int GetMessage(const int nch,basecan_msg * pMsg,const int nCap);
    int SetMessage(const int nch,basecan_msg * pMsg);

    virtual   bool IsOpen();

private slots:
    void onMsg(bool bCAN,int nR,const char * strres);

private:
    void run();
    std::vector<basecan_msg> mMsgRecvBuf[2];

    std::vector<basecan_msg> mMsgSendBuf[2];

    QMutex mMutex;

    bool mbCANOpen = false;
    bool mbRunning = false;
    int mnDevNum;
};

#endif // NVCAN_H