本文整理匯總了Python中smartcard.Observer.Observable.setChanged方法的典型用法代碼示例。如果您正苦於以下問題:Python Observable.setChanged方法的具體用法?Python Observable.setChanged怎麽用?Python Observable.setChanged使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類smartcard.Observer.Observable
的用法示例。
在下文中一共展示了Observable.setChanged方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: transmit
# 需要導入模塊: from smartcard.Observer import Observable [as 別名]
# 或者: from smartcard.Observer.Observable import setChanged [as 別名]
def transmit(self, bytes, protocol=None):
"""Transmit an apdu. Internally calls doTransmit() class method
and notify observers upon command/response APDU events.
Subclasses must override the doTransmit() class method.
bytes: list of bytes to transmit
protocol: the transmission protocol, from
CardConnection.T0_protocol,
CardConnection.T1_protocol, or
CardConnection.RAW_protocol
"""
Observable.setChanged(self)
Observable.notifyObservers(self,
CardConnectionEvent(
'command',
[bytes, protocol]))
data, sw1, sw2 = self.doTransmit(bytes, protocol)
Observable.setChanged(self)
Observable.notifyObservers(self,
CardConnectionEvent(
'response',
[data, sw1, sw2]))
if None != self.errorcheckingchain:
self.errorcheckingchain[0](data, sw1, sw2)
return data, sw1, sw2
示例2: connect
# 需要導入模塊: from smartcard.Observer import Observable [as 別名]
# 或者: from smartcard.Observer.Observable import setChanged [as 別名]
def connect(self, protocol=None, mode=None, disposition=None):
"""Connect to card.
protocol: a bit mask of the protocols to use, from
CardConnection.T0_protocol, CardConnection.T1_protocol,
CardConnection.RAW_protocol, CardConnection.T15_protocol
mode: passed as-is to the PC/SC layer
"""
Observable.setChanged(self)
Observable.notifyObservers(self, CardConnectionEvent('connect'))
示例3: connect
# 需要導入模塊: from smartcard.Observer import Observable [as 別名]
# 或者: from smartcard.Observer.Observable import setChanged [as 別名]
def connect(self, protocol=None, mode=None, disposition=None):
"""Connect to card.
protocol: a bit mask of the protocols to use, from
CardConnection.T0_protocol, CardConnection.T1_protocol,
CardConnection.RAW_protocol, CardConnection.T15_protocol
mode: SCARD_SHARE_SHARED (default), SCARD_SHARE_EXCLUSIVE or
SCARD_SHARE_DIRECT
disposition: SCARD_LEAVE_CARD (default), SCARD_RESET_CARD,
SCARD_UNPOWER_CARD or SCARD_EJECT_CARD
"""
Observable.setChanged(self)
Observable.notifyObservers(self, CardConnectionEvent('connect'))
示例4: getAttrib
# 需要導入模塊: from smartcard.Observer import Observable [as 別名]
# 或者: from smartcard.Observer.Observable import setChanged [as 別名]
def getAttrib(self, attribId):
"""return the requested attribute
attribId: attribute id like SCARD_ATTR_VENDOR_NAME
"""
Observable.setChanged(self)
Observable.notifyObservers(self,
CardConnectionEvent(
'attrib',
[attribId]))
data = self.doGetAttrib(attribId)
if None != self.errorcheckingchain:
self.errorcheckingchain[0](data)
return data
示例5: control
# 需要導入模塊: from smartcard.Observer import Observable [as 別名]
# 或者: from smartcard.Observer.Observable import setChanged [as 別名]
def control(self, controlCode, bytes=[]):
"""Send a control command and buffer. Internally calls doControl()
class method and notify observers upon command/response events.
Subclasses must override the doControl() class method.
controlCode: command code
bytes: list of bytes to transmit
"""
Observable.setChanged(self)
Observable.notifyObservers(self, CardConnectionEvent('command', [controlCode, bytes]))
data = self.doControl(controlCode, bytes)
Observable.setChanged(self)
Observable.notifyObservers(self, CardConnectionEvent('response', data))
if None != self.errorcheckingchain:
self.errorcheckingchain[0](data)
return data
示例6: disconnect
# 需要導入模塊: from smartcard.Observer import Observable [as 別名]
# 或者: from smartcard.Observer.Observable import setChanged [as 別名]
def disconnect(self):
"""Disconnect from card."""
Observable.setChanged(self)
Observable.notifyObservers(self, CardConnectionEvent('disconnect'))