5 #ifndef RIC_INTERFACE_COMMUNICATOR_H 6 #define RIC_INTERFACE_COMMUNICATOR_H 32 void connect(std::string port,
int baudrate)
71 byte incoming_checksum = (
byte)incoming;
76 if (incoming_checksum == computed_checksum)
81 return (uint8_t)pkg.
type;
94 memcpy(&pkg, buff, pkg_size);
99 memcpy(buff, &pkg, pkg_size);
110 byte pkg_buff[pkg_size];
111 toBytes(pkg, pkg_size, pkg_buff);
148 return serial_.
read();
153 #endif //RIC_INTERFACE_COMMUNICATOR_H const uint8_t HEADER_INDX
const uint8_t PKG_SIZE_INDX
bool write(const protocol::package &pkg, size_t pkg_size)
bool send(const byte buff[], size_t size)
const uint8_t HEADER_CODE
void connect(std::string port, int baudrate)
static void toBytes(const protocol::package &pkg, size_t pkg_size, byte buff[])
int read(byte buff[], size_t size)
void connect(std::string port, int baudrate)
static void fromBytes(byte buff[], size_t pkg_size, protocol::package &pkg)
byte get_crc(byte message[], size_t size)