Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bluetooth 使用flatter连接和写入蓝牙设备_Bluetooth_Flutter_Bluetooth Lowenergy - Fatal编程技术网

Bluetooth 使用flatter连接和写入蓝牙设备

Bluetooth 使用flatter连接和写入蓝牙设备,bluetooth,flutter,bluetooth-lowenergy,Bluetooth,Flutter,Bluetooth Lowenergy,我对弗利特很陌生,我只是想让这一切顺利进行 我用的是颤振蓝 尽管如此,它还是有联系的,只是写作时的这个问题 但是当我写的时候,我收到了这个信息。但我不确定我做错了什么 这是我的密码 onPressed: () { print("HEY write pressed"); var fff1 = new Guid("0000fff1-0000-1000-8000-00805f9b34fb");

我对弗利特很陌生,我只是想让这一切顺利进行

我用的是颤振蓝

尽管如此,它还是有联系的,只是写作时的这个问题

但是当我写的时候,我收到了这个信息。但我不确定我做错了什么

这是我的密码

onPressed: () {
                  print("HEY write pressed");
                  var fff1 = new Guid("0000fff1-0000-1000-8000-00805f9b34fb");
                  var fffa = new Guid("0000fffa-0000-1000-8000-00805f9b34fb");
                  BluetoothCharacteristic characteristic = new BluetoothCharacteristic(uuid: fffa, serviceUuid: fff1, descriptors: null, properties: null);
                  _writeCharacteristic(characteristic);
               },
PlatformException(locateCharacteristic,设备上找不到服务,null)

我试着跟随这篇文章。

在生产中,我可能会将UUID保存为变量,但效果应该类似


如果有任何人有任何指导或提示,那将是非常受欢迎的

您的代码是正确的,但要连接到的设备不包含此服务:
var fff1=new Guid(“0000fff1-0000-1000-8000-00805f9b34fb”)


检查要连接到的设备中存在哪些服务。

否这不是原因。Flatter_blue没有最好的异常处理。我对从设备获取的服务也有同样的问题,这很奇怪,因为当我在一秒钟后得到id为f.e.0x0的字符时,我的应用程序告诉我设备上没有这个字符。