def __init__(self,
                 cards,
                 atr=None,
                 type=types.TYPE_USIM,
                 mode=SIMTRACE_ONLINE):
        self.loggingApdu = self.setupLogger()
        if LOG_NONE_APDU_IN_FILE:
            self.logging = self.loggingApdu
        else:
            self.logging = logging
        self.atr = atr
        self.simType = type
        self.mode = mode

        self.cardsDict = self.addControlCard(cards)
        self.lastUpdate = 0

        self.apduInjectedCard = None
        self.apduInjectedData = None
        self.interpreter = None
        self.routerMode = ROUTER_MODE_DISABLED

        if self.mode != SIMTRACE_OFFLINE:
            self.dev = self.usb_find(0x03eb, 0x6119)
            if self.dev is None:
                self.logging.warning("Simtrace not connected!")
                self.mode = SIMTRACE_OFFLINE
        self.simCtrl = None
        self.loop = None
        self.shell = None
        self.lock = threading.Lock()
        self.rapduInject = None
        self.inject = INJECT_READY