bladeRF icon indicating copy to clipboard operation
bladeRF copied to clipboard

python tx and rx with metadata and get_timestamp

Open Algafix opened this issue 11 months ago • 5 comments

Hello!

I wanted to use the transmission and reception with metadata using the Python bindings and, while it was possible, it required to manually interact with the cffi and remember all the fields and flags. Also, the bladerf_get_timestamp function was missing.

Hence, I created an IntEnum to organize the Metadata Flags and a class for the Metadata object that follows the style of similar classes declared on the bindings.

For the sync_tx and sync_rx, it makes sense to be able to directly send a Metadata object instead of having to call object.struct on the method call. However, to make it backwards compatible, I have to check for the type. Also, the sync_rx has to return the Metadata object. If this approach is not correct and you prefer to maintain the previous approach or ditch the legacy version, let me know and I'll update the PR.

I've tested the functionality by implementing the C examples for TX with metadata and RX with metadata listed in the API documentation. The functionality is not exactly the same because the calls are blocking, so for example to test the TX metadata flags I had to launch multiple threads; but that is expected.

Thanks!

Algafix avatar Jul 18 '23 21:07 Algafix