Преглед изворни кода

设置新的服务器地址后,点击完成,wifi模块立即去新服务器地址注册。

master
elinkthings пре 3 година
родитељ
комит
5c84065e6e

+ 3
- 1
wifi_ble_demo/pages/index/index.js Прегледај датотеку

@@ -200,7 +200,9 @@ Page({
icon: 'none'
})
},500)
wx.navigateBack()
wx.navigateBack({
delta: 100
})
this.setData({
connected: false,
showWriteInput: false,

+ 18
- 4
wifi_ble_demo/pages/serverConfig/serverConfig.js Прегледај датотеку

@@ -54,11 +54,17 @@ Page({
},
tapItem(e) {
let index = e.currentTarget.dataset.index
this.setData({
itemIndex: index
})
console.log('tapItem()', index)
this.showModal()
if (index <= 2) {
this.setData({
itemIndex: index
})
this.showModal()
} else {
//重启模块,模块重启时,ble会断开连接
console.log('重启模块')
this.resetBLEModule()
}
},

confirm() {
@@ -305,4 +311,12 @@ Page({
plugin.sendDataOfA6(cmd)
},

/**
* 重启蓝牙模块
*/
resetBLEModule() {
let cmd = [0x21, 0x01]
plugin.sendDataOfA6(cmd)
},

})

+ 1
- 0
wifi_ble_demo/pages/serverConfig/serverConfig.wxml Прегледај датотеку

@@ -14,6 +14,7 @@ module.exports.len = function(arr) {
<button class="text_left" bindtap="tapItem" data-index='{{0}}' style="font-size: 32rpx;line-height:100rpx;width: 100%;background:#fff">服务器地址:{{serverAddress}}</button>
<button class="text_left" bindtap="tapItem" data-index='{{1}}' style="font-size: 32rpx;line-height:100rpx;width: 100%;background:#fff">端口:{{serverPort}}</button>
<button class="text_left" bindtap="tapItem" data-index='{{2}}' style="font-size: 32rpx;line-height:100rpx;width: 100%;background:#fff">路径:{{serverPath}}</button>
<button bindtap="tapItem" data-index='{{3}}' style="font-size: 32rpx;line-height:100rpx;width: 100%;background:#fff">完成</button>
</view>



Loading…
Откажи
Сачувај