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 VIBRATOR_INFOS_H 17 #define VIBRATOR_INFOS_H 18 19 #include <string> 20 #include <unordered_map> 21 22 namespace OHOS { 23 namespace Sensors { 24 namespace { 25 std::unordered_map<std::string, int32_t> vibratorEffects = { 26 {"haptic.clock.timer", 2000}, 27 {"haptic.default.effect", 804} 28 }; 29 } // namespace 30 31 struct VibrateInfo { 32 std::string mode; 33 std::string packageName; 34 int32_t pid = -1; 35 int32_t uid = -1; 36 int32_t usage = 0; 37 int32_t duration = 0; 38 std::string effect; 39 int32_t count = 0; 40 }; 41 42 enum VibrateUsage { 43 USAGE_UNKNOWN = 0, 44 USAGE_ALARM = 1, 45 USAGE_RING = 2, 46 USAGE_NOTIFICATION = 3, 47 USAGE_COMMUNICATION = 4, 48 USAGE_TOUCH = 5, 49 USAGE_MEDIA = 6, 50 USAGE_PHYSICAL_FEEDBACK = 7, 51 USAGE_SIMULATE_REALITY = 8, 52 USAGE_MAX = 9, 53 }; 54 } // namespace Sensors 55 } // namespace OHOS 56 #endif // VIBRATOR_INFOS_H