1 /* 2 * Copyright (C) 2023 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 ACCESSIBILITY_SETTINGS_H 17 #define ACCESSIBILITY_SETTINGS_H 18 19 #include <string> 20 #include <vector> 21 #include "event_handler.h" 22 23 namespace OHOS { 24 namespace Accessibility { 25 class AccessibilitySettings { 26 public: 27 AccessibilitySettings() = default; 28 ~AccessibilitySettings() = default; 29 30 void RegisterSettingsHandler(const std::shared_ptr<AppExecFwk::EventHandler> &handler); 31 void RegisterParamWatcher(); 32 static void OnParameterChanged(const char *key, const char *value, void *context); 33 34 RetError SetScreenMagnificationState(const bool state); 35 RetError SetShortKeyState(const bool state); 36 RetError SetMouseKeyState(const bool state); 37 RetError SetMouseAutoClick(const int32_t time); 38 RetError SetShortkeyTarget(const std::string &name); 39 RetError SetShortkeyMultiTarget(const std::vector<std::string> &name); 40 RetError SetHighContrastTextState(const bool state); 41 RetError SetInvertColorState(const bool state); 42 RetError SetAnimationOffState(const bool state); 43 RetError SetAudioMonoState(const bool state); 44 RetError SetDaltonizationState(const bool state); 45 RetError SetDaltonizationColorFilter(const uint32_t filter); 46 RetError SetContentTimeout(const uint32_t time); 47 RetError SetBrightnessDiscount(const float discount); 48 RetError SetAudioBalance(const float balance); 49 RetError SetClickResponseTime(const uint32_t time); 50 RetError SetIgnoreRepeatClickState(const bool state); 51 RetError SetIgnoreRepeatClickTime(const uint32_t time); 52 53 RetError GetScreenMagnificationState(bool &state); 54 RetError GetShortKeyState(bool &state); 55 RetError GetMouseKeyState(bool &state); 56 RetError GetMouseAutoClick(int32_t &time); 57 RetError GetShortkeyTarget(std::string &name); 58 RetError GetShortkeyMultiTarget(std::vector<std::string> &name); 59 RetError GetHighContrastTextState(bool &state); 60 RetError GetInvertColorState(bool &state); 61 RetError GetAnimationOffState(bool &state); 62 RetError GetAudioMonoState(bool &state); 63 RetError GetDaltonizationState(bool &state); 64 RetError GetDaltonizationColorFilter(uint32_t &type); 65 RetError GetContentTimeout(uint32_t &timer); 66 RetError GetBrightnessDiscount(float &brightness); 67 RetError GetAudioBalance(float &balance); 68 RetError GetClickResponseTime(uint32_t &time); 69 RetError GetIgnoreRepeatClickState(bool &state); 70 RetError GetIgnoreRepeatClickTime(uint32_t &time); 71 72 void UpdateConfigState(); 73 void UpdateAudioBalance(); 74 void UpdateBrightnessDiscount(); 75 void UpdateContentTimeout(); 76 void UpdateDaltonizationColorFilter(); 77 void UpdateMouseAutoClick(); 78 void UpdateShortkeyTarget(); 79 void UpdateShortkeyMultiTarget(); 80 void UpdateClickResponseTime(); 81 void UpdateIgnoreRepeatClickTime(); 82 void UpdateSettingsInAtoHos(); 83 void UpdateSettingsInAtoHosStatePart(ConfigValueAtoHosUpdate &value); 84 85 RetError GetCaptionProperty(AccessibilityConfig::CaptionProperty &caption); 86 RetError SetCaptionProperty(const AccessibilityConfig::CaptionProperty &caption); 87 RetError SetCaptionState(const bool state); 88 RetError GetCaptionState(bool &state); 89 90 void UpdateCaptionProperty(); 91 void UpdateAllSetting(); 92 93 std::shared_ptr<AppExecFwk::EventHandler> handler_ = nullptr; 94 }; 95 } // namespace Accessibility 96 } // namespace OHOS 97 #endif // ACCESSIBILITY_SETTINGS_H