Improve HS_ClientManager and fix issue
[apps/agl-service-homescreen.git] / src / hs-client.cpp
index 807b068..c683c66 100644 (file)
@@ -30,10 +30,10 @@ static const char _type[] = "type";
  * None
  *
  */
-HS_Client::HS_Client(struct afb_req request, std::string id) : my_id(id)
+HS_Client::HS_Client(afb_req_t request, std::string id) : my_id(id)
 {
     HMI_NOTICE("homescreen-service","called.");
-    my_event = afb_daemon_make_event(id.c_str());
+    my_event = afb_api_make_event(request->api, id.c_str());
 }
 
 /**
@@ -71,7 +71,8 @@ int HS_Client::tap_shortcut(const char* appname)
     struct json_object* push_obj = json_object_new_object();
     hs_add_object_to_json_object_str( push_obj, 4, _application_name, appname,
     _type, __FUNCTION__);
-    return afb_event_push(my_event, push_obj);
+    afb_event_push(my_event, push_obj);
+    return 0;
 }
 
 /**
@@ -84,7 +85,7 @@ int HS_Client::tap_shortcut(const char* appname)
  * result
  *
  */
-int HS_Client::on_screen_message(struct afb_req request, const char* message)
+int HS_Client::on_screen_message(afb_req_t request, const char* message)
 {
     if(!checkEvent(__FUNCTION__))
         return 0;
@@ -93,7 +94,8 @@ int HS_Client::on_screen_message(struct afb_req request, const char* message)
     struct json_object* push_obj = json_object_new_object();
     hs_add_object_to_json_object_str( push_obj, 4, _display_message, message,
     _type, __FUNCTION__);
-    return afb_event_push(my_event, push_obj);
+    afb_event_push(my_event, push_obj);
+    return 0;
 }
 
 /**
@@ -106,7 +108,7 @@ int HS_Client::on_screen_message(struct afb_req request, const char* message)
  * result
  *
  */
-int HS_Client::on_screen_reply(struct afb_req request, const char* message)
+int HS_Client::on_screen_reply(afb_req_t request, const char* message)
 {
     if(!checkEvent(__FUNCTION__))
         return 0;
@@ -115,7 +117,8 @@ int HS_Client::on_screen_reply(struct afb_req request, const char* message)
     struct json_object* push_obj = json_object_new_object();
     hs_add_object_to_json_object_str( push_obj, 4, _reply_message, message,
     _type, __FUNCTION__);
-    return afb_event_push(my_event, push_obj);
+    afb_event_push(my_event, push_obj);
+    return 0;
 }
 
 /**
@@ -128,7 +131,7 @@ int HS_Client::on_screen_reply(struct afb_req request, const char* message)
  * result
  *
  */
-int HS_Client::subscribe(struct afb_req request, const char* event)
+int HS_Client::subscribe(afb_req_t request, const char* event)
 {
     int ret = 0;
     auto ip = event_list.find(std::string(event));
@@ -149,7 +152,7 @@ int HS_Client::subscribe(struct afb_req request, const char* event)
  * result
  *
  */
-int HS_Client::unsubscribe(struct afb_req request, const char* event)
+int HS_Client::unsubscribe(afb_req_t request, const char* event)
 {
     int ret = 0;
     event_list.erase(std::string(event));