Add observer field to ZeroMQ sent data
Signed-off-by: Alfredos-Panagiotis Damkalis <fredy@fredy.gr>spacecruft
parent
87ac2f9dc9
commit
4aed383ed0
|
@ -276,7 +276,7 @@ class TelemetryViewSet( # pylint: disable=R0901
|
||||||
decode_current_frame.delay(norad_cat_id, serializer.instance.pk)
|
decode_current_frame.delay(norad_cat_id, serializer.instance.pk)
|
||||||
|
|
||||||
# Run task to publish the current frame via ZeroMQ
|
# Run task to publish the current frame via ZeroMQ
|
||||||
publish_current_frame.delay(norad_cat_id, timestamp, request.data.get('frame'))
|
publish_current_frame.delay(norad_cat_id, timestamp, request.data.get('frame'), observer)
|
||||||
|
|
||||||
return Response(status=status.HTTP_201_CREATED)
|
return Response(status=status.HTTP_201_CREATED)
|
||||||
|
|
||||||
|
|
|
@ -265,7 +265,7 @@ def decode_current_frame(norad_id, demoddata_id):
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def publish_current_frame(norad_id, timestamp, frame):
|
def publish_current_frame(norad_id, timestamp, frame, observer):
|
||||||
"""Task to publish a current frame for a satellite."""
|
"""Task to publish a current frame for a satellite."""
|
||||||
# Initialize ZeroMQ socket
|
# Initialize ZeroMQ socket
|
||||||
publisher = CONTEXT.socket(zmq.XPUB)
|
publisher = CONTEXT.socket(zmq.XPUB)
|
||||||
|
@ -281,9 +281,12 @@ def publish_current_frame(norad_id, timestamp, frame):
|
||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
publisher.send_multipart(
|
publisher.send_multipart(
|
||||||
[bytes(str(norad_id), 'utf-8'),
|
[
|
||||||
bytes(frame, 'utf-8'),
|
bytes(str(norad_id), 'utf-8'),
|
||||||
bytes(timestamp, 'utf-8')]
|
bytes(timestamp, 'utf-8'),
|
||||||
|
bytes(frame, 'utf-8'),
|
||||||
|
bytes(observer, 'utf-8')
|
||||||
|
]
|
||||||
)
|
)
|
||||||
finally:
|
finally:
|
||||||
publisher.close()
|
publisher.close()
|
||||||
|
|
Loading…
Reference in New Issue