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_RDB_HELPER_H 17 #define CELLULAR_DATA_RDB_HELPER_H 18 19 #include <memory> 20 #include <singleton.h> 21 #include <utility> 22 23 #include "abs_shared_result_set.h" 24 #include "data_ability_helper.h" 25 #include "data_ability_predicates.h" 26 #include "iservice_registry.h" 27 #include "refbase.h" 28 #include "system_ability_definition.h" 29 #include "uri.h" 30 #include "values_bucket.h" 31 32 #include "pdp_profile_data.h" 33 34 namespace OHOS { 35 namespace Telephony { 36 class CellularDataRdbHelper : public DelayedSingleton<CellularDataRdbHelper> { 37 DECLARE_DELAYED_SINGLETON(CellularDataRdbHelper); 38 39 public: 40 bool QueryApns(const std::string &mcc, const std::string &mnc, std::vector<PdpProfile> &apnVec); 41 void RegisterObserver(const sptr<AAFwk::IDataAbilityObserver> &dataObserver); 42 void UnRegisterObserver(const sptr<AAFwk::IDataAbilityObserver> &dataObserver); 43 44 private: 45 std::shared_ptr<AppExecFwk::DataAbilityHelper> CreateDataAbilityHelper(); 46 int Update(const NativeRdb::ValuesBucket &value, const NativeRdb::DataAbilityPredicates &predicates); 47 int Insert(const NativeRdb::ValuesBucket &values); 48 void ReadApnResult(const std::shared_ptr<NativeRdb::AbsSharedResultSet> &result, std::vector<PdpProfile> &apnVec); 49 50 private: 51 std::shared_ptr<AppExecFwk::DataAbilityHelper> helper_; 52 Uri cellularDataUri_; 53 }; 54 } // namespace Telephony 55 } // namespace OHOS 56 #endif // CELLULAR_DATA_RDB_HELPER_H 57