2 * Copyright (c) 2018 TOYOTA MOTOR CORPORATION
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef TMCAGLWM_PM_WRAPPER_HPP
18 #define TMCAGLWM_PM_WRAPPER_HPP
24 #include "policy_manager.hpp"
25 #include "request.hpp"
29 struct sd_event_source;
39 ~PMWrapper() = default;
41 using StateTransitionHandler = std::function<void(std::vector<WMAction>)>;
42 using ErrorHandler = std::function<void(void)>;
45 void registerCallback(StateTransitionHandler on_state_transitioned,
46 ErrorHandler on_error);
47 int setInputEventData(Task task, std::string role, std::string area);
48 int executeStateTransition();
51 // Do not use these functions
52 void updateStates(json_object *json_out);
56 // Disable copy and move
57 PMWrapper(PMWrapper const &) = delete;
58 PMWrapper &operator=(PMWrapper const &) = delete;
59 PMWrapper(PMWrapper &&) = delete;
60 PMWrapper &operator=(PMWrapper &&) = delete;
62 typedef std::map<std::string, std::string> RoleState;
65 StateTransitionHandler on_state_transitioned;
66 ErrorHandler on_error;
67 std::map<std::string, RoleState> prvlayer2rolestate;
68 std::map<std::string, RoleState> crrlayer2rolestate;
70 void createLayoutChangeAction(json_object *json_out, std::vector<WMAction> &actions);
75 #endif // TMCAGLWM_PM_WRAPPER_HPP