蓝牙由于身份验证错误作为从设备怎么验证pbap

12411人阅读
android架构分析(20)
从ANDROID3.0开始,BLUETOOTH& API提供了Bluetooth profile协议的支持。目前ANDROID4.0的蓝牙API提供了五种蓝牙无线接口规范(Bluetooth profile)的支持,用来在设备之间通过蓝牙实现特定功能:包括 Headset和Hands-Freeprofile(实现蓝牙耳机功能),A2dpprofile(第二代蓝牙声音设备协议,用来在蓝牙设备之间实现高质量的声音传输),InputDeviceprofile(实现蓝牙输入设备功能),Bluetooth &Panprofile(实现蓝牙个人局域网功能),Bluetooth
Healthprofile(实现蓝牙健康设备规范,用来与支持蓝牙健康设备规范的设备进行蓝牙通讯)。另外还有Bluetooth Pbapprofile(实现蓝牙电话本功能),但接口和其它profile实现不一致。
&&&& && ANDROID对 Bluetooth profile API的实现主要采用了中介模式、代理模式及状态模式等。
&&&&&& &应用通过一个统一的类BluetoothAdapter(蓝牙本地适配器类)与这些蓝牙设备协议对应的BLUETOOTH& API进行交互。
&&&&&& BluetoothAdapter是所有蓝牙对象交互和执行蓝牙操作的入口:包括调用BLUETOOTH profile API,发现其它蓝牙设备、查询配对成功的设备、使用已知的MAC地址实例化蓝牙设备、创建一个BluetoothServerSocket对象来监听其它蓝牙设备以及根据地址实例化蓝牙设备等操作。
&&&&&& 应用为了使用蓝牙功能,JELLY_BEAN_MR1以下的版本使用如下方式获得BluetoothAdapter单例对象。
BluetoothAdapter mAdapter = BluetoothAdapter.getDefaultAdapter();
&&&&&&& JELLY_BEAN_MR2以后的版本,使用如下方式来调用蓝牙API。
BluetoothManager bluetoothManager =
(BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE);
BluetoothAdapter mAdpter=bluetoothManager.getAdapter();
&&&&&几乎所有的蓝牙对象和所有的蓝牙服务都维护一个BluetoothAdapter单例对象,BluetoothAdapter单例对象通过BluetoothAdapter类提供的getDefaultAdapter函数获得。BluetoothAdapter对象可以说是整个系统交互的中介,是中介设计模式的采用。
&&&&&&而几个蓝牙设备协议的实现借助几个ANDROID服务来实现,并通过代理对象对外提供BLUETOOTH& API。Headset对应的代理对象为BluetoothHeadset,A2dp对应的代理对象为BluetoothA2dp,InputDeviceprofile对应的代理对象为BluetoothInputDevice,Bluetooth
&Pan对应的代理对象为BluetoothPan,Bluetooth &Health对应的代理对象为BluetoothHealth。
&&&&& 通过BluetoothAdapter类提供的getProfileProxy函数根据不同的profile参数实例化对应的代理对象,getProfileProxy函数还传给代理对象一个实现BluetoothProfile.ServiceListener接口的监听对象。
&&&&& &代理对象实例化时与代理的服务进行绑定,与服务进行绑定成功后调用对应监听对象的onServiceConnected回调函数,并通过回调函数把代理对象传给应用,应用通过代理对象通过BINDER访问蓝牙设备服务。
&&&&& &Headset对应蓝牙服务为BluetoothHeadsetService及BluetoothHandsfree对象,A2dpprofile对应的蓝牙服务为BluetoothA2dpService,而InputDeviceprofile、Bluetooth Healthprofile及Bluetooth &Panprofile都由BluetoothService服务来实现。Bluetooth
Pbap profile对应的服务是BluetoothPbapService。
&&&&&&&BluetoothAdapter对象相关类图如下:
&&&&&& &图中几个蓝牙服务BluetoothHeadsetService、BluetoothA2dpService、BluetoothService、BluetoothPbapService及BluetoothDeviceProfileState、BluetoothHandsfree、BluetoothEventLoop对象都维护一个BluetoothAdapter对象(使用BluetoothAdapter类提供的getDefaultAdapter函数获得),并通过BluetoothAdapter对象提供的getProfileProxy函数根据profile类型获得要访问的代理对象,还通过BluetoothAdapter对象访问其它蓝牙对象。
&&&&&& 图中几个代理对象都是BluetoothProfile接口的实现,并都维护一个ServiceListener监听对象。BluetoothHeadset对象通过IBluetoothHeadset对BluetoothHeadsetService服务进行BINDER调用,BluetoothA2dp对象通过IBluetoothA2dp对BluetoothA2dpService服务进行BINDER调用,而BluetoothInputDevice、BluetoothPan、BluetoothHealth对象通过IBluetooth调用BluetoothService的API。
&& &&&& 代理对象本身及BluetoothAudioGateway对象也可以通过BluetoothAdapter对象访问其它蓝牙对象来获得蓝牙设备信息和状态。
&&&&&&& BluetoothAdapter对象提供的接口除了getProfileProxy外主要有以下几个:
&&&&&&& getRemoteDevice()&获得远端设备,返回一个BluetoothDevice对象;
&&&&&&& getBondedDevices()&获得已配对设备,返回绑定(配对)到本地蓝牙的BluetoothDevice对象集合;
&&&&&&& getState()&&&获得本地蓝牙的当前状态,包括STATE_ON、STATE_OFF、STATE_TURNING_ON、STATE_TURNING_OFF四种状态,由BluetoothAdapterStateMachine状态机进行维护
&&&&&&& isEnabled()&&返回当前蓝牙是否可用状态,和getState()==STATE_ON对应。
&&&&&&& enable()&&&&打开本地蓝牙
&&&&&&& disable()&&&&关闭本地蓝牙
&&&&&&& getUuids()&返回本地蓝牙支持的UUIDs数组
&&&&&&&&isDiscovering() &本地蓝牙当前正处于蓝牙设备发现过程
&&&&&&& cancelDiscovery()&取消当前蓝牙设备发现过程
&&&&&&&另外还提供创建RfcommSocket监听通道的API。
&&&&&&&BluetoothAdapter对象通过六个API来创建RfcommSocket数据连接监听通道(三个使用固定端口三个使用随机端口)及一个SCO监听通道(面向连接方式,主要用于话音传输)。三个创建使用固定端口的监听通道API:一个用来创建需要认证和加密的使用固定socket端口的API(需要BLUETOOTH_ADMIN权限许可);一个用来创建不加密不认证的透明固定端口的RFCOMMSocket
API;一个用来创建加密不认证的固定端口的RFCOMMSocket API。三个创建使用随机端口的监听RfcommSocket通道API(一个创建加密认证通道、一个创建透明通道、一个创建加密无认证通道),随机端口的产生由BluetoothAdapter的内部对象RfcommChannelPicker负责产生。
&& &&& 对于蓝牙服务端,可以调用BluetoothAdapter对象的这些API来创建一个BluetoothServerSocket对象,初始化一个服务端RfcommSocket监听通道,并调用BluetoothServerSocket对象的accept函数接收对方连接(实际调用刚实例化的监听RfcommSocket的accept函数)。当成功与对方建立连接后,BluetoothServerSocket对象的accept函数返回一个新RfcommSocket通道,用来作为设备之间的数据传输的通讯通道。
&&&&&& 每个RfcommSocket通道对应一个BluetoothSocket对象。BluetoothServerSocket对象实例化时根据BluetoothServerSocket实例化函数传进来的通道socket类型、是否需要认证对方设备、连接是否加密、远端socket端口等参数来实例化一个BluetoothSocket对象,socket端口参数为空时使用产生的随机端口。实例化BluetoothSocket对象时使用的socket端口值为1到30之间的数,但10、11、12、19四个保留端口留给其它Profile使用。
&&&&&& 在BluetoothSocket对象的实例化函数中还实例化了一个BluetoothInputStream对象和BluetoothOutputStream对象,用作交换数据使用。
&&&&&&&BluetoothSocket对象还可以由蓝牙客户端设备来实例化,即由BluetoothDevice对象来实例化。每个BluetoothDevice对象对应一个远端蓝牙设备。BluetoothDevice对象使用BluetoothSocket对象向蓝牙服务端请求连接。通过BluetoothSocket对象还可以查询远端蓝牙设备的信息如设备名、MAC地址、绑定状态、蓝牙类型等。
&&&&&&&BluetoothDevice对象提供了四个创建RfcommSocket的函数(两个用于创建安全连接,两个用于创建透明连接,而两个安全连接和两个透明连接中一个通过SDP设备发现功能产生的随机socket端口,一个使用固定socket端口)&及一个创建SCO socket(用于话音传输)的函数 createScoSocket。createScoSocket及创建透明固定socket端口的API的使用需要BLUETOOTH_ADMIN权限许可。设备发现功能的实现由SdpHelper对象来实现。
&& &&& 下图是BluetoothService相关类图:
&&&&& &&BluetoothService服务采用三个ProfileHandler对象提供相关Profile API的服务。BluetoothPanProfileHandler用于Bluetooth PanProfile,BluetoothInputProfileHandler用于Bluetooth
InputDeviceProfile,BluetoothHealthProfileHandler用于Bluetooth HealthProfile。
&&&&& &三个ProfileHandler对象通过父对象BluetoothService与其它蓝牙对象交互。三个ProfileHandler对象本身都有一个以BluetoothDevice对象为key的HashMap以维护已连接设备状态。
&&&&&&&BluetoothPanProfileHandl对象还通过ConnectivityManager、INetworkManagementService、BluetoothTetheringDataTracker三个对象和接口与数据连接服务交互实现蓝牙连接共享功能。数据连接服务机制见博主的另一篇博文《》。
&&&&&&&BluetoothHealthProfileHandler使用BluetoothHealthAppConfiguration对象指示一个登记用来与医疗蓝牙设备通讯和接收健康蓝牙设备发来的数据的对象,也称为sink角色,与sink通讯的健康蓝牙设备称为Source。
&&&&& &应用通过调用BluetoothHealth代理对象的registerSinkAppConfiguration函数在BluetoothHealthProfileHandler对象中登记一个BluetoothHealthAppConfiguration对象。
&&&&&& 应用使用BluetoothHealth代理对象的connectChannelToSource或connectChannelToSink函数实现sink与Source的连接。
&&&&&& BluetoothHealthProfileHandler使用IBluetoothHealthCallback回调接口通过BluetoothHealth代理对象向应用发送事件通知。
&&&&&& BluetoothService服务还包括几个状态机对象,采用了状态设计模式。
&&&&&& 一个BluetoothAdapterStateMachine状态机,处理和维护本地蓝牙的状态事件,包括BluetoothOn、Switching、HotOffWarmUp、PowerOff、PerProcessState等几个状态对象,初始状态为PowerOff。BluetoothAdapterStateMachine状态机还通过IBluetoothStateChangeCallback接口向BluetoothAdapter对象通知本地蓝牙的状态。
&&&&&& 在PowerOff状态接收到BluetoothService服务发来的USER_TURN_ON消息时(由应用调用BluetoothAdapter对象的enable函数触发)完成本地蓝牙模块和固件的加载,还启动一个BluetoothEventLoop对象,通过JNI启动一个线程接收本地蓝牙模块bluez产生的蓝牙信号。
&&&&&&&两个BluetoothProfileState状态机,其中一个维护A2dp Profile连接状态的管理,另外一个维护Health Profile连接状态的管理。
&&&&&&&还有一个以蓝牙设备地址为key的BluetoothDeviceProfileState状态机HashMap集合。为每个已配对远程设备提供一个相关的BluetoothDeviceProfileState状态机,用来跟踪所有的蓝牙Profile的输入输出连接。
&&&&&&&&InputDevice profile的连接状态的管理由BluetoothInputProfileHandler对象提供的一个状态机对象进行维护。
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 版权所有,转载时请尊重原创显要处注明链接,谢谢!


&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:313551次
积分:3550
积分:3550
排名:第9147名
原创:51篇
转载:16篇
评论:63条
文章:17篇
阅读:49049
(1)(1)(2)(9)(22)(5)(1)(1)(9)(2)(3)(1)(5)(5)(8)19214人阅读
40.系统集成相关(6)
BluetoothFTPFile Transfer ProfilePBAPPhonebook Access ProfileOBEXOPPSynchronizationBlueZFTPPBAPAPIPBAP
BlueZ Release
BlueZ GitBlueZbluez-gnomeopenobexobexd
BluezWiki BluezHowto
IRC Channel:
irc://freenode/obexd
irc://freenode/bluez
BlueZFTPPBAPProfile4.22BlueZopenobexobexdRelease1.50.92009/1/4
openobexobex protocolAPIConnect / Disconnect / Get / Put / Setpath / Abort command
obexdFTPPBAPOPPprofileServerClient
OBEXServerClientobexdFTPPBAPObexdDBUSdbusAPIdoc
ObexdManagerdbusorg.openobex serviceorg.openobex.Manager Agentsessiontransfersignal
PluginobexdFTPOPPPBAPProfileserverSDPserver
PBAPMAILServercommonPluginCommonobexclientPlugin
FTPManagerDBUSAgenttestpythonsimple-agent
Clientobex-clientdbusorg.openobex.client service org.openobex.Client
FTPPBAPorg.openobex.ClientSessionDBUSSessionsessionobex-clientFTPPBAPDBUSFTPPBAP
FTPPBAP clientSessionAgent
BlueZARMBlueZ
PBAPFTPFTPsamplePBAP
PBAPDBUSAPIdoc/client-api.txtPBAPAPIPBAPSPEC
test/pbap-client pythonsample
samplePBAP
#!/usr/bin/python
import sys
import dbus
bus = dbus.SessionBus()
client = dbus.Interface(bus.get_object("org.openobex.client", "/"),
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& "org.openobex.Client")
org.openobex.ClientobexdMake Installobex-clientdbusserviceobex-client
session_path = client.CreateSession({"Destination": sys.argv[1], "Target": "PBAP"})
PBAPSessionDestinationserverBT
./pbap-client 11:22:33:44:55:66
BTserverOBEXD
pbap = dbus.Interface(bus.get_object("org.openobex.client", session_path),
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& "org.openobex.PhonebookAccess")
session = dbus.Interface(bus.get_object("org.openobex.client", session_path),
&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&"org.openobex.Session")
sessionAgent
pbap.Select("int", "pb")
serverPhonebookPBAPPhonebookSIM phonebookpbichochmchcch +
+ ServerSIMphonebook
ret = pbap.PullAll()
print "%s" % (ret)
phonebookvCard
ret = pbap.GetSize()
print "Size = %d/n" % (ret)
phonebookvCard
ret = pbap.List()
for item in ret:
&&&&&&& print "%s : %s" % (item[0], item[1])
PhonebookvCardvCard0.vcf
if len(ret) & 0:
&&&&&&& ret = pbap.Pull(ret[0][0])
&&&&&&& print "%s" % (ret)
PullphonebookvCardvCard1.vcfvCardList
ret = pbap.ListFilterFields()
for item in ret:
&&&&&&& print "%s" % (item)
PBAPvCardPBAPvCardPBAP ClientDBUSFiltersampleFilter
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:1150922次
积分:8856
积分:8856
排名:第2097名
原创:110篇
评论:172条
文章:19篇
阅读:84507
(2)(3)(5)(1)(2)(1)(2)(2)(4)(1)(1)(3)(2)(1)(2)(2)(4)(1)(5)(12)(1)(1)(2)(1)(8)(1)(1)(2)(1)(1)(2)(8)(6)(2)(1)(1)(8)(7)后使用快捷导航没有帐号?
平板/笔记本
云服务专区
致华为,mate8支持pbap协议吗?蓝牙耳机来电中文报名有....
&初窥门径&
来自:浏览器
华为mate8支持pbap协议吗?就是电话本访问协议,蓝牙耳机支持pbap协议,手机也支持的时候,蓝牙耳机连接后,当来电话时,蓝牙耳机内可以直接报出来电的姓名。我的是捷波朗(Jabra) STEALTH超凡3 幻影 商务通话蓝牙耳机,在iphone6和6s上都正常,来电时可以在耳机内中文播报来电者姓名(手机支持PBAP电话本协议才可以),如“电话来自张三~”,而不是在耳机内播报手机号码的数字,也不是在手机上播报姓名。已开启所连接蓝牙耳机的所有权限,谁有解决之道?或者华为的工程师给看看?& &&&不仅存在上述问题,而且开启手机上的来电播报来电姓名后来电的电话铃声都会改变,哈哈MATE7上就有这问题,这说明华为手机和蓝牙耳机连接技术一直没有做太好,不如iphone通用性强
width:100%">
&初窥门径&
来自:浏览器
搞不好这个,我花四五百专门买的可以中文播报来电者姓名的蓝牙耳机就大大浪费了啊
width:100%">
&花粉特种部队&
来自:浏览器
你好!和整个问题我帮你反馈研发,请他们看看是否支持。
←点击查看& && &
←点击查看
盖章仅为特种队员间跟进识别,不代表结贴,如果有需要,请在我的跟帖点击“回复”我,这样论坛才会提醒我,谢谢!特种部队并不是华为的工作人员,我们是一群玩机爱好者,来自花粉,服务花粉!
width:100%">
&初窥门径&
来自:浏览器
你好!和整个问题我帮你反馈研发,请他们看看是否支持。
为你们的反馈速度点赞,今天手机重启了下好像可以了,冤枉你们了,准备删帖
width:100%">
&初窥门径&
来自:浏览器
怎么删帖啊,请管理员删帖吧,不好意思了。顺便再反馈个问题,不知道是不是个例,我的mate8装了华为自己的运动健康可以正常记录数据,但是微信运动里面同步不了,步数一直是0,能帮忙看下最好了,谢谢
width:100%">
&渐入佳境&
来自:华为Mate8 NXT-AL10
本帖最后由 kjercn 于
12:44 编辑
我的Jabra freeway使用基本正常啊!唯一不爽的是语音控制的声音不能通过蓝牙传出来,还是免提的声音。B352版
width:100%">
花粉特种部队荣耀勋章
相亲角人文随拍青岛之旅河北白石山细看世界鸣沙山随手拍大观公园之夏
花粉客户端
Make it Possible
Make your device special
华为云服务
Huawei cloud services
音乐播放器
Huawei Music
Huawei Vmall
没有最新动态
关注花粉俱乐部
联系我们:
|关注花粉俱乐部:
Copyright (C)
华为软件技术有限公司 版权所有 保留一切权利>> BluetoothPbapVcardManager.java
BluetoothPbapVcardManager.java ( 文件浏览 )
* Copyright (c) , Motorola, Inc.
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of the Motorola, Inc. nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS&
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
package com.android.bluetooth.
import android.content.ContentR
import android.content.C
import android.database.C
import android.net.U
import android.pim.vcard.VCardC
import android.pim.vcard.VCardC
import android.pim.vcard.VCardComposer.OneEntryH
import android.provider.CallL
import android.provider.CallLog.C
import android.monDataK
import android.provider.ContactsContract.C
import android.provider.ContactsContract.D
import android.monDataKinds.P
import android.provider.ContactsContract.PhoneL
import android.text.TextU
import android.util.L
import com.android.bluetooth.R;
import java.io.IOE
import java.io.OutputS
import java.util.ArrayL
import javax.obex.ServerO
import javax.obex.O
import javax.obex.ResponseC
public class BluetoothPbapVcardManager {
private static final String TAG = &BluetoothPbapVcardManager&;
private static final boolean V = BluetoothPbapService.VERBOSE;
private ContentResolver mR
private Context mC
private StringBuilder mVcardResults =
static final String[] PHONES_PROJECTION = new String[] {
Data._ID, // 0
CommonDataKinds.Phone.TYPE, // 1
CommonDataKinds.Phone.LABEL, // 2
CommonDataKinds.Phone.NUMBER, // 3
Contacts.DISPLAY_NAME, // 4
private static final int PHONE_NUMBER_COLUMN_INDEX = 3;
static final String SORT_ORDER_PHONE_NUMBER = CommonDataKinds.Phone.NUMBER + & ASC&;
static final String[] CONTACTS_PROJECTION = new String[] {
Contacts._ID, // 0
Contacts.DISPLAY_NAME, // 1
static final int CONTACTS_ID_COLUMN_INDEX = 0;
static final int CONTACTS_NAME_COLUMN_INDEX = 1;
// call histories use dynamic handles, and handles
// most recently one should be the first handle. In table &calls&, _id and
// date are consistent in ordering, to implement simply, we sort by _id
static final String CALLLOG_SORT_ORDER = Calls._ID + & DESC&;
private static final String CLAUSE_ONLY_VISIBLE = Contacts.IN_VISIBLE_GROUP + &=1&;
public BluetoothPbapVcardManager(final Context context) {
mContext =
mResolver = mContext.getContentResolver();
public final String getOwnerPhoneNumberVcard(final boolean vcardType21) {
BluetoothPbapCallLogComposer composer = new BluetoothPbapCallLogComposer(mContext, false);
String name = BluetoothPbapService.getLocalPhoneName();
String number = BluetoothPbapService.getLocalPhoneNum();
String vcard = poseVCardForPhoneOwnNumber(Phone.TYPE_MOBILE, name, number,
vcardType21);
public final int getPhonebookSize(final int type) {
switch (type) {
case BluetoothPbapObexServer.ContentType.PHONEBOOK:
size = getContactsSize();
size = getCallHistorySize(type);
if (V) Log.v(TAG, &getPhonebookSzie size = & + size + & type = & + type);
public final int getContactsSize() {
final Uri myUri = Contacts.CONTENT_URI;
int size = 0;
Cursor contactCursor =
contactCursor = mResolver.query(myUri, null, CLAUSE_ONLY_VISIBLE, null, null);
if (contactCursor != null) {
size = contactCursor.getCount() + 1; // always has the 0.vcf
} finally {
if (contactCursor != null) {
contactCursor.close();
public final int getCallHistorySize(final int type) {
final Uri myUri = CallLog.Calls.CONTENT_URI;
String selection = BluetoothPbapObexServer.createSelectionPara(type);
int size = 0;
Cursor callCursor =
callCursor = mResolver.query(myUri, null, selection, null,
CallLog.Calls.DEFAULT_SORT_ORDER);
if (callCursor != null) {
size = callCursor.getCount();
} finally {
if (callCursor != null) {
callCursor.close();
public final ArrayList&String& loadCallHistoryList(final int type) {
final Uri myUri = CallLog.Calls.CONTENT_URI;
String selection = BluetoothPbapObexServer.createSelectionPara(type);
String[] projection = new String[] {
Calls.NUMBER, Calls.CACHED_NAME
final int CALLS_NUMBER_COLUMN_INDEX = 0;
final int CALLS_NAME_COLUMN_INDEX = 1;
Cursor callCursor =
ArrayList&String& list = new ArrayList&String&();
callCursor = mResolver.query(myUri, projection, selection, null,
CALLLOG_SORT_ORDER);
if (callCursor != null) {
for (callCursor.moveToFirst(); !callCursor.isAfterLast();
callCursor.moveToNext()) {
String name = callCursor.getString(CALLS_NAME_COLUMN_INDEX);
if (TextUtils.isEmpty(name)) {
// name not found,use number instead
name = callCursor.getString(CALLS_NUMBER_COLUMN_INDEX);
list.add(name);
} finally {
if (callCursor != null) {
callCursor.close();
public final ArrayList&String& getPhonebookNameList(final int orderByWhat) {
ArrayList&String& nameList = new ArrayList&String&();
nameList.add(BluetoothPbapService.getLocalPhoneName());
final Uri myUri = Contacts.CONTENT_URI;
Cursor contactCursor =
if (orderByWhat == BluetoothPbapObexServer.ORDER_BY_INDEXED) {
if (V) Log.v(TAG, &getPhonebookNameList, order by index&);
contactCursor = mResolver.query(myUri, CONTACTS_PROJECTION, CLAUSE_ONLY_VISIBLE,
null, Contacts._ID);
} else if (orderByWhat == BluetoothPbapObexServer.ORDER_BY_ALPHABETICAL) {
if (V) Log.v(TAG, &getPhonebookNameList, order by alpha&);
contactCursor = mResolver.query(myUri, CONTACTS_PROJECTION, CLAUSE_ONLY_VISIBLE,
null, Contacts.DISPLAY_NAME);
if (contactCursor != null) {
for (contactCursor.moveToFirst(); !contactCursor.isAfterLast(); contactCursor
.moveToNext()) {
String name = contactCursor.getString(CONTACTS_NAME_COLUMN_INDEX);
if (TextUtils.isEmpty(name)) {
name = mContext.getString(android.R.string.unknownName);
nameList.add(name);
} finally {
if (contactCursor != null) {
contactCursor.close();
return nameL
public final ArrayList&String& getContactNamesByNumber(final String phoneNumber) {
ArrayList&String& nameList = new ArrayList&String&();
Cursor contactCursor =
if (phoneNumber != null && phoneNumber.length() == 0) {
uri = Contacts.CONTENT_URI;
uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI,
Uri.encode(phoneNumber));
contactCursor = mResolver.query(uri, CONTACTS_PROJECTION, CLAUSE_ONLY_VISIBLE,
null, Contacts._ID);
if (contactCursor != null) {
for (contactCursor.moveToFirst(); !contactCursor.isAfterLast(); contactCursor
.moveToNext()) {
String name = contactCursor.getString(CONTACTS_NAME_COLUMN_INDEX);
long id = contactCursor.getLong(CONTACTS_ID_COLUMN_INDEX);
if (TextUtils.isEmpty(name)) {
name = mContext.getString(android.R.string.unknownName);
if (V) Log.v(TAG, &got name & + name + & by number & + phoneNumber + & @& + id);
nameList.add(name);
(文件超长,未完全显示,请下载后阅读剩余部分)
展开> <收缩
下载源码到电脑,阅读使用更方便
还剩0行未阅读,继续阅读 ▼
Sponsored links
源码文件列表
温馨提示: 点击源码文件名可预览文件内容哦 ^_^
HEAD41.00 B11-03-11 16:15
index20.38 kB11-03-11 16:15
Android.mk257.00 B11-03-11 16:15
7.03 kB11-03-11 16:15
5.68 kB11-03-11 16:15
CleanSpec.mk2.17 kB11-03-11 16:15
bt_incomming_file_notification.png1.53 kB11-03-11 16:15
bt_share.png6.21 kB11-03-11 16:15
icon.png6.21 kB11-03-11 16:15
ic_launcher_folder_bluetooth.png5.59 kB11-03-11 16:15
bt_incomming_file_notification.png964.00 B11-03-11 16:15
bt_share.png3.57 kB11-03-11 16:15
icon.png3.57 kB11-03-11 16:15
ic_launcher_folder_bluetooth.png2.85 kB11-03-11 16:15
1.63 kB11-03-11 16:15
1.59 kB11-03-11 16:15
1.03 kB11-03-11 16:15
2.53 kB11-03-11 16:15
1.51 kB11-03-11 16:15
1.34 kB11-03-11 16:15
3.82 kB11-03-11 16:15
924.00 B11-03-11 16:15
3.05 kB11-03-11 16:15
4.44 kB11-03-11 16:15
922.00 B11-03-11 16:15
951.00 B11-03-11 16:15
12.37 kB11-03-11 16:15
1.67 kB11-03-11 16:15
618.00 B11-03-11 16:15
12.67 kB11-03-11 16:15
2.22 kB11-03-11 16:15
1.08 kB11-03-11 16:15
13.60 kB11-03-11 16:15
2.40 kB11-03-11 16:15
1.17 kB11-03-11 16:15
11.94 kB11-03-11 16:15
2.11 kB11-03-11 16:15
1.09 kB11-03-11 16:15
11.89 kB11-03-11 16:15
2.12 kB11-03-11 16:15
1.03 kB11-03-11 16:15
11.41 kB11-03-11 16:15
1.95 kB11-03-11 16:15
1.00 kB11-03-11 16:15
12.05 kB11-03-11 16:15
2.04 kB11-03-11 16:15
1.06 kB11-03-11 16:15
14.45 kB11-03-11 16:15
2.73 kB11-03-11 16:15
1.19 kB11-03-11 16:15
11.32 kB11-03-11 16:15
1.92 kB11-03-11 16:15
1.01 kB11-03-11 16:15
11.93 kB11-03-11 16:15
2.09 kB11-03-11 16:15
1.07 kB11-03-11 16:15
11.94 kB11-03-11 16:15
2.14 kB11-03-11 16:15
1.09 kB11-03-11 16:15
12.93 kB11-03-11 16:15
2.29 kB11-03-11 16:15
1.09 kB11-03-11 16:15
11.72 kB11-03-11 16:15
2.03 kB11-03-11 16:15
1.02 kB11-03-11 16:15
11.97 kB11-03-11 16:15
2.14 kB11-03-11 16:15
1.11 kB11-03-11 16:15
11.77 kB11-03-11 16:15
2.06 kB11-03-11 16:15
1.04 kB11-03-11 16:15
11.99 kB11-03-11 16:15
2.16 kB11-03-11 16:15
1.06 kB11-03-11 16:15
11.56 kB11-03-11 16:15
1.96 kB11-03-11 16:15
1.03 kB11-03-11 16:15
11.75 kB11-03-11 16:15
2.02 kB11-03-11 16:15
1.04 kB11-03-11 16:15
12.11 kB11-03-11 16:15
2.15 kB11-03-11 16:15
1.07 kB11-03-11 16:15
12.48 kB11-03-11 16:15
2.13 kB11-03-11 16:15
1.06 kB11-03-11 16:15
12.09 kB11-03-11 16:15
2.05 kB11-03-11 16:15
1.02 kB11-03-11 16:15
11.57 kB11-03-11 16:15
2.04 kB11-03-11 16:15
1.07 kB11-03-11 16:15
12.00 kB11-03-11 16:15
2.15 kB11-03-11 16:15
1.04 kB11-03-11 16:15
11.35 kB11-03-11 16:15
2.01 kB11-03-11 16:15
1.03 kB11-03-11 16:15
11.86 kB11-03-11 16:15
2.03 kB11-03-11 16:15
1.04 kB11-03-11 16:15
11.87 kB11-03-11 16:15
2.09 kB11-03-11 16:15
1.04 kB11-03-11 16:15
11.76 kB11-03-11 16:15
2.04 kB11-03-11 16:15
1.06 kB11-03-11 16:15
11.85 kB11-03-11 16:15
2.05 kB11-03-11 16:15
1.05 kB11-03-11 16:15
11.96 kB11-03-11 16:15
2.04 kB11-03-11 16:15
1.08 kB11-03-11 16:15
12.06 kB11-03-11 16:15
2.08 kB11-03-11 16:15
1.10 kB11-03-11 16:15
13.29 kB11-03-11 16:15
2.45 kB11-03-11 16:15
1.17 kB11-03-11 16:15
11.97 kB11-03-11 16:15
2.12 kB11-03-11 16:15
1.04 kB11-03-11 16:15
11.57 kB11-03-11 16:15
2.01 kB11-03-11 16:15
1.03 kB11-03-11 16:15
13.51 kB11-03-11 16:15
2.47 kB11-03-11 16:15
1.13 kB11-03-11 16:15
11.49 kB11-03-11 16:15
2.02 kB11-03-11 16:15
1.02 kB11-03-11 16:15
14.80 kB11-03-11 16:15
2.64 kB11-03-11 16:15
1.26 kB11-03-11 16:15
11.92 kB11-03-11 16:15
2.07 kB11-03-11 16:15
1.05 kB11-03-11 16:15
11.69 kB11-03-11 16:15
2.05 kB11-03-11 16:15
1.03 kB11-03-11 16:15
12.89 kB11-03-11 16:15
2.24 kB11-03-11 16:15
1.13 kB11-03-11 16:15
12.03 kB11-03-11 16:15
2.10 kB11-03-11 16:15
1.06 kB11-03-11 16:15
11.24 kB11-03-11 16:15
1.89 kB11-03-11 16:15
1.02 kB11-03-11 16:15
11.31 kB11-03-11 16:15
1.91 kB11-03-11 16:15
1.01 kB11-03-11 16:15
7.30 kB11-03-11 16:15
3.81 kB11-03-11 16:15
5.33 kB11-03-11 16:15
3.09 kB11-03-11 16:15
8.25 kB11-03-11 16:15
10.68 kB11-03-11 16:15
3.29 kB11-03-11 16:15
13.96 kB11-03-11 16:15
20.12 kB11-03-11 16:15
23.56 kB11-03-11 16:15
20.38 kB11-03-11 16:15
2.63 kB11-03-11 16:15
5.85 kB11-03-11 16:15
17.40 kB11-03-11 16:15
10.83 kB11-03-11 16:15
12.29 kB11-03-11 16:15
8.78 kB11-03-11 16:15
3.10 kB11-03-11 16:15
5.79 kB11-03-11 16:15
42.14 kB11-03-11 16:15
3.91 kB11-03-11 16:15
31.07 kB11-03-11 16:15
20.22 kB11-03-11 16:15
5.58 kB11-03-11 16:15
11.30 kB11-03-11 16:15
2.08 kB11-03-11 16:15
12.97 kB11-03-11 16:15
12.37 kB11-03-11 16:15
8.95 kB11-03-11 16:15
22.51 kB11-03-11 16:15
13.10 kB11-03-11 16:15
3.65 kB11-03-11 16:15
11.61 kB11-03-11 16:15
40.88 kB11-03-11 16:15
2.81 kB11-03-11 16:15
2.87 kB11-03-11 16:15
26.92 kB11-03-11 16:15
23.20 kB11-03-11 16:15
&opp&0.00 B11-03-11 16:15
&pbap&0.00 B11-03-11 16:15
&bluetooth&0.00 B11-03-11 16:15
&android&0.00 B11-03-11 16:15
&drawable-hdpi&0.00 B11-03-11 16:15
&drawable-mdpi&0.00 B11-03-11 16:15
&layout&0.00 B11-03-11 16:15
&menu&0.00 B11-03-11 16:15
&values&0.00 B11-03-11 16:15
&values-ar&0.00 B11-03-11 16:15
&values-bg&0.00 B11-03-11 16:15
&values-ca&0.00 B11-03-11 16:15
&values-cs&0.00 B11-03-11 16:15
&values-da&0.00 B11-03-11 16:15
&values-de&0.00 B11-03-11 16:15
&values-el&0.00 B11-03-11 16:15
&values-en-rGB&0.00 B11-03-11 16:15
&values-es&0.00 B11-03-11 16:15
&values-es-rUS&0.00 B11-03-11 16:15
&values-fa&0.00 B11-03-11 16:15
&values-fi&0.00 B11-03-11 16:15
&values-fr&0.00 B11-03-11 16:15
&values-hr&0.00 B11-03-11 16:15
&values-hu&0.00 B11-03-11 16:15
&values-in&0.00 B11-03-11 16:15
&values-it&0.00 B11-03-11 16:15
&values-iw&0.00 B11-03-11 16:15
&values-ja&0.00 B11-03-11 16:15
&values-ko&0.00 B11-03-11 16:15
&values-lt&0.00 B11-03-11 16:15
&values-lv&0.00 B11-03-11 16:15
&values-nb&0.00 B11-03-11 16:15
&values-nl&0.00 B11-03-11 16:15
&values-pl&0.00 B11-03-11 16:15
&values-pt&0.00 B11-03-11 16:15
&values-pt-rPT&0.00 B11-03-11 16:15
&values-rm&0.00 B11-03-11 16:15
&values-ro&0.00 B11-03-11 16:15
&values-ru&0.00 B11-03-11 16:15
&values-sk&0.00 B11-03-11 16:15
&values-sl&0.00 B11-03-11 16:15
&values-sr&0.00 B11-03-11 16:15
&values-sv&0.00 B11-03-11 16:15
&values-th&0.00 B11-03-11 16:15
&values-tl&0.00 B11-03-11 16:15
&values-tr&0.00 B11-03-11 16:15
&values-uk&0.00 B11-03-11 16:15
&values-vi&0.00 B11-03-11 16:15
&values-zh-rCN&0.00 B11-03-11 16:15
&values-zh-rTW&0.00 B11-03-11 16:15
&com&0.00 B11-03-11 16:15
&.git&0.00 B11-03-11 16:15
&res&0.00 B11-03-11 16:15
&src&0.00 B11-03-11 16:15
&Bluetooth&0.00 B11-03-11 16:15
Sponsored links
评价成功,多谢!
下载android system buletooth trans
CodeForge积分(原CF币)全新升级,功能更强大,使用更便捷,不仅可以用来下载海量源代码马上还可兑换精美小礼品了
您的积分不足
支付宝优惠套餐快速获取 30 积分
10积分 / ¥100
30积分 / ¥200原价 ¥300 元
100积分 / ¥500原价 ¥1000 元
订单支付完成后,积分将自动加入到您的账号。以下是优惠期的人民币价格,优惠期过后将恢复美元价格。
支付宝支付宝付款
微信钱包微信付款
更多付款方式:、
您本次下载所消耗的积分将转交上传作者。
同一源码,30天内重复下载,只扣除一次积分。
鲁ICP备号-3 runtime:Elapsed:69.114ms 27.69
登录 CodeForge
还没有CodeForge账号?
Switch to the English version?
^_^"呃 ...
Sorry!这位大神很神秘,未开通博客呢,请浏览一下其他的吧

我要回帖

更多关于 蓝牙鼠标身份验证错误 的文章

 

随机推荐