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_EVENT_INFO_PARCEL_H 17 #define ACCESSIBILITY_EVENT_INFO_PARCEL_H 18 19 #include "accessibility_event_info.h" 20 #include "parcel.h" 21 22 namespace OHOS { 23 namespace Accessibility { 24 class AccessibilityEventInfoParcel : public AccessibilityEventInfo, public Parcelable { 25 public: 26 /** 27 * @brief Construct 28 * @since 3 29 * @sysCap Accessibility 30 */ AccessibilityEventInfoParcel()31 AccessibilityEventInfoParcel() {} 32 33 /** 34 * @brief Construct 35 * @param eventInfo The object of AccessibilityEventInfo. 36 * @since 3 37 * @sysCap Accessibility 38 */ 39 explicit AccessibilityEventInfoParcel(const AccessibilityEventInfo &eventInfo); 40 41 /** 42 * @brief Used for IPC communication 43 * @param parcel 44 * @return true: Read parcel data successfully; otherwise is not. 45 * @since 3 46 * @sysCap Accessibility 47 */ 48 bool ReadFromParcel(Parcel &parcel); 49 50 /** 51 * @brief Used for IPC communication 52 * @param parcel 53 * @return true: Write parcel data successfully; otherwise is not. 54 * @since 3 55 * @sysCap Accessibility 56 */ 57 bool Marshalling(Parcel &parcel) const override; 58 59 /** 60 * @brief Used for IPC communication 61 * @param parcel 62 * @return Read AccessibilityEventInfoParcel from parcel data 63 * @since 3 64 * @sysCap Accessibility 65 */ 66 static sptr<AccessibilityEventInfoParcel> Unmarshalling(Parcel &parcel); 67 68 private: 69 /** 70 * @brief Used for IPC communication first part 71 * @param parcel 72 * @return true: Read parcel data successfully; otherwise is not. 73 * @sysCap Accessibility 74 */ 75 bool ReadFromParcelFirstPart(Parcel &parcel); 76 77 /** 78 * @brief Used for IPC communication second part 79 * @param parcel 80 * @return true: Read parcel data successfully; otherwise is not. 81 * @sysCap Accessibility 82 */ 83 bool ReadFromParcelSecondPart(Parcel &parcel); 84 85 /** 86 * @brief Used for IPC communication third part 87 * @param parcel 88 * @return true: Read parcel data successfully; otherwise is not. 89 * @sysCap Accessibility 90 */ 91 bool ReadFromParcelThirdPart(Parcel &parcel); 92 }; 93 } // namespace Accessibility 94 } // namespace OHOS 95 #endif // ACCESSIBILITY_EVENT_INFO_PARCEL_H 96