BluetoothDemo/pages/PCJ02/index.wxml

42 lines
1.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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>{{height}}</view>
<view>{{imp}}</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}}"
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 style="font-size: 26rpx">广播数据:{{item.analyzeDataText}}</view> -->
</view>
</scroll-view>
</view>