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
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to