I'm attempting to demonstrate very, very basic duplex communication between two USRP N210s via time division duplexing. Essentially, I want to have one USRP receiving first, and the other transmitting first. When the receiving USRP detects the end of the message, it starts transmitting its own message. When the transmitting USRP is done sending its short message it will start receiving. Each USRP will fall back to receiving when it's not transmitting. They will only transmit their message when they've received and detected the end of a transmitted message.
Using Python, I'm able to transmit short messages from one USRP and receive on another, saving into a file. I'm having trouble however converting this into duplex communication. I've started by replacing the file sink with a message sink and message queue. When there's a message in the queue, the code invokes a callback. In this callback I'm then printing the message to the console and switching to transmission. However, I'm having two problems:
1. When the callback is invoked in the receiver the transmitter hasn't necessarily finished sending all of its data. On the receiving end how can I know if a message is complete? I've seen some information about checking for the message type (either 1 or 0). However, how can I send this message type from the transmitter? Something like gr.message(1)? What is that actually doing?
2. I'm doing some custom frame synchronization with Barker sequences so I need to append these sequences to the beginning of my messages (Strings). Normally I would simply convert everything to 1s and 0s, but I'm not clear on what message functions I can use which accept a list of bits. I've tried gr.message but that didn't work or maybe I just need to convert my data type? I tried to make gr.message_from_string work by padding my Barker sequence to make it two character lengths, but I'd really prefer just to send a message consisting of the individual bits.
Any thoughts would be greatly appreciated!