1

我正在使用flutter blue与adafruit羽毛板连接并读入/写一些值。我将如何设置我希望从中读取的新特征?我已按照示例进行操作,但在阅读我的 arduino 代码中生成的双精度值时遇到了困难。

 //Read Uuid

 BluetoothCharacteristic readCharacter = new
 BluetoothCharacteristic(uuid: null, serviceUuid: 6e400001-b5a3-f393-e0a9- 
 e50e24dcca9e, descriptors: null,
  properties: null);
//Write UUID

我不确定我想要的特定蓝牙特性的声明需要什么作为参数。文档指示我不确定如何格式化的 uuid?

此外,如果有任何其他简单项目的示例,通过建立的用户界面读取和写入值,那将是很好的查看。

4

1 回答 1

0

You can fetch the UUID from BluetoothCharacteristic by calling BluetoothCharacteristic.uuid.

To filter the specific UUID, you can set a condition inside a for-loop that reads all the characteristics from a BluetoothService.

List<BluetoothCharacteristic> characteristics = service.characteristics; 

for(BluetoothCharacteristic c in characteristics) {
  if(c.uuid == Guid('YOUR_UUID')) debugPrint('${c.uuid} found!');
}
于 2021-06-25T15:19:28.647 回答