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 32 RetError SetScreenMagnificationState(const bool state); 33 RetError SetShortKeyState(const bool state); 34 RetError SetMouseKeyState(const bool state); 35 RetError SetMouseAutoClick(const int32_t time); 36 RetError SetShortkeyTarget(const std::string &name); 37 RetError SetShortkeyMultiTarget(const std::vector<std::string> &name); 38 RetError SetHighContrastTextState(const bool state); 39 RetError SetInvertColorState(const bool state); 40 RetError SetAnimationOffState(const bool state); 41 RetError SetAudioMonoState(const bool state); 42 RetError SetDaltonizationState(const bool state); 43 RetError SetDaltonizationColorFilter(const uint32_t filter); 44 RetError SetContentTimeout(const uint32_t time); 45 RetError SetBrightnessDiscount(const float discount); 46 RetError SetAudioBalance(const float balance); 47 RetError SetClickResponseTime(const uint32_t time); 48 RetError SetIgnoreRepeatClickState(const bool state); 49 RetError SetIgnoreRepeatClickTime(const uint32_t time); 50 51 RetError GetScreenMagnificationState(bool &state); 52 RetError GetShortKeyState(bool &state); 53 RetError GetMouseKeyState(bool &state); 54 RetError GetMouseAutoClick(int32_t &time); 55 RetError GetShortkeyTarget(std::string &name); 56 RetError GetShortkeyMultiTarget(std::vector<std::string> &name); 57 RetError GetHighContrastTextState(bool &state); 58 RetError GetInvertColorState(bool &state); 59 RetError GetAnimationOffState(bool &state); 60 RetError GetAudioMonoState(bool &state); 61 RetError GetDaltonizationState(bool &state); 62 RetError GetDaltonizationColorFilter(uint32_t &type); 63 RetError GetContentTimeout(uint32_t &timer); 64 RetError GetBrightnessDiscount(float &brightness); 65 RetError GetAudioBalance(float &balance); 66 RetError GetClickResponseTime(uint32_t &time); 67 RetError GetIgnoreRepeatClickState(bool &state); 68 RetError GetIgnoreRepeatClickTime(uint32_t &time); 69 70 void UpdateConfigState(); 71 void UpdateAudioBalance(); 72 void UpdateBrightnessDiscount(); 73 void UpdateContentTimeout(); 74 void UpdateDaltonizationColorFilter(); 75 void UpdateMouseAutoClick(); 76 void UpdateShortkeyTarget(); 77 void UpdateShortkeyMultiTarget(); 78 void UpdateClickResponseTime(); 79 void UpdateIgnoreRepeatClickTime(); 80 void UpdateSettingsInAtoHos(); 81 void UpdateSettingsInAtoHosStatePart(ConfigValueAtoHosUpdate &value); 82 83 RetError GetCaptionProperty(AccessibilityConfig::CaptionProperty &caption); 84 RetError SetCaptionProperty(const AccessibilityConfig::CaptionProperty &caption); 85 RetError SetCaptionState(const bool state); 86 RetError GetCaptionState(bool &state); 87 88 void UpdateCaptionProperty(); 89 void UpdateAllSetting(); 90 91 std::shared_ptr<AppExecFwk::EventHandler> handler_ = nullptr; 92 }; 93 } // namespace Accessibility 94 } // namespace OHOS 95 #endif // ACCESSIBILITY_SETTINGS_H