分享
 
 
 

A few notes about the CommDb (use in Symbian OS)

王朝other·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

More and more applications have to use the phones connectivity. Sending some short messages (SMS) for licensing, transmit pictures using multimedia messages (MMS), manage emails (Pop3, IMAP and SMTP) or simply use a client socket for HTTP or your custom protocol over TCP/IP using GPRS, CSD or WCDMA(UMTS). This list is only a brief summary of functions where the OS will have to access an internal database for informations about how to handle the respective protocol stack. The database is called CommDB.

Like other themes you will find a lot of basic information about this “communications database” in your SDKs documentation - search for “Using CommDB”.

In my last symbian project I made some additional insights (Symbian OS versions 6.1, 7.0, 7.0s) which I want to share with you - any comments are welcome

. I won’t show much program code, because there are already many examples in the SDKs doc, the Symbian FAQ and some threads in the newsgroup. The article’s aim is to get you across the CommmDD-layout and the basically kinds to get access to it.

1. Basic termsThe CommDB is a file named cdbv2.dat for Symbian OS 6.1 (Series 60 v0.9, v1.0, v1.2) and cdbv3.dat for Symbian OS 7.0s/7.0 (Series 60 2.0 / UIQ 2.0, UIQ 2.1).

You will find this file twice on your phone:

in C:\system\data\ - The RAM-Version for storing the current data

in Z:\system\data\ - The ROM-Version. If the RAM-version cannot be found this file is copied to RAM. (Never checked this feature)

The file can be accessed through the communications database server (a layer over DBMS). This server gives you a logical access to an (extensible) database, existing of many “linked” tables. Each logical summary of information how to get connectivity access using a special protocol and/or bearer type is called Internet Access Point (IAP). Both Series 60 and UIQ offer a user interface to manage IAPs and alter the CommDB:

Each mobile network provider needs it’s own individual configuration. Therefore mostly the phones come from your provider with a subset of common IAPs, ready configured for SMS, WAP, WWW using different bearers like GSM, GPRS or GPRS. Users can add new access points manually by using the above dialogs or they make use of BIO messaging - a kind of system SMS from your provider to configure the phone.

As a developer you don’t really need to take account for selecting the right IAP for the required type of connection - the OS will prompt the user with a selection dialog. But if you want to use a special IAP for e.g. a dedicated WAP- or Intranet-Gateway you have to insert a new IAP and then select him. This can be done by direct altering the CommDB-Tables or if you developing for Series 60 by use of Nokia’s access-point-engine-library (ApEngine).

2. Nokia’s ApEngine (a general survey)This library encapsulates the CommDB-API and brings a few dialogs/views, which one can embed to the program.

There are a few classes which make programmers live easier. (Link against apengine.lib.)

Classname

Headerfile

Description (taken from SDK)

CApSelect

<apselect.h>

This class is used to help client’s access point selection. Selection can be tailored with specific filters, rules and sort order. Provides methods for setting and getting filters and sort order.

ApListItem

<aplistitem.h>

This class is used to hold the main information of an access point. It is used in CApSelect.

CApDatahandler

<apdatahandler.h>

Representation of the access point handler. Encapsulates a session with the CommsDB Provides a way to access the database and manipulate its data.

<!--[if !supportEmptyParas]-->

CApAccessPointItem

<apaccesspointitem.h>

<!--[if !supportEmptyParas]--> <!--[endif]-->

CApAccessPointItem is used to exchange data between engine and client. It holds the information for an access point including WAP, IAP, ISP (if present & applies). This class uses the same approach as CommDB to read and write data: it has functions for each data type implemented. To read or write the data, we have to know the data type and the enum name of the ’column’. The column values has the names of the database columns with the ’EAp’ prefix. The reason for this (not using the database column descriptors) is performance. It is much faster to compare enum values than literals.

CApUtils

<aputils.h>

Representation of access point utilities. Provides utilities to access points for clients. Encapsulates database handling. This class provides utility functions for clients that need some specific information or parameters from (maybe more than one) AP. It is provided for ease of use so clients do not have to work with CApDataHandler’s concept (one object-one Uid).

There are some additional information in the headerfiles. Have a look insight. Some headerfiles are missing in OS 7.0s. I copied them from 6.1 and it works for my needs (TX to Jan

.

Here are two short examples how to use it:

/*Ex1: Show a list of all IAPs (Series 60 only) */

CApSettingsHandler* settingsHandler = CApSettingsHandler::NewLC(

EFalse,

EApSettingsSelListIsListPane,

EApSettingsSelMenuNormal,

KEApIspTypeAll,

EApBearerTypeAll,

KEApSortNameAscending);

TUint32 originallyFocused(uid);

TUint32 selectedIap(uid);

// Show the dialog

settingsHandler->RunSettingsL(originallyFocused, selectedIap);

CleanupStack::PopAndDestroy(settingsHandler);

/*Ex2: Iterate over a list of IAPs (Series 60 only) */

CCommsDatabase* CommDb = CCommsDatabase::NewL(EDatabaseTypeIAP);

CleanupStack::PushL(CommDb);

CApSelect* ApSelect = CApSelect::NewLC(*CommDb, KEApIspTypeAll ,EApBearerTypeAll ,KEApSortUidAscending);

if (ApSelect->MoveToFirst())

{

do

{

TUint uid = ApSelect->Uid();

//put here your IAP stuff

}

while(ApSelect->MoveNext());

}

CleanupStack::PopAndDestroy(ApSelect);

CleanupStack::PopAndDestroy(CommDb);

When you use the ApEngine (or the Series 60 GUI) to add a new IAP, you always will find an entry in table WAP_ACCESS_POINT, even so if the IAP is not for a wap connection - it’s gateway will be set to "0.0.0.0"!

3. UiQ - missing access point engineUnfortunately you will not find a apengine.dll in UiQ’s SDK (nor at the device

). If you want to select or create an IAP you have to use the “raw” CommDB-API - see your SDKs documentation “How to access tables in the database”.

The SDKs documentation lists all necessary tables with short description of their content, but it’s obscure how they relate to each other. So I’ve created a CommDB-datamodel for Symbian OS 6.1, 7.0 and 7.0s. It’s not perfect

, but they will really help you to gain insight.

CommDB v2 - Symbian OS v6.1

CommDB v3 - Symbian v7.0

CommDB v3 - Symbian v7.0s

(cutout)

Legend: Each table and columns have a name(see <cdbcols.h>). E.g. table IAP has a column called COMMDB_ID - it’s the tables primary key (PK). The columns COMMDB_ID and COMMDB_NAME are “default” columns, which you will find nearly at every table. If there’s one or more foreign keys (IAP_SERVICE as FK2, FK3) then you can find this value - normally as primary key - in another table. This relation has as name, e.g. OUTGOING_GPRS_IAP_FK2. A choice have one or more foreign keys (FK2, FK3) to one or more tables. Which table to access is defined in IAP_SERVICE_TYPE (contains the name of the foreign table).

Some example code:

//Get all existing IAPs

CCommsDatabase* CommDb = CCommsDatabase::NewL(EDatabaseTypeIAP);

CleanupStack::PushL(CommDb);

CCommsDbTableView* tableIAP = CommDb->OpenTableLC(TPtrC(IAP));

if (tableIAP->GotoFirstRecord()==KErrNone)

{

do {

TUint32 uid(0);

tableIAP->ReadUintL(TPtrC(COMMDB_ID),uid);

...

tableIAP->ReadTextL(TPtrC(COMMDB_NAME),CommDBNamePtr);

...

}

while(tableIAP->GotoNextRecord()==KErrNone);

}

CleanupStack::PopAndDestroy(tableIAP);

CleanupStack::PopAndDestroy(CommDb);

4. Symbian ToolsThere are some tools available for editing and dumping the CommDB - CEDDUMP, CED, CommDb Editor - Read Symbians FAQ-1071 for more information.

That’s it.

All the best - happy coding

Tobias Stöger

<!--[if !supportEmptyParas]--> <!--[endif]-->

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有