diff --git a/PixelHub-Client/src/PixelBot.cpp b/PixelHub-Client/src/PixelBot.cpp index d7b4eab..cd1c57d 100644 --- a/PixelHub-Client/src/PixelBot.cpp +++ b/PixelHub-Client/src/PixelBot.cpp @@ -135,9 +135,17 @@ bool PixelBot::Tick() delay(10); // sleep for 10ms return true; } - + + String nextLine = tcpClient.readStringUntil('\n'); - Serial.print(" > "); Serial.println(nextLine); + char* messageBuffer = new char[nextLine.length()]; + nextLine.toCharArray(messageBuffer, nextLine.length()); + + int MessageType = *(static_cast(static_cast(messageBuffer + 2))); + + Serial.print("Got message: Length: "); Serial.print(nextLine.length()); + Serial.print(", Message Type: "); Serial.println(MessageType); + Serial.print(" > "); Serial.println(messageBuffer); return true; } diff --git a/PixelHub-Client/src/PixelBotController.h b/PixelHub-Client/src/PixelBotController.h index be63ada..a9b3c5c 100644 --- a/PixelHub-Client/src/PixelBotController.h +++ b/PixelHub-Client/src/PixelBotController.h @@ -16,7 +16,7 @@ public: static const int RIGHT = 4; void MoveDistance(int direction, int ticks); - void MoveTick(int direction); + void MoveTick(int direction); unsigned long GetTicksTravelled(); diff --git a/PixelHub-Client/src/PixelMessage.h b/PixelHub-Client/src/PixelMessage.h index 3add212..1ebf96b 100644 --- a/PixelHub-Client/src/PixelMessage.h +++ b/PixelHub-Client/src/PixelMessage.h @@ -26,7 +26,7 @@ public: static const unsigned int TYPE_COMMANDFAILED = 14; static const unsigned int TYPE_INFOREQUEST = 20; static const unsigned int TYPE_INFORESPONSE = 21; - + // The protocol version associated with this message. unsigned short ProtocolVersion = 1; unsigned short MessageType = 1;