Example #1
0
def safe_schedule_call(method):
    try:
        method()
    except Exception as e:
        Printer.write(e)
        return False
    return True
Example #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
Example #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)
Example #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
Example #5
0
 def compare_values(self, float_first_value, float_second_value) -> str:
     if self.compare_bigger(float_first_value, float_second_value):
         return Printer.print_bigger(Printer(), float_first_value,
                                     float_second_value)
     elif self.compare_equal(float_first_value, float_second_value):
         return Printer.print_equal(Printer(), float_first_value,
                                    float_second_value)
     else:
         return Printer.print_smaller(Printer(), float_first_value,
                                      float_second_value)
Example #6
0
def _verbose(args):
    Printer.set_print(args.verbose)
Example #7
0
 def list_schedule_task(self):
     Printer.write('list_schedule_task')
     return self._scheduler.list_tasks()
Example #8
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))
Example #9
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))
Example #10
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))
Example #11
0
 def get_temperature_history(self):
     Printer.write('get_temperature_history')
     return self._temp_history.get_list()
Example #12
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
Example #13
0
 def set_manual_mode(self, manual_mode):
     Printer.write('set_manual_mode')
     self._current_settings.manual_mode.update(manual_mode)
     return True
Example #14
0
 def get_manual_mode(self):
     Printer.write('get_manual_mode')
     return self._current_settings.manual_mode.value
Example #15
0
 def get_temperature_settings(self):
     Printer.write('get_temperature_settings')
     return self._current_settings.temperature.value