import connection from '@kit.NetworkKit';
import { hilog } from '@kit.PerformanceAnalysisKit';
export async function obConnectType(){
let defaultNet = await connection.getDefaultNet();
let data = await connection.getNetCapabilities(defaultNet);
hilog.info(0x0000,'连接属性','默认连接属性为%{public}s',JSON.stringify(data))
let type = data.bearerTypes[0]
return type.toString();
}
export async function isWIFI(): Promise<boolean> {
let defaultNet = await connection.getDefaultNet();
let data = await connection.getNetCapabilities(defaultNet);
hilog.info(0x0000, '连接属性', '默认连接属性为%{public}s', JSON.stringify(data))
let type = data.bearerTypes[0]
return connection.NetBearType.BEARER_WIFI == type;
}