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
Developer
Posts: 158
Registered: ‎01-11-2010
My Device: 9700 | 9900 | PlayBook | Dev Alpha
My Carrier: Many :)

Re: the basics of camera API and when to call camera_confing_flash / camera_config_videolight

Thanks!  I apreciate the offer.  As i understand it, you would be *the* guy to ask.

 

If i have any specific bugs with my code, i'll come back / start a new thread.

 

general questions:

 

1) can adjusting the camera flash / video light be done outside of the camera API?  I ask because i would like to use the flash as a *secondary* notification LED. I also have a few other application ideas that use the LED for 90% of the funcitonality and ther camera for only a tiny fraction of the functionality - about 10%.  Im wondering if i need to have the camera opened for the entire use of the app even if all i need is the flash LED.

 

2) when can i turn the video light on or off?  i must open the camera *and* start the camera, right?  Only once the camera is on can i actually set the configuration flags to turn the light on or off.

 

those are it for now.  Thanks for your time!

- - - - - - - - - -
BlackBerry Development Advisor
Posts: 668
Registered: ‎11-29-2011
My Device: developer
My Carrier: other

Re: the basics of camera API and when to call camera_confing_flash / camera_config_videolight


dtater wrote:

1) can adjusting the camera flash / video light be done outside of the camera API?  I ask because i would like to use the flash as a *secondary* notification LED. I also have a few other application ideas that use the LED for 90% of the funcitonality and ther camera for only a tiny fraction of the functionality - about 10%.  Im wondering if i need to have the camera opened for the entire use of the app even if all i need is the flash LED.


You can control the video LED without starting up the viewfinder.  You just need to open the camera via camera_open() and then call camera_config_videolight().

 


2) when can i turn the video light on or off?  i must open the camera *and* start the camera, right?  Only once the camera is on can i actually set the configuration flags to turn the light on or off.

Nope.  Don't need to turn camera on. Just the procedure mentioned above.  This should work in 10.0.6.  (I say "should" because I know we just fixed a bug in this area recently, but I believe it was ported to 10.0.6).

 

Cheers,

Sean

Developer
Posts: 158
Registered: ‎01-11-2010
My Device: 9700 | 9900 | PlayBook | Dev Alpha
My Carrier: Many :)

Re: the basics of camera API and when to call camera_confing_flash / camera_config_videolight

[ Edited ]

I have no idea what i was doing wrong, but your help + the HelloVideoCamera example has got me to a working point.

 

one more question: what's the difference between CAMERA_FLASH_OFF, CAMERA_FLASH_ON, and CAMERA_VIDEOLIGHT_OFF, CAMERA_VIDEOLIGHT_ON

 

 

I ask because this code

 

		if (camera_can_feature(mCameraHandle, CAMERA_FEATURE_VIDEOLIGHT)) {
			qDebug("light CAN BE oN");
		} else {
			qDebug("light CAN NOT BE ON");
		}

		if (camera_can_feature(mCameraHandle, CAMERA_FEATURE_FLASH)) {
			qDebug("FLASH light CAN BE oN");
		} else {
			qDebug("FLASH light CAN NOT BE ON");
		}

		if (camera_config_flash(mCameraHandle, CAMERA_FLASH_ON) == CAMERA_EOK) {
			qDebug("FLASH light is oN");
		} else {
			qDebug("FLASH was NOT TURNED ON.. attempting VIDEO LIGHT");

			if (camera_config_videolight(mCameraHandle, CAMERA_VIDEOLIGHT_ON)
					== CAMERA_EOK) {
				qDebug("VIDEO light is oN");
			}

		}

 

produces this output:

 

light CAN BE oN
FLASH light CAN BE oN
FLASH was NOT TURNED ON.. attempting VIDEO LIGHT
VIDEO light is oN

 

 

 so why are flash and video something that i *can* do but only video works?

 

Thanks!

 

 

edit:formatting

- - - - - - - - - -
BlackBerry Development Advisor
Posts: 668
Registered: ‎11-29-2011
My Device: developer
My Carrier: other

Re: the basics of camera API and when to call camera_confing_flash / camera_config_videolight

You can't use the flash manually.  It can only be fired when taking a picture.  It runs at a much higher current than the video light, so it is dangerous to expose that control for general use as the hardware can be damaged by misuse.

 

I think it's a bug that the flash is reported as available unless in photo mode.  I'll have to fix that Smiley Happy

 

Cheers,

Sean

Developer
Posts: 158
Registered: ‎01-11-2010
My Device: 9700 | 9900 | PlayBook | Dev Alpha
My Carrier: Many :)

Re: the basics of camera API and when to call camera_confing_flash / camera_config_videolight

thanks for the reply.  a bug makes sense.

 

do i need to file a bug report?

 

 

just strictly out of curiosity, hw much more current does the flash get compared to normal lighting operations?

 

 

- - - - - - - - - -
BlackBerry Development Advisor
Posts: 668
Registered: ‎11-29-2011
My Device: developer
My Carrier: other

Re: the basics of camera API and when to call camera_confing_flash / camera_config_videolight

No need to file a report -- I'm fixing it now while I'm in that area of the code.

 

The flash on Dev Alpha draws about 12x more current than video led.

 

Cheers,

Sean

Developer
Posts: 158
Registered: ‎01-11-2010
My Device: 9700 | 9900 | PlayBook | Dev Alpha
My Carrier: Many :)

Re: the basics of camera API and when to call camera_confing_flash / camera_config_videolight

[ Edited ]

I hate to bring up an old thread... but this question belongs here more than it does in it's own thread. is there a certain battery level threshold that prevents the camera LED from working?

 

A ask because I have not changed my code or re-loaded my app... yet i still have behavior that seems to be explained by the differeing battery percentage.

 

Yesterday (battery was somewhere in 80% range) the application was working perfectly. Tonight (battery is orange, 16%) the application does not work as it's supposed to.

 

camera_can_feature(myCam, CAMERA_FEATURE_VIDEOLIGHT) 

 

 

and

 

 

camera_config_videolight(myCam, CAMERA_VIDEOLIGHT_ON) 

 

 

both return success codes.

 

and yet, the led isint on. 

 

Thoughts?

- - - - - - - - - -
Developer
Posts: 158
Registered: ‎01-11-2010
My Device: 9700 | 9900 | PlayBook | Dev Alpha
My Carrier: Many :)

Re: the basics of camera API and when to call camera_confing_flash / camera_config_videolight

It looks like my initial suspicions were right.  i plugged in my DevAlpha and charged it up to 67%.  Application is working as expected.

 

 

This looks like a bug!

 

camera_can_feature(myCam, CAMERA_FEATURE_VIDEOLIGHT) 

 

returns true even when the system technically *cant*

- - - - - - - - - -
BlackBerry Development Advisor
Posts: 668
Registered: ‎11-29-2011
My Device: developer
My Carrier: other

Re: the basics of camera API and when to call camera_confing_flash / camera_config_videolight

I don't think we'll be changing the behaviour of the camera_can_feature() function.  It is meant to indicate whether a feature can be used based on the current operating mode of the camera (viewfinder mode, etc.).  It has no good way of taking into account the battery level. 

 

There is a camera_get_videolight_level() function, which may be able to report on the battery situation.  I am not 100% certain if that function can be called prior to turning on the LED though -- It is meant to report on the current LED level so that an app could potentially implement a percent bar.

 

That being said, I will raise an issue internally to look into why camera_config_videolight() was returning EOK when really it shouldn't have.

 

Cheers,

Sean

BlackBerry Development Advisor
Posts: 668
Registered: ‎11-29-2011
My Device: developer
My Carrier: other

Re: the basics of camera API and when to call camera_confing_flash / camera_config_videolight

I should also add that on Dev Alpha, the battery level tuning is not terribly accurate, so the 16% level may not be indicative of the actual battery level being taken into account by the LED driver hardware.

 

Also, I should point out that any time after turning on the LED, it may turn off without warning if battery level gets too low or thermal conditions dictate that it is overheating.  There is no indication that this has occurred, and it is recommended that the app just poll the camera_get_videolight_level() function periodically.

 

Cheers,

Sean