index.wxml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <!--index.wxml-->
  2. <view class="container">
  3. <view class="userinfo">
  4. <button wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>
  5. <block wx:else>
  6. <image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image>
  7. <text class="userinfo-nickname">{{userInfo.nickName}}</text>
  8. </block>
  9. </view>
  10. <view class="usermotto">
  11. <text class="user-motto">{{motto}}</text>
  12. <button bindtap='openDoor'>开启</button>
  13. <button bindtap='openadapter'>打开适配器</button>
  14. <button bindtap='closeadapter'>关闭适配器</button>
  15. <button bindtap='opendiscovery'>开始搜索</button>
  16. <button bindtap='closediscovery'>关闭搜索</button>
  17. <button bindtap='getdevice'>获取设备</button>
  18. <button bindtap='getconnecteddevice'>获取已连接设备</button>
  19. <button bindtap='connecteddevice'>连接我的设备</button>
  20. <button bindtap='getservice'>获取服务</button>
  21. <button bindtap='getcharacteristics'>获取特征值</button>
  22. <button bindtap='startread'>读取值</button>
  23. <button bindtap='startnotify'>开启notify</button>
  24. <button bindtap='startwrite'>写数据</button>
  25. <view v-for="(item,index) in devices" :key="index" bindtap="createBLEConnection(item)" class="device_item"
  26. hover-class="device_item_hover">
  27. {{item.name}}
  28. 信号强度: {{item.RSSI}}dBm {{Math.max(0, item.RSSI + 100)}}%
  29. UUID: {{item.deviceId}}
  30. Service数量: {{item.advertisServiceUUIDs.length}}
  31. 已连接到 {{name}}
  32. 特性UUID: {{item.uuid}}
  33. 特性值: {{item.value}}
  34. </view>
  35. </view>
  36. </view>