1 /* 2 * Copyright (C) 2021 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 CELLULAR_DATA_NET_AGENT_H 17 #define CELLULAR_DATA_NET_AGENT_H 18 19 #include <singleton.h> 20 #include <memory> 21 #include <string> 22 #include <utility> 23 24 #include "i_net_conn_service.h" 25 #include "if_system_ability_manager.h" 26 #include "iservice_registry.h" 27 #include "system_ability_definition.h" 28 29 #include "cellular_data_constant.h" 30 #include "net_manager_call_back.h" 31 #include "net_manager_tactics_call_back.h" 32 33 namespace OHOS { 34 namespace Telephony { 35 class CellularDataNetAgent : public DelayedRefSingleton<CellularDataNetAgent> { 36 DECLARE_DELAYED_REF_SINGLETON(CellularDataNetAgent); 37 38 public: 39 /** 40 * Register the network information with the network management module 41 * 42 * @return true if register success else return false; 43 */ 44 bool RegisterNetSupplier(const int32_t slotId); 45 46 /** 47 * Cancel the registration information to the network management 48 * 49 * @param slotId card slot identification 50 */ 51 void UnregisterNetSupplier(const int32_t slotId); 52 53 /** 54 * Cancel the registration information to the network management for sim state update 55 * 56 * @param slotId card slot identification 57 */ 58 void UnregisterNetSupplierForSimUpdate(const int32_t slotId); 59 60 /** 61 * Cancel all registration information to the network management 62 */ 63 void UnregisterAllNetSupplier(); 64 65 bool RegisterPolicyCallback(); 66 void UnregisterPolicyCallback(); 67 68 /** 69 * Update network information 70 * 71 * @param supplierId network unique identity id returned after network registration 72 * @param netSupplierInfo network data information 73 */ 74 void UpdateNetSupplierInfo(int32_t supplierId, sptr<NetManagerStandard::NetSupplierInfo> &netSupplierInfo); 75 76 /** 77 * Update link information 78 * 79 * @param supplierId network unique identity id returned after network registration 80 * @param netLinkInfo network link data information 81 */ 82 void UpdateNetLinkInfo(int32_t supplierId, sptr<NetManagerStandard::NetLinkInfo> &netLinkInfo); 83 84 /** 85 * Collect all network 86 * 87 * @param netSupplier a specific network 88 */ 89 void AddNetSupplier(const NetSupplier &netSupplier); 90 91 /** 92 * Clear all network 93 */ 94 void ClearNetSupplier(); 95 96 /** 97 * Gets the unique identity of successful registered registration 98 * 99 * @param slotId card slot identification 100 * @param capability a network capability 101 * @return unique identify 102 */ 103 int32_t GetSupplierId(const int32_t slotId, uint64_t capability) const; 104 105 void RegisterSlotType(int32_t supplierId, int32_t radioTech); 106 107 private: 108 std::vector<NetSupplier> netSuppliers_; 109 sptr<NetManagerCallBack> callBack_; 110 sptr<NetManagerTacticsCallBack> tacticsCallBack_; 111 }; 112 } // namespace Telephony 113 } // namespace OHOS 114 #endif // CELLULAR_DATA_NET_AGENT_H 115