2 * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
4 * This program is licensed under the terms and conditions of the
5 * Apache License, version 2.0. The full text of the Apache License is at
6 * http://www.apache.org/licenses/LICENSE-2.0
14 #ifndef __CICO_HOME_SCREEN_H__
15 #define __CICO_HOME_SCREEN_H__
18 #include <libwebsockets.h>
22 #include "ico_syc_common.h"
23 #include "ico_syc_winctl.h"
24 #include "ico_syc_private.h"
28 #include "CicoHomeScreenCommon.h"
30 #include "CicoGKeyFileConfig.h"
31 #include "CicoHSMenuWindow.h"
32 #include "CicoHSBackWindow.h"
33 #include "CicoHSControlBarWindow.h"
34 #include "CicoHSSwipeTouch.h"
35 #include "CicoHSWindowController.h"
36 #include "CicoHSAppInfo.h"
38 #include "CicoSystemConfig.h"
39 #include "CicoHSLifeCycleController.h"
40 #include "CicoHSAppHistory.h"
41 #include "CicoHSAppHistoryExt.h"
43 /* display position and size */
44 #define ICO_HS_WINDOW_POS_X 0
45 #define ICO_HS_WINDOW_POS_Y 0
46 #define ICO_HS_STATUSBAR_WINDOW_HEIGHT 64
47 #define ICO_HS_MENU_WINDOW_POS_X ICO_HS_WINDOW_POS_X
48 #define ICO_HS_MENU_WINDOW_POS_Y ICO_HS_STATUSBAR_WINDOW_HEIGHT
49 #define ICO_HS_CONTROLBAR_WINDOW_POS_X ICO_HS_WINDOW_POS_X
50 #define ICO_HS_CONTROLBAR_WINDOW_HEIGHT 128
53 #define ICO_HS_MODE_MENU 0
54 #define ICO_HS_MODE_APPLICATION 1
57 #define ICO_HS_SHOW_HIDE_PATTERN_SLIDE 0
58 #define ICO_HS_SHOW_HIDE_PATTERN_FADE 1
60 #define ICO_HS_CONFIG_HOMESCREEN "homescreen"
61 #define ICO_HS_CONFIG_ONSCREEN "onscreen"
62 #define ICO_HS_CONFIG_SOUND "sound"
63 #define ICO_HS_CONFIG_SB "statusbar"
64 #define ICO_HS_CONFIG_ONS "onscreen"
65 #define ICO_HS_APPID_DEFAULT_SB ICO_SYC_PACKAGE_STATUSBAR /* default statusbar appid */
66 #define ICO_HS_APPID_DEFAULT_ONS ICO_SYC_PACKAGE_ONSCREEN /* default on screen appid */
68 #define ICO_HS_GROUP_SPECIAL "menu"
70 #define ICO_HS_APP_STATUS_ERR -1
72 #define ICO_HS_CHANGE_ZONE_MAX 10
78 ~CicoHomeScreen(void);
79 static CicoHomeScreen* getInstance(void);
80 int Initialize(int orientation,CicoGKeyFileConfig *config);
81 void InitializeAppHistory(void);
84 void CreateMenuWindow(void);
85 void DeleteMenuWindow(void);
86 void UpDateMenuWindow(void);
87 void CreateBackWindow(void);
88 void DeleteBackWindow(void);
89 void UpDateBackWindow(void);
90 void CreateControlBarWindow(void);
91 void DeleteControlBarWindow(void);
92 void CreateSwipeInputWindow(void);
93 void DeleteSwipeInputWindow(void);
94 char *GetHsPackageName(void);
95 char *GetSbPackageName(void);
96 char *GetOsPackageName(void);
97 void ShowHomeScreenLayer(void);
98 void ShowHomeScreenWindow(ico_syc_win_info_t *win_info);
99 void ShowStatusBarWindow(ico_syc_win_info_t *win_info);
100 void ShowApplicationWindow(ico_syc_win_info_t *win_info);
101 void RaiseApplicationWindow(const char *appid,int surface);
102 static void ChangeMode(int pattern);
103 static void ExecuteApp(const char *appid);
104 static void TerminateApp(const char *appid);
105 static bool GetAppStatus(const char *appid);
106 void ChangeActive(const char *appid, int surface);
107 static void ChangeZone(void);
108 void requestChangeZone(CicoHSAppInfo* appinfo);
109 static CicoHSAppInfo *GetAppInfo(const char *appid);
110 void SetMode(int mode);
112 int StartHomeScreen(int orientation);
113 void UpdateTile(const char *appid);
114 static void RenewAppInfoList(void);
116 void setActiveApp(const char* appid);
117 // update current active application information
118 void SetActiveAppInfo(const char *appid);
119 CicoHSAppInfo* GetActiveAppInfo(void);
121 // update current sub displaye applicatin information
122 void SetSubDisplayAppInfo(const char *appid);
123 CicoHSAppInfo* GetSubDisplayAppInfo(void);
124 const char* GetSubDisplayAppid(void);
125 // order of the start-up window
126 void startupCheckAdd(int pid, const std::string& appid,
127 bool bSubDisp = false);
128 void startupCheck(const char* appid);
129 void finishStartup(void);
130 void readStartupApp(std::vector<pairAppidSubd>& apps);
131 void requestHideAppid(const std::string& app);
132 void requestShowAppid(const std::string& app);
133 void requestActivationAppid(const std::string& app);
134 void controlRegulation(bool regStt=true);
135 static bool ActivationUpdate(void);
136 bool ActivationUpdate_i(void);
137 static void ShowApp(const std::string& app);
138 static void HideApp(const std::string& app);
139 static void MoveApp(const std::string& app, const std::string& zone);
141 int GetProcessWindow(const char *appid);
142 static void EventCallBack(ico_syc_ev_e event,const void* detail,void* user_data);
143 void ExecuteApp_i(const char *appid);
144 void TerminateApp_i(const char *appid);
145 void CreateAppInfoList(void);
146 ico_hs_window_info *GetWindowInfo(CicoHSAppInfo* appinfo,const char *window);
147 ico_hs_window_info *GetWindowInfo(CicoHSAppInfo* appinfo,int surface);
149 static void SetNightMode(void* data);
150 static void SetRegulation(void* data);
152 void ShowApp_i(const std::string& app);
153 void RenewAppInfoList_i(void);
155 /*application control(do not use now)*/
157 CicoHSAppInfo *apps_info[ICO_HS_MAX_APP_NUM];
158 // current active application information
159 CicoHSAppInfo *active_appinfo;
161 CicoHSAppInfo *hs_app_info;
162 CicoHSAppInfo *sb_app_info;
163 CicoHSAppInfo *os_app_info;
165 int full_width,full_height;
166 int menu_width,menu_height;
167 int bg_width,bg_height;
168 int ctl_bar_width,ctl_bar_height;
170 char hs_package_name[ICO_HS_MAX_PROCESS_NAME];
171 char sb_package_name[ICO_HS_MAX_PROCESS_NAME];
172 char os_package_name[ICO_HS_MAX_PROCESS_NAME];
174 CicoHSMenuWindow* menu_window;
175 CicoHSBackWindow* back_window;
176 CicoHSControlBarWindow* ctl_bar_window;
177 int num_swipe_input_windows;
178 CicoHSSwipeInputWindow* swipe_input_windows[ICO_HS_MAX_SWIPEWINDOWS];
182 CicoGKeyFileConfig *config;
183 /*my instance for callback*/
184 static CicoHomeScreen *hs_instance;
186 CicoHSLifeCycleController* life_cycle_controller;
187 CicoHSAppHistoryExt* m_appHis;
189 // current sub display appinfo
190 CicoHSAppInfo *sub_display_appinfo;
193 // swith trigger zone rotation list
194 const char* moveZoneName;
196 // move zone animation information
197 ico_syc_animation_t moveZoneAnimation;
201 CicoHomeScreen operator=(const CicoHomeScreen&);
202 CicoHomeScreen(const CicoHomeScreen&);
205 // vim:set expandtab ts=4 sw=4: