Last active
December 6, 2019 22:34
-
-
Save eupharis/3d223c86ac7dcf637588a7078bf6d5dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from gnuradio import gr, blocks | |
def tlm_to_cosmos(list_of_temps): | |
tb = gr.top_block() | |
# sizeof_char == 1 byte in gnuradio land | |
nonblocking = False | |
tcp_snd = blocks.tcp_server_sink(gr.sizeof_char, '127.0.0.1', 8888, nonblocking) | |
# this bit simulates the dummy temp data "received" by gnuradio | |
repeat = False | |
tmp_src = blocks.vector_source_b(list_of_temps, repeat, 1) | |
# dump data from gnuradio to cosmos via tcp | |
tb.connect(tmp_src, tcp_snd) | |
tb.start() | |
tb.wait() | |
tb.stop() | |
if __name__ == '__main__': | |
print("Generating temps and sending to cosmos on 8888") | |
temps = [1, 2, 3, 4, 5] | |
tlm_to_cosmos(temps) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment