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);
60 void dumpUserList(void);
61 void dumpHomeScreenList(void);
63 // application daed watcher
64 bool appDeadHandler(int pid);
66 // default constructor
72 // assignment operator
73 CicoSCUserManager& operator=(const CicoSCUserManager &object);
76 CicoSCUserManager(const CicoSCUserManager &object);
79 void userlistCB(const std::string & appid);
80 void lastinfoCB(const std::string & appid);
82 // save last user name to file
83 void saveLastUser(void);
84 // load last user name from file
85 void loadLastUser(void);
86 // load last information from file
87 void loadLastInfo(void);
89 // set login user info from config file
90 void setLoginUser(const boost::property_tree::ptree & root);
91 // create list from config file
92 void createUserList(const boost::property_tree::ptree & root);
93 void createHomeScreenList(const boost::property_tree::ptree & root);
95 // set application's last information
96 void setLastInfo(const std::string & appid, const std::string & info);
98 // find user config by user name
99 const CicoSCUser* findUserConfbyName(const std::string & name);
101 // Imprinting to file, that file is application's running information
102 bool impritingLastApps(const std::string& ofnm);
104 // Killing running application and homeScreen
105 bool killingAppsAndHS(const std::string& usrnm);
107 // working user directory make
108 void getWorkingDir(const std::string& usr, std::string& dir);
110 // launch homescreen request
111 bool launchHomescreenReq(const std::string& usr,
112 const std::string& appid_hs);
115 void flagFileOn(const char* text = NULL);
119 static CicoSCUserManager* ms_myInstance; ///< CicoSCUserManager Object
121 std::string m_login; ///< Login User Name
122 std::vector<CicoSCUser*> m_userList; ///< User List
123 std::vector<std::string> m_homescreenList; ///< HomeScreen List
124 std::string m_parentDir; /// login-user use directory
125 const CicoSCUserConf* m_uConfig;
126 std::string m_flagPath; /// history save control flag file
127 std::vector<pairPidAppid> m_vppa; /// app dead watcher
128 bool m_wait; /// app dead wait flag
129 std::string m_waitName; /// wait backup login name
130 std::string m_waitHS; /// wait backup homescreen appid
132 #endif // __CICO_SC_USER_MANAGER_H__
133 // vim:set expandtab ts=4 sw=4: