in esp32-ble-device/main.py [0:0]
def ble_request_message_router(self, message):
try:
command = message['command']
# Action based on command.
if command == 'describe-ble-device':
self.describe_ble_device()
elif command == 'toggle_led':
self.toggle_led()
elif command == 'hw-reset-micro':
self.hw_reset_micro()
elif command == 'get-processor-board-temp':
self.publish_board_temp()
elif command == 'reflect-message':
self.reflect_message(message)
else:
err_msg = 'Unknown BLE Command: {} REQUEST received'.format(command)
self.publish_exception(404, err_msg)
except Exception as err:
err_msg = {'error_message' : 'EXCEPTION from BLE ble_request_message_router. ERROR MESSAGE {}'.format(str(err))}
self.publish_exception(500, err_msg)