• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-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 VIBRATOR_INFOS_H
17 #define VIBRATOR_INFOS_H
18 
19 #include <string>
20 #include <unordered_map>
21 
22 namespace OHOS {
23 namespace Sensors {
24 struct VibrateInfo {
25     std::string mode;
26     std::string packageName;
27     int32_t pid = -1;
28     int32_t uid = -1;
29     int32_t usage = 0;
30     int32_t duration = 0;
31     std::string effect;
32     int32_t count = 0;
33 };
34 
35 enum VibrateUsage {
36     USAGE_UNKNOWN = 0,
37     USAGE_ALARM = 1,
38     USAGE_RING = 2,
39     USAGE_NOTIFICATION = 3,
40     USAGE_COMMUNICATION = 4,
41     USAGE_TOUCH = 5,
42     USAGE_MEDIA = 6,
43     USAGE_PHYSICAL_FEEDBACK = 7,
44     USAGE_SIMULATE_REALITY = 8,
45     USAGE_MAX = 9,
46 };
47 
48 #ifdef OHOS_BUILD_ENABLE_VIBRATOR_CUSTOM
49 enum VibrateTag {
50     EVENT_TAG_CONTINUOUS = 0,
51     EVENT_TAG_TRANSIENT = 1,
52 };
53 
54 struct VibrateEvent {
55     bool operator<(const VibrateEvent& rhs) const
56     {
57         return startTime < rhs.startTime;
58     }
59 
60     VibrateTag tag;
61     int32_t startTime = 0;
62     int32_t duration = 0;
63     int32_t intensity = 0;
64     int32_t frequency = 0;
65 };
66 #endif // OHOS_BUILD_ENABLE_VIBRATOR_CUSTOM
67 }  // namespace Sensors
68 }  // namespace OHOS
69 #endif  // VIBRATOR_INFOS_H