Led

Since: BlackBerry 10.0.0

#include <bb/device/Led>

To link against this class, add the following line to your .pro file: LIBS += -lbbdevice

The Led class represents requests for flashing the LED present on the device.

Permissions:

This class requires that the application be granted the access_led_control capability.


Overview

Properties Index

Public Functions Index

Led (QObject *parent=0)
Led (bb::device::LedColor::Type ledColor, QObject *parent=0)
virtual ~Led ()
bb::device::LedColor::Typecolor () const
boolisActive () const
intremainingFlashCount () const
voidresetColor ()
voidsetColor (bb::device::LedColor::Type ledColor)

Public Slots Index

voidcancel ()
voidflash ()
voidflash (int count)

Signals Index

voidactiveChanged (bool value)
voidcolorChanged (bb::device::LedColor::Type value)
voidremainingFlashCountChanged (int value)

Properties

bool active[read-only]

Retrieve the state of the Led instance.

Since:

BlackBerry 10.0.0

bb::device::LedColor::Type color

Retrieve the color of the Led instance.

Since:

BlackBerry 10.0.0

int remainingFlashCount[read-only]

Retrieve the number of flashes remaining for the Led instance.

Since:

BlackBerry 10.0.0

Public Functions

Led (

Construct an Led instance with default options, i.e., with color as bb::device::LedColor::Red.

The Led instance is not activated automatically. Invoke flash() to activate the Led instance.

Parameters
parent

If not 0, the supplied parent is responsible for deleting this instance.

Permissions:

This application must have the access_led_control permission to use this class.

Since:

BlackBerry 10.0.0

Led (

Construct an Led instance with a custom color.

The Led instance is not activated automatically. Invoke flash() to activate the Led instance.

Parameters
ledColor

The color of the LED request.

parent

The parent of this instance.

Permissions:

This application must have the access_led_control permission to use this class.

Since:

BlackBerry 10.0.0

virtual~Led ()

Destructor.

This will cancel any pending requests.

Since:

BlackBerry 10.0.0

bb::device::LedColor::Type color ()

Retrieve the color of the Led instance.

If Led::active property is true, this represents the color that is flashing.

Return:

Returns the color of this instance.

Since:

BlackBerry 10.0.0

bool isActive ()

Retrieve the state of the Led instance.

Represents the state of the requests initiated using this instance.

Return:

Returns true if a flash request is pending.

Since:

BlackBerry 10.0.0

int remainingFlashCount ()

Retrieve the number of flashes remaining for the Led instance.

If the Led::active property is false, 0 is returned. If the Led::active property is true, this represents the remaining number of times that the active color is flashed. If the Led instance is set to flash indefinitely, a value of -1 is returned.

Return:

Returns the number of flashes remaining for this Led instance.

Since:

BlackBerry 10.0.0

void resetColor ()

Reset the color of this instance.

The default value is bb::device::LedColor::Red.

Since:

BlackBerry 10.0.0

void setColor (

Set the color of the Led instance.

If the Led::active property is true and ledColor is not LedColor::None, then the last request will continue with the new color without resetting the Led::remainingFlashCount property. If ledColor is LedColor::None, then the request is canceled, emitting the activeChanged() signal instead of the colorChanged() signal.

Parameters
ledColor

The new color for this instance.

Since:

BlackBerry 10.0.0

Public Slots

void cancel ()

Cancel any active requests that were made using flash().

The Led::active property is set to false and any requests to flash the LED that were made outside of this instance are not canceled.

Since:

BlackBerry 10.0.0

void flash ()

Requests that the LED is flashed indefinitely with the color returned by color().

The Led::active property is set to true.

Note:

Any existing requests are canceled.

,

If the Led::color property is LedColor::None, then no action is taken.

Since:

BlackBerry 10.0.0

void flash (
  • intcount)

Requests that the LED is flashed the specified number of times with the color returned by color().

The Led::active property is set to true.

Note:

Any existing requests are canceled.

,

If the Led::color property is LedColor::None, then no action is taken.

Parameters
count

The number of times that the LED should be flashed. A negative number is treated as a request to flash indefinitely.

Since:

BlackBerry 10.0.0

Signals

void activeChanged (
  • boolvalue)

Emitted when the Led::active property changes.

Parameters
value

The new value for the Led::active property.

Since:

BlackBerry 10.0.0

void colorChanged (

Emitted when the Led::color property changes.

Parameters
value

The new value for the Led::color property.

Since:

BlackBerry 10.0.0

void remainingFlashCountChanged (
  • intvalue)

Emitted when the Led::remainingFlashCount property changes.

When the count reaches 0, the request is completed, and therefore the activeChanged() signal is emitted instead of this signal.

Note:

This signal is not emitted for indefinite flash requests.

Parameters
value

The new value for the Led::remainingFlashCount property.

Since:

BlackBerry 10.0.0

Last modified: 2014-03-13

comments powered by Disqus