def test_open_conn(self): """Test open_conn method""" if not is_on_pi(): print("Aborting test on non-pi environment..") return else: self.can_task.open_conn()
def __init_task(conn_mode, verbose, port, uuid): if not conn_mode: is_can = not is_network_module_connected() and is_on_pi() conn_mode = 'can' if is_can else 'ser' if conn_mode == 'ser': return im('modi.task.ser_task').SerTask(verbose, port) elif conn_mode == 'can': return im('modi.task.can_task').CanTask(verbose) elif conn_mode == 'ble': return im('modi.task.ble_task').BleTask(verbose, uuid) else: raise ValueError(f'Invalid conn mode {conn_mode}')
def __init_task(conn_mode, verbose, port, uuid): if not conn_mode: is_can = not is_network_module_connected() and is_on_pi() conn_mode = 'can' if is_can else 'ser' if conn_mode == 'ser': return im('modi.task.ser_task').SerTask(verbose, port) elif conn_mode == 'can': return im('modi.task.can_task').CanTask(verbose) elif conn_mode == 'ble': mod_path = { 'win32': 'modi.task.ble_task.ble_task_win', 'linux': 'modi.task.ble_task.ble_task_rpi', 'darwin': 'modi.task.ble_task.ble_task_mac', }.get(sys.platform) return im(mod_path).BleTask(verbose, uuid) else: raise ValueError(f'Invalid conn mode {conn_mode}')
def __open_conn(): if is_on_pi(): return im('modi.task.can_task').CanTask() else: return im('modi.task.ser_task').SerTask()