MCPcopy Create free account
hub / github.com/RoboMaster/RoboRTS / ByteHandler

Method ByteHandler

roborts_base/roborts_sdk/protocol/protocol.cpp:650–670  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

648}
649
650bool Protocol::ByteHandler(const uint8_t byte) {
651 recv_stream_ptr_->reuse_count = 0;
652 recv_stream_ptr_->reuse_index = MAX_PACK_SIZE;
653
654 bool is_frame = StreamHandler(byte);
655
656 if (reuse_buffer_) {
657 if (recv_stream_ptr_->reuse_count != 0) {
658 while (recv_stream_ptr_->reuse_index < MAX_PACK_SIZE) {
659 /*! @note because reuse_index maybe re-located, so reuse_index must
660 * be
661 * always point to un-used index
662 * re-loop the buffered data
663 * */
664 is_frame = StreamHandler(recv_stream_ptr_->recv_buff[recv_stream_ptr_->reuse_index++]);
665 }
666 recv_stream_ptr_->reuse_count = 0;
667 }
668 }
669 return is_frame;
670}
671
672bool Protocol::StreamHandler(uint8_t byte) {
673

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected