小程序蓝牙通信例子
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
1.4 KiB

  1. <!--pages/lanyatest/lanyatest.wxml-->
  2. <view class="contentview">
  3. <view class='myview' >
  4. {{info}}
  5. </view>
  6. <button type="primary" class="button" bindtap="lanyatest1">1初始化蓝牙</button>
  7. <button type="primary" class="button" bindtap="lanyatest2">2获取蓝牙状态</button>
  8. <button type="primary" class="button" bindtap="lanyatest3">3搜索周边设备</button>
  9. <button type="primary" class="button" bindtap="lanyatest4">4获取所有设备</button>
  10. <block wx:for="{{devices}}" wx:key="{{test}}">
  11. <button type="primary" class="button" id="{{item.deviceId}}" style='background-color:red' bindtap="lanyaconnect">5连接{{item.name}} </button>
  12. </block>
  13. <button type="primary" class="button" bindtap="lanyatest6">6停止搜索周边蓝牙设备</button>
  14. <button type="primary" class="button" bindtap="lanyatest7">7获取所有service</button>
  15. <button type="primary" class="button" bindtap="lanyatest8">8获取所有特征值</button>
  16. <button type="primary" class="button" bindtap="lanyatest9">9启用特征值变化notify</button>
  17. <button type="primary" class="button" bindtap="lanyatest10">10接收蓝牙返回消息</button>
  18. <view class="section">
  19. <input placeholder='请输入要发送的信息' bindinput='getmsg'/>
  20. </view>
  21. <button type="primary" class="button" bindtap="lanyatest11">11微信发送消息</button>
  22. <button type="primary" class="button" bindtap="lanyatest12">12断开蓝牙设备</button>
  23. </view>