Beispiel #1
0
 def __init__(self, tmpfile_ext):
     Target.__init__(self)
     self._suffix = '{:0>12d}'.format(random.randint(2**16, 2**32))
     self._feedback = FeedbackCollector()
     self._target_ip = None
     self._target_port = None
     self._printer_name = None
     self._cpt = None
     self.set_tmp_file_extension(tmpfile_ext)
Beispiel #2
0
 def __init__(self, tmpfile_ext, target_path=None):
     Target.__init__(self)
     self.__suffix = '{:0>12d}'.format(random.randint(2**16, 2**32))
     self.__app = None
     self.__pre_args = None
     self.__post_args = None
     self._data_sent = None
     self._feedback_computed = None
     self.__feedback = TargetFeedback()
     self.set_target_path(target_path)
     self.set_tmp_file_extension(tmpfile_ext)
Beispiel #3
0
 def __init__(self,
              serial_port,
              baudrate,
              pin_code,
              targeted_tel_num,
              codec='latin_1'):
     Target.__init__(self)
     self.serial_port = serial_port
     self.baudrate = baudrate
     self.tel_num = targeted_tel_num
     self.pin_code = pin_code
     self.codec = codec
     if sys.version_info[0] > 2:
         self.pin_code = bytes(self.pin_code, self.codec)
     self.set_feedback_timeout(2)
Beispiel #4
0
 def __init__(self,
              target_path=None,
              pre_args='',
              post_args='',
              tmpfile_ext='.bin',
              send_via_stdin=False,
              send_via_cmdline=False):
     Target.__init__(self)
     self._suffix = '{:0>12d}'.format(random.randint(2**16, 2**32))
     self._app = None
     self._pre_args = pre_args
     self._post_args = post_args
     self._send_via_stdin = send_via_stdin
     self._send_via_cmdline = send_via_cmdline
     self._data_sent = None
     self._feedback_computed = None
     self._feedback = FeedbackCollector()
     self.set_target_path(target_path)
     self.set_tmp_file_extension(tmpfile_ext)
Beispiel #5
0
    def get_description(self):
        # Note the provided string is dot/graphviz oriented.
        step_desc = str(self).replace(
            '\n', '\\n')  # for graphviz display in 'record' boxes

        if self._do_before_sending is not None or self._do_before_data_processing is not None:
            if self._do_before_data_processing is None:
                cbk_before_dataproc_str = ' x '
            else:
                cbk_before_dataproc_str = ' \<-- {:s}()  '.format(
                    self._do_before_data_processing.__name__)
            if self._do_before_sending is None:
                cbk_before_sending_str = ' x '
            else:
                cbk_before_sending_str = ' --\> {:s}() '.format(
                    self._do_before_sending.__name__)

            if self.is_blocked():
                step_desc = step_desc + '|{:s}'.format(cbk_before_dataproc_str)
            else:
                step_desc = step_desc + '|{{{:s}|{:s}}}'.format(
                    cbk_before_dataproc_str, cbk_before_sending_str)

        fbk_mode = None if self.feedback_mode is None else Target.get_fbk_mode_desc(
            self.feedback_mode, short=True)
        if self.feedback_timeout is not None and self.feedback_mode is not None:
            step_desc = '{{fbk timeout {!s}s|{:s}}}|{:s}'.format(
                self.feedback_timeout, fbk_mode, step_desc)
        elif self.feedback_timeout is not None:
            step_desc = 'fbk timeout\\n{!s}s|{:s}'.format(
                self.feedback_timeout, step_desc)
        elif self.feedback_mode is not None:
            step_desc = 'fbk mode\\n{:s}|{:s}'.format(fbk_mode, step_desc)
        else:
            pass

        return step_desc
Beispiel #6
0
 def __init__(self, recover_ratio=100):
     Target.__init__(self)
     self._cpt = None
     self._recover_ratio = recover_ratio