diff options
author | wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com> | 2018-11-06 10:28:59 +0800 |
---|---|---|
committer | wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com> | 2018-11-06 11:18:47 +0800 |
commit | c6035c02992d874c1422cb279423017ca4c05eec (patch) | |
tree | 7b4f59f93a760739ae18c1988a51a0d1552d9727 | |
parent | d58138e0ceb19b3f201ec5e6e7126015db2cfead (diff) |
use appid instead of appname in "tap_shortcut"
Now In homescreen-service used application_id to identify
different application, so use appid instead of appname
in "tap_shortcut" parameter.
Bug-AGL: SPEC-1764
Change-Id: I8493331f37977a30d6d88c0d222da4c2db32e727
Signed-off-by: wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
-rw-r--r-- | doc/ApplicationGuide.md | 8 | ||||
-rw-r--r-- | doc/parts/tap_shortcut.svg | 30 | ||||
-rw-r--r-- | src/homescreen.cpp | 4 | ||||
-rw-r--r-- | src/hs-client.cpp | 8 | ||||
-rw-r--r-- | src/hs-client.h | 2 | ||||
-rw-r--r-- | src/hs-clientmanager.cpp | 11 | ||||
-rw-r--r-- | src/hs-helper.h | 2 |
7 files changed, 30 insertions, 35 deletions
diff --git a/doc/ApplicationGuide.md b/doc/ApplicationGuide.md index 5bbf234..dd3f1f0 100644 --- a/doc/ApplicationGuide.md +++ b/doc/ApplicationGuide.md @@ -134,7 +134,7 @@ The port and token is provided by Application Framework Execute the "tapShortcut()" function. ``` -libhs->tapShortcut("application_name"); +libhs->tapShortcut("application_id"); ``` Regarding the detail of tap_shortcut() API, please refer [this](#HomeScreen\ API) section. @@ -190,7 +190,7 @@ The communication protocols between libhomescreen and upper binder, upper binder - [LibHomeScreen ()](api-ref/html/de/dd0/class_lib_home_screen.html#a724bd949c4154fad041f96a15ef0f5dc) - [init (const int port, const std::string &token)](api-ref/html/de/dd0/class_lib_home_screen.html#a6a57b573cc767725762ba9beab032220) -- [tapShortcut(const char *application_name)](api-ref/html/de/dd0/class_lib_home_screen.html#afb571c9577087b47065eb23e7fdbc903) +- [tapShortcut(const char *application_id)](api-ref/html/de/dd0/class_lib_home_screen.html#afb571c9577087b47065eb23e7fdbc903) - [onScreenMessage(const char *display_message)](api-ref/html/de/dd0/class_lib_home_screen.html#ac336482036a72b51a822725f1929523c) - [onScreenReply(const char *reply_message)](api-ref/html/de/dd0/class_lib_home_screen.html#a6c065f41f2c5d1f58d2763bfb4da9c37) - [registerCallback (void(*event_cb)(const std::string &event, struct json_object *event_contents), void(*reply_cb)(struct json_object *reply_contents), void(*hangup_cb)(void)=nullptr)](api-ref/html/de/dd0/class_lib_home_screen.html#a2789e8a5372202cc36f48e71dbb9b7cf) @@ -286,8 +286,8 @@ note over App LibHomeScreen::Event_TapShortcut end note -HomeScreenGUI->HomeScreenBinder: tapShortcut(application_name) -HomeScreenBinder->App: event_handler(application_name) +HomeScreenGUI->HomeScreenBinder: tapShortcut(application_id) +HomeScreenBinder->App: event_handler(application_id) @enduml ``` diff --git a/doc/parts/tap_shortcut.svg b/doc/parts/tap_shortcut.svg index d454164..c6be41b 100644 --- a/doc/parts/tap_shortcut.svg +++ b/doc/parts/tap_shortcut.svg @@ -1,18 +1,18 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="285px" preserveAspectRatio="none" style="width:662px;height:285px;" version="1.1" viewBox="0 0 662 285" width="662px" zoomAndPan="magnify"><defs><filter height="300%" id="fijzwybejitm5" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><text fill="#000000" font-family="sans-serif" font-size="14" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="361" x="151.75" y="22.9951">Application Callback Event TapShortcut phase</text><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="135" x2="135" y1="81.5938" y2="228.125"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="373" x2="373" y1="81.5938" y2="228.125"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="596.5" x2="596.5" y1="81.5938" y2="228.125"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="27" x="119" y="78.292">App</text><ellipse cx="135.5" cy="49.2969" fill="#FEFECE" filter="url(#fijzwybejitm5)" rx="12" ry="12" style="stroke: #A80036; stroke-width: 2.0;"/><line style="stroke: #A80036; stroke-width: 2.0;" x1="123.5" x2="147.5" y1="63.2969" y2="63.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="27" x="119" y="240.1201">App</text><ellipse cx="135.5" cy="259.4219" fill="#FEFECE" filter="url(#fijzwybejitm5)" rx="12" ry="12" style="stroke: #A80036; stroke-width: 2.0;"/><line style="stroke: #A80036; stroke-width: 2.0;" x1="123.5" x2="147.5" y1="273.4219" y2="273.4219"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="135" x="303" y="78.292">HomeScreenBinder</text><ellipse cx="373.5" cy="49.2969" fill="#FEFECE" filter="url(#fijzwybejitm5)" rx="12" ry="12" style="stroke: #A80036; stroke-width: 2.0;"/><line style="stroke: #A80036; stroke-width: 2.0;" x1="361.5" x2="385.5" y1="63.2969" y2="63.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="135" x="303" y="240.1201">HomeScreenBinder</text><ellipse cx="373.5" cy="259.4219" fill="#FEFECE" filter="url(#fijzwybejitm5)" rx="12" ry="12" style="stroke: #A80036; stroke-width: 2.0;"/><line style="stroke: #A80036; stroke-width: 2.0;" x1="361.5" x2="385.5" y1="273.4219" y2="273.4219"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="114" x="536.5" y="78.292">HomeScreenGUI</text><ellipse cx="596.5" cy="49.2969" fill="#FEFECE" filter="url(#fijzwybejitm5)" rx="12" ry="12" style="stroke: #A80036; stroke-width: 2.0;"/><line style="stroke: #A80036; stroke-width: 2.0;" x1="584.5" x2="608.5" y1="63.2969" y2="63.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="114" x="536.5" y="240.1201">HomeScreenGUI</text><ellipse cx="596.5" cy="259.4219" fill="#FEFECE" filter="url(#fijzwybejitm5)" rx="12" ry="12" style="stroke: #A80036; stroke-width: 2.0;"/><line style="stroke: #A80036; stroke-width: 2.0;" x1="584.5" x2="608.5" y1="273.4219" y2="273.4219"/><polygon fill="#A80036" points="361.5,108.5938,371.5,112.5938,361.5,116.5938,365.5,112.5938" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="135.5" x2="367.5" y1="112.5938" y2="112.5938"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="128" x="142.5" y="107.6606">set_event_handler()</text><polygon fill="#FBFB77" filter="url(#fijzwybejitm5)" points="8,125.7266,8,150.7266,260,150.7266,260,135.7266,250,125.7266,8,125.7266" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="250" x2="250" y1="125.7266" y2="135.7266"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="260" x2="250" y1="135.7266" y2="135.7266"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="231" x="14" y="142.7935">LibHomeScreen::Event_TapShortcut</text><polygon fill="#A80036" points="384.5,176.8594,374.5,180.8594,384.5,184.8594,380.5,180.8594" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="378.5" x2="595.5" y1="180.8594" y2="180.8594"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="199" x="390.5" y="175.9263">tapShortcut(application_name)</text><polygon fill="#A80036" points="146.5,205.9922,136.5,209.9922,146.5,213.9922,142.5,209.9922" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="140.5" x2="372.5" y1="209.9922" y2="209.9922"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="214" x="152.5" y="205.0591">event_handler(application_name)</text><!-- -@startuml
-title Application Callback Event TapShortcut phase
-entity App
-entity HomeScreenBinder
-entity HomeScreenGUI
-App->HomeScreenBinder: set_event_handler()
-
-note over App
- LibHomeScreen::Event_TapShortcut
-end note
-
-HomeScreenGUI->HomeScreenBinder: tapShortcut(application_name)
-HomeScreenBinder->App: event_handler(application_name)
-@enduml
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="285px" preserveAspectRatio="none" style="width:662px;height:285px;" version="1.1" viewBox="0 0 662 285" width="662px" zoomAndPan="magnify"><defs><filter height="300%" id="fijzwybejitm5" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><text fill="#000000" font-family="sans-serif" font-size="14" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="361" x="151.75" y="22.9951">Application Callback Event TapShortcut phase</text><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="135" x2="135" y1="81.5938" y2="228.125"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="373" x2="373" y1="81.5938" y2="228.125"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="596.5" x2="596.5" y1="81.5938" y2="228.125"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="27" x="119" y="78.292">App</text><ellipse cx="135.5" cy="49.2969" fill="#FEFECE" filter="url(#fijzwybejitm5)" rx="12" ry="12" style="stroke: #A80036; stroke-width: 2.0;"/><line style="stroke: #A80036; stroke-width: 2.0;" x1="123.5" x2="147.5" y1="63.2969" y2="63.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="27" x="119" y="240.1201">App</text><ellipse cx="135.5" cy="259.4219" fill="#FEFECE" filter="url(#fijzwybejitm5)" rx="12" ry="12" style="stroke: #A80036; stroke-width: 2.0;"/><line style="stroke: #A80036; stroke-width: 2.0;" x1="123.5" x2="147.5" y1="273.4219" y2="273.4219"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="135" x="303" y="78.292">HomeScreenBinder</text><ellipse cx="373.5" cy="49.2969" fill="#FEFECE" filter="url(#fijzwybejitm5)" rx="12" ry="12" style="stroke: #A80036; stroke-width: 2.0;"/><line style="stroke: #A80036; stroke-width: 2.0;" x1="361.5" x2="385.5" y1="63.2969" y2="63.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="135" x="303" y="240.1201">HomeScreenBinder</text><ellipse cx="373.5" cy="259.4219" fill="#FEFECE" filter="url(#fijzwybejitm5)" rx="12" ry="12" style="stroke: #A80036; stroke-width: 2.0;"/><line style="stroke: #A80036; stroke-width: 2.0;" x1="361.5" x2="385.5" y1="273.4219" y2="273.4219"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="114" x="536.5" y="78.292">HomeScreenGUI</text><ellipse cx="596.5" cy="49.2969" fill="#FEFECE" filter="url(#fijzwybejitm5)" rx="12" ry="12" style="stroke: #A80036; stroke-width: 2.0;"/><line style="stroke: #A80036; stroke-width: 2.0;" x1="584.5" x2="608.5" y1="63.2969" y2="63.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="114" x="536.5" y="240.1201">HomeScreenGUI</text><ellipse cx="596.5" cy="259.4219" fill="#FEFECE" filter="url(#fijzwybejitm5)" rx="12" ry="12" style="stroke: #A80036; stroke-width: 2.0;"/><line style="stroke: #A80036; stroke-width: 2.0;" x1="584.5" x2="608.5" y1="273.4219" y2="273.4219"/><polygon fill="#A80036" points="361.5,108.5938,371.5,112.5938,361.5,116.5938,365.5,112.5938" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="135.5" x2="367.5" y1="112.5938" y2="112.5938"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="128" x="142.5" y="107.6606">set_event_handler()</text><polygon fill="#FBFB77" filter="url(#fijzwybejitm5)" points="8,125.7266,8,150.7266,260,150.7266,260,135.7266,250,125.7266,8,125.7266" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="250" x2="250" y1="125.7266" y2="135.7266"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="260" x2="250" y1="135.7266" y2="135.7266"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="231" x="14" y="142.7935">LibHomeScreen::Event_TapShortcut</text><polygon fill="#A80036" points="384.5,176.8594,374.5,180.8594,384.5,184.8594,380.5,180.8594" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="378.5" x2="595.5" y1="180.8594" y2="180.8594"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="199" x="390.5" y="175.9263">tapShortcut(application_id)</text><polygon fill="#A80036" points="146.5,205.9922,136.5,209.9922,146.5,213.9922,142.5,209.9922" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="140.5" x2="372.5" y1="209.9922" y2="209.9922"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="214" x="152.5" y="205.0591">event_handler(application_id)</text><!-- +@startuml +title Application Callback Event TapShortcut phase +entity App +entity HomeScreenBinder +entity HomeScreenGUI +App->HomeScreenBinder: set_event_handler() + +note over App + LibHomeScreen::Event_TapShortcut +end note + +HomeScreenGUI->HomeScreenBinder: tapShortcut(application_id) +HomeScreenBinder->App: event_handler(application_id) +@enduml PlantUML version 1.2017.18(Fri Oct 06 16:56:32 UTC 2017) (GPL source distribution) diff --git a/src/homescreen.cpp b/src/homescreen.cpp index b518139..c6b4cdf 100644 --- a/src/homescreen.cpp +++ b/src/homescreen.cpp @@ -25,7 +25,7 @@ const char _error[] = "error"; -const char _application_name[] = "application_name"; +const char _application_id[] = "application_id"; const char _display_message[] = "display_message"; const char _reply_message[] = "reply_message"; @@ -49,7 +49,7 @@ static void pingSample(afb_req_t request) * * #### Parameters * Request key - * - application_name : application name + * - application_id : application id * * #### Return * None diff --git a/src/hs-client.cpp b/src/hs-client.cpp index c683c66..7da2cda 100644 --- a/src/hs-client.cpp +++ b/src/hs-client.cpp @@ -56,20 +56,20 @@ HS_Client::~HS_Client() * push tap_shortcut event * * #### Parameters - * - appname: app's name. + * - appid: app's id. * * #### Return * result * */ -int HS_Client::tap_shortcut(const char* appname) +int HS_Client::tap_shortcut(const char* appid) { if(!checkEvent(__FUNCTION__)) return 0; - HMI_NOTICE("homescreen-service","%s application_name = %s.", __FUNCTION__, appname); + HMI_NOTICE("homescreen-service","%s application_id = %s.", __FUNCTION__, appid); struct json_object* push_obj = json_object_new_object(); - hs_add_object_to_json_object_str( push_obj, 4, _application_name, appname, + hs_add_object_to_json_object_str( push_obj, 4, _application_id, appid, _type, __FUNCTION__); afb_event_push(my_event, push_obj); return 0; diff --git a/src/hs-client.h b/src/hs-client.h index 1b2eb8f..2564587 100644 --- a/src/hs-client.h +++ b/src/hs-client.h @@ -30,7 +30,7 @@ public: HS_Client &operator=(HS_Client&) = delete; ~HS_Client(); - int tap_shortcut(const char* appname); + int tap_shortcut(const char* appid); int on_screen_message (afb_req_t request, const char* message); int on_screen_reply (afb_req_t request, const char* message); int subscribe(afb_req_t request, const char* event); diff --git a/src/hs-clientmanager.cpp b/src/hs-clientmanager.cpp index aae8c42..15897b7 100644 --- a/src/hs-clientmanager.cpp +++ b/src/hs-clientmanager.cpp @@ -164,20 +164,17 @@ void HS_ClientManager::removeClientCtxt(void *data) int HS_ClientManager::tap_shortcut(afb_req_t request) { int ret = 0; - const char* value = afb_req_value(request, _application_name); + const char* value = afb_req_value(request, _application_id); if (value) { HMI_NOTICE("homescreen-service","request params = %s.", value); - // first step get appid from appname, next step change appname to appid - std::string appid(value); - std::transform(appid.begin(), appid.end(), appid.begin(), ::tolower); std::lock_guard<std::mutex> lock(this->mtx); - auto ip = client_list.find(appid); + auto ip = client_list.find(std::string(value)); if(ip != client_list.end()) { ip->second->tap_shortcut(value); } } else { - HMI_NOTICE("homescreen-service","Please input application_name"); + HMI_NOTICE("homescreen-service","Please input application_id"); ret = AFB_EVENT_BAD_REQUEST; } return ret; @@ -256,7 +253,6 @@ int HS_ClientManager::subscribe(afb_req_t request) HMI_NOTICE("homescreen-service","value is %s", value); if(value) { std::string appid(afb_req_get_application_id(request)); - std::transform(appid.begin(), appid.end(), appid.begin(), ::tolower); std::lock_guard<std::mutex> lock(this->mtx); HS_Client* client = nullptr; @@ -298,7 +294,6 @@ int HS_ClientManager::unsubscribe(afb_req_t request) int ret = 0; if(value) { std::string appid(afb_req_get_application_id(request)); - std::transform(appid.begin(), appid.end(), appid.begin(), ::tolower); std::lock_guard<std::mutex> lock(this->mtx); auto ip = client_list.find(appid); diff --git a/src/hs-helper.h b/src/hs-helper.h index a2fc0a9..ff8579a 100644 --- a/src/hs-helper.h +++ b/src/hs-helper.h @@ -34,7 +34,7 @@ typedef enum REQ_ERROR extern const char* evlist[]; extern const char _error[]; -extern const char _application_name[]; +extern const char _application_id[]; extern const char _display_message[]; extern const char _reply_message[]; |