• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 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 MOTION_RECOGNITION_H
17 #define MOTION_RECOGNITION_H
18 
19 #include <refbase.h>
20 #include <screen_sensor_plugin.h>
21 
22 namespace OHOS {
23 namespace Telephony {
24 
25 class MotionRecogntion : public RefBase {
26 public:
27     MotionRecogntion() = delete;
28     ~MotionRecogntion() = default;
29 
30     static void SubscribePickupSensor();
31     static void UnsubscribePickupSensor();
32     static void SubscribeFlipSensor();
33     static void UnsubscribeFlipSensor();
34     static void SubscribeCloseToEarSensor();
35     static void UnsubscribeCloseToEarSensor();
36     static void ReduceRingToneVolume();
37 };
38 
39 #ifdef  OHOS_SUBSCRIBE_MOTION_ENABLE
40 class MotionPickupSubscriber {
41 friend MotionRecogntion;
42 
43 public:
44     MotionPickupSubscriber() = delete;
45     ~MotionPickupSubscriber() = default;
46 
47 private:
48     static void SubscribePickupMotion();
49     static void UnsubscribePickupMotion();
50 
51     static bool isMotionPickupSubscribed_;
52 };
53 
54 class MotionCloseToEarSubscriber {
55 friend MotionRecogntion;
56 
57 public:
58     MotionCloseToEarSubscriber() = delete;
59     ~MotionCloseToEarSubscriber() = default;
60 
61 private:
62     static void SubscribeCloseToEarMotion();
63     static void UnsubscribeCloseToEarMotion();
64 
65     static bool isMotionCloseToEarSubscribed_;
66 };
67 
68 class MotionFlipSubscriber {
69 friend MotionRecogntion;
70 
71 public:
72     MotionFlipSubscriber() = delete;
73     ~MotionFlipSubscriber() = default;
74 
75 private:
76     static void SubscribeFlipMotion();
77     static void UnsubscribeFlipMotion();
78 
79     static bool isMotionFlipSubscribed_;
80 };
81 #endif
82 } // namespace Telephony
83 } // namespace OHOS
84 #endif // MOTION_RECOGNITION_H