mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-25 23:08:34 +03:00
transport: Pass argparse.Namespace directly into transport classes
It's odd that the individual transport driver specifies their argparse options but then the core transport part evaluates them individually. This means we cannot add new options within a transport. Let's pass the Namespace instance into the constructor of the specific transport to improve this. Change-Id: Ib977007dd605ec9a9c09a3d143d2c2308991a12c
This commit is contained in:
@@ -35,7 +35,10 @@ from pySim.exceptions import *
|
||||
class ModemATCommandLink(LinkBase):
|
||||
"""Transport Link for 3GPP TS 27.007 compliant modems."""
|
||||
|
||||
def __init__(self, device: str = '/dev/ttyUSB0', baudrate: int = 115200, **kwargs):
|
||||
def __init__(self, opts: argparse.Namespace = argparse.Namespace(modem_dev='/dev/ttyUSB0',
|
||||
modem_baud=115200), **kwargs):
|
||||
device = opts.modem_dev
|
||||
baudrate = opts.modem_baud
|
||||
super().__init__(**kwargs)
|
||||
if os.environ.get('PYSIM_INTEGRATION_TEST') == "1":
|
||||
print("Using modem for Generic SIM Access (3GPP TS 27.007)")
|
||||
|
||||
Reference in New Issue
Block a user