[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Fwd: Re: USING SET/GET_GAIN UHD USRP FUNCTION
From: |
Marcus Müller |
Subject: |
Re: [Discuss-gnuradio] Fwd: Re: USING SET/GET_GAIN UHD USRP FUNCTION |
Date: |
Mon, 01 Sep 2014 15:50:20 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 |
Hi Simone,
use the make function; you can't directly instantiate a GNU Radio block
for safety reasons, so the correct way to get one is doing
block_name::sptr object_pointer = block_name::make(...);
object_pointer->method_name()
(-> is always a pointer dereference shortcut, ie.
pointer_to_object->member is usually just a short form of
(*pointer_to_object).member; you can never use -> on a non-pointer
object, ie. classname object; object->member is always wrong).
Also, it's always a good idea to include the compiler error, since that
usually shows us what goes wrong, so we don't have to guess :)
Greetings,
Marcus
On 01.09.2014 15:28, Simone Ciccia S210664 wrote:
>
> -------- Original Message --------
> Subject: Re: [Discuss-gnuradio] USING SET/GET_GAIN UHD USRP FUNCTION
> Date: Fri, 29 Aug 2014 11:33:03 +0200
> From: Simone Ciccia S210664 <address@hidden>
> To: Martin Braun <address@hidden>
>
> Hi,
> thank you for the answer.
> I have created my own gnuradio block and linked the header that contains
> set/get_gain function in the _impl.cc by means of (#include
> <gnuradio/uhd/usrp_source.h>).
> In the general work of _impl.cc I call directly these functions as
> set/get_gain(), but the compiler returns errors!
> Probably I'm forgetting to create the object that link this type of class
> in my code _impl.cc
>
> For example:
>
> usrp_source.h looks like this
>
> namespace gr {
> namespace uhd {
>
> class uhd_usrp_source;
>
> class GR_UHD_API usrp_source : virtual public sync_block
> {
> public:
> .................................
>
> and in my code _imple.cc I have defined the object now:
>
> usrp_source object;
> object->set_gain();
>
> Anyway, it does not work...
> Do you know what I missing ? Probably this definition is wrong!
>
> My best thanks for the help...
> Simone
>
>
>
>
>
> On Thu, 28 Aug 2014 18:54:06 +0200, Martin Braun <address@hidden>
> wrote:
>> On 08/28/2014 01:34 PM, Simone Ciccia S210664 wrote:
>>> hi,
>>>
>>> I have some problem to use USRP UHD set/get_gain functions.
>>>
>>> In my code, _impl.cc I have included:
>>>
>>> #include <gnuradio/uhd/usrp_source.h>
>>>
>>> the header file in which
>>>
>>> virtual double get_gain() and virtual void set_gain()
>>>
>>> are defined!
>>>
>>> When I try to compile errors appear:
>>>
>>> error: ‘get_gain’ was not declared in this scope
>>> DB_gain =(float*) get_gain(0);
>> Are you calling this on your own block? Or on the USRP source?
>>
>> M
>>
>>
>>> error: ‘set_gain’ was not declared in this scope
>>> set_gain(g_z,0);
>>>
>>> Have I forgot some definitions for these functions?
>>>
>>> Thanks
>>> Simone
>>>
>>> _______________________________________________
>>> 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
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio