From c00d4ae549424a8ef8019a492a2951039d02d26c Mon Sep 17 00:00:00 2001 From: Evan Typanski Date: Sun, 17 Feb 2019 16:54:11 -0500 Subject: [PATCH] Solidify protocol --- README.md | 35 +++++++++++++++++++++++++++++++++++ escape-room-server.py | 6 +++--- 2 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..74d4b54 --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ +# ESP8266 Escape Room Wifi +The server and client code for Gizmologists escape room. + +Code in `escape-room-server.py` will be run on a Raspberry Pi to be communicated with ESP8266-01 chips. Code in the Arduino libraries runs on Arduinos to communicate with it. + +## Protocol +All requests and responses are 7 bytes. + +### Requests +Format: `puzzle_code command` + +`puzzle_code` - The puzzle of the request + - `MRS`: Morse code puzzle + - `BKS`: Books puzzle + - `TIM`: Time machine puzzle + - `GRS`: Gears puzzle + +`command` - The command to run + - `DNE`: Mark puzzle as done + - `RST`: Reset puzzle to incomplete + - `GET`: Get status of puzzle + +Example requests: + - `MRS DNE`: Mark the morse code puzzle as done + - `BKS GET`: Get the status of the books puzzle + +### Responses + +Format: `puzzle_code status` + +`puzzle_code` - The puzzle of the request (same codes as request) + +`status` - Status of the puzzle AFTER the request is processed (same codes as request) + +Response will be `INVALID` if command was invalid in any way. diff --git a/escape-room-server.py b/escape-room-server.py index aa233c4..fd7e07e 100644 --- a/escape-room-server.py +++ b/escape-room-server.py @@ -22,12 +22,12 @@ # # Given a request, this server responds in a 7 byte code as follows: # puzzle_code status -# Where puzzle_code is the puzzle passed in and status is DNE for done or INC for not done +# Where puzzle_code is the puzzle passed in and status is DNE for done or RST for not done # BKS DNE: Means books puzzle is done # # Note this means DNE commands should always return the puzzle name then DNE -# and RST commands always return puzzle name then INC -# GET commands will return the status, either DNE (done) or INC (incomplete) +# and RST commands always return puzzle name then RST +# GET commands will return the status, either DNE (done) or RST (incomplete) # # Invalid commands are responded to with INVALID