Namespaces
Variants
Actions
(Redirected from Hardware Abstraction Layer)

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 (24 Jan 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.

Comments

Reviewer-approved.png
19 Sep
2009
Article Review by User:FireSwarog (20090919)

Hardware Abstraction Layer (HAL) - is an important feature that allows you to get important information about device in your programs.

This functionality allows you to create your own "Device Info" application. But it is necessary to note, that some devices retuirn incorrect HAL-information. Therefore, you must be very careful to use this feature.


This page was last modified on 24 January 2012, at 00:53.
136 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 2012 All rights reserved