User-side programs can get and set a number of system attributes about power using the HAL interface.
The base port must provide and register a HAL handler to handle these attributes.
The power attributes are in the EHalGroupPower HAL group. The handler provides a kernel-side implementation to deal with the user-side calls to HAL::Get() and HAL::Set() when one of the following parameters is passed:
A typical application will have a user side monitor that periodically calls HAL::Get(), passing HALData::EPowerBatteryStatus to get the charge level of the battery.
Typically, the handler is implemented as part of a DPowerHal derived object, which is created by the entry point of the base port power kernel extension. The object is, therefore, part of the power controller kernel extension.
The DPowerHal derived object constructor must register with the power manager by calling Register().
If there is some power-related data that can be accessed via the HAL component and that persists through power cycles (On/Off), it should be initialised here. Typically the TOnOffInfoV1 data member of the Variant-specific TActualMachineConfig (usually found in mconf.h file under the platform directory) contains some of that persistent data.
The handler itself is the function PowerHalFunction(), and must be fully implemented in the base port.
The kernel hooks up the handler to service the HAL functions at boot-time.
The power Hal functions that the Handler can handle are enumerated by TPowerHalFunction. Not all of these functions need to be handled. If not handled, the kernel returns KErrNotSupported when the HAL function is called with the relevant parameter. It is left to the base port to decide which functions are relevant.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.