import zmq

from flandre import C
from flandre.utils.RfFrame import b2t

if __name__ == '__main__':
    context = zmq.Context()
    device_socket = context.socket(zmq.PULL)
    device_socket.connect(C.live_push_socket)
    last_ts = 0
    while True:
        buffer = device_socket.recv()
        ts, sequence_id, encoder, s = b2t(buffer)
        if last_ts == ts:
            print(ts)
        last_ts = ts
