getConnectedWifi
Introduction
Gets information about the currently connected Wi-Fi network.
Parameters
None
Callback Return Parameter
Object res
Parameter | Type | Description |
---|---|---|
wifi | wifiInfo | Wi-Fi information |
Sample Code
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,
});
},
});
},
});