def _decode(packets): decoded = [decode(x) for x in packets] if packets[0][0] == TOKEN_TYPE_PRE_ERR: start = decoded[1] else: start = decoded[0] interface = '' # TODO handshake = decoded[-1] if handshake['name'] in (TOKEN_TYPE_ACK, TOKEN_TYPE_NAK, TOKEN_TYPE_STALL, TOKEN_TYPE_NYET): status = handshake['name'] else: status = '' speed = '' # TODO (LS/FS/HS) payload = '' for item in decoded: if 'data' in item: payload += (' '.join('%02x' % (ord(x), ) for x in item['data'])) return (start['name'], (str(start['address']), str(start['endpoint']), interface, status, speed, payload), start['tic'], ((x['name'], ('', '', '', '', '', ' '.join( '%02x' % (ord(y), ) for y in x.get('data', ''))), x['tic'], ()) for x in decoded))
def _decode(packets): decoded = [decode(x) for x in packets] if packets[0][0] == TOKEN_TYPE_PRE_ERR: start = decoded[1] else: start = decoded[0] interface = '' # TODO handshake = decoded[-1] if handshake['name'] in (TOKEN_TYPE_ACK, TOKEN_TYPE_NAK, TOKEN_TYPE_STALL, TOKEN_TYPE_NYET): status = handshake['name'] else: status = '' speed = '' # TODO (LS/FS/HS) payload = '' for item in decoded: if 'data' in item: payload += (' '.join('%02x' % (ord(x), ) for x in item['data'])) return (start['name'], (str(start['address']), str( start['endpoint']), interface, status, speed, payload), start['tic'], ( (x['name'], ('', '', '', '', '', ' '.join('%02x' % (ord(y), ) for y in x.get('data', '')) ), x['tic'], ()) for x in decoded ))
def busEvent(tic, event_type, data): assert event_type == MESSAGE_TRANSACTION, event_type assert len(data) == 1, data addBaseTreeItem(self.bus_list, 'SOF %i' % (decode(data[0])['frame'], ), (), tic, ())