getConnectedWifi
简介
获取已连接中的 Wi-Fi 信息
入参
无
callback 返回参数说明
Object res
参数 | 类型 | 说明 |
---|---|---|
wifi | wifiInfo | Wi-Fi 信息 |
示例代码
Page({
data: {
wifiStatus: '',
getConnectedWifi: '',
},
onReady() {
this.startWifi().then(() => {
this.getConnectedWifi();
});
},
startWifi() {
const _that = this;
return new Promise((resolve, reject) => {
dlt.startWifi({
success: function (res) {
console.log('startWifi success', res);
_that.setData({
wifiStatus: 'startWifi',
});
resolve(res);
},
complete: function (res) {
console.log('startWifi complete', res);
},
fail: function (res) {
console.log('startWifi fail', res);
reject(res);
},
});
});
},
getConnectedWifi() {
const _that = this;
dlt.getConnectedWifi({
success: function (res) {
console.log('getConnectedWifi success', res);
_that.setData({
getConnectedWifi: res,
});
},
complete: function (res) {
console.log('getConnectedWifi complete', res);
},
fail: function (res) {
console.log('getConnectedWifi fail', res);
_that.setData({
getConnectedWifi: res,
});
},
});
},
});