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 //==========================================================================
12 * @file CicoSCUserManager.h
14 * @brief This file is definition of CicoSCUserManager class
16 //==========================================================================
17 #ifndef __CICO_SC_USER_MANAGER_H__
18 #define __CICO_SC_USER_MANAGER_H__
23 //==========================================================================
24 // Forward declaration
25 //==========================================================================
30 typedef std::pair<int, std::string> pairPidAppid;
32 //==========================================================================
34 * @brief This class manages control of user and access to user information
36 //==========================================================================
37 class CicoSCUserManager
40 // get CicoSCUserManager instance
41 static CicoSCUserManager* getInstance(void);
44 void handleCommand(const CicoSCCommand * cmd);
46 // load configuration file
47 int load(const std::string & confFile);
52 const CicoSCUser* getLoginUser(void);
53 const std::vector<CicoSCUser*>& getUserList(void);
54 const std::vector<std::string>& getHomeScreenList(void);
57 void changeUser(const std::string & name, const std::string & passwd);
61 void dumpUserList(void);
62 void dumpHomeScreenList(void);
64 // application daed watcher
65 bool appDeadHandler(int pid);
69 // working user directory make
70 void getWorkingDir(const std::string& usr, std::string& dir);
71 const std::string& getHomeDir() const;
73 // default constructor
79 // assignment operator
80 CicoSCUserManager& operator=(const CicoSCUserManager &object);
83 CicoSCUserManager(const CicoSCUserManager &object);
86 void userlistCB(const std::string & appid);
87 void lastinfoCB(const std::string & appid);
89 // save last user name to file
90 void saveLastUser(void);
91 // load last user name from file
92 void loadLastUser(void);
93 // load last information from file
94 void loadLastInfo(void);
96 // set login user info from config file
97 void setLoginUser(const boost::property_tree::ptree & root);
98 // create list from config file
99 void createUserList(const boost::property_tree::ptree & root);
100 void createHomeScreenList(const boost::property_tree::ptree & root);
102 // set application's last information
103 void setLastInfo(const std::string & appid, const std::string & info);
105 // find user config by user name
106 const CicoSCUser* findUserConfbyName(const std::string & name);
108 // Imprinting to file, that file is application's running information
109 bool impritingLastApps(const std::string& ofnm);
111 // Killing running application and homeScreen
112 bool killingAppsAndHS(const std::string& usrnm);
114 // launch homescreen request
115 bool launchHomescreenReq(const std::string& usr,
116 const std::string& appid_hs);
119 void flagFileOn(const char* text = NULL);
123 static CicoSCUserManager* ms_myInstance; ///< CicoSCUserManager Object
125 std::string m_login; ///< Login User Name
126 std::vector<CicoSCUser*> m_userList; ///< User List
127 std::vector<std::string> m_homescreenList; ///< HomeScreen List
128 std::string m_parentDir; /// login-user use directory
129 const CicoSCUserConf* m_uConfig;
130 std::string m_flagPath; /// history save control flag file
131 std::vector<pairPidAppid> m_vppa; /// app dead watcher
132 bool m_wait; /// app dead wait flag
133 std::string m_waitName; /// wait backup login name
134 std::string m_waitHS; /// wait backup homescreen appid
138 * @brief get Homescreen Stopping Status
140 * @retval true: stopping now
141 * @retval false: no stop
144 inline bool CicoSCUserManager::isStoppingNow(){
145 return !m_vppa.empty();
151 inline void CicoSCUserManager::cloaseUser()
154 killingAppsAndHS(m_login);
160 inline const std::string& CicoSCUserManager::getHomeDir() const
165 #endif // __CICO_SC_USER_MANAGER_H__
166 // vim:set expandtab ts=4 sw=4: