开发微信小程序蓝牙的项目,第一次搞,遇到2个坑:
1.安卓和苹果获取的硬件服务UUID顺序不同
2.目前用的这一版 “启用低功耗蓝牙设备特征值变化时的 notify 功能”在安卓和苹果的测试机上都返回启动失败,其实是已经启动成功,在我同事安卓手机上返回的正常。
index.wxml
[html] view plain copy- !--index.wxml--
- view class="content"
- text class="status"适配器状态:{{ status }}/text
- text class="sousuo"是否搜索:{{ sousuo }}/text
- text class="msg"消息:{{ msg }} /text
- text class="msg1"消息:{{ msg1 }}/text
- button type="primary" class="button" bindtap="lanya1"1初始化蓝牙适配器/button
- button type="primary" class="button" bindtap="lanya2"2本机蓝牙适配状态/button
- button type="primary" class="button" bindtap="lanya3"3搜索周边设备/button
- button type="primary" class="button" bindtap="lanya4"4获取设备后在列表中连接/button
- button type="primary" class="button" bindtap="lanya5"5停止搜索周边设备/button
- button type="primary" class="button" bindtap="lanya6"6获取连接设备所有service/button
- button type="primary" class="button" bindtap="lanya7"7获取连接设备所有特征值/button
- button type="primary" class="button" bindtap="lanya8"8发送指定消息/button
- button type="primary" class="button" bindtap="lanya9"9启用设备特征值变化时的notify/button













