12 手机网络模块 - MiEcosystem/miot-plugin-sdk GitHub Wiki
手机网络相关接口
Export: public
Doc_name: 手机网络模块
Doc_index: 12
Doc_directory: system
Example
import {System} from "miot"
...
System.network.getGatewayIpAddress().then()
...
-
miot/system
-
~INetwork
-
.getGatewayIpAddress() ⇒
[ 'Promise' ].<object>
-
.getWifiBroadcastAddress() ⇒
[ 'Promise' ].<object>
-
.getGatewayIpAddress() ⇒
-
~INetwork
Kind: inner interface of miot/system
-
~INetwork
-
.getGatewayIpAddress() ⇒
[ 'Promise' ].<object>
-
.getWifiBroadcastAddress() ⇒
[ 'Promise' ].<object>
-
.getGatewayIpAddress() ⇒
获取手机当前连接的路由器IP地址
Kind: instance method of INetwork
Returns: [ 'Promise' ].<object>
- result:
成功时:{"code":0, "data":xxx},data.ipAddress:手机当前连接的路由器IP地址
失败时:{"code":-1, "message":"xxx" }
Since: 10045
Example
System.network.getGatewayIpAddress().then((res) => {
if (res && res.data) {
alert(`getGatewayIpAddress success,ipAddress:${ res.data.ipAddress }`);
} else {
alert(`getGatewayIpAddress fail,${ JSON.stringify(res) }`);
}
}).catch((error) => {
alert(`getGatewayIpAddress fail,${ JSON.stringify(error) }`);
});
获取当前wifi的广播地址
Kind: instance method of INetwork
Returns: [ 'Promise' ].<object>
- result:
成功时:{"code":0, "data":{"address":xxx.xxx.xxx}}
失败时:{"code":-1, "message":"xxx" }
Since: 10047
Example
System.network.getGatewayIpAddress().then( res =>{
alert(JSON.stringify(res));
}).catch(err =>{
alert(JSON.stringify(err));
})