add restriction function
[apps/agl-service-homescreen.git] / src / hs-client.cpp
index e97f844..41be426 100644 (file)
@@ -388,3 +388,28 @@ int HS_Client::showInformation(afb_req_t request)
 
     return ret;
 }
+
+/**
+ * push event
+ *
+ * #### Parameters
+ *  - event : the event want to push
+ *  - param : the parameter contents of event
+ *
+ * #### Return
+ * 0 : success
+ * others : fail
+ *
+ */
+int HS_Client::pushEvent(const char *event, struct json_object *param)
+{
+    if(!checkEvent(event))
+        return 0;
+
+    struct json_object* push_obj = json_object_new_object();
+    hs_add_object_to_json_object_str( push_obj, 4, _application_id, my_id.c_str(), _type, event);
+    if(param != nullptr)
+        json_object_object_add(push_obj, _parameter, param);
+    afb_event_push(my_event, push_obj);
+    return 0;
+}
\ No newline at end of file