[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss-gnuradio] Continuos data transmission using messages ...
From: |
Kshitij Kumar Singh |
Subject: |
[Discuss-gnuradio] Continuos data transmission using messages ... |
Date: |
Tue, 26 Feb 2008 10:12:44 -0500 |
I am having a little problem working with messages. I want to transmit
an entire binary file using messages over and over again. Eg., msg1
transmits file x, msg2 again transmits file x
and so forth. My problem is that I'm unable to find a way to loop over
the file again and again. I tried using tx_voice.py as a reference but
was unable to find something suitable.
Setting repeat to true in gr.file_source won't help either. My goal is
to send this file using packets(which is why I started out with a
shorter script using messages) , so repeating or throttling ends up
making them strings longer than 4096.
Any help would be much appreciated. Thanks in advance.
Regards,
Kshitij
-----------------------------------------------------------------------------------------------------------------------------
from gnuradio import gr
from struct import unpack
queue = gr.msg_queue(10)
source = gr.file_source(gr.sizeof_char,'/home/kshitij/work/tp.dat',
False)
c2f = gr.char_to_float()
sink = gr.message_sink(gr.sizeof_float,queue,False)
tb = gr.top_block()
tb.connect(source,c2f,sink)
try:
tb.start()
msg = queue.delete_head()
payload = msg.to_string()
data = unpack('512f', payload)
print data, len(payload)
print msg.type(), msg.arg1(), msg.arg2(), msg.length()
except KeyboardInterrupt:
pass
---------------------------------------------------------------------------------------------------------------------------------
- [Discuss-gnuradio] Continuos data transmission using messages ...,
Kshitij Kumar Singh <=