MTK-Phonebook PDF study

来源:互联网 发布:淘宝evisu官方旗舰店 编辑:程序博客网 时间:2024/05/16 07:57
 

1.Introduction

include files:

       PhoneBookDef.h

       PhoneBookGprot.h

       PhoneBookProt.h

       PhoneBookTypes.h

 

       PhoneBookMain.c

       PhoneBookOperateSingle.c

       PhoneBookSearch.c

       PhoneBookCallerGroup.c

       PhoneBookExtraNumbers.c

       PhoneBookSetting.c

       PhoneBookStubsToOthers.c

内容:

 

 

几个缩写:

ADN Abbreviated dialing number
FDN Fixed dialer number
BDN Barred dialing numbers
LND Last number dialed
SDN Service dialing number

 

 

数据结构:

1. PHB_OPTIONAL_IDS_STRUCT

存储在NVRAM中

Type    Short name           Long name

U16      pictureTagID            Picture ID

U16            ringToneID Ring      Tone ID

U8               callerGroupID          Caller Group ID

 

2. PHB_OPTIONAL_FIELDS_STRUCT

存储在NVRAM中

U8 HomeNumber[ ]        Home Number Array

U8 CompanyName[ ]     Company Name Array

U8 EmailAddress[ ]      Email Address Array

U8 OfficeNumber[ ]               Office Number Array

U8 FaxNumber[ ]            Fax Number Array

 

3. PHB_CALLER_GROUP_STRUCT

U8 groupName[ ]                          Group Name Array

MMI_ALERT_TYPE alertType          Alert Type

U16 ringToneID                            Ring Tone ID

U16 pictureTagID                         Picture ID

U16 LEDPatternId                       LED Pattern ID

U16 VideoID                                 Video ID

MMI_ALERT_TYPE                      alertType Alert Type

U8 is_modified                             Is modified

 

4. MMI_PHB_NAME_STRUCT

       电话簿中一个entry的name field.

U8 name_length      Number of Character

U8 name_dcs   Encoding Type

U8 name[ ]       Name Array

 

5. MMI_PHB_NUMBER_STRUCT

This structure is for number field of a BDN (Barred Dial Number), FDN (Fix dial number), MSISDN(Owner Number),

SDN(Service dial number), ECC(Emergency number.) (Note: ADN number is not store here)

U8 type              Number Type 129 – Default,145 – International, “+”

U8 length    Number of digits

U8 Number[ ]    Number Array

 

6. MMI_PHB_NUMBER_BCD_STRUCT

This structure is for number field of an entry in phonebook. Use BCD format to store number to save space.

注意红色部分与5中的不同。

U8 type              Number Type 129 – Default,145 – International, “+”

U8 length    Number of digits

U8 Number[ ]    Number Array

 

7. MMI_PHB_ENTRY_STRUCT

This structure is for number field of a BDN (Barred Dial Number), FDN (Fix dial number), MSISDN(Owner Number),

SDN(Service dial number), ECC(Emergency number.) (Note: ADN number is not store here)

U8 storage                                                  Storage Location

U8 type                                                        Entry Type

U16 index                                                    Index in List

U16 record_index                                      Index in storage Location

MMI_PHB_NUMBER_STRUCT tel         Number

MMI_PHB_NAME_STRUCT alpha_id    Name

 

8. MMI_PHB_ENTRY_BCD_STRUCT

This structure is used to store a phonebook entry in MMI. Remove unused field and use BCD numbers to save space

MMI_PHB_NUMBER_STRUCT tel         Number

MMI_PHB_NAME_STRUCT alpha_id    Name

U8 field                                                 Filed flag.                         Indicate if an entry  has the optional fiel

 

9. MMI_OWNER_NUMBER_STRUCT

This structure is for Owner number associating with Line ID

U8 name[ ]               Name Array

U8 number[ ]            Number Array

 

10.  MMI_PHB_LOOKUP_NODE_STRUCT

The structure is used to store numbers into a lookup table for fast number matching.

U16 index          Index in phonebook list.

U32 number             Number converts to integer.

 

11. MMI_SOS_NUMBER_STRUCT

This structure is for number field of an entry in phonebook emergency number.

U8 type              Number Type                  129 – Default,145 – International, “+”

U8 length          Number of digits

U8 number[ ]     Number Array

 

12. PHB_CM_INTERFACE

This structure is for Call Management. The program will fill related fields and return it to the Call Management program.

U8 Name[ ]                             Name Array

U8 Number[ ]                         Number Array

U8 name_dcs                 Name Encoding Type

U8 alertType                          Alert Type

U16 pictureId                         Picture ID

U16 ringtoneId                Ring Tone ID

U16 backlightId                     LED Pattern ID

U16 record_index                 Record index

U16 videoId                           Video ID

U16 video_record_index     Video record index

U8 dialInList                           Dial In List

 

13. MMI_PHB_VCARD_STRUCT

The structure stores personal vCard

S8 name [ ]                            Name Array

S8 number [ ]                          Number Array

S8 homeNumber [ ]               Home number array

S8 companyName[ ]             Company name array

S8 emailAddress[ ]                      Email address array

S8 officeNumber[ ]                Office number array

S8 faxNumber[ ]                    Fax number array

U16 pictureTagID                  Picture ID

U16 ringToneID                     Ring Tone ID

 

 

 

可见:开机之后,有2个消息:

MSG_ID_L4CPHB_STARTUP_REQ                (L4 begin to read)

MSG_ID_MMI_PHB_STARTUP_FINISH_IND              (L4 finish read)

 

 

全局变量:

1. g_phb_cntx          Phonebook global context structure

结构如下:

s

 

几个编译的控制宏:

 

 

 

 

消息及响应函数:

PRT_PHB_STARTUP_BEGIN_IND

mmi_phb_ind_startup_begin

 When L4 begins to read ADN data,it will send this indication to MMIand MMI will clear its variable andreload entries.

 

PRT_PHB_STARTUP_READ_IND

mmi_phb_ind_startup_

read L4 will send indication to MMI for ach ADN entries read at bootup time.

 

 

PRT_PHB_STARTUP_FINISH_IND

mmi_phb_ind_startup_finish

When L4 is ready, it will send this message to MMI. The message contains name length information and maximum record in formation in SIM and PHONE. When receive

this message, MMI will begin to load all entry from L4.

 

PRT_PHB_SET_ENTRY_REQ

1. mmi_phb_op_copy_move_dup_req

2. mmi_phb_op_add_entry_req

3. mmi_phb_op_copy_all_one_after_one_req

4. mmi_phb_op_edit_entry_req

5. mmi_phb_owner_number_erase_req

6. mmi_phb_owner_number_edit_req

This message is used to set an entry. It is widely used to add, copy and edit an entry.

 

PRT_PHB_SET_ENTRY_RSP

1. mmi_phb_op_copy_move_dup_rsp

2. mmi_phb_op_add_entry_rsp

3. mmi_phb_op_copy_all_one_after_one_rsp

4. mmi_phb_op_edit_entry_rsp

5. mmi_phb_owner_number_erase_rsp

6. mmi_phb_owner_number_edit_rsp

The response message of set entry. It will return success or error with code.

 

PRT_PHB_GET_ENTRY_BY_INDEX_REQ

1. mmi_phb_get_entry_by_index_req

2. mmi_phb_owner_number_get_entry_req

3. mmi_phb_sdn_get_entry_req

4. mmi_phb_sos_list_get_entry_req

5. PhbGetSpeedDialPhbIndexReq

The message request L4 to an entry by index. The index can be avalid index or 0xffff to get all entries.

The type can be phonebook, MSISDN, Service Number, SOS number, and Speed Dial.

 

PRT_PHB_GET_ENTRY_BY_INDEX_RSP

1. mmi_phb_get_entry_by_index_rsp

2. mmi_phb_owner_number_get_entry_rsp

3. mmi_phb_sdn_get_entry_rsp

4. mmi_phb_sos_list_get_entry_rsp

5. PhbGetSpeedDialPhbIndexRsp

The return list of get entry by index. The list contains maximum 15 entries.

 

PRT_PHB_DEL_ENTRY_REQ

1. mmi_phb_op_delete_entry_req

2. mmi_phb_op_delete_all_one_after_one_req

3. mmi_phb_op_move_req

The message can request L4 to delete entry. It can delete one entry, entry on SIM, entry on PHONE and all entries.

 

PRT_PHB_DEL_ENTRY_RSP

1. mmi_phb_op_delete_entry_rsp

2. mmi_phb_op_delete_all_one_after_one_rsp

3. mmi_phb_op_move_req

The return message of delete request. It will be success or fail with error code.

 

PRT_PHB_UPDATE_IND

PhoneBookUpdateIndication

An indication from L4 indicates that the L4 data has been changed. MMI has to do the correspond change.

 

PRT_PHB_GET_ENTRY_BY_NAME_REQ

Currently Not used.

Search the record by name. Input a name string. And the L4 will return the index as result.

 

PRT_PHB_GET_ENTRY_BY_NAME_RSP

Currently Not used. The response message contains index of search result.

 

PRT_PHB_GET_ALPHA_LIST_REQ

Currently Not used.

Request to get the index of first record begins with each alphabet. Total 26 indexes.

 

PRT_PHB_GET_ALPHA_LIST_RSP

Currently Not used.

The response message contains a array of index.

 

PRT_PHB_GET_PREFERRED_STORAGE_REQ

Currently Not used.

Request to get current preferred storage location.

 

PRT_PHB_GET_PREFERRED_STORAGE_RSP

Currently Not used.

Response message contains the current preferred storage location.

 

PRT_PHB_SET_PREFERRED_STORAGE_REQ

Currently Not used.

Request to set the current preferred storage location.

 

PRT_PHB_SET_PREFERRED_STORAGE_RSP

Currently Not used.

Response message contains the current preferred storage.

 

 

S

 

7 External Interface

 

 

8 Algorithms

对于每一个phone entry,都有5个基本的数据结构来存储。 对一个entry操作之后,一定要同步所有这些结构。

(1) Phonebook Name / Number List Structure

这2个是必须存储的。由于:other app, search functions and phonebook list view.

这个结构的数据在开机启动的时候一个接一个加载,并且存储顺序与物理存储顺序一致。

 

(2) Optional Field Structure (For Record in NVRAM Only)

Phonebook optional field contains the following fields:

1. Home Number

2. Office Number

3. Fax Number

4. Company Name

5. Email Address

保存在NVRAM中。当用户需要读取或修改这个结构时,根据record index每次从NVRAM中读取一个record。

 

(3) Optional ID Structure (For Record in NVRAM Only)

The phonebook optional ID contains the following ID:

1. Caller Group ID

2. Associate Ring Tone ID

3. Associate Picture ID

3*2=6。每个record需要6个字节,为提高存取效率,每85个结构为一组,即作为一个NVRAM record。因此,当需要读取的时候,要首先计算是存储在哪一个NVRAM RECORD中。

 

(4) Sorted Name Index

这是一个按照电话簿的姓名来排列的数组,数组的内容是:phonebook name/number中的存储位置。

也就是说:phonebook name/number结构中,并不是按照姓名的顺序来排列的(比如按字母顺序)。这个数组呢,是按照姓名来存储phonebook name/numbe中的存储位置。

 

(5) Sorted Number Index

因为每一个phone entry都可能包含很多的号码,如:移动电话,家庭电话,传真号码,办公室号码。为了quick access(快速查询),把所有的号码都排列起来并存储在这个数组中,这样查找起来就很快了。

存储时,是以“index, number”成对出现的,number是转换之后的号码,index是实际在phonebook data中的存储位置。

由于是存储在NVRAM中的,为节省时间,每次只读取10个entries。

9.1 Phonebook Initialization Procedure