Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Trusted Contributor
taylor-tomt
Posts: 231
Registered: ‎11-19-2010
My Device: Z10, Playbook
Accepted Solution

API bug for sensor_info_get_range_maximum ?

When I build the following:

 

sensor_info(SENSOR_TYPE_GYROSCOPE, &sensorinfo);
                mingyro=sensor_info_get_range_minimum(sensorinfo);
                maxgyro=sensor_info_get_range_maximum(sensorinfo);

 

a build error is reported

 

called object sensor_info_get_range_maximum is not a function

 

As far as I can tell it is defined the same as the sensor_info_get_range_minimum in sensor.h

 

the sensor_info_get_range_minimum works fine (well, it returns a value with no build error. I can't actually verify if the reported value means anything...).

 

Am I missing something or id this a bug?

Please use plain text.
Developer
mmd12
Posts: 117
Registered: ‎03-13-2012
My Device: Playbook, Dev Alpha C, Q10, Z10
My Carrier: T-Mobile

Re: API bug for sensor_info_get_range_maximum ?

I'm not sure why you're having a problem.

 

I used the following code:

 

float information;

unsigned int informationi;

sensor_info_t *info = NULL;

sensor_info(SENSOR_TYPE_GYROSCOPE, &info);

if (info){

   information = sensor_info_get_range_maximum(info);

   printf("Max_Range = %f\n", information);

   information = sensor_info_get_resolution(info);

   printf("Resolution = %f\n", information);

   information = sensor_info_get_range_minimum(info);

   printf("Min_Range = %f\n", information);

   informationi = sensor_info_get_delay_mininum(info);

   printf("Min_Delay = %d\n", informationi);

   informationi = sensor_info_get_delay_maximum(info);

   printf("Max_Delay = %d\n", informationi);

   informationi = sensor_info_get_delay_default(info);

   printf("Default_Delay = %d\n", informationi);

   information = sensor_info_get_power(info);

   printf("Power = %f\n", information);

   sensor_info_destroy(info);

   fflush(stdout);

}

 

and got the following results:

 

Max_Range = 1000.000000
Resolution = 0.000000
Min_Range = -1000.000000
Min_Delay = 10000
Max_Delay = 256000
Default_Delay = 20000
Power = -1.000000

 

The only problem I've encountered was the spelling of sensor_info_get_delay_mininum.

 

It would throw an error when I spelled minimum correctly.  I had to go to the header file to note the incorrect spelling and use it in my code.

 

BTW I'm using version 2.0.0 of the IDE.

 

Please use plain text.
Trusted Contributor
taylor-tomt
Posts: 231
Registered: ‎11-19-2010
My Device: Z10, Playbook

Re: API bug for sensor_info_get_range_maximum ?

I am running IDE 2.1.0 Build id: 201206041807

 

in sensor.h the declarations are:

 

BPS_API float sensor_info_get_range_minimum(sensor_info_t *info);


BPS_API float sensor_info_get_range_maximum(sensor_info_t *info);

 

I even cut/paste the name directly from sensor.h into my code and I still get the build error.

Please use plain text.
Developer
mmd12
Posts: 117
Registered: ‎03-13-2012
My Device: Playbook, Dev Alpha C, Q10, Z10
My Carrier: T-Mobile

Re: API bug for sensor_info_get_range_maximum ?

Very strange.  Do the other sensor_info functions compile and work?

Please use plain text.
Trusted Contributor
taylor-tomt
Posts: 231
Registered: ‎11-19-2010
My Device: Z10, Playbook

Re: API bug for sensor_info_get_range_maximum ?

Never mind.

 

I found a problem further back in the code that was redefining sensor_info_get_range_maximum.

 

My Bad.

Please use plain text.
BlackBerry Development Advisor (Retired)
aparco
Posts: 15
Registered: ‎10-11-2012
My Device: BlackBerry Z10
My Carrier: Rogers

Re: API bug for sensor_info_get_range_maximum ?

Hi mmd12,


Thanks for pointing out the typo, we are getting it fixed.

Please use plain text.
Developer
mmd12
Posts: 117
Registered: ‎03-13-2012
My Device: Playbook, Dev Alpha C, Q10, Z10
My Carrier: T-Mobile

Re: API bug for sensor_info_get_range_maximum ?

aparco,

 

So, you're going to make me change my code?

 

Well, OK.

 

:smileyhappy:

 

 

Please use plain text.
BlackBerry Development Advisor (Retired)
aparco
Posts: 15
Registered: ‎10-11-2012
My Device: BlackBerry Z10
My Carrier: Rogers

Re: API bug for sensor_info_get_range_maximum ?

mmd12, we would never do that :smileyhappy:  We will deprecate the function containing the typo and introduce a new function without the typo.  No code changes will be requied on your end.

Please use plain text.