diff options
Diffstat (limited to 'src/homescreen.cpp')
-rw-r--r-- | src/homescreen.cpp | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/src/homescreen.cpp b/src/homescreen.cpp index c6b4cdf..fce25ee 100644 --- a/src/homescreen.cpp +++ b/src/homescreen.cpp @@ -181,6 +181,145 @@ static void unsubscribe(afb_req_t request) afb_req_success_f(request, res, "homescreen binder unsubscribe success."); } +/** + * showWindow event + * + * #### Parameters + * - request : the request + * + * #### Return + * None + * + */ +static void showWindow(afb_req_t request) +{ + HMI_NOTICE("homescreen-service","called."); + + int ret = g_client_manager->showWindow(request); + if (ret != 0) { + afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__); + return; + } + + // response to HomeScreen + 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 [showWindow]"); +} + +/** + * hideWindow event + * + * #### Parameters + * - request : the request + * + * #### Return + * None + * + */ +static void hideWindow(afb_req_t request) +{ + HMI_NOTICE("homescreen-service","called."); + + int ret = g_client_manager->hideWindow(request); + if (ret != 0) { + afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__); + return; + } + + // response to HomeScreen + 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 [hideWindow]"); +} + +/** + * replyShowWindow event + * + * #### Parameters + * - request : the request + * + * #### Return + * None + * + */ +static void replyShowWindow(afb_req_t request) +{ + HMI_NOTICE("homescreen-service","called."); + + int ret = g_client_manager->replyShowWindow(request); + if (ret != 0) { + afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__); + return; + } + + // response to HomeScreen + 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 [replyShowWindow]"); +} + +/** + * showNotification event + * + * the contents to homescreen which display at top area. + * + * #### Parameters + * - request : the request + * + * #### Return + * None + * + */ +static void showNotification(afb_req_t request) +{ + HMI_NOTICE("homescreen-service","called."); + + int ret = g_client_manager->showNotification(request); + if (ret != 0) { + afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__); + return; + } + + // response to Application + 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 [showNotification]"); +} + +/** + * showInformation event + * + * the contents to homescreen which display at bottom area. + * + * #### Parameters + * - request : the request + * + * #### Return + * None + * + */ +static void showInformation(afb_req_t request) +{ + HMI_NOTICE("homescreen-service","called."); + + int ret = g_client_manager->showInformation(request); + if (ret != 0) { + afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__); + return; + } + + // response to Application + 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 [showInformation]"); +} + /* * array of the verbs exported to afb-daemon */ @@ -188,10 +327,15 @@ static const afb_verb_t verbs[]= { /* VERB'S NAME FUNCTION TO CALL */ { .verb="ping", .callback=pingSample }, { .verb="tap_shortcut", .callback=tap_shortcut }, + { .verb="showWindow", .callback=showWindow }, + { .verb="hideWindow", .callback=hideWindow }, + { .verb="replyShowWindow", .callback=replyShowWindow }, { .verb="on_screen_message", .callback=on_screen_message }, { .verb="on_screen_reply", .callback=on_screen_reply }, { .verb="subscribe", .callback=subscribe }, { .verb="unsubscribe", .callback=unsubscribe }, + { .verb="showNotification", .callback=showNotification }, + { .verb="showInformation", .callback=showInformation }, {NULL } /* marker for end of the array */ }; |