简体   繁体   English

修改BLE设备名称

[英]Modify the BLE device name

I am working on an iPhone app and this app send command to a board through BLE module. 我正在开发一个iPhone应用程序,这个应用程序通过BLE模块向一个板发送命令。 the board controls some motor to move around. 电路板控制一些电机移动。

I do code on iOS app and another guy do the code on Arduino. 我在iOS应用程序上执行代码,另一个人在Arduino上执行代码。 There is a BLUGiga 112 module on the board. 板上有一个BLUGiga 112模块。

Now, in my iOS app, I can search out available BLE devices, but the detected device name is not always what I want. 现在,在我的iOS应用程序中,我可以搜索出可用的BLE设备,但检测到的设备名称并不总是我想要的。

The device name defined in gatt.xml file can always be detected on the iOS app. 始终可以在iOS应用程序中检测gatt.xml文件中定义的设备名称。 But I want user to be able to change the name by iOS app while the name in xml is static. 但我希望用户能够通过iOS应用程序更改名称,而xml中的名称是静态的。 So I let another hardware engineer write some code to accept new name from iOS and store in flush and then broadcast back to iPhone. 所以我让另一位硬件工程师编写一些代码来接受来自iOS的新名称并存储在flush中,然后再广播回iPhone。 I can pass the name from iOS app and the name is stored in device successfully. 我可以从iOS应用程序传递名称,并且名称已成功存储在设备中。 But next time, when I open iOS app and try to search around, the new name is not always be detected. 但是下次,当我打开iOS应用程序并尝试搜索时,并不总是检测到新名称。

Anybody can tell me why? 谁能告诉我为什么? or what should I do to get the rename function done? 或者我该怎么做才能完成重命名功能?

iOS prevents that Service from being usable by a developer. iOS阻止开发人员使用该服务。 It also caches that data and it is hard to clear that cache. 它还缓存数据并且很难清除缓存。

I ended up making a custom Characteristic that an app could write to. 我最终创建了一个应用程序可以写入的自定义特征。 The firmware would handle that write request and then update the device name and advertising packet. 固件将处理该写请求,然后更新设备名称和广告数据包。 It's seems hacky, but I wasn't able to find a better solution. 这看起来很糟糕,但我无法找到更好的解决方案。

Section 3.12 (page 24) documents the fact iOS does not let a developer use that Service (and a couple others) https://developer.apple.com/hardwaredrivers/BluetoothDesignGuidelines.pdf 第3.12节(第24页)记录了iOS不允许开发人员使用该服务(以及其他几个)的事实https://developer.apple.com/hardwaredrivers/BluetoothDesignGuidelines.pdf

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

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