def handle_hive_commands(data): """Handles incoming commands from the hive master.""" print data incomingCommand = str(data) command = incomingCommand[6:] #Check for a start command if command == "start": R.state = "active" R.hiveCommand = command StateMachine.state_start() #Check for a stop command elif command == "stop": R.state = "dormant" R.hiveCommand = command StateMachine.state_stop() #Check for a pause command elif command == "pause": R.hiveCommand = command StateMachine.state_wait_for_start() #Check for formation commands elif command == "line": R.hiveCommand = command elif command == "square": R.hiveCommand = command #Check for incorrect commands else: print "Invalid command."