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_ABILITY_INFO_H 17885b47fbSopenharmony_ci#define ACCESSIBILITY_ABILITY_INFO_H 18885b47fbSopenharmony_ci 19885b47fbSopenharmony_ci#include <vector> 20885b47fbSopenharmony_ci#include "accessibility_def.h" 21885b47fbSopenharmony_ci 22885b47fbSopenharmony_cinamespace OHOS { 23885b47fbSopenharmony_cinamespace Accessibility { 24885b47fbSopenharmony_cistruct AccessibilityAbilityInitParams { 25885b47fbSopenharmony_ci std::string bundleName = ""; 26885b47fbSopenharmony_ci std::string description = ""; 27885b47fbSopenharmony_ci std::string moduleName = ""; 28885b47fbSopenharmony_ci std::string name = ""; 29885b47fbSopenharmony_ci std::string rationale = ""; 30885b47fbSopenharmony_ci std::string settingsAbility = ""; 31885b47fbSopenharmony_ci std::string label = ""; 32885b47fbSopenharmony_ci uint32_t staticCapabilities = 0; 33885b47fbSopenharmony_ci uint32_t abilityTypes = ACCESSIBILITY_ABILITY_TYPE_INVALID; 34885b47fbSopenharmony_ci bool isImportant = false; 35885b47fbSopenharmony_ci bool needHide = false; 36885b47fbSopenharmony_ci}; 37885b47fbSopenharmony_ci 38885b47fbSopenharmony_ciclass AccessibilityAbilityInfo { 39885b47fbSopenharmony_cipublic: 40885b47fbSopenharmony_ci /** 41885b47fbSopenharmony_ci * @brief The constructor of AccessibilityAbilityInfo. 42885b47fbSopenharmony_ci */ 43885b47fbSopenharmony_ci AccessibilityAbilityInfo() = default; 44885b47fbSopenharmony_ci 45885b47fbSopenharmony_ci /** 46885b47fbSopenharmony_ci * @brief The deconstructor of AccessibilityAbilityInfo. 47885b47fbSopenharmony_ci */ 48885b47fbSopenharmony_ci ~AccessibilityAbilityInfo() = default; 49885b47fbSopenharmony_ci 50885b47fbSopenharmony_ci /** 51885b47fbSopenharmony_ci * @brief The constructor of AccessibilityAbilityInfo. 52885b47fbSopenharmony_ci * @param initParams The params to init AccessibilityAbilityInfo. 53885b47fbSopenharmony_ci */ 54885b47fbSopenharmony_ci AccessibilityAbilityInfo(const AccessibilityAbilityInitParams &initParams); 55885b47fbSopenharmony_ci 56885b47fbSopenharmony_ci /** 57885b47fbSopenharmony_ci * @brief Obtains the types of the accessible ability. 58885b47fbSopenharmony_ci * @return Return the types of the accessible ability. 59885b47fbSopenharmony_ci */ 60885b47fbSopenharmony_ci uint32_t GetAccessibilityAbilityType(); 61885b47fbSopenharmony_ci 62885b47fbSopenharmony_ci /** 63885b47fbSopenharmony_ci * @brief Obtains the types of the capabilities. 64885b47fbSopenharmony_ci * @return Return the types of the capabilities. 65885b47fbSopenharmony_ci */ 66885b47fbSopenharmony_ci uint32_t GetCapabilityValues() const; 67885b47fbSopenharmony_ci 68885b47fbSopenharmony_ci /** 69885b47fbSopenharmony_ci * @brief Obtains the description of the accessible ability. 70885b47fbSopenharmony_ci * @return Return the description of the accessible ability. 71885b47fbSopenharmony_ci */ 72885b47fbSopenharmony_ci const std::string &GetDescription() const; 73885b47fbSopenharmony_ci 74885b47fbSopenharmony_ci /** 75885b47fbSopenharmony_ci * @brief Obtains the types of the accessible events. 76885b47fbSopenharmony_ci * @return Return the types of the accessible events. 77885b47fbSopenharmony_ci */ 78885b47fbSopenharmony_ci uint32_t GetEventTypes(); 79885b47fbSopenharmony_ci 80885b47fbSopenharmony_ci /** 81885b47fbSopenharmony_ci * @brief Obtains the id of the accessible ability. 82885b47fbSopenharmony_ci * @return Return the id of the accessible ability. 83885b47fbSopenharmony_ci */ 84885b47fbSopenharmony_ci std::string GetId() const; 85885b47fbSopenharmony_ci 86885b47fbSopenharmony_ci /** 87885b47fbSopenharmony_ci * @brief Obtains the name of the accessible ability. 88885b47fbSopenharmony_ci * @return Return the name of the accessible ability. 89885b47fbSopenharmony_ci */ 90885b47fbSopenharmony_ci const std::string &GetName() const; 91885b47fbSopenharmony_ci 92885b47fbSopenharmony_ci /** 93885b47fbSopenharmony_ci * @brief Obtains the package name of the accessible ability. 94885b47fbSopenharmony_ci * @return Return the package name of the accessible ability. 95885b47fbSopenharmony_ci */ 96885b47fbSopenharmony_ci const std::string &GetPackageName() const; 97885b47fbSopenharmony_ci 98885b47fbSopenharmony_ci /** 99885b47fbSopenharmony_ci * @brief Obtains the module name of the accessible ability. 100885b47fbSopenharmony_ci * @return Return the module name of the accessible ability. 101885b47fbSopenharmony_ci */ 102885b47fbSopenharmony_ci const std::string &GetModuleName() const; 103885b47fbSopenharmony_ci 104885b47fbSopenharmony_ci /** 105885b47fbSopenharmony_ci * @brief Set the package name of the accessible ability. 106885b47fbSopenharmony_ci * @param bundleName the package name of the accessible ability 107885b47fbSopenharmony_ci */ 108885b47fbSopenharmony_ci void SetPackageName(const std::string &bundleName); 109885b47fbSopenharmony_ci 110885b47fbSopenharmony_ci /** 111885b47fbSopenharmony_ci * @brief Obtains the target bundles's name that you are listening on. 112885b47fbSopenharmony_ci * @return Return the target bundles's name that you are listening on. 113885b47fbSopenharmony_ci */ 114885b47fbSopenharmony_ci const std::vector<std::string> &GetFilterBundleNames() const; 115885b47fbSopenharmony_ci 116885b47fbSopenharmony_ci /** 117885b47fbSopenharmony_ci * @brief Obtains the setting ability of the accessible ability. 118885b47fbSopenharmony_ci * @return Return the setting ability of the accessible ability. 119885b47fbSopenharmony_ci */ 120885b47fbSopenharmony_ci const std::string &GetSettingsAbility() const; 121885b47fbSopenharmony_ci 122885b47fbSopenharmony_ci /** 123885b47fbSopenharmony_ci * @brief Set the target bundles's name that you want to listening on. 124885b47fbSopenharmony_ci * @param targetBundleNames the target bundle name to set. 125885b47fbSopenharmony_ci */ 126885b47fbSopenharmony_ci inline void SetFilterBundleNames(const std::vector<std::string> &targetBundleNames) 127885b47fbSopenharmony_ci { 128885b47fbSopenharmony_ci targetBundleNames_ = targetBundleNames; 129885b47fbSopenharmony_ci } 130885b47fbSopenharmony_ci 131885b47fbSopenharmony_ci /** 132885b47fbSopenharmony_ci * @brief Set the types of the capabilities. 133885b47fbSopenharmony_ci * @param capabilities the capabilities to set. 134885b47fbSopenharmony_ci */ 135885b47fbSopenharmony_ci inline void SetCapabilityValues(uint32_t capabilities) 136885b47fbSopenharmony_ci { 137885b47fbSopenharmony_ci capabilities_ = capabilities; 138885b47fbSopenharmony_ci } 139885b47fbSopenharmony_ci 140885b47fbSopenharmony_ci /** 141885b47fbSopenharmony_ci * @brief Set the types of the ability. 142885b47fbSopenharmony_ci * @param abilityTypes the ability types to set. 143885b47fbSopenharmony_ci */ 144885b47fbSopenharmony_ci inline void SetAccessibilityAbilityType(uint32_t abilityTypes) 145885b47fbSopenharmony_ci { 146885b47fbSopenharmony_ci abilityTypes_ = abilityTypes; 147885b47fbSopenharmony_ci } 148885b47fbSopenharmony_ci 149885b47fbSopenharmony_ci /** 150885b47fbSopenharmony_ci * @brief Set the types of the event. 151885b47fbSopenharmony_ci * @param eventTypes the event to set. 152885b47fbSopenharmony_ci */ 153885b47fbSopenharmony_ci inline void SetEventTypes(uint32_t eventTypes) 154885b47fbSopenharmony_ci { 155885b47fbSopenharmony_ci eventTypes_ = eventTypes; 156885b47fbSopenharmony_ci } 157885b47fbSopenharmony_ci 158885b47fbSopenharmony_ci /** 159885b47fbSopenharmony_ci * @brief Obtains if the ability is important. 160885b47fbSopenharmony_ci * @return Return if the ability is important. 161885b47fbSopenharmony_ci */ 162885b47fbSopenharmony_ci bool IsImportant() const; 163885b47fbSopenharmony_ci 164885b47fbSopenharmony_ci /** 165885b47fbSopenharmony_ci * @brief Obtains the capability types of static configuration. 166885b47fbSopenharmony_ci * @return Return the capability types of static configuration. 167885b47fbSopenharmony_ci */ 168885b47fbSopenharmony_ci uint32_t GetStaticCapabilityValues() const; 169885b47fbSopenharmony_ci 170885b47fbSopenharmony_ci /** 171885b47fbSopenharmony_ci * @brief Obtains if the ability is need to hide. 172885b47fbSopenharmony_ci * @return Return true means hide the ability, return false means show the ability. 173885b47fbSopenharmony_ci */ 174885b47fbSopenharmony_ci bool NeedHide() const; 175885b47fbSopenharmony_ci 176885b47fbSopenharmony_ci /** 177885b47fbSopenharmony_ci * @brief Obtains the label of the accessible ability. 178885b47fbSopenharmony_ci * @return Return the label of the accessible ability. 179885b47fbSopenharmony_ci */ 180885b47fbSopenharmony_ci const std::string &GetLabel() const; 181885b47fbSopenharmony_ci 182885b47fbSopenharmony_ciprotected: 183885b47fbSopenharmony_ci std::string bundleName_; 184885b47fbSopenharmony_ci std::string moduleName_; 185885b47fbSopenharmony_ci std::string name_; 186885b47fbSopenharmony_ci std::string description_; 187885b47fbSopenharmony_ci std::string label_; 188885b47fbSopenharmony_ci 189885b47fbSopenharmony_ci uint32_t staticCapabilities_ = 0; 190885b47fbSopenharmony_ci uint32_t capabilities_ = 0; 191885b47fbSopenharmony_ci std::string rationale_ = ""; 192885b47fbSopenharmony_ci std::string settingsAbility_; 193885b47fbSopenharmony_ci 194885b47fbSopenharmony_ci uint32_t abilityTypes_ = ACCESSIBILITY_ABILITY_TYPE_INVALID; 195885b47fbSopenharmony_ci uint32_t eventTypes_ = EventType::TYPES_ALL_MASK; 196885b47fbSopenharmony_ci 197885b47fbSopenharmony_ci std::vector<std::string> targetBundleNames_; 198885b47fbSopenharmony_ci bool isImportant_ = false; 199885b47fbSopenharmony_ci bool needHide_ = false; 200885b47fbSopenharmony_ci}; 201885b47fbSopenharmony_ci} // namespace Accessibility 202885b47fbSopenharmony_ci} // namespace OHOS 203885b47fbSopenharmony_ci#endif // ACCESSIBILITY_ABILITY_INFO_H