Пример #1
0
    def get_serialized_order(self, display_identifier=None):
        if display_identifier:
            display = iot_devices.get(display_identifier)
        else:
            display = DisplayDriver.get_default_display()

        if display:
            return display.get_serialized_order()
        return {
            'rendered_html': False,
            'error': "No display found",
        }
Пример #2
0
 def action(self, session_id, device_identifier, data):
     """
     This route is called when we want to make a action with device (take picture, printing,...)
     We specify in data from which session_id that action is called
     And call the action of specific device
     """
     iot_device = iot_devices.get(device_identifier)
     if iot_device:
         iot_device.data['owner'] = session_id
         data = json.loads(data)
         iot_device.action(data)
         return True
     return False