草庐IT

android - Android 4.0 中的蓝牙智能 (4.0)/GATT 支持?

我正在尝试寻找使用现代Android智能手机的蓝牙4.0(又名蓝牙智能)设备的方法,即-HTCOneV。据我了解,由于API限制,即使在带有蓝牙4.0硬件的Android4.0中使用GATT配置文件也存在一些问题。我看到摩托罗拉发布了它自己的BTLEAPI,但不确定它是否适用于其他供应商。我的目标是为所有配备适当硬件的智能手机获得普遍支持。非常感谢任何解决方案的建议。阿列克谢PS:是的,我看到了用于HDP的AndroidAPI,但它似乎只用于“经典”蓝牙设备(不是低功耗设备,如BTLE)。 最佳答案 很遗憾,没有Android原生G

android - 具有 128 位 UUID 的 startLeScan 不适用于 native Android BLE 实现

我在使用startLeScan(newUUID[]{MY_DESIRED_128_BIT_SERVICE_UUID},callback)时遇到问题在我的Nexus4上新引入的Android4.3BLEAPI。回调只是没有被调用。我仍然可以在日志中看到传入的包:08-0215:48:57.985:I/bt-hci(1051):btu_ble_process_adv_pkt08-0215:48:58.636:I/bt-hci(1051):BLEHCI(id=62)event=0x02)如果我不使用该参数来过滤UUID,它会起作用。我们正在为我们公司的设备使用制造商特定的128位UUID。现

android - 具有 128 位 UUID 的 startLeScan 不适用于 native Android BLE 实现

我在使用startLeScan(newUUID[]{MY_DESIRED_128_BIT_SERVICE_UUID},callback)时遇到问题在我的Nexus4上新引入的Android4.3BLEAPI。回调只是没有被调用。我仍然可以在日志中看到传入的包:08-0215:48:57.985:I/bt-hci(1051):btu_ble_process_adv_pkt08-0215:48:58.636:I/bt-hci(1051):BLEHCI(id=62)event=0x02)如果我不使用该参数来过滤UUID,它会起作用。我们正在为我们公司的设备使用制造商特定的128位UUID。现

android - onServicesDiscovered(BluetoothGatt gatt, int status) 永远不会被调用

我有一个从IntentService调用的BluetoothLeService。BLEService在连接之前工作正常。与iBeacon建立连接后,调用;publicvoidonConnectionStateChange(BluetoothGattgatt,intstatus,intnewState){StringintentAction;if(newState==BluetoothProfile.STATE_CONNECTED){intentAction=ACTION_GATT_CONNECTED;mConnectionState=STATE_CONNECTED;broadcastU

android - samsung ble api 无法从多个 GATT 特性中获取通知

我正在三星ACE3上开发一个应用程序来连接低功耗蓝牙设备。由于三星不希望ACE3升级到Android4.3,我需要使用三星bleapi。目前,连接、读取数据、发送数据和从一个特征获取通知都可以。但是,当我为多个特征启用通知时,只有第一个启用的特征能够收到通知。有人有同样的问题吗?感谢您的帮助!以下代码是启用连接通知if(mBluetoothGatt!=null&&device!=null){BluetoothGattServicepucService=mBluetoothGatt.getService(device,PROFILE_UART_CONTROL_SERVICE);if(pu

android - 蓝牙 GATT onConnectionState Change 不适用于 Lollipop

我目前有一种方法可以写入BLE设备以发出蜂鸣声。我的蓝牙回调如下:publicclassReadWriteCharacteristicextendsBluetoothGattCallback{publicReadWriteCharacteristic(Contextcontext,StringmacAddress,UUIDservice,UUIDcharacteristic,Objecttag,Activityactivity){mMacAddress=macAddress;mService=service;mCharacteristic=characteristic;mTag=tag

多次成功连接后,Android GATT 服务返回 Null

我正在开发一个连接到BLE设备的Android应用程序,设备在大多数时间确实连接并且我能够捕获读数。但在多次连接断开后,蓝牙开/关,我的BluetoothGattCallback类方法onServicesDiscovered(BluetoothGattgatt,intstatus)状态为0[这意味着GATT_SUCCESS]。现在当我尝试获取BluetoothGattService时:BluetoothGattServiceservice=gatt.getService(getServiceUUID());它返回null,因此我无法执行后续步骤。请帮我找出问题所在。

android - 连接到 GATT 服务器时从未调用过 onServicesDiscovered

我有一个蓝牙耳机与我的Nexus5X(运行Android7.1)配对,我想连接到耳机的GATT服务器。我用下面的代码试了一下:privateBluetoothGattCallbackbtleGattCallback=newBluetoothGattCallback(){@OverridepublicvoidonConnectionStateChange(BluetoothGattgatt,intstatus,intnewState){Log.d(TAG,"onConnectionStateChange:"+status+","+newState);if(newState==STATE_

android - 如何通过读/写 BLE Gatt 特性实现最大的线程安全性?

我正在与BLE设备通信,该设备通过一个特性向我发送大量数据。相同的特性用于向设备发送数据。在AndroidsBluetoothGattCharacteristic里面有方法publicbyte[]getValue(){returnmValue;}publicbooleansetValue(byte[]value){mValue=value;returntrue;}但是,执行发生在不同的线程中。Android运行大约5个不同的Binder线程,它们调用onCharacteristicChanged(BluetoothGattgatt,BluetoothGattCharacteristic

android - 订阅通知后未调用 BLE GATT onCharacteristicChanged

这是我关于SO的第一篇文章。我在android5.0.2上订阅GATT通知时遇到一些问题。我打算做的是将带有BLEShield的Arduino连接到我的Android手机。我有一个连接到Arduino的传感器,我想使用BLEshield将数据从Arduino发送到我的手机。shield上有个nRF8001是server,我的手机/app是client。我所做的到目前为止是创建一个扫描BLE设备的Android应用程序。它可以连接到设备并读取或写入特性。因此,我可以通过调用gatt.readCharacteristic(mCharacteristic);“手动”读取特性。这使我能够从Ar