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
10 * @brief homescreen application main
21 #include <home_screen_main.h>
23 #include "CicoHomeScreenConfig.h"
24 #include "ico_syc_public.h"
25 #include "CicoSCConf.h"
26 #include "CicoSCSystemConfig.h"
30 string g_login_user_name;
32 bool launchApps(const string& filepath);
34 /*--------------------------------------------------------------------------*/
37 * homescreen main. initialize UXF, app manager, and ecore.
39 * @param[in] argc counts of argment
40 * @param[in] argv argment
45 /*--------------------------------------------------------------------------*/
47 main(int argc, char *argv[])
52 eina_log_level_set(EINA_LOG_LEVEL_DBG);
54 ico_log_open("HomeScreen");
57 /* init configuration */
58 ICO_DBG("main: config initialize start");
59 CicoHomeScreenConfig *config = new CicoHomeScreenConfig();
60 config->Initialize(ICO_HOMESCREEN_CONFIG_FILE);
61 ICO_DBG("main: config initialize end");
63 /* PARAM GET LOGIN USER */
64 bundle *b = bundle_import_from_argv(argc, argv); // import from argc+argv
65 const char* valusr = bundle_get_val(b, ICO_SYC_APP_BUNDLE_KEY1);
66 const char* valpath = bundle_get_val(b, ICO_SYC_APP_BUNDLE_KEY2);
67 if ((NULL != valusr) && (0 != valusr)) {
68 g_login_user_name = valusr;
71 g_login_user_name.clear();
73 string user_start_apps_path;
74 if ((NULL != valpath) && (0 != valpath)) {
75 user_start_apps_path = valpath;
78 user_start_apps_path.clear();
80 ICO_DBG("PARAM=\"%s\", \"%s\"", g_login_user_name.c_str(),
81 user_start_apps_path.c_str());
83 valusr = valpath = NULL;
85 /* init home screen soud */
86 ICO_DBG("main: sound initialize start");
87 CicoHomeScreenSound *sound = new CicoHomeScreenSound();
88 sound->Initialize(config);
89 ICO_DBG("main: sound initialize end");
92 ICO_DBG("main: homescreen initialize start");
93 CicoHomeScreen *home_screen = new CicoHomeScreen();
95 ret = home_screen->Initialize(ICO_ORIENTATION_VERTICAL,config);
97 ICO_ERR("main: homescreen initialize failed");
104 ICO_DBG("main: homescreen initialize end");
106 ICO_DBG("main: create homescreen ");
107 launchApps(user_start_apps_path);
108 /*home screen start and go into main loop*/
109 home_screen->StartHomeScreen();
111 ICO_DBG("main: end homescreen");
113 /* when loop is terminated */
114 /* delete homescreen */
115 home_screen->Finalize();
117 /*clear all classes*/
127 /*--------------------------------------------------------------------------*/
129 * @brief launch applications
131 * @param filepath start applications list file path
133 * @retval true success
136 /*--------------------------------------------------------------------------*/
137 bool launchApps(const string& filepath)
139 ICO_DBG("launcApps start = %s", filepath.c_str());
140 struct stat stat_buf;
141 if (0 != stat(filepath.c_str(), &stat_buf)) {
142 ICO_DBG("launcApps end false(%d, %s)", errno, filepath.c_str());
148 ifstream ifs(filepath.c_str());
149 while(ifs >> tagApp) {
151 if (true == tagApp.empty()) {
154 int r = aul_launch_app(tagApp.c_str(), NULL);
155 ICO_DBG("aul_launch_app %d:appid(%s), r(%d)", i, tagApp.c_str(), r);
160 ICO_DBG("launcApps end %s", rb? "true": "false");