Go to the documentation of this file.
52 log->logRead(buf, res);
63 log->logWrite(buf, len);
71 unsigned char* payload,
81 unsigned char* payload,
95 res =
send(
id, len, payload);
157 if (msg.
id != expectedId)
163 str(boost::format(
"Response ID (%02X) does not match submitted command ID (%02X)") %
164 (
int)msg.
id % (
int)expectedId));
187 unsigned char header[3];
188 unsigned short checksum = 0x50f5;
197 res =
read(header, 1);
210 res =
read(header, 3);
215 str(boost::format(
"Failed to receive header data (%d bytes read)") % res));
232 unsigned char*
data =
new unsigned char[msg->
len + 2u];
264 str(boost::format(
"Not enough data (%d, expected %d), Command = %02X") % res %
265 (msg->
len + 2) % msg->
id));
320 unsigned char* buf =
new unsigned char[6 + len + 2];
321 memcpy(buf, header, 6);
322 memcpy(buf + 6,
data, len);
323 memcpy(buf + 6 + len, (
unsigned char*)&crc, 2);
325 res =
write(buf, 6 + len + 2);
327 if (res < 6 + (
int)len + 2)
345 return strm <<
a.toString();
int read(unsigned char *buf, unsigned int len)
virtual ~AbstractInterface()
int write(unsigned char *buf, unsigned int len)
message(STATUS "Boost-Library-Dir: " "${Boost_LIBRARY_DIRS}") message(STATUS "Boost-LIBRARIES
Response receiveWithoutChecks()
Response submitCmd(unsigned char id, unsigned char *payload, unsigned int len, bool pending)
int send(unsigned char id, unsigned int len, unsigned char *data)
static unsigned short Crc16(unsigned char *data, unsigned int size)
Calculates the CRC16 checksum of an array by using a table.
static unsigned short Update_crc16(unsigned char *data, unsigned int size, unsigned short crc)
Calculates the CRC16 checksum of an array by using a table.
void fireAndForgetCmd(unsigned char id, unsigned char *payload, unsigned int len, bool pending)
double a(double t, double a0, double j)
void logText(std::string message)
#define make_short(lowbyte, highbyte)
void startLogging(std::string file)
#define MSG_PREAMBLE_BYTE
virtual int writeInternal(unsigned char *buf, unsigned int len)=0
virtual int readInternal(unsigned char *buf, unsigned int len)=0
std::ostream & operator<<(std::ostream &strm, const AbstractInterface &a)
std::vector< unsigned char > data