1 /* 2 * Copyright (C) 2022 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_ABILITY_MANAGER_SERVICE_STATE_STUB_H 17 #define ACCESSIBILITY_ABILITY_MANAGER_SERVICE_STATE_STUB_H 18 19 #include <cstdint> 20 #include <list> 21 22 #include "accessible_ability_manager_service_state_interface.h" 23 #include "accessibility_errorcode.h" 24 #include "iremote_stub.h" 25 #include "nocopyable.h" 26 27 namespace OHOS { 28 namespace Accessibility { 29 class AccessibleAbilityManagerServiceStateStub : public IRemoteStub<IAccessibleAbilityManagerServiceState> { 30 public: 31 /** 32 * @brief construct function 33 * @param object The object of IPC 34 * @return 35 */ 36 AccessibleAbilityManagerServiceStateStub(); 37 38 /** 39 * @brief destruct function 40 * @param 41 * @return 42 */ 43 virtual ~AccessibleAbilityManagerServiceStateStub() = default; 44 45 /** 46 * @brief Receive the event from proxy by IPC mechanism. 47 * @param code The code is matched with the process function. 48 * @param data The data of process communication 49 * @param reply The response of IPC request 50 * @param option The option parameter of IPC,such as: async,sync 51 * @return 52 */ 53 int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, 54 MessageOption &option) override; 55 56 /** 57 * @brief Receive the state notify from AAMS and send it to the observer registered. 58 * @param stateType The state type and value. 59 * state type: Refer to AccessibilityStateEventType. 60 * value: STATE_ACCESSIBILITY_ENABLED/STATE_EXPLORATION_ENABLED/ 61 * STATE_ACCESSIBILITY_DISABLED/STATE_EXPLORATION_DISABLED 62 * @return 63 */ 64 void OnStateChanged(const uint32_t stateType) override; 65 private: 66 /** 67 * @brief Handle the IPC request for the function:HandleOnStateChanged. 68 * @param data The data of process communication 69 * @param reply The response of IPC request 70 * @return NO_ERROR: successful; otherwise is failed. 71 */ 72 ErrCode HandleOnStateChanged(MessageParcel &data, MessageParcel &reply); 73 74 DISALLOW_COPY_AND_MOVE(AccessibleAbilityManagerServiceStateStub); 75 }; 76 } // namespace Accessibility 77 } // namespace OHOS 78 #endif 79