1 /*
2  * Copyright (c) 2021-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 PROCESSING_FINGER_DEVICE_H
17 #define PROCESSING_FINGER_DEVICE_H
18 
19 #include "device_base.h"
20 #include "msg_head.h"
21 
22 namespace OHOS {
23 namespace MMI {
24 class ProcessingFingerDevice : public DeviceBase {
25     struct TouchPadCoordinates {
26         int32_t xPos { 0 };
27         int32_t yPos { 0 };
28     };
29 
30     struct TouchPadInputEvent {
31         uint32_t groupNumber { 0 };
32         std::vector<TouchPadCoordinates> events;
33     };
34 
35     struct TouchPadInputEvents {
36         uint64_t eventNumber { 0 };
37         std::vector<TouchPadInputEvent> eventArray;
38     };
39 public:
40     ProcessingFingerDevice() = default;
41     DISALLOW_COPY_AND_MOVE(ProcessingFingerDevice);
42     ~ProcessingFingerDevice() = default;
43     int32_t TransformJsonDataToInputData(const DeviceItem &inputEventArrays, InputEventArray &inputEventArray);
44 private:
45     void AnalysisTouchPadFingerDate(const std::vector<DeviceEvent> &inputData,
46                                     TouchPadInputEvents &touchPadInputEvents);
47     void AnalysisTouchPadFingerPressData(InputEventArray &inputEventArray,
48                                          const TouchPadInputEvent &touchPadInputEvent);
49     void AnalysisTouchPadFingerMoveData(InputEventArray &inputEventArray, const TouchPadInputEvent &touchPadInputEvent);
50     void AnalysisTouchPadFingerReleaseData(InputEventArray &inputEventArray,
51                                            const TouchPadInputEvent &touchPadInputEvent);
52 };
53 } // namespace MMI
54 } // namespace OHOS
55 #endif // PROCESSING_FINGER_DEVICE_H