1885b47fbSopenharmony_ci/* 2885b47fbSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 3885b47fbSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4885b47fbSopenharmony_ci * you may not use this file except in compliance with the License. 5885b47fbSopenharmony_ci * You may obtain a copy of the License at 6885b47fbSopenharmony_ci * 7885b47fbSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8885b47fbSopenharmony_ci * 9885b47fbSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10885b47fbSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11885b47fbSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12885b47fbSopenharmony_ci * See the License for the specific language governing permissions and 13885b47fbSopenharmony_ci * limitations under the License. 14885b47fbSopenharmony_ci */ 15885b47fbSopenharmony_ci 16885b47fbSopenharmony_ci#ifndef ACCESSIBILITY_SETTING_PROVIDER_H 17885b47fbSopenharmony_ci#define ACCESSIBILITY_SETTING_PROVIDER_H 18885b47fbSopenharmony_ci 19885b47fbSopenharmony_ci#include "errors.h" 20885b47fbSopenharmony_ci#include "mutex" 21885b47fbSopenharmony_ci#include "accessibility_setting_observer.h" 22885b47fbSopenharmony_ci#include "accessibility_datashare_helper.h" 23885b47fbSopenharmony_ci#include "accessibility_caption.h" 24885b47fbSopenharmony_ci 25885b47fbSopenharmony_cinamespace OHOS { 26885b47fbSopenharmony_cinamespace Accessibility { 27885b47fbSopenharmony_ciclass AccessibilitySettingProvider : public AccessibilityDatashareHelper { 28885b47fbSopenharmony_cipublic: 29885b47fbSopenharmony_ci static std::shared_ptr<AccessibilitySettingProvider> GetInstance(int32_t systemAbilityId); 30885b47fbSopenharmony_ci static std::shared_ptr<AccessibilitySettingProvider> instance_; 31885b47fbSopenharmony_ci AccessibilitySettingProvider(); 32885b47fbSopenharmony_ci ~AccessibilitySettingProvider(); 33885b47fbSopenharmony_ci void DeleteInstance(); 34885b47fbSopenharmony_ci RetError GetStringValue(const std::string& key, std::string& value); 35885b47fbSopenharmony_ci RetError GetIntValue(const std::string& key, int32_t& value); 36885b47fbSopenharmony_ci RetError GetLongValue(const std::string& key, int64_t& value); 37885b47fbSopenharmony_ci RetError GetBoolValue(const std::string& key, bool& value); 38885b47fbSopenharmony_ci RetError GetFloatValue(const std::string& key, float& value); 39885b47fbSopenharmony_ci RetError PutStringValue(const std::string& key, const std::string& value, bool needNotify = true); 40885b47fbSopenharmony_ci RetError PutIntValue(const std::string& key, int32_t value, bool needNotify = true); 41885b47fbSopenharmony_ci RetError PutLongValue(const std::string& key, int64_t value, bool needNotify = true); 42885b47fbSopenharmony_ci RetError PutBoolValue(const std::string& key, bool value, bool needNotify = true); 43885b47fbSopenharmony_ci bool IsValidKey(const std::string& key); 44885b47fbSopenharmony_ci sptr<AccessibilitySettingObserver> CreateObserver(const std::string& key, 45885b47fbSopenharmony_ci AccessibilitySettingObserver::UpdateFunc& func); 46885b47fbSopenharmony_ci 47885b47fbSopenharmony_ci RetError RegisterObserver(const std::string& key, AccessibilitySettingObserver::UpdateFunc& func); 48885b47fbSopenharmony_ci RetError UnregisterObserver(const std::string& key); 49885b47fbSopenharmony_ciprivate: 50885b47fbSopenharmony_ci std::string GetConfigKey(int32_t state); 51885b47fbSopenharmony_ci 52885b47fbSopenharmony_ciprivate: 53885b47fbSopenharmony_ci static ffrt::mutex mutex_; 54885b47fbSopenharmony_ci}; 55885b47fbSopenharmony_ci} // namespace Accessibility 56885b47fbSopenharmony_ci} // namespace OHOS 57885b47fbSopenharmony_ci#endif // ACCESSIBILITY_SETTING_PROVIDER_H