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:
Philipp Maier
2023-10-23 10:44:44 +02:00
committed by laforge
parent 3077343739
commit 8c82378bfd
5 changed files with 41 additions and 20 deletions

View File

@@ -20,6 +20,7 @@ import logging as log
import serial
import time
import re
import argparse
from typing import Optional
from pySim.utils import Hexstr, ResTuple
@@ -173,3 +174,11 @@ class ModemATCommandLink(LinkBase):
def __str__(self) -> str:
return "modem:%s" % self._device
@staticmethod
def argparse_add_reader_args(arg_parser: argparse.ArgumentParser):
modem_group = arg_parser.add_argument_group('AT Command Modem Reader')
modem_group.add_argument('--modem-device', dest='modem_dev', metavar='DEV', default=None,
help='Serial port of modem for Generic SIM Access (3GPP TS 27.007)')
modem_group.add_argument('--modem-baud', type=int, metavar='BAUD', default=115200,
help='Baud rate used for modem port')