aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTadao Tanikawa <tanikawa.tadao@jp.panasonic.com>2017-12-22 22:57:55 +0900
committerTadao Tanikawa <tanikawa.tadao@jp.panasonic.com>2017-12-24 19:37:59 +0000
commit216b7abd87aad5d41b9b8df609b04c878bb45af2 (patch)
treec5c8a9b06d38491ddd43d13e190850eb1c959fb8
parente5fa699e6c1fb5bf59978eef78ed50202eba7fc0 (diff)
Support passing port/token to XDG app from AGL appfw
Introducing special string '@port@' and '@token@' in order that runxdg pass them to target XDG application. See detail in README.txt Bug-AGL: SPEC-1096 Change-Id: I6d6cfe62bba50ba5515a6aea6fb2697ae379df5f Signed-off-by: Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com>
-rw-r--r--README.txt10
-rw-r--r--src/runxdg.cpp22
2 files changed, 32 insertions, 0 deletions
diff --git a/README.txt b/README.txt
index 5006c2d..24eb4d9 100644
--- a/README.txt
+++ b/README.txt
@@ -23,6 +23,16 @@ How to build with SDK
e.g. followings are predefined role by default
"role": "MediaPlayer|Radio|Phone|Navigation|HVAC|Settings|Dashboard|POI|Mixer"
+ In order to pass port number and token which are given from
+ AGL application framework binder to XDG application,
+ you can use special string '@port@' and '@token@'.
+
+ For 'params', you can use special string '@port@' and '@token@"
+ to pass them to target XDG application
+ which are from AGL application framework binder.
+
+ e.g. params = [ --port=@port@ --secret=@token@ ]
+
3. Prepare config.xml for widget
<content> should be follow.
diff --git a/src/runxdg.cpp b/src/runxdg.cpp
index 5553ff5..3ff942c 100644
--- a/src/runxdg.cpp
+++ b/src/runxdg.cpp
@@ -410,7 +410,29 @@ int RunXDG::parse_config (const char *path_to_config)
auto params = app->get_array_of<std::string>("params");
for (const auto& param : *params)
{
+ // replace special string "@port@" and "@token@"
+ size_t found = param.find("@port@");
+ if (found != std::string::npos) {
+ std::string sub1 = param.substr(0, found);
+ std::string sub2 = param.substr(found + 6, param.size() - found);
+ std::string str = sub1 + std::to_string(m_port) + sub2;
+ pl->m_args_v.push_back(str);
+ AGL_DEBUG("params[%s] (match @port@)", str.c_str());
+ continue;
+ }
+
+ found = param.find("@token@");
+ if (found != std::string::npos) {
+ std::string sub1 = param.substr(0, found);
+ std::string sub2 = param.substr(found + 7, param.size() - found);
+ std::string str = sub1 + m_token + sub2;
+ pl->m_args_v.push_back(str);
+ AGL_DEBUG("params[%s] (match @token@)", str.c_str());
+ continue;
+ }
+
pl->m_args_v.push_back(param);
+
AGL_DEBUG("params[%s]", param.c_str());
}