1 /*
2  * Copyright (c) 2023 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 IVIBRATOR_TYPE_VDI_H
17 #define IVIBRATOR_TYPE_VDI_H
18 
19 #include <stdint.h>
20 
21 #ifdef __cplusplus
22 #if __cplusplus
23 extern "C" {
24 #endif
25 #endif /* __cplusplus */
26 
27 enum HdfVibratorStatusVdi {
28     VDI_VIBRATOR_SUCCESS            = 0,
29     VDI_VIBRATOR_NOT_PERIOD         = -1,
30     VDI_VIBRATOR_NOT_INTENSITY      = -2,
31     VDI_VIBRATOR_NOT_FREQUENCY      = -3,
32 };
33 
34 enum HdfVibratorModeVdi {
35     VDI_VIBRATOR_MODE_ONCE   = 0,
36     VDI_VIBRATOR_MODE_PRESET = 1,
37     VDI_VIBRATOR_MODE_HDHAPTIC = 2,
38     VDI_VIBRATOR_MODE_BUTT
39 };
40 
41 enum HdfEffectTypeVdi {
42     VDI_EFFECT_TYPE_TIME,
43     VDI_EFFECT_TYPE_PRIMITIVE,
44     VDI_EFFECT_TYPE_BUTT,
45 };
46 
47 enum EVENT_TYPEVdi {
48     VDI_CONTINUOUS = 0,
49     VDI_TRANSIENT = 1,
50 };
51 
52 struct HdfVibratorInfoVdi {
53     bool isSupportIntensity;
54     bool isSupportFrequency;
55     uint16_t intensityMaxValue;
56     uint16_t intensityMinValue;
57     int16_t frequencyMaxValue;
58     int16_t frequencyMinValue;
59 };
60 
61 struct HdfTimeEffectVdi {
62     int32_t delay;
63     int32_t time;
64     uint16_t intensity;
65     int16_t frequency;
66 };
67 
68 struct HdfPrimitiveEffectVdi {
69     int32_t delay;
70     int32_t effectId;
71     uint16_t intensity;
72 };
73 
74 union HdfEffectVdi {
75     struct HdfTimeEffectVdi timeEffect;
76     struct HdfPrimitiveEffectVdi primitiveEffect;
77 };
78 
79 struct HdfCompositeEffectVdi {
80     int32_t type;
81     std::vector<HdfEffectVdi> effects;
82 };
83 
84 struct HdfEffectInfoVdi {
85     int32_t duration;
86     bool isSupportEffect;
87 };
88 
89 struct CurvePointVdi {
90     int32_t time;
91     int32_t intensity;
92     int32_t frequency;
93 };
94 
95 struct HapticEventVdi {
96     EVENT_TYPEVdi type;
97     int32_t time;
98     int32_t duration;
99     int32_t intensity;
100     int32_t frequency;
101     int32_t index;
102     int32_t pointNum;
103     std::vector<CurvePointVdi> points;
104 };
105 
106 struct HapticPaketVdi {
107     int32_t time;
108     int32_t eventNum;
109     std::vector<HapticEventVdi> events;
110 };
111 
112 struct HapticCapacityVdi {
113     bool isSupportHdHaptic;
114     bool isSupportPresetMapping;
115     bool isSupportTimeDelay;
116     bool reserved0;
117     int32_t reserved1;
118 };
119 
120 #ifdef __cplusplus
121 #if __cplusplus
122 }
123 #endif
124 #endif /* __cplusplus */
125 
126 #endif /* IVIBRATOR_TYPE_VDI_H */
127 /** @} */
128