Skip to content
This repository has been archived by the owner on Dec 23, 2021. It is now read-only.

Commit

Permalink
modifications to active device microbit
Browse files Browse the repository at this point in the history
  • Loading branch information
andreamah committed Feb 19, 2020
1 parent a050aff commit b3f6567
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/common/debugger_communication_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ def init_connection(port=CONSTANTS.DEFAULT_PORT):
def __update_api_state(data):
try:
event_state = json.loads(data)
print(event_state)
active_device = event_state.get(CONSTANTS.ACTIVE_DEVICE_FIELD)
print(active_device)
# can we do without this?
device_dict[active_device].update_state(data)
if active_device is None:
device_dict[active_device].update_state(data)
except Exception as e:
print(CONSTANTS.ERROR_SENDING_EVENT, e, file=sys.stderr, flush=True)

Expand All @@ -69,7 +72,8 @@ def update_state(state):
# or Sensor changed (Temperature, light, Motion)
@sio.on("input_changed")
def input_changed(data):
sio.emit("receivedState", {})
print("input changed!")
sio.emit("receivedState", data)
__update_api_state(data)


Expand Down

0 comments on commit b3f6567

Please sign in to comment.