×
Namespaces

Variants
Actions

接收远程蓝牙设备信息

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata

兼容于
文章
翻译:
hoolee
最后由 hamishwillee 在 09 Aug 2012 编辑
  • 详细描述

应用程序可以接收远程蓝牙设备的特定蓝牙信息。这个信息可以用来,例如过滤特定设备或设备类型以便节省搜索设备的时间。


当蓝牙开启后,手机便提供它的类型或设备/服务属性以便其他设备能在设备搜索过程中接收到这些信息。这些属性指明了主副设备类型(如手机和智能手机等),和一般服务类型(如网络,对象交换,和音频等),注意这是公共服务的高级类型,也是蓝牙资料和服务的一个概念,可以被应用程序确保兼容性(能多相信信息请看Archived:Discovering Bluetooth services using Symbian C++


  • 解决方案

在设备搜索时,每个远程设备的socket地址TInquirySockAddr和TBTDeviceClass(定义在btdevice.h)都可以得以构造。

TBTDeviceClassMajorServiceClass, MajorDeviceClass, and MinorDeviceClass获有信息,可以通过如下方式获取:

// Issue request
iHostResolver.GetByAddress( iInquirySockAddr, iEntry, iStatus );
SetActive();<br>
//Receive result in RunL()
if( iStatus == KErrNone)
{
TInquirySockAddr& sa = TInquirySockAddr::Cast( iEntry().iAddr );
TBTDeviceClass tmpDeviceClass( sa.MajorServiceClass(),
sa.MajorClassOfDevice(), sa.MinorClassOfDevice());
}

注意没有直接的蓝牙API可以用来获得其他设备的指定信息如串号或手机号码等。你必须有一个程序运行在远程手机端,才能询问到这些信息。

Version Hint

Windows Phone: [[Category:Windows Phone]]
[[Category:Windows Phone 7.5]]
[[Category:Windows Phone 8]]

Nokia Asha: [[Category:Nokia Asha]]
[[Category:Nokia Asha Platform 1.0]]

Series 40: [[Category:Series 40]]
[[Category:Series 40 1st Edition]] [[Category:Series 40 2nd Edition]]
[[Category:Series 40 3rd Edition (initial release)]] [[Category:Series 40 3rd Edition FP1]] [[Category:Series 40 3rd Edition FP2]]
[[Category:Series 40 5th Edition (initial release)]] [[Category:Series 40 5th Edition FP1]]
[[Category:Series 40 6th Edition (initial release)]] [[Category:Series 40 6th Edition FP1]] [[Category:Series 40 Developer Platform 1.0]] [[Category:Series 40 Developer Platform 1.1]] [[Category:Series 40 Developer Platform 2.0]]

Symbian: [[Category:Symbian]]
[[Category:S60 1st Edition]] [[Category:S60 2nd Edition (initial release)]] [[Category:S60 2nd Edition FP1]] [[Category:S60 2nd Edition FP2]] [[Category:S60 2nd Edition FP3]]
[[Category:S60 3rd Edition (initial release)]] [[Category:S60 3rd Edition FP1]] [[Category:S60 3rd Edition FP2]]
[[Category:S60 5th Edition]]
[[Category:Symbian^3]] [[Category:Symbian Anna]] [[Category:Nokia Belle]]

This page was last modified on 9 August 2012, at 05:19.
62 page views in the last 30 days.