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

原创 2004年12月29日 13:45:00

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 sourire.png. 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 terms

The 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:

s60_iap.jpg uiq_iap.jpg

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]--> <?XML:NAMESPACE PREFIX = O />

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 clin_d-oeil.png.

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 engine

Unfortunately you will not find a apengine.dll in UiQ’s SDK (nor at the device clin_d-oeil.png ). 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 clin_d-oeil.png , but they will really help you to gain insight.

(cutout)

pullout.jpg

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 Tools

There 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 sourire.png

— 
Tobias Stöger

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

Symbian OS 源码下载方式

本文由 www.J2meGame.com 撰写,转载请说明。Symbian OS 源码下载方式,导航:近日Symbian OS开源,肯定有很多移动开发爱好者去下载Symbian系统代码。但是笔者发现S...
  • wag2765
  • wag2765
  • 2016年01月25日 16:41
  • 509

执行umount 的时候却提示:device is busy 的处理方法

[root@web2-server yum.repos.d]# umount /mnt/cdrom/ umount: /mnt/cdrom: device is busy. (In some ca...
  • lengyue1084
  • lengyue1084
  • 2016年05月22日 23:31
  • 5555

搭建Vue项目环境

安装运行环境 安装node、webpack、vue-cli 快捷键win+R,输入cmd,再输入以下命令 >node -v >npm -vnode -v 查看node.js版本,如果显示nod...
  • lxhuang_14
  • lxhuang_14
  • 2018年01月03日 13:58
  • 108

46. Lotus Notes中编程发送邮件(一)

邮件是Lotus Notes体系的核心和基本功能,以至于Send()是NotesDocument的一个方法,任何一个文档都可以被发送出去,Notes里的一封邮件也只是一个有一些特殊字段的文档。在程序开...
  • starrow
  • starrow
  • 2013年08月14日 17:24
  • 9143

C#简单操作Lotus Notes邮件

前段时间简单的研究了一下.NET操作Lotus Notes邮件的实现,具体的操作包括邮件的读取和发送,而且都要包含附件,其间参考了《在 Microsoft .NET 应用程序中使用 IBM Lotus...
  • sinat_27305053
  • sinat_27305053
  • 2017年02月25日 17:17
  • 830

Lotus Notes 公式函数集

A @Abs 返回一个数字的绝对值(无符号值)。 @Abstract 英文缩写,中文无效 @Accessed 指出最后一次访问(即读取或编辑)该文档的时间和日期。   @Acos 使用角度的余...
  • wodemingzisiweiwei
  • wodemingzisiweiwei
  • 2013年07月30日 11:25
  • 1219

执行umount 的时候却提示:device is busy 的处理方法

[root@web2-server yum.repos.d]# umount /mnt/cdrom/ umount: /mnt/cdrom: device is busy.         (In...
  • zimuxin
  • zimuxin
  • 2017年03月15日 17:45
  • 1366

[读书笔记]iOS与OS X多线程和内存管理 [GCD部分]

3.2 GCD的API 苹果对GCD的说明:开发者要做的只是定义想执行的任务并追加到适当的Dispatch Queue中。 “Dispatch Queue”是执行处理的等待队列。通过dis...
  • zyb050607
  • zyb050607
  • 2015年03月13日 10:15
  • 1257

基础知识Notes: 字符串编码(ASCII, Unicode and UTF8)

总结陈述:ASCII码是用来表示英语字符的编码。只用1个字节(8位)。所以总共有256种可能。虽然实际而言只规定了128种,但是其每个字符的表示依然需要1个字节。而且,最高位永远为0. UT...
  • Firehotest
  • Firehotest
  • 2017年02月20日 07:50
  • 360

Notes消除冲突文档

之前开发的xpages项目出现多个重复的文档,从BS端来看是多个相同文档,在CS端来看就是冲突文档,看了前辈留下的文档,下面介绍如何来消除冲突文档。 Domino 的数据库在使用的过程中,会因为复制...
  • liuchang__
  • liuchang__
  • 2015年07月27日 17:13
  • 691
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:A few notes about the CommDb (use in Symbian OS)
举报原因:
原因补充:

(最多只允许输入30个字)