Namespaces
Variants
Actions
Revision as of 10:13, 13 August 2012 by hamishwillee (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Symbian Hardware Abstraction Layer (HAL) APIs

Jump to: navigation, search

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.

Article Metadata

Article
Created: vvsnaresh (15 Apr 2007)
Last edited: hamishwillee (13 Aug 2012)

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.

Header Required:

#include <hal.h>

Library needed:

LIBRARY hal.lib

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

  1. Getting all the device attributes
    TInt numHalEntries;
     
    HAL::SEntry* halEntries;
     
    HAL::GetAll(numHalEntries, halEntries);
  2. Getting one specific attribute, in this case total RAM in bytes.
    TInt ram;
     
    HAL::Get(HAL::EMemoryRAM, ram);


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.

181 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved