pySim/transport: add abstract get_atr method to LinkBase
The implementations that inheret from the LinkBase class are expected to implement a get_atr method. This method is mandatory, since it is one of the most basic functionalities of pySim to display an ATR. Also the ATR is sometimes needed to distinguish between different card models. The modem_atcmd and calypso implementation completely lack the get_atr method. Apparantly it is not possible to get an ATR in those environments, so lets add a dummy method there. Related: OS#6322 Change-Id: I4fc020ca45658af78e495a5c1b985213f83cbb50
This commit is contained in:
@@ -119,6 +119,11 @@ class LinkBase(abc.ABC):
|
||||
"""Connect to a card immediately
|
||||
"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_atr(self) -> Hexstr:
|
||||
"""Retrieve card ATR
|
||||
"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def disconnect(self):
|
||||
"""Disconnect from card
|
||||
|
||||
@@ -123,6 +123,9 @@ class CalypsoSimLink(LinkBaseTpdu):
|
||||
def connect(self):
|
||||
self.reset_card()
|
||||
|
||||
def get_atr(self) -> Hexstr:
|
||||
return "3b00" # Dummy ATR
|
||||
|
||||
def disconnect(self):
|
||||
pass # Nothing to do really ...
|
||||
|
||||
|
||||
@@ -139,6 +139,9 @@ class ModemATCommandLink(LinkBaseTpdu):
|
||||
def connect(self):
|
||||
pass # Nothing to do really ...
|
||||
|
||||
def get_atr(self) -> Hexstr:
|
||||
return "3b00" # Dummy ATR
|
||||
|
||||
def disconnect(self):
|
||||
pass # Nothing to do really ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user