ElinkThings小程序蓝牙插件SDK集合:aifresh、ailink http://doc.elinkthings.com/web/#/36?page_id=127
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.

index.wxml 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. </wxs>
  10. <view class="container">
  11. <view class="header" wx:if="{{!showWriteInput}}">
  12. <button bindtap="openBluetoothAdapter" style="font-size: 32rpx;line-height:100rpx;width: 100%;">开始扫描</button>
  13. <button bindtap="stopBluetoothDevicesDiscovery" style="font-size: 32rpx;line-height:100rpx;width: 100%;">停止扫描</button>
  14. <button bindtap="closeBluetoothAdapter" style="font-size: 32rpx;line-height:100rpx;width: 100%;">结束流程</button>
  15. </view>
  16. <view wx:if="{{!showWriteInput}}" class="devices_summary">已发现 {{devices.length}} 个外围设备:</view>
  17. <scroll-view wx:if="{{!showWriteInput}}" class="device_list" scroll-y scroll-with-animation>
  18. <view wx:for="{{devices}}" wx:key="index"
  19. data-device-id="{{item.deviceId}}"
  20. data-name="{{item.name || item.localName}}"
  21. data-mac="{{item.mac}}"
  22. data-index="{{index}}"
  23. bindtap="createBLEConnection"
  24. class="device_item"
  25. hover-class="device_item_hover">
  26. <view style="font-size: 32rpx;">
  27. <text style="color:#000;font-weight:bold">{{item.name}}</text>
  28. <text style="font-size:26rpx">(信号强度: {{item.RSSI}}dBm)</text>
  29. </view>
  30. <view style="font-size: 26rpx">mac地址: {{item.macAddr || item.deviceId}}</view>
  31. <!-- <view style="font-size: 10px">Service数量: {{utils.len(item.advertisServiceUUIDs)}}</view> -->
  32. <view style="font-size: 26rpx">广播数据:{{item.analyzeDataText}}</view>
  33. </view>
  34. </scroll-view>
  35. <view class="connected_info" wx:if="{{connected}}">
  36. <view>
  37. <text>已连接到 {{name}}</text>
  38. <view class="operation">
  39. <button size="mini" bindtap="closeBLEConnection" style="line-height:54rpx; font-size:28rpx;padding:0 20rpx;">断开连接</button>
  40. </view>
  41. </view>
  42. <view wx:for="{{chs}}" wx:key="index" style="font-size: 26rpx; margin-top: 20rpx;">
  43. <view>特性值: {{item.value}}</view>
  44. </view>
  45. </view>
  46. <view style="width: 100vw;display:flex;flex-wrap: wrap;" wx:if="{{showWriteInput}}">
  47. <view class = 'operation' bindtap="SendInstructions" data-index="1">同步时间戳</view>
  48. <view class = 'operation' bindtap="SendInstructions" data-index="2">启动自由跳</view>
  49. <view class = 'operation' bindtap="SendInstructions" data-index="3">结束自由跳</view>
  50. <view class = 'operation' bindtap="SendInstructions" data-index="4">启动倒计时</view>
  51. <view class = 'operation' bindtap="SendInstructions" data-index="5">结束倒计时</view>
  52. <view class = 'operation' bindtap="SendInstructions" data-index="6">启动倒计数</view>
  53. <view class = 'operation' bindtap="SendInstructions" data-index="7">结束倒计数</view>
  54. <view class = 'operation' bindtap="SendInstructions" data-index="8">修改成120秒倒计时</view>
  55. <view class = 'operation' bindtap="SendInstructions" data-index="9">修改成50个倒计数</view>
  56. <view class = 'operation'bindtap="SendInstructions" data-index="10">获取离线历史记录</view>
  57. <view class = 'operation' bindtap="SendInstructions" data-index="11">绑定设备</view>
  58. </view>
  59. <view class="writeInputView" wx:if="{{showWriteInput}}">
  60. <view wx:if="{{isStumbleRope === 1}}">
  61. <view>实时数据上报</view>
  62. <view>状态:{{state}}(0:跳绳准备阶段1:正在跳绳阶段2:跳绳完成阶段)</view>
  63. <view>模式:{{model}}(1:自由跳绳2:倒计时跳绳3:倒计数跳绳)</view>
  64. <view>模式默认值:{{skipNumber}}</view>
  65. <view>{{skipTime}}当前跳绳累积时间(2字节、小端序)</view>
  66. <view>{{cumulativeNumber}}当前跳绳累积个数(2字节、小端序)</view>
  67. <view>电量:{{electricity}}</view>
  68. </view>
  69. <view wx:elif="{{isStumbleRope === 2}}">
  70. <view>跳绳结束</view>
  71. <view>时间:{{finishArr.timeStamp}}</view>
  72. <view>跳绳模式:{{finishArr.model}}</view>
  73. <view>模式默认值:{{finishArr.skipNumber}}</view>
  74. <view>总个数{{finishArr.cumulativeNumber}}</view>
  75. <view>总时间{{finishArr.skipTime}}</view>
  76. <view>电量:{{electricity}}</view>
  77. <view>最快频次:{{finishArr.prestissimo}}</view>
  78. <view>平均频次:{{finishArr.averageVelocity}}</view>
  79. <view wx:for="{{stumbleRope}}" wx:key="index">
  80. <view>绊绳数量:{{item.stumbleRopeOneNum}}绊绳时间:{{item.stumbleRopeOneTime}}</view>
  81. <view>绊绳数量:{{item.stumbleRopeTwoNum}}绊绳时间:{{item.stumbleRopeTwoTime}}</view>
  82. <view>绊绳数量:{{item.stumbleRopeZeroNum}}绊绳时间:{{item.stumbleRopeZeroTime}}</view>
  83. </view>
  84. </view>
  85. <view wx:else="{{isStumbleRope === 3}}">
  86. <view>离线历史记录</view>
  87. <view>历史记录:{{historicalRecord}}(0x01:请求获取离线记录0x02:清空离线记录)</view>
  88. <view>是否成功:{{isSupport}}(0x00:成功0x01:失败0x02:不支持)</view>
  89. <view>历史记录条数:{{record}}(当前离线历史记录条数(2字节、小端序))</view>
  90. </view>
  91. </view>
  92. </view>