36 lines
1.3 KiB
Plaintext
36 lines
1.3 KiB
Plaintext
|
|
<wxs module="utils">
|
|||
|
|
module.exports.max = function(n1, n2) {
|
|||
|
|
return Math.max(n1, n2)
|
|||
|
|
}
|
|||
|
|
module.exports.len = function(arr) {
|
|||
|
|
arr = arr || []
|
|||
|
|
return arr.length
|
|||
|
|
}
|
|||
|
|
</wxs>
|
|||
|
|
|
|||
|
|
<view class="container">
|
|||
|
|
<view class="header">
|
|||
|
|
<button bindtap="openBluetoothAdapter">开始扫描</button>
|
|||
|
|
<!-- <button bindtap="stopBluetoothDevicesDiscovery">停止扫描</button> -->
|
|||
|
|
<button bindtap="closeBluetoothAdapter">结束流程</button>
|
|||
|
|
</view>
|
|||
|
|
<view class="weight">
|
|||
|
|
<view>{{weight}}</view>
|
|||
|
|
<view>{{imp}}</view>
|
|||
|
|
<view>{{text}}</view>
|
|||
|
|
</view>
|
|||
|
|
<view class="devices_summary">已发现 {{devices.length}} 个外围设备:</view>
|
|||
|
|
<scroll-view class="device_list" scroll-y scroll-with-animation>
|
|||
|
|
<view wx:for="{{devices}}" wx:key="index" data-device-id="{{item.deviceId}}"
|
|||
|
|
data-name="{{item.name || item.localName}}" data-mac="{{item.mac}}" data-index="{{index}}"
|
|||
|
|
bindtap="createBLEConnection" class="device_item" hover-class="device_item_hover">
|
|||
|
|
<view style="font-size: 32rpx;">
|
|||
|
|
<text style="color:#000;font-weight:bold">{{item.name}}</text>
|
|||
|
|
<text style="font-size:26rpx">(信号强度: {{item.RSSI}}dBm)</text>
|
|||
|
|
</view>
|
|||
|
|
<view style="font-size: 26rpx">mac地址: {{item.macAddr || item.deviceId}}</view>
|
|||
|
|
</view>
|
|||
|
|
</scroll-view>
|
|||
|
|
|
|||
|
|
</view>
|