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 OHOS_ROSEN_SCREEN_SENSOR_CONNECTOR_H 17 #define OHOS_ROSEN_SCREEN_SENSOR_CONNECTOR_H 18 19 #include <map> 20 #include <refbase.h> 21 #include "dm_common.h" 22 #include "screen_rotation_property.h" 23 #include "screen_tent_property.h" 24 #ifdef SENSOR_ENABLE 25 #include "sensor_agent.h" 26 #endif 27 #include "window_manager_hilog.h" 28 #include "screen_sensor_plugin.h" 29 30 namespace OHOS { 31 namespace Rosen { 32 class ScreenSensorConnector : public RefBase { 33 public: 34 ScreenSensorConnector() = delete; 35 ~ScreenSensorConnector() = default; 36 37 static void SubscribeRotationSensor(); 38 static void UnsubscribeRotationSensor(); 39 static void SubscribeTentSensor(); 40 static void UnsubscribeTentSensor(); 41 }; 42 43 #ifdef WM_SUBSCRIBE_MOTION_ENABLE 44 class MotionSubscriber { 45 friend ScreenSensorConnector; 46 public: 47 MotionSubscriber() = delete; 48 ~MotionSubscriber() = default; 49 private: 50 static void SubscribeMotionSensor(); 51 static void UnsubscribeMotionSensor(); 52 53 static bool isMotionSensorSubscribed_; 54 }; 55 56 class MotionTentSubscriber { 57 friend ScreenSensorConnector; 58 public: 59 MotionTentSubscriber() = delete; 60 ~MotionTentSubscriber() = default; 61 private: 62 static void SubscribeMotionSensor(); 63 static void UnsubscribeMotionSensor(); 64 65 static bool isMotionSensorSubscribed_; 66 }; 67 #endif 68 } // Rosen 69 } // OHOS 70 #endif // OHOS_ROSEN_SCREEN_CONNECTOR_H 71