Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- """
- Subscriber for: https://pastebin.com/yECG4APX
- """
- import zmq
- import struct
- IQ_STRUCT = struct.Struct('>512h')
- def parse(data):
- iq = IQ_STRUCT.unpack(data)
- return iq[:256], iq[256:]
- def receive(address):
- with zmq.Context() as ctx:
- sock = ctx.socket(zmq.SUB)
- sock.connect(address)
- sock.subscribe(b'sensor')
- while True:
- topic, frame = sock.recv_multipart()
- i, q = parse(frame)
- print(i[:4], q[:4])
- if __name__ == '__main__':
- address = 'tcp://192.168.0.254:5050'
- receive(address)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement