mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-31 23:34:43 +03:00
cards.py: Fix type annotation
The CardBaes 'scc' member refers to a SimCardCommands instance, not to a LinkBase. Change-Id: If4c0dfbd8c9a03d1a0bc4129bb3c5d5fa492d4cb
This commit is contained in:
@@ -25,15 +25,14 @@
|
|||||||
from typing import Optional, Dict, Tuple
|
from typing import Optional, Dict, Tuple
|
||||||
from pySim.ts_102_221 import EF_DIR
|
from pySim.ts_102_221 import EF_DIR
|
||||||
from pySim.ts_51_011 import DF_GSM
|
from pySim.ts_51_011 import DF_GSM
|
||||||
from pySim.transport import LinkBase
|
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
from pySim.utils import *
|
from pySim.utils import *
|
||||||
from pySim.commands import Path
|
from pySim.commands import Path, SimCardCommands
|
||||||
|
|
||||||
class CardBase:
|
class CardBase:
|
||||||
"""General base class for some kind of telecommunications card."""
|
"""General base class for some kind of telecommunications card."""
|
||||||
def __init__(self, scc: LinkBase):
|
def __init__(self, scc: SimCardCommands):
|
||||||
self._scc = scc
|
self._scc = scc
|
||||||
self._aids = []
|
self._aids = []
|
||||||
|
|
||||||
@@ -75,7 +74,7 @@ class SimCardBase(CardBase):
|
|||||||
any higher-layer processing."""
|
any higher-layer processing."""
|
||||||
name = 'SIM'
|
name = 'SIM'
|
||||||
|
|
||||||
def __init__(self, scc: LinkBase):
|
def __init__(self, scc: SimCardCommands):
|
||||||
super(SimCardBase, self).__init__(scc)
|
super(SimCardBase, self).__init__(scc)
|
||||||
self._scc.cla_byte = "A0"
|
self._scc.cla_byte = "A0"
|
||||||
self._scc.sel_ctrl = "0000"
|
self._scc.sel_ctrl = "0000"
|
||||||
@@ -88,7 +87,7 @@ class SimCardBase(CardBase):
|
|||||||
class UiccCardBase(SimCardBase):
|
class UiccCardBase(SimCardBase):
|
||||||
name = 'UICC'
|
name = 'UICC'
|
||||||
|
|
||||||
def __init__(self, scc: LinkBase):
|
def __init__(self, scc: SimCardCommands):
|
||||||
super(UiccCardBase, self).__init__(scc)
|
super(UiccCardBase, self).__init__(scc)
|
||||||
self._scc.cla_byte = "00"
|
self._scc.cla_byte = "00"
|
||||||
self._scc.sel_ctrl = "0004" # request an FCP
|
self._scc.sel_ctrl = "0004" # request an FCP
|
||||||
@@ -162,7 +161,7 @@ class UiccCardBase(SimCardBase):
|
|||||||
return self._scc.select_adf(aid)
|
return self._scc.select_adf(aid)
|
||||||
return (None, None)
|
return (None, None)
|
||||||
|
|
||||||
def card_detect(scc: LinkBase) -> Optional[CardBase]:
|
def card_detect(scc: SimCardCommands) -> Optional[CardBase]:
|
||||||
# UICC always has higher preference, as a UICC might also contain a SIM application
|
# UICC always has higher preference, as a UICC might also contain a SIM application
|
||||||
uicc = UiccCardBase(scc)
|
uicc = UiccCardBase(scc)
|
||||||
if uicc.probe():
|
if uicc.probe():
|
||||||
|
|||||||
Reference in New Issue
Block a user