1 /* 2 * Copyright (c) 2024-2025 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 I_ANCO_CONSUMER_H 17 #define I_ANCO_CONSUMER_H 18 19 #include "key_event.h" 20 #include "pointer_event.h" 21 #include "window_info.h" 22 23 namespace OHOS { 24 namespace MMI { 25 26 enum class ANCO_WINDOW_UPDATE_TYPE: uint32_t { 27 ALL = 0, 28 INCREMENT = 1, 29 }; 30 31 struct AncoWindowInfo { 32 /** 33 * Globally unique identifier of the window 34 */ 35 int32_t id; 36 37 /** 38 * A 32-bit flag that represents the window status. If the 0th bitt is 1, 39 * the window is untouchable; if the 0th bit is 0, the window is touchable. 40 */ 41 uint32_t flags; 42 43 /** 44 * Agent window ID 45 */ 46 WINDOW_UPDATE_ACTION action { WINDOW_UPDATE_ACTION::UNKNOWN }; 47 48 /** 49 * Window display ID 50 */ 51 int32_t displayId { DEFAULT_DISPLAY_ID }; 52 53 /** 54 * Window order in Z-index 55 */ 56 float zOrder { 0.0f }; 57 58 /** 59 * Window transform for changing display x,y to window x,y. 60 */ 61 std::vector<float> transform; 62 63 /** 64 * Number of touch response areas (excluding the mouse response areas) in the window. 65 * The value cannot exceed the value of MAX_HOTAREA_COUNT. 66 */ 67 std::vector<Rect> defaultHotAreas; 68 69 /** 70 * Number of excluded touch response areas in the window. 71 */ 72 std::vector<Rect> ancoExcludedAreas; 73 }; 74 75 struct AncoWindows : public Parcelable { 76 ANCO_WINDOW_UPDATE_TYPE updateType; 77 int32_t focusWindowId; 78 std::vector<AncoWindowInfo> windows; 79 80 bool Marshalling(Parcel &out) const; 81 bool ReadFromParcel(Parcel &in); 82 static AncoWindows* Unmarshalling(Parcel &in); 83 }; 84 85 struct AncoOneHandData : public Parcelable { 86 int32_t oneHandX; 87 int32_t oneHandY; 88 int32_t expandHeight; 89 int32_t scalePercent; 90 bool Marshalling(Parcel &parcel) const; 91 bool ReadFromParcel(Parcel &parcel); 92 static AncoOneHandData* Unmarshalling(Parcel &parcel); 93 }; 94 95 class IAncoConsumer { 96 public: 97 IAncoConsumer() = default; 98 virtual ~IAncoConsumer() = default; 99 100 virtual int32_t SyncInputEvent(std::shared_ptr<PointerEvent> pointerEvent) = 0; 101 virtual int32_t SyncInputEvent(std::shared_ptr<KeyEvent> keyEvent) = 0; 102 virtual int32_t UpdateWindowInfo(std::shared_ptr<AncoWindows> windows) = 0; 103 virtual int32_t SyncKnuckleStatus(bool isKnuckleEnable) = 0; 104 virtual int32_t UpdateOneHandData(const AncoOneHandData &oneHandData) = 0; 105 }; 106 } // namespace MMI 107 } // namespace OHOS 108 #endif // I_ANCO_CONSUMER_H 109