Categories: Symbian C++ | S60 | Security | Platform Security | How To | Code Examples
This page was last modified 17:32, 23 June 2008.
How to use HAL attributes in pkg file
From Forum Nokia Wiki
If we want to control the installation of files at the install time we can use the conditional blocks in Pkg file. Attributes for comparison are defined in HALData::TAttribute. These attributes correspond to properties of the device's hardware.
Following is the usage and implementation of these attributes.
Contents |
MANUFACTURER
This correspond to the UIDs for a defined set of manufacturers.
If we want to install a file for a Nokia phone and another file for other manufacturer phone then you can use the following code snippet in pkg file.
IF (MANUFACTURER =0x00000002) ; If the device is Nokia , then install the following file "\epoc32\release\armv5\urel\InsPgm.exe" -"!:\sys\bin\InsPgm.exe" ELSE “OnlyNokia.txt”- “!:\OnlyNokia.txt” ,FT,TEENDIF
The manufacturer uids can be determined from the following enum- TManufacturer
enum TManufacturer // UID for manufacturer
{
EManufacturer_Ericsson=0x00000000,
EManufacturer_Motorola=0x00000001,
EManufacturer_Nokia=0x00000002,
EManufacturer_Panasonic=0x00000003,
EManufacturer_Psion=0x00000004,
EManufacturer_Intel=0x00000005,
EManufacturer_Cogent=0x00000006,
EManufacturer_Cirrus=0x00000007,
EManufacturer_Linkup=0x00000008,
EManufacturer_TexasInstruments=0x00000009,
};
MANUFACTURERSOFTWAREBUILD
This is device specific software version number. This is as defined by the device manufacturer
Ex.
IF (MANUFACTURERSOFTWAREBUILD = 256) ; If the device has software build is 256 , then install this file "\epoc32\release\armv5\urel\InsPgm.exe" -"!:\sys\bin\InsPgm.exe" ELSE ; Otherwise install some other file ENDIF
MACHINEUID
This is the device specific UID, It is unique to the class/model of device.
IF (MachineUID=0x20000600) OR (MachineUID=0x2000060B) ; If the device is Nokia N93 or N95, then install these files "\epoc32\release\armv5\urel\InsPgm.exe" -"!:\sys\bin\InsPgm.exe" ELSE ; Otherwise install any files for other devices "\epoc32\release\armv5\urel\InsPgm1.exe" -"!:\sys\bin\InsPgm1.exe" ENDIF
DEVICEFAMILY
The Symbian OS specified device family identifier.
IF (DEVICEFAMILY =0) ; If we want to install only in crstal device family "\epoc32\release\armv5\urel\InsPgm.exe" -"!:\sys\bin\InsPgm.exe" ELSE ; Otherwise install any files in this block. "\epoc32\release\armv5\urel\InsPgm1.exe" -"!:\sys\bin\InsPgm1.exe" ENDIF
The device family can be determined from the following enum- TDeviceFamily
enum TDeviceFamily
{
EDeviceFamily_Crystal,
EDeviceFamily_Pearl,
EDeviceFamily_Quartz,
};
CPU
The CPU architecture used by this device. The values are enumerated by TCPU.
IF (CPU =0) ; If we want to install only in ARM device "\epoc32\release\armv5\urel\InsPgm.exe" -"!:\sys\bin\InsPgm.exe" ELSE ; Otherwise install any files in this block. “NoARMCPU.txt”- “!:\NoARMCPU.txt” ,FT,TE ENDIF
The CPU can be determined from the following enum
enum TCPU
{
ECPU_ARM,
ECPU_MCORE,
ECPU_X86,
};
CPUABI
This is the default ABI used by CPU for user applications.
IF (CPUABI =0) ; If we want to install only in ARM4 default ABI device "\epoc32\release\armv5\urel\InsPgm.exe" -"!:\sys\bin\InsPgm.exe" ELSE ; Otherwise install any files in this block. "\epoc32\release\thumb\urel\InsPgm.exe" -"!:\sys\bin\InsPgm.exe" ENDIF
The CPU ABI can be determined from the following enum
enum TCPUABI
{
ECPUABI_ARM4,
ECPUABI_ARMI,
ECPUABI_THUMB,
ECPUABI_MCORE,
ECPUABI_MSVC,
ECPUABI_ARM5T,
ECPUABI_X86,
};
CPUSPEED=
The processor speed in KHz. CPU clock speed/1024: eg 36864=36MHz
IF (CPUSpeed>=36) ; if we want to install in the device with CPU speed more than 36 Mhz "\epoc32\release\armv5\urel\InsPgm.exe" -"!:\sys\bin\InsPgm.exe" ELSE "Notenoughspeed.txt"-"",FT,TE ENDIF
MEMORYRAM
The total system RAM, in bytes.
IF (MemoryRAM>=0x800000) ; if we want to install in the device with RAM size more than 0x800000 "\epoc32\release\armv5\urel\InsPgm.exe" -"!:\sys\bin\InsPgm.exe" ELSE “NotenoughRAMMemory.txt”- “!:\NotenoughRAMMemory.txt” ,FT,TE ENDIF
POWERBACKUP
It Indicates whether a backup power supply is available.
Possible Values:
0 = the device does not support (or need) a backup battery source;
1 = a backup batter source is present.
IF (PowerBackup) ; If the device has backup battery source then install files in this block. "\epoc32\release\armv5\urel\InsPgm.exe" -"!:\sys\bin\InsPgm.exe" ELSE ; Otherwise install files in this block. "\epoc32\release\thumb\urel\InsPgm.exe" -"!:\sys\bin\InsPgm.exe" ENDIF
DISPLAYXPIXELS and DISPLAYYPIXELS
Resolution in pixels
IF(DISPLAYXPIXELS<=240) AND (DISPLAYYPIXELS<=320) ; If the device supports 240x320 resolution then install files in this block "\epoc32\release\armv5\urel\mygame.exe" -"!:\sys\bin\mygame.exe" ELSE "display.txt"-"",FT,TE ;Display it to the user that its not supported and act accordingly. ENDIF
DISPLAYXTWIPS and DISPLAYYTWIPS
Resolution in Twips
IF(DISPLAYXTWIPS<=2245) AND (DISPLAYXTWIPS<=2993) ;If the device supports 2245x2993 twip resolution then install files in this block "\epoc32\release\armv5\urel\mygame.exe" -"!:\sys\bin\mygame.exe" ELSE ;Display it to the user that its not supported and act accordingly. "display.txt"-"",FT,TE ENDIF
DISPLAYCOLORS
Number of colours that are supported by the device
IF(DisplayColors>=3000) ;If the device can display more than 3000 hues (colors or shades of grey) displayable on ; the screen then install files in this block "\epoc32\release\armv5\urel\mygame.exe" -"!:\sys\bin\mygame.exe" ELSE ;Display it to the user that its not supported and act accordingly. "display.txt"-"",FT,TE ENDIF
PEN
Indicates whether a pen or digitizer is available for input.
Expected values:
0 = a pen/digitizer is not available for input.
1 = a pen/digitizeris present.
IF(PEN) ;if pen is present intall files into this block "\epoc32\release\armv5\urel\myapp.exe" -"!:\sys\bin\myapp.exe" ELSE ; Otherwise install other file in this block. "\epoc32\release\armv5\urel\yourapp.exe" -"!:\sys\bin\yourapp.exe" ENDIF
BACKLIGHT
Indicates whether there is a backlight on the device.
Epected values:
0 = there is no screen backlight.
1 = a screen backlight is present.
IF(BACKLIGHT) ;if backlight is present install files into this block "\epoc32\release\armv5\urel\myapp.exe" -"!:\sys\bin\myapp.exe" ELSE ;Display it to the user that its not supported and act accordingly. "display.txt"-"",FT,TE ENDIF
Note:.txt file will not be copied to the target.
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| a question about makesis | billqu | General Symbian C++ | 4 | 2004-10-08 10:16 |
| Including C++ files outside the project tree | nkonstas | Carbide.c++ and CodeWarrior Tools | 4 | 2007-05-25 00:07 |
| Dont know what to name this thread! | amerzannouneh | Symbian Signing, Certification and Security | 9 | 2008-08-17 22:33 |
| how to create .sis file in Carbide..... | pritesh_j2me | Carbide.c++ and CodeWarrior Tools | 9 | 2008-05-16 08:25 |
| Autouninstall after closing application? | kayem | General Symbian C++ | 10 | 2008-04-22 10:26 |
