discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Accessing the uhd_usrp object


From: M. Ranganathan
Subject: Re: [Discuss-gnuradio] Accessing the uhd_usrp object
Date: Thu, 14 Nov 2013 09:39:02 -0500

Marcus,

Thanks for your reply. What will the shared pointer be called. I see stuff like this in the code:

GR_SWIG_BLOCK_MAGIC2(uhd, usrp_source)
GR_SWIG_BLOCK_MAGIC2(uhd, usrp_sink)
GR_SWIG_BLOCK_MAGIC2(uhd, amsg_source)


Presumably, that generates a structure that is registered as a global pointer. So in my mac, I want something like

extern ....

At the risk of asking for too much help, can you give me some guidance or point me to a fragment of code somewhere that does this sort of thing.

Thanks,

Ranga



On Thu, Nov 14, 2013 at 4:06 AM, Marcus Müller <address@hidden> wrote:
Hi Ranga,

that's what pointers are for, after all. Just do it! Thanks to the make()-magic you basically always have a smart shared pointer instead of an block object (unless you really try to break the system ;) ).

Just a quick note though: MAC is usually timing-relevant. Timed commands might not work as you expect, so please be aware that calling set_command_time on your source might break functionality since there is no out-of-order execution.

Greetings,
Marcus


On 14.11.2013 01:26, M. Ranganathan wrote:
Hello all!

I want to write a block that can directly access the uhd_usrp_source. This block is a mac block hence it is up on the food chain and far away from uhd_usrp_source in terms of its processing function. What is a good way of passing it a handle to the usrp_source ?

I can think of some hacks (such as a static global pointer where the uhd_usrp_source C++ object registers itself) but it seems ugly to me to take that route. Is there a better way to access global objects from within a block implementation.

Thanks in advance for any help.

Regards,

Ranga

--
M. Ranganathan


_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio




--
M. Ranganathan

reply via email to

[Prev in Thread] Current Thread [Next in Thread]