简体   繁体   English

编写特征时不提示配对

[英]Write characteristic without prompt for pairing

In my Android application, I am using BLE and have a read characteristic so that devices can read data from each other with no prompt. 在我的Android应用程序中,我正在使用BLE并具有读取特性,因此设备可以在没有提示的情况下互相读取数据。 I added a write characteristic too now, but now the user is prompted to pair the devices. 我现在也添加了写特性,但是现在提示用户配对设备。 Is it possible to have a write characteristic without the prompt? 如果没有提示,是否可能具有写特性? I don't want to bother the user with it. 我不想打扰用户。

When creating a Bluetooth Low Energy characteristic, there are two main things that you are in control of:- 创建蓝牙低功耗特性时,您需要控制两个主要方面:-

  • Property (readable, writeable, notifiable, etc). 属性(可读,可写,可通知等)。
  • Permission (Open, encrypted, signed). 权限(打开,加密,签名)。

It appears that you are not setting the permission of the characteristic to open. 似乎您没有设置特征的打开权限。 If the characteristic that you are creating is using Android, then you can change this by:- 如果您要创建的特征正在使用Android,则可以通过以下方式对此进行更改:-

BluetoothGattCharacteristic.PROPERTY_WRITE
BluetoothGattCharacteristic.PERMISSION_WRITE

You can find more details about this here:- 您可以在这里找到更多有关此的详细信息:

I hope this helps. 我希望这有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM