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 #ifndef TELEPHONY_EXT_WRAPPER_H 17 #define TELEPHONY_EXT_WRAPPER_H 18 19 #include "nocopyable.h" 20 #include "singleton.h" 21 22 #include "apn_item.h" 23 #include "apn_holder.h" 24 #include "net_manager_call_back.h" 25 #include "net_supplier_callback_base.h" 26 27 namespace OHOS { 28 namespace Telephony { 29 class TelephonyExtWrapper final { 30 DECLARE_DELAYED_REF_SINGLETON(TelephonyExtWrapper); 31 32 public: 33 DISALLOW_COPY_AND_MOVE(TelephonyExtWrapper); 34 void InitTelephonyExtWrapper(); 35 36 typedef void (*DATA_EDN_SELF_CURE)(int32_t&, int32_t&); 37 typedef bool (*IS_APN_ALLOWED_ACTIVE)(int32_t, const char*, bool); 38 /* add for vsim begin */ 39 typedef void (*GET_VSIM_SLOT_ID)(int32_t &slotId); 40 typedef bool (*CREATE_ALL_APN_ITEM_EXT)(int32_t slotId, sptr<ApnItem> &apnItem); 41 typedef bool (*IS_CARD_ALLOW_DATA)(int32_t simId, int32_t capability); 42 typedef bool (*IS_VSIM_ENABLED)(void); 43 /* add for vsim end */ 44 typedef void (*SEND_DATA_SWITCH_CHANGE_INFO)(const char*, bool); 45 typedef bool (*IS_ALL_CELLULAR_DATA_ALLOWED)( 46 const NetRequest &, const HasSystemUse hasSystemUse); 47 typedef bool (*IS_DUAL_CELLULAR_CARD_ALLOWED)(); 48 typedef int64_t (*HANDLE_DEND_FAILCAUSE)(int32_t, int64_t); 49 typedef int32_t (*CONVERT_PDP_ERROR)(int32_t); 50 typedef void (*RESTART_RADIO_IF_RQUIRED)(int32_t, int32_t); 51 typedef bool (*GET_USER_DATA_ROAMING_EXPEND)(int32_t, bool); 52 typedef void (*SEND_APN_NEED_RETRY_INFO)(int32_t); 53 DATA_EDN_SELF_CURE dataEndSelfCure_ = nullptr; 54 IS_APN_ALLOWED_ACTIVE isApnAllowedActive_ = nullptr; 55 GET_VSIM_SLOT_ID getVSimSlotId_ = nullptr; 56 CREATE_ALL_APN_ITEM_EXT createAllApnItemExt_ = nullptr; 57 IS_CARD_ALLOW_DATA isCardAllowData_ = nullptr; 58 IS_VSIM_ENABLED isVSimEnabled_ = nullptr; 59 SEND_DATA_SWITCH_CHANGE_INFO sendDataSwitchChangeInfo_ = nullptr; 60 IS_ALL_CELLULAR_DATA_ALLOWED isAllCellularDataAllowed_ = nullptr; 61 IS_DUAL_CELLULAR_CARD_ALLOWED isDualCellularCardAllowed_ = nullptr; 62 GET_USER_DATA_ROAMING_EXPEND getUserDataRoamingExpend_ = nullptr; 63 SEND_APN_NEED_RETRY_INFO sendApnNeedRetryInfo_ = nullptr; 64 HANDLE_DEND_FAILCAUSE handleDendFailcause_ = nullptr; 65 CONVERT_PDP_ERROR convertPdpError_ = nullptr; 66 RESTART_RADIO_IF_RQUIRED restartRadioIfRequired_ = nullptr; 67 private: 68 void* telephonyExtWrapperHandle_ = nullptr; 69 void* telephonyVSimWrapperHandle_ = nullptr; 70 71 void InitTelephonyExtWrapperForCellularData(); 72 void InitDataEndSelfCure(); 73 void InitTelephonyExtForCustomization(); 74 void InitTelephonyExtWrapperForVSim(); 75 void InitSendDataSwitchChangeInfo(); 76 void InitIsAllCellularDataAllowed(); 77 void InitIsDualCellularCardAllowed(); 78 void InitHandleDendFailcause(); 79 void InitConvertPdpError(); 80 void InitRestartRadioIfRequired(); 81 void InitSendApnNeedRetryInfo(); 82 }; 83 84 #define TELEPHONY_EXT_WRAPPER ::OHOS::DelayedRefSingleton<TelephonyExtWrapper>::GetInstance() 85 } // namespace Telephony 86 } // namespace OHOS 87 #endif // TELEPHONY_EXT_WRAPPER_H