Showing posts with label symbian. Show all posts
Showing posts with label symbian. Show all posts

Create the assembly listing of cpp file on Symbian Thursday, January 20, 2011

  1. go ot group folder where bld.inf file is stored.for example, cd \uiqsrc\qapps\sharedui\qcontactssharedui\group
  2. > abld reallyclean
  3. > abld makefile armv5 
  4. > abld listing armv5 urel QContacUI ContactsListBoxModel
    • The final two arguments are the MMP and CPP names for the function you want to look at
    • The final output is: Created [...]\contactslistboxmodel.ARMV5.lst. And the .lst file is one we're interested in

Status pane of S60 Wednesday, November 17, 2010








The status pane consistes of five sub-panes. If changing the theme, the influence is following:
  1. Background bitmap for the entire pane can be changed
  2. Signal pane: Foreground color and the bitmap can be changed
  3. Battery pane: Foreground color and the bitmap can be changed
  4. Context pane: The bitmap (that is, application icon) can be changed
  5. Title pane: Foreground color can be changed
  6. Universal Indicator pane: Foreground color can be changed
  7. Navi pane: Foreground color can be changed

CTextResolver把错误码转换为错误描述 Wednesday, February 3, 2010



S60提供的CTextResolver类可以把错误码转换为错误描述,这样我们就不用输出那些不好懂的数字,不用一直开着帮助去查询错误码的意思了。

Here's a demo. FYI

TInt err = xxx //error code
iErrRe = CTextResolver::NewL(); 
TInt resourceID = 0;
TUint flags = 0;
TPtrC errstr = iErrRe ->ResolveErrorString(err,resourceID,flags,Context);
if ( !(flags & ETextResolverBlankErrorFlag) )
{
//handle error string 
}

CErrorUi就是嵌套了这个类!!

AdMob认为Apple, Nokia主导世界手机市场 Monday, January 25, 2010

















1〉09年,智能手机只占到了手机总数的19% (发展空间巨大阿)
2〉Symbian OS在亚洲和非洲市场处于主导地位;在东欧和拉丁美洲占据较大的市场份额
3〉iPhone OS占据了北美、澳大利亚、西欧以及大西洋周边地区
4〉Android 在北美和西欧市场有显著增长
5〉2009年Q4全球智能手机os市场,iPhone 51%,Symbian 21%,Android 16%(注意:2008年Q4仅为1%)
6〉2009年Q4亚洲智能手机os市场,Symbian 69%, iPhone 27%

AdMob公司向手机平台上的发布商出售文字和旗帜广告,同时AdMob还追踪并记录各品牌手机、移动设备在全球各地的使用情况。关于AdMob的详细信息参见:http://www.admob.com/home/about

how to create a global singleton object in exe Monday, January 11, 2010




// how to create a global singleton object
const TInt KMarkTlsHandle = 0xC0FFEE;

class CYourClass: public CBase
{
public:
CYourClass(){};
void ConstructL(){};
~CYourClass();
};



CYourClass::~CYourClass()
{

//release TLS
UserSvr::DllFreeTls(KMarkTlsHandle);
}



//how to create a global singleton object
void CMarkEComWrapper::DoCommandCreateSingletonObject()
{
TInt err = KErrNone;

//Get object from STL
CYourClass* iSingletonObject = static_cast (UserSvr::DllTls(KMarkTlsHandle));

//if not, create one
if (!iSingletonObject)
{
iSingletonObject = new (ELeave) CYourClass;
CleanupStack::PushL(iSingletonObject);
iSingletonObject->ConstructL();
err = UserSvr::DllSetTls( KMarkTlsHandle, iSingletonObject );
CleanupStack::Pop(iSingletonObject);
}

delete iSingletonObject ;

iSingletonObject = 0;
}

使用Sqlitecc查看symbian sql 数据库 Tuesday, October 13, 2009

在symbian OS 9.5 上提供了sqlite api,用这些api 生成的数据库可以用sqlitecc打开。
sqlitecc是图形界面,可以在其中修改数据,很方便、直观

首先需要从sourceforge上下载sqlitecc,http://sqlitecc.sourceforge.net/
然后直接可以打开。打开后界面如下





WLAN研究起步 Monday, October 12, 2009

  • wlan的物理特性
  WLAN利用电磁波在空气中发送和接受数据,而无需线缆介质。WLAN的数据传输速率现在已经能够达到11Mbps,传输距离可远至20km以上。
  • wlan的好处

  安装便捷:一般在网络建设当中,施工周期最长、对周边环境影响最大的就是网络布线的施工了。在施工过程时,往往需要破墙掘地、穿线架管。而WLAN最大的优势就是免去或减少了这部分繁杂的网络布线的工作量,一般只要在安放一个或多个接入点(Access Point)设备就可建立覆盖整个建筑或地区的局域网络。

  使用灵活:在有线网络中,网络设备的安放位置受网络信息点位置的限制。而一旦WLAN建成后,在无线网的信号覆盖区域内任何一个位置都可以接入网络,进行通讯。

  经济节约:由于有线网络中缺少灵活性,这就要求网络的规划者尽可能地考虑未来的发展的需要,这就往往导致需要预设大量利用率较低的信息点。而一旦网络的发展超出了设计规划时的预期,又要花费较多费用进行网络改造。而WLAN可以避免或减少以上情况的发生。

  易于扩展:WLAN又多种配置方式,能够根据实际需要灵活选择。这样,WLAN能够胜任只有几个用户的小型局域网到上千用户的大型网络,并且能够提供像"漫游(Roaming)"等有线网络无法提供的特性。

  由于WLAN具有多方面的优点,其发展十分迅速。在最近几年里,WLAN已经在医院、商店、工厂和学校等不适合网络布线的场合得到了广泛的应用。
  • wlan的危害
  电磁波辐射
   还有人说会给公司和社团保密带来不利因素,因为wlan可以随时随地连接。
  • wlan的前景  
  据权威调研机构Cahners In-Stat Group预计,全球无线局域网市场将在2000年至2004年保持快速增长趋势,每年平均增长率高达25%。无线局域网市场的网卡、接入点设备及其他相关设备的总销售额也将在2000年轻松突破10亿美元大关,在2004年达到21.97亿美元。
 

[FW]Polymorphic DLL UID summary

The following table summarises the UID usage for the common system-defined polymorphic DLLs:

Description

Usual extension

UID2

UID3 required?

application

app

KUidApp in apadef.h

yes

animation

ani

KWservAnimDllUid in w32adll.h

no

control panel applet

ctl

KUidSystemControlDll in apgctl.h

yes

ECom plug-in

ECOMIIC

0x10009D8D

yes

front-end processor

fep

0x10005e32

yes

MIME recognizer

mdl

0x10003A19

yes

serial protocol module

csy

KUidUnicodeCommServerModuleV02 in cs_port.h

no

socket server protocol module

prt

KUidProtocolModule in es_prot.h

yes

Server-side MTM

dll

KUidMtmServerComponent in msvruids.h

yes

Client-side MTM

dll

KUidMtmClientComponent in msvruids.h

yes

UI MTM

dll

KUidMtmUiComponent in msvruids.h

yes

UI Data MTM

dll

KUidMtmUiDataComponent in msvruids.h

yes


symbian上如何快速debug你的代码

     今天在一个blog(Exported classes and global functions in C:\Symbian\9.1\S30\epoc32\RELEASE\winscw\UDEB)上无意中看到:

CTestConfig
TESTCONFIGFILEPARSER.LIB
CTestConfigItem
TESTCONFIGFILEPARSER.LIB
CTestConfigSection
TESTCONFIGFILEPARSER.LIB
RTestExecuteLogServ
TESTEXECUTELOGCLIENT.LIB
CTestExecuteIniData
TESTEXECUTEUTILS.LIB
CTestExecuteLogger
TESTEXECUTEUTILS.LIB
RTestServ
TESTEXECUTEUTILS.LIB
CTestServer
TESTEXECUTEUTILS.LIB
CTestSession
TESTEXECUTEUTILS.LIB
RTestSession
TESTEXECUTEUTILS.LIB
CTestStep
TESTEXECUTEUTILS.LIB
我以前一直想当然地认为这些类没有被导出来,只有symbian的白金用户可以用。看来是错了。
有了这些类就可以写白盒测试程序。 其实这些类都属于一个叫tef的框架。这个框架的特点是:
  1. 脚本驱动
  2. 可以并行执行测试
  3. 支持客户/服务器模式
  4. log 强大,可以是html/xml格式,显示结果很直观,比如是错误提示是红色显示
  5. 在模拟器上以text模式运行,执行很快
大体是可以这样实现:先从CTestServer 配生一个自己的server,他的主要工作是创建CTestStep配生对象;然后从CTestStep配生自己的test step,这个对象主要工作是描述test case,其实脚本engine就是按照这个描述执行的。

Carbide.c++ 2.0 免费下载

 Application developers are encouraged to install the Developer or Professional Edition. The OEM Edition is recommended for device manufacturers.

 

Supported new features and improvements

  • Support for S60 5th Edition (in particular Touch UI and Platform Services).
  • Addition of several Touch design components to the UI Designer tool. Users can touch-enable basic user interface applications using this graphical tool.
  • Support for Qt development tools for S60 (expect updated Qt SDK’s next year)
  • Improved connection and reporting for On-Device Debugging.
  • Knowledgebase Scanner is a new addition to the CodeScanner static analysis tool. Knowledgebase Scanner scans the user’s code and provides advice for adding touch capabilities to existing applications.
  • Improved speed and accuracy of code completion aids.
  • Improved rendering for the Performance Investigator tool (Available in PRO and OEM Editions).

http://www.forum.nokia.com/info/sw.nokia.com/id/dbb8841d-832c-43a6-be13-f78119a2b4cb.html

 

 

Download the latest version of Carbide.c++

Compare and explore Forum Nokia’s Carbide.c++ resources

 

 

TEF例子代码

 先给出一个脚本例子:

START_TESTCASE TC1308200809_ACTIVE
START_TEST_BLOCK 100 YinSymbianTestServer yinexample.ini
CREATE_OBJECT HeapWatcherWrapper heap
CREATE_OBJECT YinExampleWrapper2 wrapper2
COMMAND heap mark
COMMAND wrapper2 NewL
COMMAND wrapper2 Initialize
COMMAND wrapper2 ActivateActiveObject
OUTSTANDING
COMMAND wrapper2 PrintInfo
COMMAND wrapper2 Clean
COMMAND heap markend
END_TEST_BLOCK
END_TESTCASE TC1308200809_ACTIVE

这个脚本执行结果:

09:36:56:705
09:36:56:705 
TEST SYNOPSIS:
TEF Version : 3.0.1003
START_TESTCASE COUNT : 1
START_TEST_BLOCK COUNT : 1

*** TestExecute Started 02/04/2009 09:36:56:705 ***
09:36:56:710 c:\yintest\yinutils.script LOAD_SERVER YinSymbianTestServer 
09:36:56:785 c:\yintest\yinutils.script START_TESTCASE TC1308200809_ACTIVE 
09:36:56:790 c:\yintest\yinutils.script Line = 30 Command = START_TESTCASE TC1308200809_ACTIVE  
09:36:56:790 c:\yintest\yinutils.script START_TEST_BLOCK 100 YinSymbianTestServer c:\yintest\yinexample.ini 
09:36:56:790 c:\yintest\yinutils.script Line = 31 Command = START_TEST_BLOCK 100 YinSymbianTestServer c:\yintest\yinexample.ini ***Result = PASS 
09:36:56:790 INFO -  36 YinSymbianTestServer.cpp 55 CreateTestBlock>>>>>>>>>
09:36:56:790 INFO -  36 YinSymbianTestServer.cpp 65 CreateTestBlock<<<<<<<<<<<
09:36:56:796 INFO -  36 TestBlockController.cpp 134 Creating a local active scheduler.
09:36:56:796 INFO -  36 TestStepBase.Cpp 249 INI READ : c:\yintest\yinexample.ini heap name CheckMemoryLack
09:36:56:796 INFO -  36 YinExampleBlockController.cpp 30 CreateDataL>>>>>>>>
09:36:56:796 INFO -  36 YinExampleBlockController.cpp 34 Create hewp watcher
09:36:56:796 INFO -  36 TestStepBase.Cpp 249 INI READ : c:\yintest\yinexample.ini wrapper2 name TestWrapper2
09:36:56:796 INFO -  36 YinExampleBlockController.cpp 30 CreateDataL>>>>>>>>
09:36:56:796 INFO -  36 TestStepBase.Cpp 249 INI READ : c:\yintest\yinexample.ini heap name CheckMemoryLack
09:36:56:801 INFO -  36 TestStepBase.Cpp 249 INI READ : c:\yintest\yinexample.ini wrapper2 name TestWrapper2
09:36:56:801 INFO -  36 TestStepBase.Cpp 249 INI READ : c:\yintest\yinexample.ini wrapper2 name TestWrapper2
09:36:56:801 INFO -  36 TestStepBase.Cpp 249 INI READ : c:\yintest\yinexample.ini wrapper2 name TestWrapper2
09:36:56:801 INFO -  36 YinExampleWrapper2.cpp 176 [***Mark.Yin***]CTEFIntegrationTestWrapper::RunL
09:36:56:812 INFO -  36 TestStepBase.Cpp 249 INI READ : c:\yintest\yinexample.ini wrapper2 name TestWrapper2
09:36:56:812 INFO -  36 YinExampleWrapper2.cpp 94 [***Mark.Yin***] current value=1
09:36:56:812 INFO -  36 TestStepBase.Cpp 249 INI READ : c:\yintest\yinexample.ini wrapper2 name TestWrapper2
09:36:56:812 INFO -  36 TestStepBase.Cpp 249 INI READ : c:\yintest\yinexample.ini heap name CheckMemoryLack
09:36:56:812 CREATE_OBJECT HeapWatcherWrapper heap  ***Result = PASS 
09:36:56:812 CREATE_OBJECT YinExampleWrapper2 wrapper2  ***Result = PASS 
09:36:56:812 COMMAND !Error=0 !AsyncError=0 heap mark   ***Result = PASS 
09:36:56:812 COMMAND !Error=0 !AsyncError=0 wrapper2 NewL   ***Result = PASS 
09:36:56:812 COMMAND !Error=0 !AsyncError=0 wrapper2 Initialize   ***Result = PASS 
09:36:56:812 COMMAND !Error=0 !AsyncError=0 wrapper2 ActivateActiveObject   ***Result = PASS 
09:36:56:812 OUTSTANDING 0   ***Result = PASS 
09:36:56:812 COMMAND !Error=0 !AsyncError=0 wrapper2 PrintInfo   ***Result = PASS 
09:36:56:812 COMMAND !Error=0 !AsyncError=0 wrapper2 Clean   ***Result = PASS 
09:36:56:812 COMMAND !Error=0 !AsyncError=0 heap markend   ***Result = PASS 
09:36:56:817 c:\yintest\yinutils.script Line = 42 Command =  END_TEST_BLOCK ***Result = PASS 
09:36:56:822 c:\yintest\yinutils.script END_TESTCASE TC1308200809_ACTIVE 
09:36:56:822 c:\yintest\yinutils.script Line = 43 Command = END_TESTCASE TC1308200809_ACTIVE ***TestCaseResult = PASS 
09:36:56:827 TEST STEP SUMMARY:
09:36:56:827 INFO -  35 YinSymbianTestServer.cpp 44 ~CYinSymbianTestServer
09:36:56:827 PASS = 1
09:36:56:827 FAIL = 0
09:36:56:827 ABORT = 0
09:36:56:827 PANIC = 0
09:36:56:827 INCONCLUSIVE = 0
09:36:56:827 UNKNOWN = 0
09:36:56:827 UNEXECUTED = 0
09:36:56:827 COMMENTED OUT COMMAND'S = 8
09:36:56:827 TEST CASE SUMMARY:
09:36:56:827 PASS = 1
09:36:56:827 FAIL = 0
09:36:56:832 INCONCLUSIVE = 0
09:36:56:832 

IPCv2实现机制

IPCInter-Process Communication的缩写,说的就是client-server框架。它可是symbian OS 上的元老之一。在Psion Series 5上就已经实现了,直到symbian OS v9.5都在不断的改进扩展新的功能。client-serverOS上随处可见,比如F32(文件服务)、ESOCKsocket服务)、大名鼎鼎的WSERVwindow 服务)以及ETEL(电话服务)等等。由于我现在使用9.5版本的symbian os,所以在这里只讨论IPCv2。老一点IPCv1就不专门说了。
       从使用client-server的角度来看,developer只需要关注4个接口类:CServer2CSession2RSessionBaseRSubSessionBase,其中前两个类的实例运行于user端的server端,后两个类实际上是提供给client使用的接口,运行于user端的client端。由此可见client-server框架非常便利,它的工作过程可以大体描述为:
1.        client使用全局唯一的server名字与server建立起连接,创建一个session
2.        如果server没有启动,就启动之。
3.        server一启动就是发出一个request检查kernel端消息队列是不是有待处理的消息。
4.        client发送消息给server。实际上将消息放入到kernel端的消息队列中。
5.        client等待消息的处理结果。
6.        一旦有消息,server就取出一个消息
7.        server处理消息
8.        server处理完消息后,通知client消息已经处理完。
注意,消息队列FIFO队列,并且server一次只能取出一个消息,不能并行处理。
IPCv2相对于IPCv1来说提供了更健全的安全机制和更便利的使用方式。Server的名字必须是以“!”开头的,kernel端将保证名字的合法性和唯一性;session不再绑定到特定client中的线程;在kernel端创建server以及client连接到这个server是异步进行的,这将保证client不会连接到恶意的serverserver通过送来的message中包含的handle访问client端的地址空间,而message包含的handle是经过server认证的;session可以在线程之间也可以在进程之间共享。
在上文中我们提高了4个类,还提到了User端、kernel端等,看着有些乱。下面我用一个图来表示这些概念,将它们一一对应起来。


这样是不是比较清楚些?从上图可以看出来只要实现了CServer2CSession2这两个类就实现了server。一般我们接触到的server都是一个exe,也就是说一般情况下server都是运行在独立的进程空间的。但是实际上只要支持AO机制的线程或者进程都可以用于实现server,这是由于CServer2派生于CActiveServer必须在client与之交互之前启动,有两种方式启动server
1、client组织代码启动server
2、在手机启动的过程中自动启动,比如ETEL。自动启动server都是在system boot过程中执行的,参见symbian手机启动过程
Server启动后马上创建CServer2对象,然后调用Start()使CServer2处于接收message的状态,同时在kernel会有一个对应的kernel server对象被创建。Kernel server对象拥有一个FIFO message队列,里面的message依次发送到CServer2对象。
无论如何client端都需要从RSessionBase派生一个类。就RSessionBase这个类本身来说主要做三件事情:a)创建与server交互的sessionb)与server交互;c)设置session共享的级别。而其派生类主要实现地是利用RSessionBase提供的基础接口与sever交互的功能,这与具体是需求有关系,每个不同的需求都会有不同的实现,这里就不讨论派生类了。
Client调用RSessionBase::CreateSession创建与server交互的session,并与server建立连接。这个过程中同时创建了kernel端的session对象,这个kernel对象也有一个FIFO message队列,比较奇怪吧?想想为什么。此时如果server还没有启动,CreateSession会失败,就需要client组织代码启动server。到这里大家明白了吧,RSessionBase封装的handle就是kernel session对象,clientserver交互的环境。在这个过程中还调用了NewSessionL()创建CSession2对象。
到现在为止clientserver连接起来,可以进行交互了。下面说说交互的过程。
Client调用Sendxxx这类函数与server交互,它们都使用了那个handle,将message首先放入了kernel session对象的消息队列,之所以放入到这里是因为client-server框架有一个非常重要承诺:就算server死掉了,client发送给servermessage都会有返回。随后kernel再将message转发到kernel server的消息队列中,此时kernel激活user端的CServer2对象,CServer2收到后,会将接受到的message发送给CSession2对象。随后的处理过程就是大家熟悉的过程了。
该到RSubSessionBase出场的时候了。我认为IPCv2的共享的特性主要体现在这个类上。大家对RFsRFile这两个类比较熟悉吧,RFs建立起于F32的连接,然后若干个RFile共享这个RFsF32进行交互。RSubSessionBase封装的handle实现与CSession2中,由用户定义。
不同进程之间共享session通过SetParameter实现的,具体过程以后讨论吧。

Syamiban Q&A (1)

1> 如何判断文件是否存在
有3个函数可以使用

  1. ConeUtils::FileExists
  2. BaflUtils::FileExists
  3. RFs::Entry
第一个比第二个要方便些

2> 创建随机数
    Math::Rand

3> symbian应用程序如何获得命令行参数
  1. TBuf<KCommandLen> command; // You determine the value of KCommandLen
  2. User::GetCommand(command); // got it
对于eka2来说,这个是非常简单的

Symbian入门的资料

Basics: http://developer.symbian.com/main/documentation/symbian_cpp/symbian_cpp/
Development tips: http://developer.symbian.com/main/documentation/symbian_cpp/development_tips/
C++ examples: http://developer.symbian.com/main/documentation/example_app_code/cpp/
Booklets:
Essentials: http://developer.symbian.com/main/documentation/booklets/essential.jsp
Essential UI (includes location aware apps booklet): http://developer.symbian.com/main/documentation/example_app_code/cpp/
Books:
http://developer.symbian.com/main/documentation/books/developer/

Others
http://developer.symbian.com/main/downloads/papers/RBuf/Introduction_to_RBuf_v1.0.pdf