此文档为开发视界翻译转载者请注明出处(开发视界 www.sf.org.cn)否则追究法律责任 3、蓝牙开发接口V2的结构 原始的蓝牙开发接口结构在Symbianv8.0a(S60 第二版,Feature Pack2)中已经有了很大的改进,他们包括:
l 创建端口的新方法。
l 创建安全设置方法
l 通过Publish和Subscribe开发接口设置Stack和硬件
l CBluetoothSockek为蓝牙提供了比RSocket更好的功能。
|
|
注意:The __BLUETOOTH_API_V2__ macro不支持S60平台知道S60第三版(Symbian_os_v9.1.hrh)的发布。因此开发者需要根据平台版本的不同创建不同的项目。另外,在S60第三版中需要创建不同的builds。
尽管如此,开发者可以使用S60第二版的Feature Pack2中S60 Identification Code在安装的时候确认兼容性。关于确认代码,可以参考http://www.forum.nokia.com[8]。 |
本文中还会陆续介绍平台的一些变化,附件A汇总。
4、安全管理,对蓝牙应用平台的作用 Symbian OSv9.1(S60第三版)最大的改变就是安全的概念。他包括几个主要的模块Capabilities(用于设置应用程序的优先权),DataCaging(用于存储数据),Secure Interprocess Communication(IPC)和存储管理。Recognizers, notifiers,和converter plug-in都作为ECOM插件。为了使应用程序能够实现不同的功能,应用程序都必须被定义成EXE文件。平台安全也需要对应用程序的结构进行调整。 出了一些基本的变化,蓝牙的开发者还需要对能否实现特定的功能进行检测。下面是一个表,列举了蓝牙相关的行为以及可能实现能力。更多信息,参考“功能说明”。 大部分蓝牙应用程序使用的时候,都需要用户确认信息的一些功能。CBluetoothPhysicalLinks 类中很多一些功能需要NetworkControl才能实现,而NetworkControl 需要用户填写表单获取信息。表格2种列举了蓝牙应用中需要的功能。
|
Capability |
Description |
Classification |
|
LocalServices |
Grants access to local network services that usually do not incur a cost. |
User-grantable |
|
NetworkServices |
Grants access to remote network services that may incur a cost. This capability is granted on a one-shot basis if not previously authorized. |
User-grantable |
|
ReadUserData |
Grants read access to data that is confidential to the mobile phone user (subject to confirmation). |
User-grantable |
|
WriteUserData |
Grants write access to data that is confidential to the mobile phone user (subject to confirmation). |
User-grantable |
|
ReadDeviceData |
Grants read access to sensitive system data. |
Symbian Signed (declarative justification required) |
|
WriteDeviceData |
Grants write access to sensitive system data. |
Symbian Signed (declarative justification required) |
|
NetworkControl |
Grants access or modification rights to network protocol controls. |
Symbian Signed (Capability Request Form and Platform approval required) |
表格2:蓝牙应用程序需要的功能
表格3列举了使用特定的蓝牙组建的时候可能需要的功能。
|
Component |
Capabilities |
Description |
|
BLUETOOTH_SDP |
LocalServices |
Usage of CSdpAgent or RSdpDatabase requires LocalServices capability. |
|
In BLUETOOTH_USER
CBluetoothPhysicalLinks
CBluetoothSocket and CBluetoothSynchronousLink |
NetworkControl
LocalServices |
LocalServices is also required when using CBluetoothSocket. CBluetoothPhysicalLinks requires NetworkControl and may therefore be unusable for developers. |
|
BLUETOOTH_MANAGER |
LocalServices WriteDeviceData ReadDeviceData |
For creating view, modifying devices in registry, etc., different capabilities will be required. |
|
RSocket::Ioctl |
NetworkServices |
Required for KIoctlGetMsgId and KIoctlGetLastSendError commands. | 表格3:特定蓝牙组件需要的功能 综合起来,平台安全并不影响使用高层的开发接口开发蓝牙应用程序。但是,如果应用程序需要使用底层的接口(比如修改远程设备数据)就需要上述的功能了。
|