aboutsummaryrefslogtreecommitdiffstats
path: root/src/homescreen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/homescreen.cpp')
-rw-r--r--src/homescreen.cpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/homescreen.cpp b/src/homescreen.cpp
index d63d5aa..56c1e7c 100644
--- a/src/homescreen.cpp
+++ b/src/homescreen.cpp
@@ -634,6 +634,72 @@ static void getRunnables(afb_req_t request)
afb_req_success_f(request, res, "homescreen binder unsubscribe success.");
}
+/**
+ * registerShortcut event
+ *
+ * #### Parameters
+ * - value : the json contents to MenuBar.
+ * {"application_id":"homescreen","parameter":{"shortcut_id":"dashboard@0.1","shortcut_name":"Dashboard","postion": 1}}
+ *
+ * #### Return
+ * None
+ *
+ */
+static void registerShortcut(afb_req_t request)
+{
+ int ret = 0;
+ const char* value = afb_req_value(request, _application_id);
+ if (value) {
+ ret = g_hs_instance->client_manager->handleRequest(request, __FUNCTION__, value);
+ }
+ else {
+ ret = AFB_EVENT_BAD_REQUEST;
+ }
+
+ if (ret) {
+ afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
+ }
+ else {
+ struct json_object *res = json_object_new_object();
+ hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
+ _error, ret);
+ afb_req_success(request, res, "afb_event_push event [registerShortcut]");
+ }
+}
+
+/**
+ * updateShortcut event
+ *
+ * #### Parameters
+ * - value : homescreen shortcut json contents.
+ * {"application_id":"launcher","parameter":{"shortcut":[{"shortcut_id":"hvac","shortcut_name":"HVAC"},...]}}
+ *
+ * #### Return
+ * None
+ *
+ */
+static void updateShortcut(afb_req_t request)
+{
+ int ret = 0;
+ const char* value = afb_req_value(request, _application_id);
+ if (value) {
+ ret = g_hs_instance->client_manager->handleRequest(request, __FUNCTION__, value);
+ }
+ else {
+ ret = AFB_EVENT_BAD_REQUEST;
+ }
+
+ if (ret) {
+ afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
+ }
+ else {
+ struct json_object *res = json_object_new_object();
+ hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
+ _error, ret);
+ afb_req_success(request, res, "afb_event_push event [updateShortcut]");
+ }
+}
+
/*
* array of the verbs exported to afb-daemon
*/
@@ -650,7 +716,9 @@ static const afb_verb_t verbs[]= {
{ .verb="unsubscribe", .callback=unsubscribe },
{ .verb="showNotification", .callback=showNotification },
{ .verb="showInformation", .callback=showInformation },
+ { .verb="registerShortcut", .callback=registerShortcut },
{ .verb="getRunnables", .callback=getRunnables },
+ { .verb="updateShortcut", .callback=updateShortcut },
{NULL } /* marker for end of the array */
};