X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Fio%2FslipBio.h;h=a2fd3c2de2dfd7836e70c663a929d86a2150d084;hb=da9f337a893bd317460118f89efa83a3427f797f;hp=27bfadb7950d2e452146a33614ddc59860759667;hpb=3c27aae8d1bfbf441c25b273d328d0859022ed60;p=cassiopeia.git diff --git a/src/io/slipBio.h b/src/io/slipBio.h index 27bfadb..a2fd3c2 100644 --- a/src/io/slipBio.h +++ b/src/io/slipBio.h @@ -11,26 +11,32 @@ private: std::vector buffer; + std::vector header = {0, 0, 0, 0, 0, 0, 0, 0}; + int resetCounter = -1; // -1 means waiting for start byte + unsigned int decodeTarget; unsigned int decodePos; unsigned int rawPos; - bool failed; + bool waitForConnection = true; + bool waitForReset = false; bool packageLeft = false; + bool server = false; + private: - bool unmask(); + int unmask(); public: SlipBIO( std::shared_ptr target ); SlipBIO(); ~SlipBIO(); - void setTarget( std::shared_ptr target ); + void setTarget( std::shared_ptr target, bool server ); - virtual int write( const char* buf, int num ); - virtual int read( char* buf, int size ); - virtual long ctrl( int cmod, long arg1, void* arg2 ); + virtual int write( const char *buf, int num ); + virtual int read( char *buf, int size ); + virtual long ctrl( int cmod, long arg1, void *arg2 ); - static const char* getName(); + static const char *getName(); };