Ejemplo n.º 1
0
def safe_schedule_call(method):
    try:
        method()
    except Exception as e:
        Printer.write(e)
        return False
    return True
Ejemplo n.º 2
0
 def get_driver_status(self):
     try:
         self._serial_port_manager.send_and_receive(StatusMessage())
         return True
     except ATErrorException:
         Printer.write('Received AT+ERROR')
         return False
Ejemplo n.º 3
0
 def handle_async_message(cls, message):
     callbacks = (
         call for pattern, call in cls._message_to_callback_map.iteritems()
             if message.find(pattern) != -1)
     called = False
     for callback in callbacks:
         callback(message)
         called = True
     if not called:
         Printer.write("Unhandled async message: " + message)
Ejemplo n.º 4
0
 def set_temperature_settings(self, temperature):
     Printer.write('set_temperature_settings: ')
     Printer.write(temperature)
     try:
         self._current_settings.temperature.update_temperature_manual(temperature)
         return True
     except ATErrorException:
         Printer.write('Received AT+ERROR')
         return False
Ejemplo n.º 5
0
 def list_schedule_task(self):
     Printer.write('list_schedule_task')
     return self._scheduler.list_tasks()
Ejemplo n.º 6
0
 def remove_schedule_task(self, task):
     Printer.write('remove_schedule_task: ')
     Printer.write(task)
     return safe_schedule_call(partial(self._scheduler.remove_task, task))
Ejemplo n.º 7
0
 def update_schedule_task(self, tasks):
     Printer.write('update_schedule_task: ')
     Printer.write(tasks)
     return safe_schedule_call(partial(self._scheduler.update_task, tasks))
Ejemplo n.º 8
0
 def add_schedule_task(self, task):
     Printer.write('add_schedule_task: ')
     Printer.write(task)
     return safe_schedule_call(partial(self._scheduler.add_task, task))
Ejemplo n.º 9
0
 def get_temperature_history(self):
     Printer.write('get_temperature_history')
     return self._temp_history.get_list()
Ejemplo n.º 10
0
 def get_temperature_status(self):
     Printer.write('get_temperature_status')
     temp_status = self._serial_port_manager.send_and_receive(
         TemperatureGetMessage())
     self._current_status.update(temp_status)
     return temp_status
Ejemplo n.º 11
0
 def set_manual_mode(self, manual_mode):
     Printer.write('set_manual_mode')
     self._current_settings.manual_mode.update(manual_mode)
     return True
Ejemplo n.º 12
0
 def get_manual_mode(self):
     Printer.write('get_manual_mode')
     return self._current_settings.manual_mode.value
Ejemplo n.º 13
0
 def get_temperature_settings(self):
     Printer.write('get_temperature_settings')
     return self._current_settings.temperature.value