Processing data in binary (byte) form
This commit is contained in:
@@ -13,7 +13,7 @@ class CommObd2Can : public CommInterface {
|
||||
protected:
|
||||
const uint8_t pinCanInt = 15;
|
||||
const uint8_t pinCanCs = 12;
|
||||
std::unique_ptr <MCP_CAN> CAN;
|
||||
std::unique_ptr <MCP_CAN> CAN;
|
||||
long unsigned int rxId;
|
||||
unsigned char rxLen = 0;
|
||||
uint8_t rxBuf[32];
|
||||
@@ -22,22 +22,32 @@ class CommObd2Can : public CommInterface {
|
||||
char msgString[128]; // Array to store serial string
|
||||
uint16_t lastPid;
|
||||
unsigned long lastDataSent = 0;
|
||||
|
||||
|
||||
std::vector<uint8_t> mergedData;
|
||||
typedef std::vector<uint8_t> frameData_t;
|
||||
std::unordered_map<uint16_t, frameData_t> dataRows;
|
||||
|
||||
std::unordered_map<uint16_t, std::vector<uint8_t>> dataRows;
|
||||
|
||||
enum class enFrame_t
|
||||
{
|
||||
single = 0,
|
||||
first = 1,
|
||||
consecutive = 2,
|
||||
unknown = 9
|
||||
};
|
||||
|
||||
public:
|
||||
void connectDevice() override;
|
||||
void disconnectDevice() override;
|
||||
void scanDevices() override;
|
||||
void mainLoop() override;
|
||||
void executeCommand(String cmd) override;
|
||||
//
|
||||
|
||||
private:
|
||||
void sendPID(const uint16_t pid, const String& cmd);
|
||||
void sendFlowControlFrame();
|
||||
uint8_t receivePID();
|
||||
enFrame_t getFrameType(const uint8_t firstByte);
|
||||
bool processFrameBytes();
|
||||
bool processFrame();
|
||||
void processMergedResponse();
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user