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 OHOS_I_DINPUT_CONTEXT_H
17 #define OHOS_I_DINPUT_CONTEXT_H
18 
19 #include <cstdint>
20 #include <string>
21 
22 #include "constants_dinput.h"
23 
24 namespace OHOS {
25 namespace DistributedHardware {
26 namespace DistributedInput {
27 struct LocalAbsInfo {
28     int32_t absXMin = 0;
29     int32_t absXMax = 0;
30     int32_t absYMin = 0;
31     int32_t absYMax = 0;
32     int32_t absPressureMin = 0;
33     int32_t absPressureMax = 0;
34     int32_t absMtTouchMajorMin = 0;
35     int32_t absMtTouchMajorMax = 0;
36     int32_t absMtTouchMinorMin = 0;
37     int32_t absMtTouchMinorMax = 0;
38     int32_t absMtOrientationMin = 0;
39     int32_t absMtOrientationMax = 0;
40     int32_t absMtPositionXMin = 0;
41     int32_t absMtPositionXMax = 0;
42     int32_t absMtPositionYMin = 0;
43     int32_t absMtPositionYMax = 0;
44     int32_t absMtBlobIdMin = 0;
45     int32_t absMtBlobIdMax = 0;
46     int32_t absMtTrackingIdMin = 0;
47     int32_t absMtTrackingIdMax = 0;
48     int32_t absMtPressureMin = 0;
49     int32_t absMtPressureMax = 0;
50     InputDevice deviceInfo;
51 };
52 
53 struct LocalTouchScreenInfo {
54     uint32_t sinkShowWidth = 0;
55     uint32_t sinkShowHeight = 0;
56     uint32_t sinkPhyWidth = 0;
57     uint32_t sinkPhyHeight = 0;
58     LocalAbsInfo localAbsInfo;
59 };
60 
61 struct TransformInfo {
62     uint32_t sinkWinPhyX = 0;           // projection area X coordinate in touch coordinate
63     uint32_t sinkWinPhyY = 0;           // projection area Y coordinate in touch coordinate
64     uint32_t sinkProjPhyWidth = 0;      // projection area width in touch coordinate
65     uint32_t sinkProjPhyHeight = 0;     // projection area height in touch coordinate
66     double coeffWidth = 0.0;            // sink width transform source coefficient
67     double coeffHeight = 0.0;           // sink height transform source coefficient
68 };
69 
70 struct SrcScreenInfo {
71     std::string devId = "";             // source device id
72     std::string uuid = "";              // source device uuid
73     int32_t sessionId = 0;              // source device session id
74     uint64_t sourceWinId = 0;           // source projection window id
75     uint32_t sourceWinWidth = 0;        // source projection window width
76     uint32_t sourceWinHeight = 0;       // source projection window height
77     std::string sourcePhyId = "";       // source virtual screen driver id
78     uint32_t sourcePhyFd = 0;           // source virtual screen driver fd
79     uint32_t sourcePhyWidth = 0;        // source virtual screen driver width
80     uint32_t sourcePhyHeight = 0;       // source virtual screen driver height
81 };
82 
83 struct SinkScreenInfo {
84     uint32_t sinkShowWidth = 0;         // sink show width
85     uint32_t sinkShowHeight = 0;        // sink show height
86     uint32_t sinkPhyWidth = 0;          // sink touch screen width
87     uint32_t sinkPhyHeight = 0;         // sink touch screen height
88     uint64_t sinkShowWinId = 0;         // sink show window id
89     uint32_t sinkWinShowX = 0;          // sink show window x coordinate
90     uint32_t sinkWinShowY = 0;          // sink show window y coordinate
91     uint32_t sinkProjShowWidth = 0;     // sink show window width
92     uint32_t sinkProjShowHeight = 0;    // sink show window height
93     SrcScreenInfo srcScreenInfo;
94     TransformInfo transformInfo;
95 };
96 } // namespace DistributedInput
97 } // namespace DistributedHardware
98 } // namespace OHOS
99 
100 #endif // OHOS_I_DINPUT_CONTEXT_H
101