public static interface PowerManaged.Group
Group
interface provides methods for registering for power state changes of peripherals belonging
to the same power management group. Peripherals currently open by an application belong to the same power management group when their power managements
are logically or physically dependent. For example, different GPIO pins may be controlled by the same GPIO controller
and their power managements are physically dependent: when a power state change is requested on one pin it results in
applications that have open any of the other pins to be notified of that power state change request, including
the requesting application. Registering for power state change request notifications on a power management group
rather than on indvidual peripherals belonging to that group allows for being notified only once for each
of the peripherals opened by the application belonging to that group. If an
application has registered for both notifications on an indvidual peripheral belonging to a group and for notifications
on that same group notifications will happen on all registered handlers. Notification on the group happens last.
Note that peripherals belonging to the same group may not necessarily be of the same type.Modifier and Type | Method and Description |
---|---|
boolean |
contains(PowerManaged peripheral)
Check whether the provided
Peripheral is part of this group. |
void |
setPowerSavingHandler(PowerSavingHandler handler)
Registers a
PowerSavingHandler instance to get asynchronously notified when the power management
facility is about to change the power state of this group, hence allowing the application to veto the power
state change. |
void setPowerSavingHandler(PowerSavingHandler handler) throws java.io.IOException, ClosedPeripheralException
PowerSavingHandler
instance to get asynchronously notified when the power management
facility is about to change the power state of this group, hence allowing the application to veto the power
state change.
If handler
is null
then the previously registered PowerSavingHandler
is unregistered.handler
- the PowerSavingHandler
instance to be notified when a power state change is requested
for thhis group.java.lang.IllegalStateException
- if handler
is not null
and a PowerSavingHandler
is
already registered.java.lang.SecurityException
- if the caller does not have the required permission.ClosedPeripheralException
- if all the peripherals belonging to this group have been closed.java.io.IOException
- if some other I/O error occurs.boolean contains(PowerManaged peripheral) throws java.io.IOException, ClosedPeripheralException
Peripheral
is part of this group. To be part of a group
the Peripheral
must be open. As soon as a Peripheral
is closed it is removed
from the group.peripheral
- the peripheral to be checked.true
if the provided Peripheral
is part of this group; false
otherwise.java.lang.NullPointerException
- if peripheral
is null
.java.lang.SecurityException
- if the caller does not have the required permission.ClosedPeripheralException
- if all the peripherals belonging to this group have been closed.java.io.IOException
- if some other I/O error occurs.Copyright © 2012, 2013, Oracle and/or its affiliates. All rights reserved.
Legal Notices