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 "net_manager_call_back.h"
24 namespace OHOS {
25 namespace Telephony {
26 class TelephonyExtWrapper final {
27 DECLARE_DELAYED_REF_SINGLETON(TelephonyExtWrapper);
28 
29 public:
30     DISALLOW_COPY_AND_MOVE(TelephonyExtWrapper);
31     void InitTelephonyExtWrapper();
32 
33     typedef void (*DATA_EDN_SELF_CURE)(int32_t&, int32_t&);
34     typedef bool (*IS_APN_ALLOWED_ACTIVE)(int32_t, const char*, bool);
35     /* add for vsim begin */
36     typedef void (*GET_VSIM_SLOT_ID)(int32_t &slotId);
37     typedef bool (*CREATE_ALL_APN_ITEM_EXT)(int32_t slotId, sptr<ApnItem> &apnItem);
38     typedef bool (*IS_CARD_ALLOW_DATA)(int32_t simId, int32_t capability);
39     /* add for vsim end */
40     typedef void (*SEND_DATA_SWITCH_CHANGE_INFO)(const char*, bool);
41     typedef bool (*IS_ALL_CELLULAR_DATA_ALLOWED)(int32_t, const NetRequest &);
42     typedef bool (*IS_DUAL_CELLULAR_CARD_ALLOWED)();
43     DATA_EDN_SELF_CURE dataEndSelfCure_ = nullptr;
44     IS_APN_ALLOWED_ACTIVE isApnAllowedActive_ = nullptr;
45     GET_VSIM_SLOT_ID getVSimSlotId_ = nullptr;
46     CREATE_ALL_APN_ITEM_EXT createAllApnItemExt_ = nullptr;
47     IS_CARD_ALLOW_DATA isCardAllowData_ = nullptr;
48     SEND_DATA_SWITCH_CHANGE_INFO sendDataSwitchChangeInfo_ = nullptr;
49     IS_ALL_CELLULAR_DATA_ALLOWED isAllCellularDataAllowed_ = nullptr;
50     IS_DUAL_CELLULAR_CARD_ALLOWED isDualCellularCardAllowed_ = nullptr;
51 private:
52     void* telephonyExtWrapperHandle_ = nullptr;
53     void* telephonyVSimWrapperHandle_ = nullptr;
54 
55     void InitTelephonyExtWrapperForCellularData();
56     void InitDataEndSelfCure();
57     void InitIsApnAllowedActive();
58     void InitTelephonyExtWrapperForVSim();
59     void InitSendDataSwitchChangeInfo();
60     void InitIsAllCellularDataAllowed();
61     void InitIsDualCellularCardAllowed();
62 };
63 
64 #define TELEPHONY_EXT_WRAPPER ::OHOS::DelayedRefSingleton<TelephonyExtWrapper>::GetInstance()
65 } // namespace Telephony
66 } // namespace OHOS
67 #endif // TELEPHONY_EXT_WRAPPER_H