def _onResponseRecv(self, xAsyncTCPClient, data, arg):
     uid = arg[0]
     if len(arg) == 2:
         trackingNbr, code, dataFormat, formatOpt, dataLen = arg[1]
         data = data.tobytes()
     else:
         hdr = IoTSocketStruct.DecodeResponseHdr(data.tobytes())
         trackingNbr, code, dataFormat, formatOpt, dataLen = hdr
         if dataLen > 0:
             self._recv(dataLen, self._onResponseRecv, (uid, hdr))
             return
         data = b''
     if uid:
         strUID = ('{%s}' % IoTSocketStruct.UIDFromBin128(uid))
     else:
         strUID = 'CENTRAL'
     self._router.Log('SESSION %s > RESPONSE TO %s RECEIVED (#%s)' %
                      (self._getSessionName(), strUID, trackingNbr))
     self._router.RouteResponse(
         fromUID=None if self._isCentral else self._uid,
         toUID=uid,
         trackingNbr=trackingNbr,
         code=code,
         dataFormat=dataFormat,
         formatOpt=formatOpt,
         data=data)
     self._waitDataTransmission()
 def _onResponseRecv(self, xAsyncTCPClient, data, arg) :
     uid = arg[0]
     if len(arg) == 2 :
         trackingNbr, code, dataFormat, formatOpt, dataLen = arg[1]
         data = data.tobytes()
     else :
         hdr = IoTSocketStruct.DecodeResponseHdr(data.tobytes())
         trackingNbr, code, dataFormat, formatOpt, dataLen = hdr
         if dataLen > 0 :
             self._recv(dataLen, self._onResponseRecv, (uid, hdr))
             return
         data = b''
     print('ON RESPONSE [%s] RECV (%s)' % (trackingNbr, code))
     self._waitDataTransmission()