mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-24 22:38:38 +03:00
transport: move argument parser setup into concrete classes
The argument parser is set up globally for all LinkBase objects in __init__.py. Since we tend to have only platform independed code in __init__.py, we should move the argument parser setup into the specific LinkBase classes. Related: OS#6210 Change-Id: I22c32aa81ca0588e3314c3ff4546f6e5092c11df
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
import serial
|
||||
import time
|
||||
import os.path
|
||||
import argparse
|
||||
from typing import Optional
|
||||
|
||||
from pySim.exceptions import NoCardError, ProtocolError
|
||||
@@ -240,3 +241,11 @@ class SerialSimLink(LinkBase):
|
||||
|
||||
def __str__(self) -> str:
|
||||
return "serial:%s" % (self._sl.name)
|
||||
|
||||
@staticmethod
|
||||
def argparse_add_reader_args(arg_parser: argparse.ArgumentParser):
|
||||
serial_group = arg_parser.add_argument_group('Serial Reader')
|
||||
serial_group.add_argument('-d', '--device', metavar='DEV', default='/dev/ttyUSB0',
|
||||
help='Serial Device for SIM access')
|
||||
serial_group.add_argument('-b', '--baud', dest='baudrate', type=int, metavar='BAUD', default=9600,
|
||||
help='Baud rate used for SIM access')
|
||||
|
||||
Reference in New Issue
Block a user