Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.
Symbian Hardware Abstraction Layer (HAL) APIs
The Symbian C++ Hardware Abstraction Layer APIs can be used to query system capabilities, share state data with other applications and register for notification of changes to system states.
These APIs are implemented in two main components:
- The Hardware Abstraction Layer (HAL)
- The System Agent Components
HAL provides a very simple to use APIs, which can query the attributes of the device, for example:
- Manufacturer: manufacturer of the device, hardware and software version number.
- Processor: processor architecture, ABI and processor speed.
- Memory: total RAM, free RAM and total ROM.
- Screen: screen dimension and display color.
- Keyboard information.
The class HAL (hal.h) derives from HALData (hal_data.h), which contains the definition of the enumeration TAttribute.
The API itself is very small, with only three functions, all provided by the class HAL:
static TInt Get(TAttribute anAttribute, TInt& aValue);
static TInt Set(TAttribute anAttribute, TInt& aValue);
static TInt GetAll(TInt& aNumEntries, SEntry*& aData);
Some examples for getting the device attributes
- Getting all the device attributes
- Getting one specific attribute, in this case total RAM in bytes.
Some examples for setting the device attributes
TInt err = HAL::Set(HAL::ECaseSwitchDisplayOn, 1);
If a field is not settable, then the return value from the call will be one of the standard system error codes, typically KErrNotSupported.