首 页 | 新 闻 | Symbian | Android| Windows Mobile | J2ME | 下载中心 | 游戏策划招聘与求职 | 购书指南 | 视频教程
您现在的位置: 开发视界 >> Symbian英文资料 >> Network >> 正文
Publish&Subscribe API and Bluetooth HCI Commands
作者:佚名    文章来源:不详    更新时间:2006-5-7 11:16:33

Introduction

With the version 8.0a the Publish&Subscribe API was introduced. This API simplifies the communication between multiple processes. Besides this new API replaced the access to the Bluetooth Host Controler Interface.

The Host Controler Interface (HCI) offers an access to the Bluetooth baseband and permits to read the Bluetooth address or to shift the mobile telephone into another dicoverbility mode. If you try to address the Host Controler Interface like in former times via the socket, then the method SetIoctl throws the error KErrNotSupported.

The use of the Publish&Subscribe API is shown here. However the usage of the Publish&Subscribe API in connection with the host controller interface isn’t described anythere.

How to use the api

In the header file bt_subscribe.h of the SDK variables are specified, which can be used in connection with the Publish&Subsribe API to access the HCI:

// For Bluetooth notifications via Publish & Subscribe
const TUid KPropertyUidBluetoothCategory = {0x101FD916};
//to send properties *to* the stack
const TUid KPropertyUidBluetoothControlCategory = {0x101FD917};

// enumerate keys here
const TUint KPropertyKeyBluetoothLocalDeviceAddress = 0;
const TUint KPropertyKeyBluetoothPHYCount = 1;
const TUint KPropertyKeyBluetoothConnecting = 2;
const TUint KPropertyKeyBluetoothScanning = 3;
const TUint KPropertyKeyBluetoothLimitedDiscoverable = 4;
const TUint KPropertyKeyBluetoothDeviceClass = 5;
const TUint KPropertyKeyBluetoothRegistryTableChange = 0x1000;

// the values for the keys
//RegistryTableChanges
const TUint KRegistryChangeRemoteTable = 0;
const TUint KRegistryChangeLocalTable = 1;
const TUint KRegistryChangeCSYTable = 2;

To read the Bluetooth addresse for example the following call can be accomplished:

TPckgBuf<TBTDevAddr> aDevAddrPckg;
TInt error = RProperty::Get(KPropertyUidBluetoothCategory, KPropertyKeyBluetoothLocalDeviceAddress, aDevAddrPckg);

For writing a Properties it firstly has to be defined. The next example shows how to set the discoverbility mode:

RProperty::Define(KPropertyUidBluetoothControlCategory,  KPropertyKeyBluetoothLimitedDiscoverable, RProperty::EByteArray);

TPckgBuf <TUint32> type = KLIAC;// KGIAC
return RProperty::Set(KPropertyUidBluetoothControlCategory,  KPropertyKeyBluetoothLimitedDiscoverable, type);

Conclusion

The Publish&Subscirbe API provides an ease way to access the Host Controller interface. Unfortunately the API in connection with the Host Controler Interface isn’t described anywhere. If you now how the Publish&Subscibes API simplyfies the access to the HCI.

相关文章:
Carbide.c++: Setting up On Target Debugging
On Target Debugging using BlueTooth
Changing the COM port to access the Internet
A few notes about the CommDb
Bluetooth: PC-Suite Configuration
Cobain: doing Bluetooth the easy way on Symbian OS/Series 60
Bluetooth: Pairing a mobile with an USB adapter
Bluetooth: Installation and Configuration of a Bluetooth USB adapter
 

站点地图 | 加入收藏 | 联系站长 | 广告服务 |
QQ:280529124  Tel:0592-8271361 辽ICP备05021703号