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 mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio