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_SETTINGS_RDB_HELPER_H 17 #define CELLULAR_DATA_SETTINGS_RDB_HELPER_H 18 19 #include <memory> 20 #include <singleton.h> 21 #include <utility> 22 23 #include "datashare_helper.h" 24 #include "datashare_predicates.h" 25 #include "datashare_result_set.h" 26 #include "datashare_values_bucket.h" 27 #include "iservice_registry.h" 28 #include "result_set.h" 29 #include "system_ability_definition.h" 30 #include "uri.h" 31 32 namespace OHOS { 33 namespace Telephony { 34 class CellularDataSettingsRdbHelper : public DelayedSingleton<CellularDataSettingsRdbHelper> { 35 DECLARE_DELAYED_SINGLETON(CellularDataSettingsRdbHelper); 36 public: 37 /** 38 * Registers an observer to DataObsMgr specified by the given Uri. 39 * 40 * @param uri, Indicates the path of the data to operate. 41 * @param dataObserver, Indicates the IDataAbilityObserver object. 42 */ 43 void RegisterSettingsObserver(const Uri &uri, const sptr<AAFwk::IDataAbilityObserver> &dataObserver); 44 45 /** 46 * Deregisters an observer used for DataObsMgr specified by the given Uri. 47 * 48 * @param uri, Indicates the path of the data to operate. 49 * @param dataObserver, Indicates the IDataAbilityObserver object. 50 */ 51 void UnRegisterSettingsObserver(const Uri &uri, const sptr<AAFwk::IDataAbilityObserver> &dataObserver); 52 53 /** 54 * Notifies the registered observers of a change to the data resource specified by Uri. 55 * 56 * @param uri, Indicates the path of the data to operate. 57 */ 58 void NotifyChange(const Uri &uri); 59 int32_t GetValue(Uri &uri, const std::string &column, int32_t &value); 60 int32_t PutValue(Uri &uri, const std::string &column, int value); 61 std::shared_ptr<DataShare::DataShareHelper> CreateDataShareHelper(); 62 }; 63 } // namespace Telephony 64 } // namespace OHOS 65 #endif // CELLULAR_DATA_SETTINGS_RDB_HELPER_H 66