Browse Source

Finish initial sped! :D

master
Starbeamrainbowlabs 4 years ago
parent
commit
cd708c1f3a
2 changed files with 50 additions and 2 deletions
  1. +49
    -1
      PixelHub Protocol.md
  2. +1
    -1
      PixelHub-Client/PixelBot.cpp

+ 49
- 1
PixelHub Protocol.md View File

@ -111,6 +111,7 @@ Type | Name | Description
3 | Left | Turning left.
4 | Right | Turning right.
### CommandOk: When the PixelBot is ok with a command
This message doesn't have a body, but it is sent by a PixelBot to say that it is going to perform the command that was sent previously.
@ -118,7 +119,54 @@ This message is a direct response to a `Move` command.
### CommandComplete: When a PixelBot completes a command
This message doesn't have a body, but is sent by a PixelBot when it finished executing a `Move` command. It should be in direct response the commandd sent by the server.
This message doesn't have a body, but is sent by a PixelBot when it finished executing a `Move` command. It should be in direct response the `Move` command sent by the server.
### CommandFailed: PixelBot Complaints
This message doesn't have a body, but it's sent by PixelBots who can't complete an instruction they've been given. It should be in direct response to the `Move` command that it is complaining about.
### InfoRequest: Requesting information
An `InfoRequest` can be used by the server to request information from the client. Information held by a PixelBot is accessed by the server in a key / value format. All keys and values are formatted as a `char*` - the server needs to parse the result sent by the PixelBot into the appropriate type. It does have a body, and it is formatted like this:
```
+------------+------------+------------+------------+
| Byte 1 | Byte 2 | Byte 3 | Byte 4 |
+------------+------------+------------+------------+
| char* Key |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
```
- `char*` Key - The key. Must not contain a null byte - there's one at the end of the message.
### InfoResponse: Responding with information
The response to an `InfoRequest`. Must be in direct reply to the `InfoRequest` that it is responding to. The possible keys and values are detailed in the [keys and values](#Information keys and values) section.
```
+------------+------------+------------+------------+
| Byte 1 | Byte 2 | Byte 3 | Byte 4 |
+------------+------------+------------+------------+
| char* Value |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
```
- `char*` Value - The value that corresponds to the key requested in the `InfoRequest`. Numbers should be converted to their string representation - i.e. converted to ASCII / UTF8. Must not contain a null byte - there's one at the end of the message.
## Information keys and values
Information requests enable the server to request several different pieces of information from a PixelBot.
Key | Value description
------------------------|-------------------
`Id` | The PixelBot's unique id.
`TicksTravelled` | The number of ticks that the PixelBot has been moving for.
`LastMoveDirection` | The direction that the PixelBot last moved in. See the [Movement Types](#Movement Types) section.
`LastMoveDuration` | The duration that the PixelBot last moved for in ticks.
`PixelBotType` | The type of PixelBot that this bot is. SHould be the same character array from the `HandshakeRequest`.
`TicksPerRevolution` | The number of ticks that this PixelBot needs in order to do one ful revolution of it's wheels.
If a key is not found, then a blank `InfoResponse` must be returned.
## Message Types


+ 1
- 1
PixelHub-Client/PixelBot.cpp View File

@ -138,7 +138,7 @@ void PixelBot::Listen()
bool PixelBot::processCommand(String command)
{
return false;
}