示例#1
0
 def set_config(self, line):
     util.set_config(line, self.config, C, log)
     cmd, tail = util.parse_cmdline2(line, self.config, log)
     if cmd == 'log-level':
         log.set_log_level(self.config['log-level'].value)
     if cmd == 'wav-prefix':
         self.transport.set_wav_prefix(tail)
示例#2
0
    def exec_line(self, line):
        k = self.kermit
        while line:
            cmd, tail = util.parse_cmdline2(line, kermit.kermit_cmds.keys(),
                                            log)
            if cmd == 'help':
                k.help(tail)
            elif cmd == 'finish':
                k.finish()
            elif cmd == 'send':
                k.send(tail)
            elif cmd == 'get':
                k.get(tail)
            elif cmd == 'receive':
                k.receive()
            elif cmd == 'remote':
                self._remote(tail)
            elif cmd == 'server':
                k.server(tail)
            elif cmd == 'take':
                k.take(tail)
            elif cmd == 'echo':
                k.echo(tail)
            elif cmd == 'local':
                self._local(tail)
            elif cmd == 'set':
                k.set(tail)
            elif cmd == 'show':
                k.show(tail)
            elif cmd == '':
                self._local(line)

            line = k.next_cmd()
示例#3
0
    def _local(self, line):
        cmd, tail = util.parse_cmdline2(line,
                                        kermit.kermit_cmds['local'].subcmds,
                                        log)

        k = self.kermit

        if cmd == 'cwd':
            k.local_cwd(tail)
        elif cmd == 'delete':
            k.local_delete(tail)
        elif cmd == 'directory':
            k.local_directory(tail)
        elif cmd == 'path':
            k.local_path()
        elif cmd == 'push':
            k.local_push()
        elif cmd == 'run':
            k.local_run(tail)
        elif cmd == 'space':
            k.local_space()
        elif cmd == 'type':
            k.local_type(tail)
        else:
            log.i('Invalid local command: {}'.format(line))
示例#4
0
    def _remote(self, line):
        cmd, tail = util.parse_cmdline2(line,
                                        kermit.kermit_cmds['remote'].subcmds,
                                        log)

        k = self.kermit

        if cmd == 'cwd':
            k.remote_cwd(tail)
        elif cmd == 'delete':
            k.remote_delete(tail)
        elif cmd == 'directory':
            k.remote_directory()
        elif cmd == 'host':
            if tail:
                k.remote_host(tail)
            else:
                self._hpcalc()
        elif cmd == 'path':  # Not in Kermit specification
            k.remote_path()
        elif cmd == 'space':
            k.remote_space()
        elif cmd == 'type':
            k.remote_type(tail)
        else:
            log.i('Invalid remote command: {}'.format(line))
示例#5
0
 def set(self, line):
     cmd, tail = util.parse_cmdline2(line, self.config, log)
     if not cmd:
         log.e('Name not found: {}'.format(line))
         return
     if cmd == 'receive':
         log.i('Cannot set receive')
         return
     util.set_config(line, self.config, kprotocol.C, log)
示例#6
0
    def _send(self, line):
        cmd, tail = util.parse_cmdline2(line, ['file', 'chars'], log)

        s = self.serial

        if cmd == 'file':
            s.send_file(tail)
        elif cmd == 'chars':
            s.send_chars(tail)
        else:
            log.i('Invalid send: ' + line)
示例#7
0
    def exec_line(self, line):
        cmd, tail = util.parse_cmdline2(
            line, ['send', 'receive', 'help', 'show', 'set'], log)
        s = self.serial

        if cmd == 'send':
            self._send(tail)
        elif cmd == 'receive':
            s.receive_file(tail)
        elif cmd == 'show':
            s.show_config(tail)
        elif cmd == 'set':
            s.set_config(tail)
        elif cmd == 'help':
            s.help(tail)
        else:
            log.i('Invalid {}'.format(line))
示例#8
0
    def exec_line(self, line):
        cmd, tail = util.parse_cmdline2(
            line, ['send', 'receive', 'help', 'show', 'set'], log)

        x = self.xmodem

        if cmd == 'send':
            x.send_file(tail)
        elif cmd == 'receive':
            x.receive_file(tail)
        elif cmd == 'show':
            x.show_config(tail)
        elif cmd == 'set':
            x.set_config(tail)
        elif cmd == 'help':
            x.help(tail)
        else:
            log.i('Invalid command {}'.format(line))
示例#9
0
    def exec_line(self, line):
        if not line.strip():
            return

        d = self
        cmd, tail = util.parse_cmdline2(line, hpcomm_cmds.keys(), log)

        if cmd == 'quit':
            d.quit()
            return

        if d._sub_proc(line):
            return

        if cmd == 'echo':
            d.echo(tail)
        elif cmd == 'serial':
            d.proc_serial(tail)
        elif cmd == 'kermit':
            d.proc_kermit(tail)
        elif cmd == 'xmodem':
            d.proc_xmodem(tail)
        elif cmd == 'help':
            d.help(tail)
        elif cmd == 'listen':
            d.listen(tail)
        elif cmd == 'peek':
            d.peek()
        elif cmd == 'wait':
            d.wait(tail)
        elif cmd == 'script':
            d.script(tail)
        elif cmd == 'show':
            d.show_config(tail)
        elif cmd == 'set':
            d.set_config(tail)
        else:
            log.i('Unrecognized command: {}'.format(line))