标签: gatt

蓝牙低功耗 - notifyCharacteristicChanged()不更新描述符值

我有以下问题 - 我必须在我的应用程序工作时动态更改我的特性(BluetoothGattCharacteristic)中的描述符(BluetoothGattDescriptor).

不幸的是,来自BluetoothGattServer的函数notifyCharacteristicChanged()只更新了特性的值(在Andoird源代码中查找了这个函数 - https://github.com/android/platform_frameworks_base/blob/master/core/java/android/bluetooth/BluetoothGattServer.java),它忽略了描述符.

我的描述符只读一次 - 建立连接时.但是我想动态地改变它,每次重新连接都不是一个选择.

添加具有相同UUID但描述符不同的两个服务或特征并不能解决问题 - 区分它们是不可能的.

有人遇到类似问题吗?

这是代码:

BluetoothGattCharacteristic bc = mBluetoothGattServer.getService(service).getCharacteristic(characteristic);
bc.setValue(data);
bc.getDescriptor(descriptor).setValue(new byte[]{0, 0});      <- no effect here
mBluetoothGattServer.notifyCharacteristicChanged(connectedDevice, bc, false);
Run Code Online (Sandbox Code Playgroud)

谢谢你的建议!

android bluetooth descriptor bluetooth-lowenergy gatt

1
推荐指数
1
解决办法
1389
查看次数

Android 应用程序:使用 UUID 连接到 GATT 服务器

我正在尝试从我的 android 应用程序连接到 Bleno Periphecal GATT 服务器。

GATT 服务器具有带有唯一 UUID 的自定义服务和特性。

如何确定连接到此服务器并发送一些文本?

最小SDK是21,目标SDK是24,所以旧的BluetoothLE Scanning方法被弃用,现在我需要使用BluetoothLEScanner。

android bluetooth bluetooth-lowenergy android-bluetooth gatt

1
推荐指数
1
解决办法
2927
查看次数

Android 蓝牙 BLE 我可以修改哪些连接的配置参数

我正在开发一款与 LE 蓝牙外设配合使用的应用程序。一切正常,我得到了特征服务等。我可以从传感器等获取值。

问题是,应用程序在获取值时有时会“冻结”,有时外设会返回错误的值。我不明白为什么会发生这种情况。

所以我想尝试的是配置一些关于手机和设备之间连接的参数。这就是为什么我想知道连接时可以设置哪些参数(例如,在 GATT 实例上,但不仅如此)。我试图搜索一些有关它的信息,但信息太少了。

这就是为什么我想要一个可以改变设备之间连接性能的参数列表。

我想做的最后一件事就是改变外围设备(adafruit)方面的所有内容。

performance android bluetooth bluetooth-lowenergy gatt

1
推荐指数
1
解决办法
975
查看次数

BLE 从特征接收 GATT 通知

我希望在该特性发生更改时收到通知Micro:Bit

\n\n

我正在做的事情基本上如下:

\n\n

1)检查系统是否兼容BLE

\n\n

2) 启用蓝牙以防其被禁用

\n\n

3) 连接到唯一一个配对设备 (Micro:Bit)

\n\n

4) 当连接发生变化时激活此代码(\xc2\xbfConnected/Disconnected?)

\n\n

5) 当特性更新时激活此代码\xc2\xbf?

\n\n
public class MainActivity extends Activity {\n\nBluetoothAdapter bleAdapter;\n\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n    super.onCreate(savedInstanceState);\n    setContentView(R.layout.activity_main);\n\n    **(1)**\n\n    if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {\n        Toast.makeText(this, "BLE Not Supported", Toast.LENGTH_SHORT).show();\n        finish();\n    }\n\n    **(2)**\n\n    bleAdapter = ((BluetoothManager) getSystemService(BLUETOOTH_SERVICE)).getAdapter();\n\n    if (bleAdapter == null || !bleAdapter.isEnabled()) {\n        Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);\n        startActivityForResult(enableBtIntent, 1);\n    }\n\n    Set<BluetoothDevice> pairedDevices = bleAdapter.getBondedDevices();\n\n    for (BluetoothDevice device : pairedDevices) {\n\n        **(3)**\n\n        device.connectGatt(this, true, new BluetoothGattCallback() …
Run Code Online (Sandbox Code Playgroud)

uuid android characteristics bluetooth-lowenergy gatt

1
推荐指数
1
解决办法
5807
查看次数

GATT服务器无法与Bluez 5.32、5.37一起使用

当我尝试通过带有4.0加密狗的rpi通过电话连接手机时,Bluetoothed出现了这两个错误,有人绊倒吗?

蓝牙[1776]:src / device.c:gatt_debug()MTU交换失败。ATT ECODE:0x06蓝牙[1776]:src / device.c:gatt_client_ready_cb()状态:失败,错误:6

手机连接到rpi,当我运行example-gatt-server脚本时,服务已在服务器中注册,但在我的手机上只有两种,通用属性和通用访问权限

linux bluetooth-lowenergy bluez gatt

0
推荐指数
1
解决办法
966
查看次数

Android使用BluetoothGattServer

对于一个应用程序,我需要一个Android设备既是一个Ble Gatt外设和服务器接受传入和发送传出消息; 但是,除了在github中查看其他项目之外,我似乎找不到有关设置和维护服务器的更多信息.任何人都可以告诉我正确的解决方案或指导我有关设置BluetoothGattServer的更多信息.

android bluetooth-lowenergy gatt

0
推荐指数
1
解决办法
2972
查看次数

如何找到BLE设备不同UUID对应的句柄

使用 gattool,我可以找到与我的智能手表手柄对应的 UUID,如下所示:

Device: MAC address
Name: MS1020
Alias: MS1020
Paired: yes
Trusted: yes
Blocked: no
Connected: no
LegacyPairing: no
UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
UUID: Unknown                   (0000cc00-0000-1000-8000-00805f9b34fb)
UUID: Tencent Holdings Limited  (0000fee7-0000-1000-8000-00805f9b34fb)
UUID: Vendor specific           (00010203-0405-0607-0809-0a0b0c0d1912)
ManufacturerData Key: 0x0211
ManufacturerData Value:
[LE]> characteristics
handle: 0x0002, char properties: 0x12, char value handle: 0x0003, uuid: 2b120008-0600-072a-0100-050200042a00
handle: 0x0004, char properties: 0x02, char value handle: 0x0005, uuid: 0708090a-0b0c-0d2b-1200-080600072a01
handle: 0x0007, char properties: 0x06, char value handle: 0x0008, uuid: 00010203-0405-0607-0809-0a0b0c0d2b12
handle: 0x000b, char …
Run Code Online (Sandbox Code Playgroud)

bluetooth-lowenergy gatt bluetooth-gatt gatttool

0
推荐指数
1
解决办法
6795
查看次数