1 /* 2 * Copyright (C) 2021 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 MULTIMODAL_EVENT_H 17 #define MULTIMODAL_EVENT_H 18 19 #include <string> 20 #include <iostream> 21 #include <memory> 22 23 #include "parcel.h" 24 25 namespace OHOS { 26 struct MultimodalProperty { 27 int highLevelEvent; 28 std::string uuid; 29 int sourceType; 30 int occurredTime; 31 std::string deviceId; 32 int inputDeviceId; 33 bool isHighLevelEvent; 34 }; 35 36 class MultimodalEvent : public Parcelable { 37 public: 38 void Initialize(MultimodalProperty &multimodalStruct); 39 40 bool IsSameEvent(const std::string &id); 41 42 bool IsHighLevelInput(); 43 44 int GetHighLevelEvent(); 45 46 int GetSourceDevice(); 47 48 std::string GetDeviceId(); 49 50 int GetInputDeviceId(); 51 52 int GetOccurredTime(); 53 54 std::string GetUuid(); 55 bool Marshalling(Parcel &parcel) const override; 56 static MultimodalEvent *Unmarshalling(Parcel &parcel); 57 58 static constexpr int UNSUPPORTED_DEVICE = -1; 59 60 static constexpr int TOUCH_PANEL = 0; 61 62 static constexpr int KEYBOARD = 1; 63 64 static constexpr int MOUSE = 2; 65 66 static constexpr int STYLUS = 3; 67 68 static constexpr int BUILTIN_KEY = 4; 69 70 static constexpr int ROTATION = 5; 71 72 static constexpr int SPEECH = 6; 73 74 static constexpr int DEFAULT_TYPE = -1; 75 76 static constexpr int MUTE = 91; 77 78 static constexpr int NAVIGATION_UP = 280; 79 80 static constexpr int NAVIGATION_DOWN = 281; 81 82 static constexpr int NAVIGATION_LEFT = 282; 83 84 static constexpr int NAVIGATION_RIGHT = 283; 85 86 static constexpr int DAY_MODE = 5; 87 88 static constexpr int NIGHT_MODE = 4; 89 protected: 90 virtual ~MultimodalEvent() = default; 91 MultimodalProperty multiProperty_; 92 }; 93 } // namespace OHOS 94 #endif // MULTIMODAL_EVENT_H