def sendWrappedData(self, data): wrapper = Wrapper() d = Data() d.errcode = Data.ERROR_NOERROR d.blob = data.SerializeToString() wrapper.Data.MergeFrom(d) self.sendOneMsg(wrapper)
def getStatusMessage(): data = Data() data.errcode = Data.ERROR_NOERROR status = Status() status.code = Status.CARD_FOUND iWrapper = Wrapper() iWrapper.Status.MergeFrom(status) data.blob = iWrapper.SerializeToString() wrapper = Wrapper() wrapper.Data.MergeFrom(data) return wrapper
def getDummyDataMessage(): data = Data() data.errcode = Data.ERROR_NOERROR nfcdata = NFCData() nfcdata.data_source = NFCData.CARD nfcdata.data_bytes = urandom(8) iWrapper = Wrapper() iWrapper.NFCData.MergeFrom(nfcdata) data.blob = iWrapper.SerializeToString() wrapper = Wrapper() wrapper.Data.MergeFrom(data) return wrapper