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 DEVICESTATUS_DATA_DEFINE_H
17 #define DEVICESTATUS_DATA_DEFINE_H
18 
19 #include <functional>
20 
21 #ifdef DEVICE_STATUS_SENSOR_ENABLE
22 #include "sensor_agent.h"
23 #endif // DEVICE_STATUS_SENSOR_ENABLE
24 #include "stationary_data.h"
25 
26 namespace OHOS {
27 namespace Msdp {
28 namespace DeviceStatus {
29 constexpr double PI { 3.141592653589793 };
30 constexpr int32_t RESULTANT_ACC_LOW_THRHD { 7 };
31 constexpr int32_t RESULTANT_ACC_UP_THRHD { 11 };
32 constexpr double ACC_VALID_THRHD { 160.0 };
33 constexpr double ANGLE_180_DEGREE { 180.0 };
34 constexpr double ANGLE_HOR_UP_THRHD { 180.1 };
35 constexpr double ANGLE_HOR_LOW_THRHD { 160.0 };
36 constexpr double ANGLE_HOR_FLIPPED_THRHD { 5.0 };
37 constexpr double ANGLE_VER_UP_THRHD { 110.0 };
38 constexpr double ANGLE_VER_LOW_THRHD { 80.0 };
39 constexpr double ANGLE_VER_FLIPPED_THRHD { 5.0 };
40 
41 constexpr int32_t VALID_TIME_THRESHOLD { 500 };
42 constexpr int32_t ACC_SAMPLE_PERIOD { 100 };
43 constexpr int32_t COUNTER_THRESHOLD = VALID_TIME_THRESHOLD / ACC_SAMPLE_PERIOD;
44 
45 #ifdef DEVICE_STATUS_SENSOR_ENABLE
46 using SensorCallback = std::function<void(int32_t, AccelData*)>;
47 #endif // DEVICE_STATUS_SENSOR_ENABLE
48 } // namespace DeviceStatus
49 } // namespace Msdp
50 } // namespace OHOS
51 #endif // DEVICESTATUS_DATA_DEFINE_H
52