[client] Start working on hooking the message receiving code up to the PixelMessage class, but there are problems :-(

This commit is contained in:
Starbeamrainbowlabs 2017-05-18 19:58:13 +01:00
parent e0bc536891
commit 461396d231
3 changed files with 12 additions and 4 deletions

View file

@ -136,8 +136,16 @@ bool PixelBot::Tick()
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;
}