/* * Copyright (C) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef APN_MANAGER_H #define APN_MANAGER_H #include #include #include "apn_holder.h" #include "apn_item.h" #include "cellular_data_rdb_helper.h" namespace OHOS { namespace Telephony { class ApnManager : public RefBase { public: ApnManager(); ~ApnManager(); sptr GetApnHolder(const std::string &apnType) const; std::vector> GetAllApnHolder() const; std::vector> GetSortApnHolder() const; void CreateAllApnItem(); std::vector> FilterMatchedApns(const std::string &requestApnType) const; void InitApnHolders(); sptr FindApnHolderById(const int32_t id) const; static int32_t FindApnIdByApnName(const std::string &type); static std::string FindApnNameByApnId(const int32_t id); static int32_t FindApnIdByCapability(const uint64_t capability); bool IsDataConnectionNotUsed(const std::shared_ptr &stateMachine) const; int32_t CreateAllApnItemByDatabase(const std::string &numeric); bool HasAnyConnectedState() const; ApnProfileState GetOverallApnState() const; sptr GetRilAttachApn() const; private: void AddApnHolder(const std::string &apnType, const int32_t priority); private: static const std::map apnIdApnNameMap_; std::vector> allApnItem_; std::vector> apnHolders_; std::map> apnIdApnHolderMap_; std::vector> sortedApnHolders_; }; } // namespace Telephony } // namespace OHOS #endif // APN_MANAGER_H