def rx_stream(self, count=None, secs=None):
self.set_rx_mode()
start = time.time()
while count is None or count > 0:
buffer = self.device.read(0x82, 64)
if count is not None:
count -= 1
if secs is not None:
if time.time() >= start+secs:
break
pkt = BitArray(bytes=buffer)
metadata = pkt.unpack('uint:8, uint:8, uint:8, uint:8, uint:32,'
'int:8, int:8, int:8, uint:8')
metanames = ('pkt_type', 'status', 'channel', 'clkn_high',
'clk100ns', 'rssi_max', 'rssi_min', 'rss_avg',
'rssi_count')
yield dict(zip(metanames, metadata)), pkt[112:]
评论列表
文章目录