diff options
author | Yuta Doi <yuta-d@witz-inc.co.jp> | 2018-04-27 19:01:36 +0900 |
---|---|---|
committer | Yuta Doi <yuta-d@witz-inc.co.jp> | 2018-04-27 19:01:36 +0900 |
commit | 55be85ed4bdfea6fc037d781b8cd8f58487718d1 (patch) | |
tree | 279a88e26c74aee58f11e2a5d20348569ce34667 /src/app.hpp | |
parent | d50188f726b15a0ae2777bf2d91ee88836feeac5 (diff) |
Add PolicyManager, related classes and some config files
- PolicyManager
Decide next layout by using occured event and current state
based on policy table.
This PolicyManger is reference and the OEMs can replace it.
- LayoutManager
Change the current layout to the layout
which decided by PolicyManager.
NOTE:
The functions of this class had been included in App class.
The part of function of this class remain there yet.
- LowCanClient
Receive the CAN signal from low level CAN service.
- app.db
Define the applications name and its role.
This file will be deleted
when the names and roles can be given by other module.
- layout.cb
Define the layouts and areas which are included by the layout.
- role.db
Define the roles of the applications.
Change-Id: I2f84bdf5e68355e022f516cee9a1db88efe58825
Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
Diffstat (limited to 'src/app.hpp')
-rw-r--r-- | src/app.hpp | 48 |
1 files changed, 39 insertions, 9 deletions
diff --git a/src/app.hpp b/src/app.hpp index d1393c0..9ab1280 100644 --- a/src/app.hpp +++ b/src/app.hpp @@ -31,6 +31,7 @@ #include "policy.hpp" #include "result.hpp" #include "wayland_ivi_wm.hpp" +#include "policy_manager.hpp" #include "hmi-debug.h" namespace wl { @@ -144,7 +145,13 @@ struct App { Event_SyncDraw, Event_FlushDraw, - Event_Val_Max = Event_FlushDraw, + Event_HeadlampOff, + Event_HeadlampOn, + + Event_CarStop, + Event_CarRun, + + Event_Val_Max = Event_CarRun, }; const std::vector<const char *> kListEventName{ @@ -153,7 +160,11 @@ struct App { "visible", "invisible", "syncdraw", - "flushdraw" + "flushdraw", + "headlamp_off", + "headlamp_on", + "car_stop", + "car_run", }; struct controller_hooks chooks; @@ -203,12 +214,14 @@ struct App { result<int> api_request_surface(char const *drawing_name); char const *api_request_surface(char const *drawing_name, char const *ivi_id); - void api_activate_surface(char const *drawing_name, char const *drawing_area, const reply_func &reply); - void api_deactivate_surface(char const *drawing_name, const reply_func &reply); + void allocateWindowResource(char const *event, char const *drawing_name, + char const *role, char const *drawing_area, + const reply_func &reply); void api_enddraw(char const *drawing_name); result<json_object *> api_get_display_info(); result<json_object *> api_get_area_info(char const *drawing_name); void api_ping(); + void send_event(char const *evname); void send_event(char const *evname, char const *label); void send_event(char const *evname, char const *label, char const *area, int x, int y, int w, int h); @@ -217,6 +230,23 @@ struct App { void surface_removed(uint32_t surface_id); private: +#if 1 // @@@@@ + PolicyManager pm_; + LayoutManager lm_; + std::unordered_map<std::string, int> role2surfaceid_; + std::unordered_map<std::string, std::string> app2role_; + std::unordered_map<int, int> appid2role_; + + int allocateSurface(); + void setSurfaceSize(const char* role, const char* area); + std::string roleToApp(std::string role); + int loadAppDb(); + +#if 0 + struct id_allocator app_id_alloc_; + std::unordered_map<std::string, int> appname2appid_; +#endif +#endif optional<int> lookup_id(char const *name); optional<std::string> lookup_name(int id); @@ -227,7 +257,6 @@ private: int init_layers(); - void surface_set_layout(int surface_id, optional<int> sub_surface_id = nullopt); void layout_commit(); // TMC WM Events to clients @@ -238,15 +267,16 @@ private: void emit_visible(char const *label, bool is_visible); void emit_invisible(char const *label); void emit_visible(char const *label); + void emitHeadlampOff(); + void emitHeadlampOn(); + void emitCarStop(); + void emitCarRun(); void activate(int id); void deactivate(int id); + void deactivate(std::string role); void deactivate_main_surface(); - bool can_split(struct LayoutState const &state, int new_id); - void try_layout(struct LayoutState &state, - struct LayoutState const &new_layout, - std::function<void(LayoutState const &nl)> apply); }; } // namespace wm |