1 /* 2 * Copyright (c) 2021-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 SCREEN_STATE_COLLECTION_H 17 #define SCREEN_STATE_COLLECTION_H 18 19 #include <common_event_subscriber.h> 20 #include "istate_collection.h" 21 22 using IntentWant = OHOS::AAFwk::Want; 23 namespace OHOS { 24 namespace PowerMgr { 25 class ScreenStateCollection : public IStateCollection { 26 public: 27 ScreenStateCollection() = default; 28 ~ScreenStateCollection() = default; 29 bool Init() override; 30 bool InitParam(std::string& params) override; 31 std::string GetState() override; 32 virtual bool DecideState(const std::string& value) override; 33 void HandleScreenOnCompleted(const EventFwk::CommonEventData& data); 34 void HandleScreenOffCompleted(const EventFwk::CommonEventData& data); 35 bool RegisterEvent(); 36 virtual void SetState(const std::string& stateValue) override; 37 private: 38 std::string params_; 39 std::string state_; 40 std::string mockState_; 41 }; 42 } 43 } 44 #endif // SCREEN_STATE_COLLECTION_H 45