diff options
author | wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com> | 2018-11-14 11:12:44 +0800 |
---|---|---|
committer | wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com> | 2018-11-14 11:12:44 +0800 |
commit | 7a123d6d802fe76a6d2eb32adacb2215d5bb873a (patch) | |
tree | cd707443b7ab659b071845e8b7b66b708335eb22 /src/homescreen.cpp | |
parent | c6035c02992d874c1422cb279423017ca4c05eec (diff) |
add new features in homescreen-service and homescreen
homescreen-service: add five verbs.
1.showWindow: instead of tap_shortcut and show onscreen.
2.hideWindow: used when want to hide onscreen.
3.replyShowWindow: used when post onscreen reply information to application.
4.showNotification: used by application who want to display notification on homescreen top area.
5.showInformation: used by application who want to display information on homescreen botton area.
homescreen:
1.add fullscreen transfer button.
2.display notification and information.
Bug-AGL: SPEC-1931
Change-Id: I612e541243ee6502eb90ff1aa2ab4d99bfbc7156
Signed-off-by: wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
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 */ }; |