[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss-gnuradio] What happens when delete_head() is executed?
From: |
udadidd |
Subject: |
[Discuss-gnuradio] What happens when delete_head() is executed? |
Date: |
Wed, 29 Jul 2009 13:18:01 -0700 (PDT) |
Hi
1) i used the same code as benchmark_tx.py to make packets and saved this in
a file
2) Now i try to read this file back and unmake packets. But the code doesnt
do any thing at msg.delete_head().
My code is as follows:
class my_top_block(gr.top_block):
def __init__(self,rx_callback):
gr.top_block.__init__(self)
access_code=functions.conv_packed_binary_string_to_1_0_string('\xAC\xDD\xA4\xE2\xF2\x8C\x20\xFC')
threshold = 1
u = gr.file_source(gr.sizeof_char,"packetizer.data")
correlator = gr.correlate_access_code_bb(access_code, threshold)
rcvd_pktq = gr.msg_queue()
framer_sink = gr.framer_sink_1(rcvd_pktq)
self.connect(u,correlator,framer_sink)
watcher = _queue_watcher_thread(rcvd_pktq,rx_callback)
class _queue_watcher_thread(_threading.Thread):
def __init__(self, rcvd_pktq, rx_callback):
_threading.Thread.__init__(self)
self.setDaemon(1)
self.rcvd_pktq = rcvd_pktq
self.rx_callback = rx_callback
self.keep_running = True
self.start()
def run(self):
while self.keep_running:
msg = self.rcvd_pktq.delete_head()
ok,payload = packet_utils.unmake_packet(self.rcvd_pktq, 0)
print "payload",payload
if self.callback:
self.rx_callback(ok, payload)
break
def main():
print "in 'def main()' now"
def rx_callback(ok, payload):
print "in the def of rx_callback "
print payload
(pktno,) = struct.unpack('!H', payload[0:2])
print ok
r = gr.enable_realtime_scheduling()
if r != gr.RT_OK:
print "Warning: Failed to enable realtime scheduling."
tb = my_top_block(rx_callback)
tb.start() # start flow graph
tb.wait() # wait for it to finish
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
pass
--
View this message in context:
http://www.nabble.com/Packet-mod-demod-race-condition--tp12660275p24726750.html
Sent from the GnuRadio mailing list archive at Nabble.com.
- [Discuss-gnuradio] blks2.mod, blks2.demod, udadidd, 2009/07/13
- Re: [Discuss-gnuradio] blks2.mod, blks2.demod, Mir M. Ali, 2009/07/13
- Re: [Discuss-gnuradio] blks2.mod, blks2.demod, Eric Blossom, 2009/07/14
- Re: [Discuss-gnuradio] blks2.mod, blks2.demod, udadidd, 2009/07/18
- [Discuss-gnuradio] Packetizer and Depacketizer, udadidd, 2009/07/18
- [Discuss-gnuradio] What happens when delete_head() is executed?,
udadidd <=
- [Discuss-gnuradio] What happens when delete_head() is executed?, udadidd, 2009/07/29
- Re: [Discuss-gnuradio] What happens when delete_head() is executed?, Mattias Kjellsson, 2009/07/30
- Re: [Discuss-gnuradio] What happens when delete_head() is executed?, udadidd, 2009/07/30
- Re: [Discuss-gnuradio] What happens when delete_head() is executed?, Eric Blossom, 2009/07/30