add recvm

This commit is contained in:
remilia 2025-05-15 22:14:08 +08:00
parent de83fafc0d
commit cebd85e39c
2 changed files with 25 additions and 3 deletions

View File

@ -238,6 +238,17 @@ def device_upload(name, file: TextIOWrapper):
dd.set_name_and_file_only(name, file.read()) dd.set_name_and_file_only(name, file.read())
@device.command('recvm')
def device_recvmonitor():
ctx = zmq.Context()
pull = ctx.socket(zmq.PULL)
pull.connect(C.live_push_socket)
while True:
b = pull.recv()
seq, encoder, host_ts, device_ts_low, device_ts_high, buffer = b2t(b)
print(seq, encoder, host_ts, device_ts_low, device_ts_high)
@device.command('recvplot') @device.command('recvplot')
def device_recvplot(): def device_recvplot():
ctx = zmq.Context() ctx = zmq.Context()

View File

@ -41,6 +41,17 @@ class RfFrameMemory(RfFrame):
def b2t(b: bytes): def b2t(b: bytes):
_, sequence_id, ts, encoder = struct.unpack_from('=IQQi', b) # _, seq, encoder, host_ts, driver_ts = struct.unpack_from('<iQiQQ', b)
buffer = b[4 + 8 + 8 + 4:] # _, seq, encoder, host_ts, driver_ts = struct.unpack_from('=QQiQi', b)
return ts, sequence_id, encoder, buffer # driver_ts, host_ts, encoder, seq = struct.unpack_from('QQiQ', b)
# buffer = b[4 + 8 + 8 + 8 + 4:]
# return seq, encoder, host_ts, driver_ts, buffer
magic, seq, encoder, host_ts, device_ts_low, device_ts_high = struct.unpack_from('iQiQII', b)
# bb = b[4 + 8 + 4 + 8:4 + 8 + 4 + 8 + 4]
# device_ts_low = struct.unpack('<I', bb)
# device_ts_low = b[4 + 8 + 4 + 8:4 + 8 + 4 + 8 + 4]
# print(bin(device_ts_low[0]),bin(device_ts_low[1]),bin(device_ts_low[2]),bin(device_ts_low[3]))
buffer = b[4 + 8 + 8 + 8 + 4:]
return seq, encoder, host_ts, device_ts_low, device_ts_high, buffer