1 /* 2 * Copyright (c) 2025 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 POWERMGR_IPROXIMITY_CONTROLLER_H 17 #define POWERMGR_IPROXIMITY_CONTROLLER_H 18 19 namespace OHOS { 20 namespace PowerMgr { 21 class IProximityController { 22 public: 23 enum { 24 PROXIMITY_AWAY = 0, 25 PROXIMITY_CLOSE 26 }; 27 IProximityController() = default; 28 virtual ~IProximityController() = default; 29 virtual void Enable() = 0; 30 virtual void Disable() = 0; 31 virtual void OnClose() = 0; 32 virtual void OnAway() = 0; 33 SetEnabled(bool enabled)34 void SetEnabled(bool enabled) 35 { 36 enabled_ = enabled; 37 } IsEnabled()38 bool IsEnabled() const 39 { 40 return enabled_; 41 } SetSupported(bool support)42 void SetSupported(bool support) 43 { 44 support_ = support; 45 } IsSupported()46 bool IsSupported() const 47 { 48 return support_; 49 } SetClose(bool isClose)50 void SetClose(bool isClose) 51 { 52 isClose_ = isClose; 53 } IsClose()54 bool IsClose() const 55 { 56 return isClose_; 57 } SetStatus(uint32_t status)58 void SetStatus(uint32_t status) 59 { 60 status_ = status; 61 } GetStatus()62 uint32_t GetStatus() const 63 { 64 return status_; 65 } Clear()66 void Clear() 67 { 68 isClose_ = false; 69 } 70 private: 71 bool enabled_ {false}; 72 bool support_ {false}; 73 bool isClose_ {false}; 74 uint32_t status_ {0}; 75 }; 76 } // namespace PowerMgr 77 } // namespace OHOS 78 #endif // POWERMGR_IPROXIMITY_CONTROLLER_H