std::vector<uint8_t> ErrorResponse::getBytes() const { auto packet = startPacket(1); packet.push_back((uint8_t) m_error); finishPacket(packet); return packet; }
std::vector<uint8_t> HelloResponse::getBytes() const { std::string cfg = m_devInfo->asString(); // Need config string here to know packet size auto packet = startPacket(2 + cfg.size()); packet.push_back(m_devInfo->protocolVersion()); // protocol version packet.push_back(m_devInfo->resetFlags()); // reset flags packet.insert(packet.end(), cfg.begin(), cfg.end()); // device config finishPacket(packet); return packet; }
void finishCurrentAndStartNewPacket ( ) { finishAndLaunchPacket ( false ); startPacket ( ); }
void start ( ) { startPacket ( ); }
std::vector<uint8_t> HelloRequest::getBytes() const { auto packet = startPacket(0); finishPacket(packet); return packet; }