123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <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" wx:if="{{!showWriteInput}}">
- <button bindtap="openBluetoothAdapter" style="font-size: 32rpx;line-height:100rpx;width: 100%;">开始扫描</button>
- <button bindtap="stopBluetoothDevicesDiscovery" style="font-size: 32rpx;line-height:100rpx;width: 100%;">停止扫描</button>
- <button bindtap="closeBluetoothAdapter" style="font-size: 32rpx;line-height:100rpx;width: 100%;">结束流程</button>
- </view>
- <view wx:if="{{!showWriteInput}}" class="devices_summary">已发现 {{devices.length}} 个外围设备:</view>
- <scroll-view wx:if="{{!showWriteInput}}" 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 style="font-size: 10px">Service数量: {{utils.len(item.advertisServiceUUIDs)}}</view> -->
- <view style="font-size: 26rpx">广播数据:{{item.analyzeDataText}}</view>
- </view>
- </scroll-view>
-
- <view class="connected_info" wx:if="{{connected}}">
- <view>
- <text>已连接到 {{name}}</text>
- <view class="operation">
- <button size="mini" bindtap="closeBLEConnection" style="line-height:54rpx; font-size:28rpx;padding:0 20rpx;">断开连接</button>
- </view>
- </view>
- <view wx:for="{{chs}}" wx:key="index" style="font-size: 26rpx; margin-top: 20rpx;">
- <view>特性值: {{item.value}}</view>
- </view>
- </view>
- <view style="width: 100vw;display:flex;flex-wrap: wrap;" wx:if="{{showWriteInput}}">
- <view class = 'operation' bindtap="SendInstructions" data-index="1">同步时间戳</view>
- <view class = 'operation' bindtap="SendInstructions" data-index="2">启动自由跳</view>
- <view class = 'operation' bindtap="SendInstructions" data-index="3">结束自由跳</view>
- <view class = 'operation' bindtap="SendInstructions" data-index="4">启动倒计时</view>
- <view class = 'operation' bindtap="SendInstructions" data-index="5">结束倒计时</view>
- <view class = 'operation' bindtap="SendInstructions" data-index="6">启动倒计数</view>
- <view class = 'operation' bindtap="SendInstructions" data-index="7">结束倒计数</view>
- <view class = 'operation' bindtap="SendInstructions" data-index="8">修改成120秒倒计时</view>
- <view class = 'operation' bindtap="SendInstructions" data-index="9">修改成50个倒计数</view>
- <view class = 'operation'bindtap="SendInstructions" data-index="10">获取离线历史记录</view>
- <view class = 'operation' bindtap="SendInstructions" data-index="11">绑定设备</view>
- </view>
-
-
- <view class="writeInputView" wx:if="{{showWriteInput}}">
-
-
- <view wx:if="{{isStumbleRope === 1}}">
- <view>实时数据上报</view>
- <view>状态:{{state}}(0:跳绳准备阶段1:正在跳绳阶段2:跳绳完成阶段)</view>
- <view>模式:{{model}}(1:自由跳绳2:倒计时跳绳3:倒计数跳绳)</view>
- <view>模式默认值:{{skipNumber}}</view>
- <view>{{skipTime}}当前跳绳累积时间(2字节、小端序)</view>
- <view>{{cumulativeNumber}}当前跳绳累积个数(2字节、小端序)</view>
- <view>电量:{{electricity}}</view>
- </view>
-
-
- <view wx:elif="{{isStumbleRope === 2}}">
- <view>跳绳结束</view>
- <view>时间:{{finishArr.timeStamp}}</view>
- <view>跳绳模式:{{finishArr.model}}</view>
- <view>模式默认值:{{finishArr.skipNumber}}</view>
- <view>总个数{{finishArr.cumulativeNumber}}</view>
- <view>总时间{{finishArr.skipTime}}</view>
- <view>电量:{{electricity}}</view>
- <view>最快频次:{{finishArr.prestissimo}}</view>
- <view>平均频次:{{finishArr.averageVelocity}}</view>
- <view wx:for="{{stumbleRope}}" wx:key="index">
- <view>绊绳数量:{{item.stumbleRopeOneNum}}绊绳时间:{{item.stumbleRopeOneTime}}</view>
- <view>绊绳数量:{{item.stumbleRopeTwoNum}}绊绳时间:{{item.stumbleRopeTwoTime}}</view>
- <view>绊绳数量:{{item.stumbleRopeZeroNum}}绊绳时间:{{item.stumbleRopeZeroTime}}</view>
- </view>
- </view>
-
-
- <view wx:else="{{isStumbleRope === 3}}">
- <view>离线历史记录</view>
- <view>历史记录:{{historicalRecord}}(0x01:请求获取离线记录0x02:清空离线记录)</view>
- <view>是否成功:{{isSupport}}(0x00:成功0x01:失败0x02:不支持)</view>
- <view>历史记录条数:{{record}}(当前离线历史记录条数(2字节、小端序))</view>
- </view>
-
-
- </view>
- </view>
|