• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 #include "thermalsrv_event_handler.h"
17 #include "thermal_common.h"
18 #include "thermal_service.h"
19 #include "ithermal_action.h"
20 
21 namespace OHOS {
22 namespace PowerMgr {
ThermalsrvEventHandler(const std::shared_ptr<AppExecFwk::EventRunner> & runner,const wptr<ThermalService> & service)23 ThermalsrvEventHandler::ThermalsrvEventHandler(const std::shared_ptr<AppExecFwk::EventRunner> &runner,
24     const wptr<ThermalService> &service) : AppExecFwk::EventHandler(runner), service_(service)
25 {
26     THERMAL_HILOGD(COMP_SVC, "ThermalsrvEventHandler::ThermalsrvEventHandler instance created.");
27 }
28 
ProcessEvent(const AppExecFwk::InnerEvent::Pointer & event)29 void ThermalsrvEventHandler::ProcessEvent([[maybe_unused]] const AppExecFwk::InnerEvent::Pointer &event)
30 {
31     auto tmsptr = service_.promote();
32     if (tmsptr == nullptr) {
33         return;
34     }
35     THERMAL_HILOGI(COMP_SVC, "eventid = %{public}d", event->GetInnerEventId());
36     tmsptr->HandleEvent(event->GetInnerEventId());
37 }
38 } // namespace PowerMgr
39 } // namespace OHOS