Accessing nasty elements of 'payload' in benchmark_rx.py

Hi all,

Here is the summary:

EXAMPLE FILE:Â Â Â Â benchmark_rx.py
FUNCTION:Â Â Â Â Â Â Â Â Â Â rx_callback(ok, payload)
ARGUMENT:Â Â Â Â Â Â Â Â payloadÂ
PROBLEM:Â Â Â Â Â Â Â Â Â Â Â Can any one please tell me how to access and assess
individual elements/entities/values of the argument ‘payload’ in the
function “rx_callback(ok, payload)” in benchmark_rx.py.
NEED:Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Need to calculate bit/byte-error rate and so need
to compare transmitted and received words.

It seems to be a binary-stream and I am transmitting a packet with just
0’s and 1’s.

I have tried writing payload to both, .txt and .bin files and output
contains wierd characters. (Ofcourse, writing .txt file required me use
repr() ).Â

I am done with trying decode it using utf-8, utf-16, latin-1 and ascii
encodings, but all in vain. None of these schemes can decode a packet
correctly if CRC is False. (Shows error that value is out of range)

payload.count(0) returns an error: “TypeError: expected a character
buffer object”.

Feeling sleepy now, wish I can get some answer by tomorrow. I guess
working-hours’s gonna start in Europe and already in Asia etc :). Any
help would be highly appreciated.

-Ahmed

It seems to be a binary-stream and I am transmitting a packet with just 0’s
and 1’s.

I have tried writing payload to both, .txt and .bin files and output
contains wierd characters. (Ofcourse, writing .txt file required me use
repr() ).

First of all, what you want done may have already been implemented,
look at the digital-bert examples in the trunk

Now, how are you sending the data? Benchmark_tx just sends packets
full of copies of the packet number, have you modified this behavior?

How are you writing the payload to a txt file? Typically for the
purpose of benchmark_rx the payload is stripped out of the packet by
the time it gets to the top level of the python file because all
benchmark_rx cares about is if the CRC is correct.

Look into the guts of the receive_path.py and pkt.py files and you
will see how the packets are demodulated. You can probably just
change the code after the de-whitener to check for the full BER.

Jason

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs