You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
592 B
C++

#ifndef _CANMSGHANDLER_HPP_
#define _CANMSGHANDLER_HPP_
#include <string>
#include <cstdint>
#include "MsgHandler.hpp"
class CanMsgHandler : public MsgHandler{
public:
CanMsgHandler();
~CanMsgHandler();
// 打开CAN
bool OpenPort(const std::string& port, const std::string& baudrate);
// 发送消息
int SendDeviceMsg(std::vector<uint8_t> &data);
// 接收消息
int RecvDeviceMsg(std::vector<uint8_t>& data, int timeoutMs);
private:
uint32_t GetCanId(uint32_t DeviceID, uint32_t CommandID, uint32_t BlockID);
};
#endif // _CANMSGHANDLER_HPP_