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.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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="topView">
  11. <view class="op-topView">{{headTip}}</view>
  12. </view>
  13. <view class="ming"> {{dev1}} {{devices.length}} {{dev2}} {{shebei}}</view>
  14. <view wx:for="{{devices}}" wx:for-item="item"
  15. data-title="{{item.deviceId}}"
  16. data-name="{{item.name}}"
  17. data-macaddress="{{item.advertisData}}"
  18. data-advertisData="{{item.advertisServiceUUIDs}}"
  19. wx:key="{{item.deviceId}}" bindtap="bindViewTap">
  20. <view class="cell-item">
  21. <view class="cell-head">
  22. <view >名称:{{item.name}}</view>
  23. <view >信号强度::{{item.RSSI}}dBm ({{utils.max(0, item.RSSI + 100)}}%)</view>
  24. <view class='cell-head-id'>地址:{{item.advertisData}}</view>
  25. </view>
  26. <view class="cell-click">
  27. <text>{{dainji}}</text>
  28. </view>
  29. </view>
  30. </view>
  31. <!-- 没有找到设备
  32. <view class="hide{{showView?'show':''}}" bindtap="onChangeShowState">
  33. <image src='../Image/timg.jpg'></image>
  34. </view>
  35. <button bindtap="openBluetoothAdapter">开始扫描</button>
  36. <button bindtap="stopBluetoothDevicesDiscovery">停止扫描</button>
  37. <button bindtap="closeBluetoothAdapter">结束流程</button>
  38. <view class="devices_summary">已发现 {{devices.length}} 个外围设备:</view>
  39. <scroll-view class="device_list" scroll-y scroll-with-animation>
  40. <view wx:for="{{devices}}" wx:key="index"
  41. data-device-id="{{item.deviceId}}"
  42. data-name="{{item.name || item.localName}}"
  43. bindtap="createBLEConnection"
  44. class="device_item"
  45. hover-class="device_item_hover">
  46. <view style="font-size: 16px; color: #333;">{{item.name}}</view>
  47. <view style="font-size: 10px">信号强度: {{item.RSSI}}dBm ({{utils.max(0, item.RSSI + 100)}}%)</view>
  48. <view style="font-size: 10px">UUID: {{item.deviceId}}</view>
  49. <view style="font-size: 10px">Service数量: {{utils.len(item.advertisServiceUUIDs)}}</view>
  50. </view>
  51. </scroll-view>
  52. -->