1 /* 2 * Copyright (c) 2024 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 #ifndef CJ_ACCESSIBILITY_FFI_H 16 #define CJ_ACCESSIBILITY_FFI_H 17 #include <cstdint> 18 #include "cj_common_ffi.h" 19 #include "native/ffi_remote_data.h" 20 21 namespace OHOS { 22 namespace Accessibility { 23 extern "C" { 24 const int32_t SUCCESS_CODE = 0; 25 const int32_t ERR_INPUT_INVALID = 401; 26 27 struct CArrString { 28 char **head; 29 int64_t size; 30 }; 31 32 struct CAccessibilityAbilityInfo { 33 char *id_; 34 char *name_; 35 char *bundleName_; 36 CArrString targetBundleNames_; 37 CArrString abilityTypes_; 38 CArrString capabilities_; 39 char *description_; 40 CArrString eventTypes_; 41 bool needHide_; 42 char *label_; 43 }; 44 45 struct CArrAccessibilityAbilityInfo { 46 CAccessibilityAbilityInfo *head; 47 int64_t size; 48 }; 49 50 struct CEventInfo { 51 char *type_; 52 char *windowUpdateType_; 53 char *bundleName_; 54 char *componentType_; 55 int32_t pageId_; 56 char *description_; 57 char *triggerAction_; 58 char *textMoveUnit_; 59 CArrString contents_; 60 char *lastContent_; 61 int32_t beginIndex_; 62 int32_t currentIndex_; 63 int32_t endIndex_; 64 int32_t itemCount_; 65 int64_t elementId_; 66 char *textAnnouncedForAccessibility_; 67 char *customId_; 68 }; 69 70 /* Static Method */ 71 FFI_EXPORT bool FfiAccIsOpenAccessibility(int32_t *errorCode); 72 FFI_EXPORT bool FfiAccIsOpenTouchGuide(int32_t *errorCode); 73 FFI_EXPORT bool FfiAccIsScreenReaderOpen(int32_t *errorCode); 74 FFI_EXPORT CArrAccessibilityAbilityInfo FfiAccGetAccessibilityExtensionList(char *cAbilityType, char *cStateType, 75 int32_t *errorCode); 76 FFI_EXPORT CEventInfo FfiAccEventInfoInit(char *ctype, char *cBundleName, char *cTrigger, int32_t *errorCode); 77 FFI_EXPORT void FfiAccSendAccessibilityEvent(CEventInfo event, int32_t *errorCode); 78 FFI_EXPORT void FfiAccOn(char *cbType, void (*callback)(), int32_t *errorCode); 79 } 80 } // namespace Accessibility 81 } // namespace OHOS 82 #endif // CJ_ACCESSIBILITY_FFI_H