discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] USRP control thread in GR block - how do I pass a


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] USRP control thread in GR block - how do I pass a USRP sptr?
Date: Fri, 29 Jan 2016 09:13:42 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

Hi Sean,

it's been a while since I did that, but I think that "smart_ptr<A> cannot be casted to smart_ptr<B>" can be remedied using Boost's pointer_cast[1].

Hope that gives you a start.

Best regards,
Marcus

[1] http://www.boost.org/doc/libs/1_60_0/libs/smart_ptr/pointer_cast.html
On 01/28/2016 08:34 PM, Nowlan, Sean wrote:

I have a USRP with a GPSDO. I am working on a block that will poll a USRP for PPS changes in an attempt to adjust for clock offset between host and USRP. Assume I have explicitly set the USRP time-of-day correctly to UTC using PPS and a set_time_next_pps_call, and GPS is locked.

 

I would like to pass a USRP sink (or source) shared pointer to this block. It will have its own internal thread that will loop waiting for PPS edge transitions, polling with get_time_now, and then measuring offset between PC/system clock and USRP clock.

 

Following guidance from a mailing list thread [1], I attempted to pass a usrp_sink shared pointer as a basic_block_sptr and then dynamic_cast it in the block xtor. Here’s the error I get:

 

clock_manager_impl.cc: In constructor ‘gr::mymodule::clock_manager_impl::clock_manager_impl(gr::basic_block_sptr, double, const string&)’:

clock_manager_impl.cc:50:59: error: cannot dynamic_cast ‘usrp’ (of type ‘gr::basic_block_sptr {aka class boost::shared_ptr<gr::basic_block>}’) to type ‘gr::uhd::usrp_sink::sptr {aka class boost::shared_ptr<gr::uhd::usrp_sink>}’ (target is not pointer or reference)

         d_usrp(dynamic_cast<gr::uhd::usrp_sink::sptr>(usrp)),

 

Any advice on the best way to do this? Is my approach sane?

 

Thanks,

Sean



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


reply via email to

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