April 2020
Intermediate to advanced
294 pages
7h 53m
English
The command parsing function is going to parse the incoming socket data, which will be in JSON, to determine what command the system is receiving. The commands that we will look at supporting right now are as follows:
These commands can have only two possible values:
Now, if you recall, the receive function takes the received string and then reconstructs it into a JSON-formatted dictionary. Our parsing function needs to search the dictionary to see whether there are references to our command words in the message and, if there are, we can reference the value using the command as a key. For example, our parse_command function might look something like the following:
def parse_command(message): if "LED1" ...
Read now
Unlock full access