SWILIB API (X75)    
Loading...
Searching...
No Matches
Settings

Detailed Description

Functions for working with phone settings.

Usage: #include <swilib.h> or #include <swilib/settings.h>

Data Structures

struct  REG_CLIENT
 Structure describing a registry client. More...
 

Typedefs

typedef void(* SettingsAE_ListenerProc) (int set, const char *entry, const char *keyword)
 
typedef struct REG_CLIENT REG_CLIENT
 

Enumerations

enum  SettingsID {
  SETTINGS_ID_FAK ,
  SETTINGS_ID_MYMENU ,
  SETTINGS_ID_VIBRALIGHT ,
  SETTINGS_ID_USERPROFILES ,
  SETTINGS_ID_SETUP ,
  SETTINGS_ID_DEVELOPER_MENU ,
  SETTINGS_ID_APIDC_SETUP ,
  SETTINGS_ID_MEDIAPLAYER ,
  SETTINGS_ID_SOUNDRECORDER ,
  SETTINGS_ID_FRDB ,
  SETTINGS_ID_AVATAR ,
  SETTINGS_ID_RADIO ,
  SETTINGS_ID_ORANGEHOMESCREEN
}
 IDs of the settings files. More...
 
enum  ProfileVolumeTypeID {
  PROFILE_VOLUME_TYPE_MAIN = 0x12 ,
  PROFILE_VOLUME_TYPE_ALARMCLOCK = 0xD ,
  PROFILE_VOLUME_TYPE_INCALL = 2
}
 Types of the profile volume. More...
 

Date

void SetDateTime (const TDate *date, const TTime *time)
 Update phone date and time.
 

Backlight

void SaveMaxIllumination (int level)
 Change maximum backlight level.
 
void SetIlluminationoffTimeout (int timeout)
 Change the backlight timeout (time to OFF).
 

SettingsAE

Functions for working with settings in .pd file format.

The ".pd" file format is a plain analog of the.ini files:

  • Settings are grouped by entries. This is identical to the [section] in .ini.
  • Each entry contains pairs of the keyword=value.
  • There is a global section (when the entry is an empty string).

For example, .ini analog:

keyword=value
[entry]
keyword=value

As a ".pd" file, it will look like this:

000022:T:keyword=value1
000028:T:entry.keyword=value2

These values can be accessed like this:

SettingsAE_Read_ws(ws, SETTINGS_ID_FAK, "", "keyword"); // value1
SettingsAE_Read_ws(ws, SETTINGS_ID_FAK, "entry", "keyword"); // value2
int SettingsAE_Read_ws(WSHDR *value, int set_id, char *entry, char *keyword)
Get the setting value (WSHDR).
@ SETTINGS_ID_FAK
fak.pd
Definition settings.h:27
int SettingsAE_GetFlag (int *value, int set_id, char *entry, char *keyword)
 Get the setting value (flag 1 or 0).
 
int SettingsAE_Read (int *value, int set_id, char *entry, char *keyword)
 Get the setting value (int).
 
char ** SettingsAE_GetEntryList (int set_id)
 Get a list of record IDs in a settings file.
 
int SettingsAE_Read_ws (WSHDR *value, int set_id, char *entry, char *keyword)
 Get the setting value (WSHDR).
 
int SettingsAE_Update (int value, int set_id, char *entry, char *keyword)
 Set the setting value (int).
 
int SettingsAE_Update_ws (WSHDR *value, int set_id, char *entry, char *keyword)
 Set the setting value (WSHDR).
 
int SettingsAE_SetFlag (int value, int set_id, char *entry, char *keyword)
 Set the setting value (flag 1 or 0).
 
int SettingsAE_RemoveEntry (int set_id, char *entry, int flag)
 Delete an entry and all its values.
 
void SettingsAE_RegisterListener (SettingsAE_ListenerProc proc, int set_id, const char *entry, const char *keyword)
 Register SettingsAE changes listener.
 
void SettingsAE_DeregisterListener (SettingsAE_ListenerProc proc, int set_id, const char *entry, const char *keyword)
 Unregister SettingsAE changes listener.
 

Registry

int Registry_GetHMIKeyID (char *key)
 Converting string key to the HMI key ID.
 
int Registry_GetResourcePathFromLevel (int hmi_key_id, int start_prio, int *prio, WSHDR *path)
 Get resource path from the registry.
 
int Registry_SetResourcePath (int hmi_key_id, int prio, const WSHDR *path)
 Set a path to the resource with priority.
 
int Registry_DeleteResourcePath (int hmi_key_id, int prio)
 Remove the path with given priority from the registry.
 
int Registry_RegClient (const REG_CLIENT *client)
 Register a client in the Registry system.
 
void Registry_UnregClient (int client_id)
 Unregister client in the Registry system.
 

PD

uint32_t ReadValueFromPDFile (uint32_t file_id, const char *key, char *value, uint32_t *size)
 Get the setting value from PD file.
 
uint32_t WriteValueToPDFile (uint32_t file_id, const char *key, const char *value, size_t size)
 Write the setting value to PD file.
 

Profiles

char GetProfile (void)
 Get ID of the active profile.
 
char * RamProfileNum (void)
 Get ID of the active profile.
 
char SetProfile (char profile_id)
 Change profile.
 
void getProfileNameByN (WSHDR *name, int profile_id, int unk)
 Get profile name by ID.
 
void getCurrentProfileName (WSHDR *name)
 Get current profile name.
 
int GetProfileVolumeSetting (int profile_id, int type)
 Get volume from the profile.
 

Ringtones

void Ringtones_SetState (uint8_t state)
 Set ringtones state.
 

Low-level functions for settings cache.

int pdcache_getval (char *value, int maxlen, int set_id, const char *entry, const char *keyword)
 Get raw setting value from cache.
 
int pdcache_setval (const char *value, int set_id, const char *entry, const char *keyword)
 Set raw setting value to cache.
 

Data Structure Documentation

◆ REG_CLIENT

struct REG_CLIENT

Typedef Documentation

◆ SettingsAE_ListenerProc

typedef void(* SettingsAE_ListenerProc) (int set, const char *entry, const char *keyword)

Definition at line 19 of file settings.h.

◆ REG_CLIENT

typedef struct REG_CLIENT REG_CLIENT

Definition at line 21 of file settings.h.

Enumeration Type Documentation

◆ SettingsID

enum SettingsID

IDs of the settings files.

Enumerator
SETTINGS_ID_FAK 

fak.pd

SETTINGS_ID_MYMENU 

mymenu.pd

SETTINGS_ID_VIBRALIGHT 

vibralight.pd

SETTINGS_ID_USERPROFILES 

userprofiles.pd

SETTINGS_ID_SETUP 

setup.pd

SETTINGS_ID_DEVELOPER_MENU 

developer_menu.pd

SETTINGS_ID_APIDC_SETUP 

apidc_setup.pd

SETTINGS_ID_MEDIAPLAYER 

mediaplayer.pd

SETTINGS_ID_SOUNDRECORDER 

soundrecorder.pd

SETTINGS_ID_FRDB 

frdb.pd

SETTINGS_ID_AVATAR 

avatar.pd

SETTINGS_ID_RADIO 

radio.pd

SETTINGS_ID_ORANGEHOMESCREEN 

orangehomescreen.pd

Definition at line 26 of file settings.h.

◆ ProfileVolumeTypeID

Types of the profile volume.

Enumerator
PROFILE_VOLUME_TYPE_MAIN 

Main phone volume.

PROFILE_VOLUME_TYPE_ALARMCLOCK 

AlarmClock volume.

PROFILE_VOLUME_TYPE_INCALL 

Incall volume.

Definition at line 45 of file settings.h.

Function Documentation

◆ SetDateTime()

void SetDateTime ( const TDate * date,
const TTime * time )

Update phone date and time.

Parameters
datenew date
timenew time

◆ SaveMaxIllumination()

void SaveMaxIllumination ( int level)

Change maximum backlight level.

This function updates DISPLAY_ILLUMINATION in setup.pd

Parameters
level0-100

◆ SetIlluminationoffTimeout()

void SetIlluminationoffTimeout ( int timeout)

Change the backlight timeout (time to OFF).

This function updates DISPLAY_ILLUMINATION_TIMEOUT in setup.pd

Parameters
timeouttime in seconds

◆ SettingsAE_GetFlag()

int SettingsAE_GetFlag ( int * value,
int set_id,
char * entry,
char * keyword )

Get the setting value (flag 1 or 0).

Parameters
valuepointer where the result will be written
set_idsettings file id (SettingsID)
entryentry id
keywordkey
Returns
0 or error

◆ SettingsAE_Read()

int SettingsAE_Read ( int * value,
int set_id,
char * entry,
char * keyword )

Get the setting value (int).

Parameters
valuepointer where the result will be written
set_idsettings file id (SettingsID)
entryentry id
keywordkey
Returns
0 or error

◆ SettingsAE_GetEntryList()

char ** SettingsAE_GetEntryList ( int set_id)

Get a list of record IDs in a settings file.

Parameters
set_idsettings file id (SettingsID)
Returns
pointer to the array of C strings

◆ SettingsAE_Read_ws()

int SettingsAE_Read_ws ( WSHDR * value,
int set_id,
char * entry,
char * keyword )

Get the setting value (WSHDR).

Parameters
valuepointer where the result will be written
set_idsettings file id (SettingsID)
entryentry id
keywordkey
Returns
0 or error

◆ SettingsAE_Update()

int SettingsAE_Update ( int value,
int set_id,
char * entry,
char * keyword )

Set the setting value (int).

Parameters
valuenew value
set_idsettings file id (SettingsID)
entryentry id
keywordkey
Returns
0 or error

◆ SettingsAE_Update_ws()

int SettingsAE_Update_ws ( WSHDR * value,
int set_id,
char * entry,
char * keyword )

Set the setting value (WSHDR).

Parameters
valuenew value
set_idsettings file id (SettingsID)
entryentry id
keywordkey
Returns
0 or error

◆ SettingsAE_SetFlag()

int SettingsAE_SetFlag ( int value,
int set_id,
char * entry,
char * keyword )

Set the setting value (flag 1 or 0).

Parameters
valuenew value
set_idsettings file id (SettingsID)
entryentry id
keywordkey
Returns
0 or error

◆ SettingsAE_RemoveEntry()

int SettingsAE_RemoveEntry ( int set_id,
char * entry,
int flag )

Delete an entry and all its values.

Parameters
set_idsettings file id (SettingsID)
entryentry id
flagunknown
Returns
0 or error

◆ SettingsAE_RegisterListener()

void SettingsAE_RegisterListener ( SettingsAE_ListenerProc proc,
int set_id,
const char * entry,
const char * keyword )

Register SettingsAE changes listener.

Parameters
proccallback
set_idsettings file id (SettingsID)
entryentry id
keywordkey

◆ SettingsAE_DeregisterListener()

void SettingsAE_DeregisterListener ( SettingsAE_ListenerProc proc,
int set_id,
const char * entry,
const char * keyword )

Unregister SettingsAE changes listener.

Parameters
proccallback
set_idsettings file id (SettingsID)
entryentry id
keywordkey

◆ Registry_GetHMIKeyID()

int Registry_GetHMIKeyID ( char * key)

Converting string key to the HMI key ID.

Parameters
keystring like "Wallpaper", "Screensaver", ...
Returns
id

◆ Registry_GetResourcePathFromLevel()

int Registry_GetResourcePathFromLevel ( int hmi_key_id,
int start_prio,
int * prio,
WSHDR * path )

Get resource path from the registry.

Parameters
hmi_key_idHMID key ID, see Registry_GetHMIKeyID
start_prioinitial priority for searching in registry
[out]prioactual priority of the founded resource path
[out]pathfounded resource path
Returns
0 or error

◆ Registry_SetResourcePath()

int Registry_SetResourcePath ( int hmi_key_id,
int prio,
const WSHDR * path )

Set a path to the resource with priority.

Parameters
hmi_key_idHMID key ID, see Registry_GetHMIKeyID
priopriority of this resource path
pathpath to the resource
Returns
0 or error

◆ Registry_DeleteResourcePath()

int Registry_DeleteResourcePath ( int hmi_key_id,
int prio )

Remove the path with given priority from the registry.

Parameters
hmi_key_idHMID key ID, see Registry_GetHMIKeyID
priopriority of resource path
Returns
0 or error

◆ Registry_RegClient()

int Registry_RegClient ( const REG_CLIENT * client)

Register a client in the Registry system.

After successful registration, the client will receive Registry events.

Parameters
clientpointer to a REG_CLIENT structure with registration data
Returns
client ID (non‑negative) on success, or error code (<0) on failure

◆ Registry_UnregClient()

void Registry_UnregClient ( int client_id)

Unregister client in the Registry system.

Parameters
client_idclient ID returned by Registry_RegClient

◆ ReadValueFromPDFile()

uint32_t ReadValueFromPDFile ( uint32_t file_id,
const char * key,
char * value,
uint32_t * size )

Get the setting value from PD file.

Parameters
file_idunique file id
keykeyword
[out]valuepointer where the result will be written
sizemax length, read size will be written in variable
Returns
0 or error

◆ WriteValueToPDFile()

uint32_t WriteValueToPDFile ( uint32_t file_id,
const char * key,
const char * value,
size_t size )

Write the setting value to PD file.

Parameters
file_idunique file id
keykeyword
valuenew value
sizewrite size

◆ GetProfile()

char GetProfile ( void )

Get ID of the active profile.

Returns
ID

◆ RamProfileNum()

char * RamProfileNum ( void )

Get ID of the active profile.

Returns
pointer to the ID
Deprecated
use GetProfile
Available on platforms:
X75, SG

◆ SetProfile()

char SetProfile ( char profile_id)

Change profile.

Parameters
profile_idprofile ID
Returns
0 or error

◆ getProfileNameByN()

void getProfileNameByN ( WSHDR * name,
int profile_id,
int unk )

Get profile name by ID.

Parameters
[out]nameprofile name
profile_idprofile ID
unkset to 0

◆ getCurrentProfileName()

void getCurrentProfileName ( WSHDR * name)

Get current profile name.

Parameters
[out]nameprofile name

◆ GetProfileVolumeSetting()

int GetProfileVolumeSetting ( int profile_id,
int type )

Get volume from the profile.

Parameters
profile_idprofile ID
typevolume type, see ProfileVolumeTypeID

◆ Ringtones_SetState()

void Ringtones_SetState ( uint8_t state)

Set ringtones state.

Parameters
state1 - on, 0 - off

◆ pdcache_getval()

int pdcache_getval ( char * value,
int maxlen,
int set_id,
const char * entry,
const char * keyword )

Get raw setting value from cache.

Parameters
valuepointer where the result will be written
maxlenmaximum size of the value buffer
set_idsettings file id (SettingsID)
entryentry id
keywordkey
Returns
0 or error

◆ pdcache_setval()

int pdcache_setval ( const char * value,
int set_id,
const char * entry,
const char * keyword )

Set raw setting value to cache.

Parameters
valueraw value
set_idsettings file id (SettingsID)
entryentry id
keywordkey
Returns
0 or error