ElinkThings小程序蓝牙插件SDK集合:aifresh、ailink http://doc.elinkthings.com/web/#/36?page_id=127
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <wxs module="utils">
  2. module.exports.max = function(n1, n2) {
  3. return Math.max(n1, n2)
  4. }
  5. module.exports.len = function(arr) {
  6. arr = arr || []
  7. return arr.length
  8. }
  9. module.exports.fill0 = function(num) {
  10. if (!num) {
  11. return '00'
  12. }
  13. return ('00' + num).slice(-2)
  14. }
  15. </wxs>
  16. <block wx:if="{{!connected}}">
  17. <button bindtap="openBluetoothAdapter">开始扫描</button>
  18. <button bindtap="stopBluetoothDevicesDiscovery">停止扫描</button>
  19. <button bindtap="closeBluetoothAdapter">结束流程</button>
  20. <button bindtap="clearDevices">清空列表</button>
  21. <view class="devices_summary">已发现 {{devices.length}} 个外围设备:</view>
  22. <view class="device_list">
  23. <view wx:for="{{devices}}" wx:key="index"
  24. class="device_item">
  25. <view style="font-size: 16px; color: #333;">{{item.name || item.localName}}</view>
  26. <view style="font-size: 10px">信号强度: {{item.RSSI}}dBm ({{utils.max(0, item.RSSI + 100)}}%)</view>
  27. <view style="font-size: 10px">mac地址: {{item.deviceId}}</view>
  28. <view
  29. class="device_item_btn"
  30. hover-class="btn_hover"
  31. data-device-id="{{item.deviceId}}"
  32. data-name="{{item.name || item.localName}}"
  33. data-index="{{index}}"
  34. bindtap="createBLEConnection"
  35. >连接</view>
  36. </view>
  37. </view>
  38. </block>
  39. <view class="wrap" wx:else>
  40. <view class="stopConnect">
  41. <view>{{mac}}</view>
  42. <view class="btn_connect" hover-class="btn_hover" bindtap="closeBLEConnection">断开连接</view>
  43. </view>
  44. <view class="btn_wrap">
  45. <button bindtap="setSystemTime">设置系统时间</button>
  46. <button bindtap="getSystemTime">获取系统时间</button>
  47. <button bindtap="updateUserList">更新用户列表</button>
  48. <button bindtap="updateUserInformation">更新个人用户信息</button>
  49. <button bindtap="requestHis">请求同步历史记录</button>
  50. <button bindtap="quit">退回蓝牙连接页面</button>
  51. </view>
  52. <!-- <view class="weight_wrap"> -->
  53. <scroll-view class="log" scroll-y style='height:{{2*height}}rpx' scroll-into-view="{{jumpPoint}}">
  54. <view class="logList" wx:for="{{information}}">
  55. {{item}}
  56. </view>
  57. </scroll-view>
  58. </view>