コード例 #1
0
ファイル: MuxConfig.py プロジェクト: link2cory/smartmeshsdk
 def start_service(self, sm_config):
     print 'Starting', sm_config.config_name
     self.processmgr.start(sm_config.config_name)
     # TODO: handle errors
     sm_config.status = SerialMuxConfigs.SerialMuxConfig.STATUS_RUNNING
     SerialMuxConfigs.check_device(sm_config)
     # update UI
     self.ui.update_row_values(sm_config)
コード例 #2
0
ファイル: MuxConfig.py プロジェクト: link2cory/smartmeshsdk
 def update_service(self, sm_config):
     do_restart = (sm_config.status == SerialMuxConfigs.SerialMuxConfig.STATUS_RUNNING)
     self.processmgr.update(sm_config.config_name,
                            sm_config.com_port, sm_config.listener_port, do_restart)
     if do_restart:
         sm_config.status = SerialMuxConfigs.SerialMuxConfig.STATUS_RUNNING
         SerialMuxConfigs.check_device(sm_config)
     else:
         sm_config.status = SerialMuxConfigs.SerialMuxConfig.STATUS_STOPPED
     # update UI
     self.ui.update_row_values(sm_config)
コード例 #3
0
ファイル: MuxConfig.py プロジェクト: link2cory/smartmeshsdk
    def scan(self):
        mux_configs = scan_configs(self.processmgr.SERIAL_MUX_CONFIG_DIR)
        for mux_config in mux_configs:
            smc = self.model.add(mux_config['config_name'])
            smc.listener_port = mux_config['listener_port']
            smc.com_port = mux_config['com_port']
            
        svc_configs = scan_services()
        for svc_config in svc_configs:
            #print 'Scanning', svc_config['service_name']
            smc = self.model.find_config(svc_config['service_name'])
            if svc_config['state'] == 'Running':
                smc.status = SerialMuxConfigs.SerialMuxConfig.STATUS_RUNNING
                SerialMuxConfigs.check_device(smc)
            elif svc_config['state'] == 'Stopped':
                smc.status = SerialMuxConfigs.SerialMuxConfig.STATUS_STOPPED

        self._all_ports = get_virtual_serial_ports()