[client] Start working on hooking the message receiving code up to the PixelMessage class, but there are problems :-(
This commit is contained in:
parent
e0bc536891
commit
461396d231
3 changed files with 12 additions and 4 deletions
|
@ -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<unsigned short*>(static_cast<void*>(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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Reference in a new issue