1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file: Move data interface call 18 */ 19 20import { telephonyData } from './api'; 21import radio from '@ohos.telephony.radio'; 22import LogUtils from '../utils/LogUtils' 23 24const TAG = "getCellularDataRomingEnabledApi" 25/** 26 * Whether to enable cellular data roaming 27 * 28 * @return {Promise} 29 */ 30export function isCellularDataRoamingEnabledCardOne(slotId = 0) { 31 return telephonyData.isCellularDataRoamingEnabled(slotId); 32} 33 34export function isCellularDataRoamingEnabledCardTwo(slotId = 1) { 35 return telephonyData.isCellularDataRoamingEnabled(slotId); 36} 37 38export function getSupportNetwork(slotId = 0) { 39 return new Promise(function (resolve, reject) { 40 try { 41 let isSupported = radio.isNrSupported(); 42 LogUtils.i(TAG, "getSupportNetwork success data:" + JSON.stringify(isSupported)) 43 resolve(isSupported); 44 } catch (error) { 45 LogUtils.i(TAG, "getSupportNetwork success catch:" + JSON.stringify(error)) 46 reject(error); 47 } 48 }); 49}; 50 51/** 52 * Enabling Data Roaming 53 * 54 * @return {Promise} 55 */ 56export function enableCellularDataRoaming(slotId = 0) { 57 return telephonyData.enableCellularDataRoaming(slotId); 58} 59 60/** 61 * Enabling Data Roaming 62 * 63 * @return {Promise} 64 */ 65export function disableCellularDataRoaming(slotId = 0) { 66 return telephonyData.disableCellularDataRoaming(slotId); 67}