86 HS_ClientCtxt* HS_ClientManager::createClientCtxt(afb_req_t req, std::string appid)
91 HMI_NOTICE(
"homescreen-service",
"create new session for %s", appid.c_str());
93 afb_req_session_set_LOA(req, 1);
109 HS_Client* HS_ClientManager::addClient(afb_req_t req, std::string appid)
111 return (client_list[appid] =
new HS_Client(req, appid));
124 void HS_ClientManager::removeClient(std::string appid)
126 delete client_list[appid];
127 client_list.erase(appid);
145 HMI_ERROR(
"homescreen-service",
"data is nullptr");
149 HMI_NOTICE(
"homescreen-service",
"remove app %s", ctxt->
id.c_str());
150 std::lock_guard<std::mutex> lock(this->mtx);
151 removeClient(ctxt->
id);
152 delete appid2ctxt[ctxt->
id];
153 appid2ctxt.erase(ctxt->
id);
171 HMI_NOTICE(
"homescreen-service",
"request params = %s.", value);
172 std::lock_guard<std::mutex> lock(this->mtx);
173 auto ip = client_list.find(std::string(value));
174 if(ip != client_list.end()) {
175 ip->second->tap_shortcut(value);
179 HMI_NOTICE(
"homescreen-service",
"Please input application_id");
200 HMI_NOTICE(
"homescreen-service",
"request params = %s.", value);
201 std::lock_guard<std::mutex> lock(this->mtx);
202 for(
auto m : client_list) {
203 m.second->on_screen_message(request, value);
207 HMI_NOTICE(
"homescreen-service",
"Please input display_message");
228 HMI_NOTICE(
"homescreen-service",
"request params = %s.", value);
229 std::lock_guard<std::mutex> lock(this->mtx);
230 for(
auto m : client_list) {
231 m.second->on_screen_reply(request, value);
235 HMI_NOTICE(
"homescreen-service",
"Please input reply_message");
254 const char *value = afb_req_value(request,
"event");
255 HMI_NOTICE(
"homescreen-service",
"value is %s", value);
257 std::string appid(afb_req_get_application_id(request));
258 std::lock_guard<std::mutex> lock(this->mtx);
261 auto ip = client_list.find(appid);
262 if(ip != client_list.end()) {
263 client = client_list[appid];
266 appid2ctxt[appid] = createClientCtxt(request, appid);
267 client = addClient(request, appid);
270 if(client->
subscribe(request, value) != 0) {
271 HMI_NOTICE(
"homescreen-service",
"subscribe failed");
276 HMI_NOTICE(
"homescreen-service",
"Please input event name");
294 const char *value = afb_req_value(request,
"event");
295 HMI_NOTICE(
"homescreen-service",
"value is %s", value);
298 std::string appid(afb_req_get_application_id(request));
299 std::lock_guard<std::mutex> lock(this->mtx);
301 auto ip = client_list.find(appid);
302 if(ip != client_list.end()
303 && ip->second->unsubscribe(request, value) != 0) {
304 HMI_NOTICE(
"homescreen-service",
"unsubscribe failed");
309 HMI_NOTICE(
"homescreen-service",
"Please input event name");
331 HMI_NOTICE(
"homescreen-service",
"request params = %s.", value);
332 std::lock_guard<std::mutex> lock(this->mtx);
333 auto ip = client_list.find(std::string(value));
334 if(ip != client_list.end()) {
335 ret = ip->second->showWindow(request, value);
339 HMI_NOTICE(
"homescreen-service",
"Please input application_id");
361 HMI_NOTICE(
"homescreen-service",
"request params = %s.", value);
362 std::lock_guard<std::mutex> lock(this->mtx);
363 auto ip = client_list.find(std::string(value));
364 if(ip != client_list.end()) {
365 ret = ip->second->hideWindow(request);
369 HMI_NOTICE(
"homescreen-service",
"Please input application_id");
391 HMI_NOTICE(
"homescreen-service",
"request params = %s.", value);
392 std::lock_guard<std::mutex> lock(this->mtx);
393 auto ip = client_list.find(std::string(value));
394 if(ip != client_list.end()) {
395 ret = ip->second->replyShowWindow(request, value);
399 HMI_NOTICE(
"homescreen-service",
"Please input application_id");
419 std::lock_guard<std::mutex> lock(this->mtx);
421 if(ip != client_list.end()) {
422 ret = ip->second->showNotification(request);
425 HMI_NOTICE(
"homescreen-service",
"not exist sessiion with homescreen");
446 std::lock_guard<std::mutex> lock(this->mtx);
448 if(ip != client_list.end()) {
449 ret = ip->second->showInformation(request);
452 HMI_NOTICE(
"homescreen-service",
"not exist sessiion with homescreen");
int subscribe(afb_req_t request, const char *event)
int hideWindow(afb_req_t request)
int subscribe(afb_req_t request)
int tap_shortcut(afb_req_t request)
#define AFB_REQ_SHOWNOTIFICATION_ERROR
const char _reply_message[]
int on_screen_reply(afb_req_t request)
#define HMI_NOTICE(prefix, args,...)
int showWindow(afb_req_t request)
struct HS_ClientCtxt HS_ClientCtxt
int unsubscribe(afb_req_t request)
static const char _homescreen[]
int replyShowWindow(afb_req_t request)
const char _display_message[]
void removeClientCtxt(void *data)
static HS_ClientManager * instance(void)
static void cbRemoveClientCtxt(void *data)
#define AFB_REQ_UNSUBSCRIBE_ERROR
int showInformation(afb_req_t request)
#define HMI_ERROR(prefix, args,...)
int on_screen_message(afb_req_t request)
const char _application_id[]
#define AFB_EVENT_BAD_REQUEST
int showNotification(afb_req_t request)
#define AFB_REQ_SUBSCRIBE_ERROR
#define AFB_REQ_SHOWINFORMATION_ERROR