Symbian SDK 3.0的改变

这个问题是非常让人头疼的,因为你以前用的程序是很正常的,但是你拿到SDK3.0来编译的时候就根本不好使了,下面我把改动的地方做了一下翻译,大家可以看看,这样大家也好了解一下如何把第二版开发的东西如何移到3.0下开发。

1.应用程序入口点的改变。

过去我们开发的时候是没有main函数的,只有一个叫E32DLL的入口函数,但是在第三版的时候这点改变了。下面是示例代码。

#ifdef __SERIES60_30__

#include <eikstart.h>

#endif

中间这部分是其它代码

#ifdef __SERIES60_30__ //开始入口函数定义

GLDEF_C TInt E32Main()

{

   return EikStart::RunApplication( NewApplication );

}

# else

GLDEF_C TInt E32Dll( TDllReason )

{

  return KErrNone;

}

#endif

相信大家都能看明白,就是定义了一些编译器指令,进行条件编译,我们在改动以前的程序的时候,只要把这段代码考过去,然后按需添加删除一些代码就可以了。

2.S60 BLD.INF Project File Changes(S60 BLD.INF 工程文件的改变)

在第三版中使用了新的位图编译工具MIFCONV,所以如果你只是使用.MMP文件定义位图、ICON文件的使用时,是不能引起MIFCONV工具的自动执行,所以同样也要修改BLD.INF,同样可以定义编译条件,其中下面<appname>代表应用程序名。

PRJ_MMPFILES

#ifdef EKA2 // S60 3rd Ed

gnumakefile <appname>_icons.mk

<appname>_3rd.mmp

#else // S60 1st and 2nd Ed

<appname>_2nd.mmp

#endif

这段代码意思就是在BLD中引用两个MMP文件,一个给2.0编译,一个给3.0编译,下面我们讲MMP文件定义的改变(这部分改动很大,大家注意一下)

3.MMP文件的改变

3.1 TARGETTYPE已前定义目标文件如下

TARGETTYPE app

and

TARGET <appname>.app

现在必须改成

TARGETTYPE exe

and

TARGET <appname>.exe

3.2 Resources(资源)

2.0中的定义

TARGETPATH /system/Apps

RESOURCE <appname>.rss

现在必须改下如下这样的,即有一个START RESOURCE <>.rss,最后末尾必须加上END

START RESOURCE <appname>.rss

HEADER

TARGETPATH /resource/Apps

END

8.4 应用程序 RSS 资源文件的改变

    对于 3rd 来说,资源的编译是差不多的,但是需要加上一点东西,这是为了实现文字的可移植性而加上去的,我们需要添加这样一条语句LOCALISABLE_APP_INFO <resourceID>到资源文件中。

代码如下:

#include <appinfo.rh>

RESOURCE LOCALISABLE_APP_INFO r_<appname>_localisable_app_info

{

short_caption = rls_app_short_caption_string;

caption_and_icon =

CAPTION_AND_ICON_INFO

{

caption = rls_app_caption_string;

number_of_icons = 2;

icon_file = "//resource//apps//<appname>.mbm";

};

}

8.4 Application RSS Resource File Changes

应用程序RSS资源文件的改变

三版的资源编译与二版的资源编译基本相同,然而,有一点不同,就是要加入LOCALISABLE_APP_INFO <resourceID> 到文件中,这是为了实现国际化的要求,对资源中的一些比如说文字进行统一。

Resource building for most S60 3rd Edition applications is similar to building for S60 2nd Edition applications. However, there is one addition to S60 3rd Edition concerning the localization of the application—it will be done by adding a LOCALISABLE_APP_INFO <resourceID> statement into the application UI resource file.

The new structure is added:

#include <appinfo.rh>

RESOURCE LOCALISABLE_APP_INFO r_<appname>_localisable_app_info

{

short_caption = rls_app_short_caption_string;

caption_and_icon =

CAPTION_AND_ICON_INFO

{

caption = rls_app_caption_string;

number_of_icons = 2;

icon_file = "//resource//apps//<appname>.mbm";

};

}

8.5 应用程序注册文件的添加

工程中必须加入一个新的注册文件,这是因为三版的系统运行载入程序需要这个注册文件载入应用程序。

A new registration file must be added into the project because the S60 3rd Edition system launcher needs it to load the application.

一般来说,注册文件的文件名就是在应用程序后加上_reg.rss这个后涰

Typically the name of the application registration file is the name of the application, plus the _reg suffix, e.g., <appname>_reg.rss.

注册文件中包括APP_REGISTRATION_INFO 资源结构体和 appinfo.rh头文件,在这个头文件中会声明注册的属性

The registration file includes the APP_REGISTRATION_INFO resource structure and the appinfo.rh header file in which registration properties are declared.

在应用程序中UID2总是KUidAppRegistrationResourceFile这个常量,而UID3则是应用程序的UID3(UUID),就是应用程序的UID了

In the application registration file, UID2 always has the value KUidAppRegistrationResourceFile and UID3 has the application UID3 (unique UID).

app_file代表没有扩展名的应用程序文件名,newfile这个属性的默认值是KAppDoesNotSupportNewFile,而embeddabilit属性的默认值是KAppNotEmbeddable。

The app_file property has the name of the application without an extension. The newfile property has the default value KAppDoesNotSupportNewFile and embeddability has a default value KAppNotEmbeddable, e.g.:

下面是示例代码

<appinfo.rh>

UID2 KUidAppRegistrationResourceFile

UID3 <appUID3>

Version 1.0 | December 12, 2005 S60 Platform: Porting From 2nd To 3rd Edition | 19

RESOURCE APP_REGISTRATION_INFO

{

app_file= “<appname>”;

newfile = KappDoesNotSupportNewFile;

embeddability = KappNotEmbeddable;

localisable_resource_file = "<appResourceName without extension>";

// needed only if localizable_resource_file points to main UI // resource file

localisable_resource_id = <appResourceInfoID>;

}

8.6 Icons Building

ICON的编译

三版提供了新的API去载入ICON,新的API支持从旧的MBM文件中载入图标(2版使用的资源文件),也支持三版的MIF文件。

S60 3rd Edition provides a new API for the purpose of loading icons. This new API supports loading of both old bitmap icons (from MBM) and scalable icons (from MIF files). The MIF files are located in the same folders as the MBM files.

在三版中,图标与位图需要使用MIFCONV工具来编译,这个工具不能由MMP工程文件直接调用,而是需要一个特殊的名为MF的make file来编译,这个MF文件是由BLD.INF来调用的。

In S60 3rd Edition, icons and bitmaps are built with the MIFCONV tool. It cannot be started directly from an MMP project file, but needs a special MK make file, which will be started in the BLD.INF project file.

下面是例子

For example,

BLD.INF project file:

PRJ_MMPFILES

gnumakefile <appname>_aif.mk   //这就是那个MK文件

icon/bitmap makefile:

… //表示省略

feq (WINS,$(findstring WINS, $(PLATFORM)))

ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/Z

else

ZDIR=$(EPOCROOT)epoc32/data/z

endif

TARGETDIR=$(ZDIR)/RESOURCE/APPS

ICONTARGETFILENAME=$(TARGETDIR)/<appname>.mbm

# ICONTARGETFILENAME=$(TARGETDIR)/<appname>.mif

RESOURCE :

mifconv $(ICONTARGETFILENAME) /c12,1 ../aif/list_icon.bmp /c12,1 ../aif/context_pane_icon.bmp

Version 1.0 | December 12, 2005 S60 Platform: Porting From 2nd To 3rd Edition | 20

8.7 Signing the Installation Package

签署安装包

三版SDK在发布安装包前有一个签署的过程,这是出于安全的考虑,如果一个SISX包不需要任何的平台安全支持,一个自动创建的密钥对会完成这个签署的过程考虑ke fileh

S60 3rd Edition includes mandatory signing of the SISX installation package before it can be installed into a target device. If a SISX package does not need any platform security capabilities, it can be signed with a self-created key pair.

如果需要使用数字签名,那么需要有一个认证,如果要测试这样的应用程序,开发者需要有获得一个Symbain 开发者认证。而当应用程序进入市场时则需要Symbain签署的认证。

If a capability that requires a digital signature is used, a certificate is needed to run the application on a target device. To test such an application, a developer needs to acquire a Symbian Developer Certificate; a Symbian Signed certificate is needed before the application can enter the market.

安装包文件可以使用安装文件SignSIS来签署,任何认证与私钥都会被特化在包文件中或者是在命令行参数中

The installation package file can be signed using the installation file signer SignSIS. Any certificates and private keys are specified in the package file or as command line arguments, e.g.:

下面是一个例子,说明用命令行来签署安装文件

SignSIS InternetEmail_v30_gcce.sis InternetEmail_v30_gcce.sis DevCert.cer Access.key 12345678

这个很容易能看懂的,DevCert代表目标设备,Access Key代表认证的私钥, 12345678则是认证私钥文件的密码

where:

1. DevCert.cer is a target device installation certificate file.

2. Access.key is private key file of the certificate.

3. 12345678 is a pass phrase of the certificate’s private key file.

Version 1.0 | December 12, 2005

最后想说的就是大家可以先用三版的工程生成工具先生成一个工程文件,然后比对二版同三版的不同,最好是从简单的开始看起,然后一点点看,Carbide这个工具是一个方向,因为是它是依赖于世界最大的开源项目Eclipse来实现,正所谓背靠大树好乘凉,我想我们还是尽量上手三版的开发,以应对3G开发来临,由于本人最近考研,能出力的时间不多,也请大家原谅,本人水平有限,翻译难免有不足之处,请大家别太介意了 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值