Unpack k bits block with a new created block

HI

I’m using the unpack k bits block (which is located at the output of a
vector source), before the new block that I’m trying to create. I would
want
to save all the bits at the output of the unpacked k bits block, in a
vector
(inside the block), so I can manipulate them individually. Is it
possible? I
thought each bit at the unpack_k_bit block’s output would be one of the
input_items in my block, Is this right?
I tried to do that defining a new integer type vector inside the block
and
save there all the input_items[i] and then use that vector in my code.
But
it is giving me this error: invalid conversion from ‘const void*’ to
‘int’
[-fpermissive]

I don’t know if I can do something like this.

Thank you very much.

David


View this message in context:
http://gnuradio.4.n7.nabble.com/unpack-k-bits-block-with-a-new-created-block-tp54234.html
Sent from the GnuRadio mailing list archive at Nabble.com.

Hey David,

you should be able to store your bits in a vector.
First of all, unpack_k_bits will yield bytes with the LSB carrying the
actual bit. All the others should be ‘0’.

Next, the error you get points in another direction. One of the
parameters ‘work’ gets is a vector with void pointers. It’s up to you
to deal with them correctly. Most block’s work functions start with
converting those void pointers to the actual data type they’re
supposed to deal with.
e.g. const float* in = (const float*) input_items[0];

in your case the compiler complains that you don’t do a conversion to
int. Be aware that ‘unpack_k_bits’ deals with char. Thus casting your
input buffer to int, will cause some unindented beaviour.

from ‘pack_k_bits’
const unsigned char *in = (const unsigned char *)input_items[0];
and then do something like
vec[i] = (int) in[i];
in a loop.

Cheers
Johannes

On 17.06.2015 05:09, dcardona wrote:

and then use that vector in my code. But it is giving me this

– View this message in context:

http://gnuradio.4.n7.nabble.com/unpack-k-bits-block-with-a-new-created-block-tp54234.html

Sent from the GnuRadio mailing list archive at Nabble.com.

Hello Johannes.

Thank you for answering me.
I did what told me and it didn’t give that error, but when i connect my
block’s output to a qtgui_time_sink, I don’t see anything.

I put the loop you told me below the “// Do <+signal processing+>” part,
Is
it there or in the constructor?

Thank you very much.

David


View this message in context:
http://gnuradio.4.n7.nabble.com/unpack-k-bits-block-with-a-new-created-block-tp54234p54255.html
Sent from the GnuRadio mailing list archive at Nabble.com.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey David,

I suggest you read the tutorial [1]. It explains the various parts of
a block in great detail.

[1] https://gnuradio.org/redmine/projects/gnuradio/wiki/OutOfTreeModules

On 18.06.2015 00:12, dcardona wrote:

David

– View this message in context:
http://gnuradio.4.n7.nabble.com/unpack-k-bits-block-with-a-new-created

  • -block-tp54234p54255.html

Sent from the GnuRadio mailing list archive at Nabble.com.

_______________________________________________ Discuss-gnuradio
mailing list [email protected]
Discuss-gnuradio Info Page

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQIcBAEBAgAGBQJVgnQYAAoJEO7fmkDsqywMHxQQALfS8Ancv2h6wr69EbzBV+Up
dw0ghWNgVpNirfyMD4ijIfi8O+bPtHO/Xf9Dpy7XvkI9poIyhkrHLDCFDyNVTk+a
KE20ewiH5sIXpJh+mBHxRDFLPIl2UQiy92i5Y0blnpHFv1iff0n/18gkbKHsizny
WKvkmOAdmeecC6/NmYzG/zuzHDHVaJovaHypvux/AMWmxGhnzh22MugKDQJZSMi2
XCtX8hJeEtSLzCx/RDfvtzsjLwMXIrMW6p4F+wCttXqorLOij0KY8ntMDFC6H13a
1nLd6FUH1+7bSnFqy8bb5XiZFmX5StXeDu0WfHGgs8DSlz6g1UTmFdXdylPMwNHv
2VWoLK03L8p4MYiYkqwP9Z3tDOyMH285MQo7DFywuML1R/RaGB1AangaeXDnx8V2
L4K1qzU7moJrjsUobIK74LA/pJFpp3WyaSrSFR7mCkN24Uq2xDjauGbm4Ek5j5Jd
/EKuP0nBjMUyNQhZI0qdnfEd8Q6HEri7mIIyancBSJRbgCllQ2svMnTr6xxesVuF
uRH+r4A5W0rDK3PDEeWFz+dRmtdWvtMoVLnaRg/S+VwAYsgpClLizXw16p6DLeaP
HkMZydbTrAc4dF1VnaNxuN4dYuf378CitMfOYsdNY2JgQ08KEDei86y5aykctS28
w4rOIO1A+UgLQcZM0Evm
=eBZl
-----END PGP SIGNATURE-----