将BLE属性值写入iPhone(Bluez)

时间:2014-12-11 20:30:40

标签: ios iphone core-bluetooth dbus bluez

我使用以下文章 https://dobots.nl/2014/07/23/linux-and-le 来验证从Bluez连接,读取和写入属性值到iPhone的能力。我正在运行最新的Bluez堆栈(5.25)和LightBlue应用程序来模拟BLE服务。我执行以下步骤:

  • sudo hcitool lescan (找到服务)
  • sudo attrib / gatttool -t random -b 68:8A:02:D1:32:72 -I
  • 连接(连接到bluez堆栈)
  • char-desc (列出特征描述)
  • char-read-hnd 0x0031 (读取要更新的属性值)
  

[68:8A:02:D1:32:72] [LE]> char-read-hnd 0x0031
  特征值/描述符:01

  • char-write-req 0x0031 00 (写入属性值)
[68:8A:02:D1:32:72][LE]> char-write-req 0x0031 00
Error: Characteristic Write Request failed: Attribute can't be written

我确实将属性权限设置为 读取,写入和通知 ,以便可以正确访问属性值。但是,我不断收到消息:错误:特征写请求失败:无法写入属性

我计划创建一个BLUEZ DBUS C程序,将属性写入我的iOS应用程序。 是否可以在Bluez的iOS应用中编写定义的属性值?

我可以使用TI SensorTag设备执行这些步骤。我也能够从iPhone连接到Bluez并更新属性值,但我想通过Bluez直接执行此操作。

0 个答案:

没有答案