CardConnectionObserver callback.

def update(self, cardconnection, ccevent):
        '''CardConnectionObserver callback.'''

        apduline = ""
        if 'connect' == ccevent.type:
            apduline += 'connecting to ' + cardconnection.getReader()

        elif 'disconnect' == ccevent.type:
            apduline += 'disconnecting from ' + cardconnection.getReader()

        elif 'command' == ccevent.type:
            apduline += '> ' + toHexString(ccevent.args[0])

        elif 'response' == ccevent.type:
            if [] == ccevent.args[0]:
                apduline += "< %-2X %-2X" % tuple(ccevent.args[-2:])
            else:
                apduline += "< " + toHexString(ccevent.args[0]) + \
                            "%-2X %-2X" % tuple(ccevent.args[-2:])

        self.apdutextctrl.AppendText(apduline + "\n")