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 typedef bool (*IS_VSIM_IN_DISABLE_PROCESS)(void); 44 /* add for vsim end */ 45 typedef void (*SEND_DATA_SWITCH_CHANGE_INFO)(const char*, int32_t, bool); 46 typedef bool (*IS_ALL_CELLULAR_DATA_ALLOWED)( 47 const NetRequest &, const HasSystemUse hasSystemUse); 48 typedef bool (*IS_DUAL_CELLULAR_CARD_ALLOWED)(); 49 typedef int64_t (*HANDLE_DEND_FAILCAUSE)(int32_t, int64_t); 50 typedef int32_t (*CONVERT_PDP_ERROR)(int32_t); 51 typedef void (*RESTART_RADIO_IF_RQUIRED)(int32_t, int32_t); 52 typedef bool (*GET_USER_DATA_ROAMING_EXPEND)(int32_t, bool); 53 typedef void (*SEND_APN_NEED_RETRY_INFO)(int32_t); 54 typedef bool (*JUDGE_OTHER_REQUEST_HOLDING)(const NetRequest &, const HasSystemUse hasSystemUse); 55 typedef void (*DynamicLoadInit)(void); 56 typedef void (*NotifyReqCellularData)(bool isReqCellularData); 57 typedef bool (*CREATE_DC_APN_ITEM_EXT)(int32_t slotId, sptr<ApnItem> &apnItem); 58 59 DATA_EDN_SELF_CURE dataEndSelfCure_ = nullptr; 60 IS_APN_ALLOWED_ACTIVE isApnAllowedActive_ = nullptr; 61 GET_VSIM_SLOT_ID getVSimSlotId_ = nullptr; 62 CREATE_ALL_APN_ITEM_EXT createAllApnItemExt_ = nullptr; 63 IS_CARD_ALLOW_DATA isCardAllowData_ = nullptr; 64 IS_VSIM_ENABLED isVSimEnabled_ = nullptr; 65 IS_VSIM_IN_DISABLE_PROCESS isVSimInDisableProcess_ = nullptr; 66 SEND_DATA_SWITCH_CHANGE_INFO sendDataSwitchChangeInfo_ = nullptr; 67 IS_ALL_CELLULAR_DATA_ALLOWED isAllCellularDataAllowed_ = nullptr; 68 IS_DUAL_CELLULAR_CARD_ALLOWED isDualCellularCardAllowed_ = nullptr; 69 GET_USER_DATA_ROAMING_EXPEND getUserDataRoamingExpend_ = nullptr; 70 SEND_APN_NEED_RETRY_INFO sendApnNeedRetryInfo_ = nullptr; 71 HANDLE_DEND_FAILCAUSE handleDendFailcause_ = nullptr; 72 CONVERT_PDP_ERROR convertPdpError_ = nullptr; 73 RESTART_RADIO_IF_RQUIRED restartRadioIfRequired_ = nullptr; 74 JUDGE_OTHER_REQUEST_HOLDING judgeOtherRequestHolding_ = nullptr; 75 DynamicLoadInit dynamicLoadInit_ = nullptr; 76 NotifyReqCellularData dynamicLoadNotifyReqCellularDataStatus_ = nullptr; 77 CREATE_DC_APN_ITEM_EXT createDcApnItemExt_ = nullptr; 78 79 private: 80 void* telephonyExtWrapperHandle_ = nullptr; 81 void* telephonyVSimWrapperHandle_ = nullptr; 82 void* telephonyDynamicLoadWrapperHandle_ = nullptr; 83 84 void InitTelephonyExtWrapperForCellularData(); 85 void InitDataEndSelfCure(); 86 void InitTelephonyExtForCustomization(); 87 void InitTelephonyExtWrapperForVSim(); 88 void InitSendDataSwitchChangeInfo(); 89 void InitIsAllCellularDataAllowed(); 90 void InitIsDualCellularCardAllowed(); 91 void InitHandleDendFailcause(); 92 void InitConvertPdpError(); 93 void InitRestartRadioIfRequired(); 94 void InitSendApnNeedRetryInfo(); 95 void InitJudgeOtherRequestHolding(); 96 void InitTelephonyExtWrapperForDynamicLoad(); 97 void InitCreateDcApnItemExt(); 98 }; 99 100 #define TELEPHONY_EXT_WRAPPER ::OHOS::DelayedRefSingleton<TelephonyExtWrapper>::GetInstance() 101 } // namespace Telephony 102 } // namespace OHOS 103 #endif // TELEPHONY_EXT_WRAPPER_H 104