Files
wideband/firmware/console/binary/tunerstudio_impl.h
rusefillc ccb790f532 Steal tunerstudio files from RusEFI (#71)
* Steal tunerstudio files from RusEFI

(cherry picked from commit dcba04fbd31700f5ca4ef4f12a6e220c5713c7d0)

* Steal crc32 files from RusEFI

(cherry picked from commit bfe88b5297c6fc90c8e647e4144c91edafef25f9)

* fix TS steal

(cherry picked from commit a77b9761da4c185359bb2d7e10abd6a8e69c740d)

* fix crc32

(cherry picked from commit cdb4df09f69c2494316c2b12f97dbe19f6bdb598)

* TS stealed from RE

(cherry picked from commit ff470e134036372425da44e9e0fb98737f31c9e9)

* Steal TS

(cherry picked from commit d11406edc2d6b3c1567ce800e207038745a162e7)

* Steal Thread Controller

(cherry picked from commit 2aa5bbd57150e0d5b51e2e88752bdc8697698861)

* Update TunerStudio protocol files

(cherry picked from commit 58f14216ec6e7fc4408e52ccc28a4f912e340b05)

* byteswap.h

(cherry picked from commit 581d647fd49890af4628f0ff5b51e9f193efcac4)

* bugfix

* one more file to compile, another file not ready - removing from this PR

* removing more from this PR

Co-authored-by: Andrey Gusakov <dron0gus@gmail.com>
Co-authored-by: rusefillc <sdfsdfqsf2334234234>
2022-06-29 01:29:40 -07:00

42 lines
1.4 KiB
C++

/**
* @file tunerstudio_impl.h
*/
#pragma once
#include <cstdint>
#include <cstddef>
struct TsChannelBase;
typedef enum {
TS_PLAIN = 0,
TS_CRC = 1
} ts_response_format_e;
class TunerStudioBase {
public:
protected:
virtual void cmdOutputChannels(TsChannelBase* tsChannel, uint16_t offset, uint16_t count) = 0;
};
class TunerStudio : public TunerStudioBase {
public:
int handleCrcCommand(TsChannelBase* tsChannel, char *data, int incomingPacketSize);
bool handlePlainCommand(TsChannelBase* tsChannel, uint8_t command);
void cmdOutputChannels(TsChannelBase* tsChannel, uint16_t offset, uint16_t count) override;
void handleQueryCommand(TsChannelBase* tsChannel, ts_response_format_e mode);
void handleExecuteCommand(TsChannelBase* tsChannel, char *data, int incomingPacketSize);
void handlePageSelectCommand(TsChannelBase *tsChannel, ts_response_format_e mode);
void handleWriteChunkCommand(TsChannelBase* tsChannel, ts_response_format_e mode, uint16_t offset, uint16_t count,
void *content);
void handleCrc32Check(TsChannelBase *tsChannel, ts_response_format_e mode, uint16_t offset, uint16_t count);
void handleWriteValueCommand(TsChannelBase* tsChannel, ts_response_format_e mode, uint16_t offset, uint8_t value);
void handlePageReadCommand(TsChannelBase* tsChannel, ts_response_format_e mode, uint16_t offset, uint16_t count);
private:
void sendErrorCode(TsChannelBase* tsChannel, uint8_t code);
};