aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2019-05-28 11:04:24 +0800
committerwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2019-05-28 11:04:24 +0800
commit0e41aa4e3bc996fea6d59aeef901c2d1856a81a8 (patch)
tree84c7eea2d1adcfb33ed28379453685b03d02f0ba
parentedde653b1e4735618242811bd4af8b34ae2f9053 (diff)
modify register/update shortcut
Change-Id: I235a9fb234f3e98eb3342948f7f6cb336d9ae1d8
-rw-r--r--include/libhomescreen.hpp4
-rw-r--r--src/libhomescreen.cpp40
2 files changed, 28 insertions, 16 deletions
diff --git a/include/libhomescreen.hpp b/include/libhomescreen.hpp
index 4abb8b2..d0b270a 100644
--- a/include/libhomescreen.hpp
+++ b/include/libhomescreen.hpp
@@ -85,8 +85,8 @@ public:
int showNotification(json_object* json);
int showInformation(json_object* json);
int getRunnables(void);
- int registerShortcut(json_object* json);
- int updateShortcut(json_object* json);
+ int registerShortcut(const char* application_id, json_object* json);
+ int updateShortcut(const char* application_id, json_object* json);
private:
int initialize_websocket();
diff --git a/src/libhomescreen.cpp b/src/libhomescreen.cpp
index d0c0d1c..24487e8 100644
--- a/src/libhomescreen.cpp
+++ b/src/libhomescreen.cpp
@@ -629,20 +629,26 @@ int LibHomeScreen::getRunnables(void)
* - Returns 0 on success or -1 in case of error.
*
*/
-int LibHomeScreen::registerShortcut(json_object* json)
+int LibHomeScreen::registerShortcut(const char* application_id, json_object* json)
{
- if(!sp_websock)
- {
- return -1;
- }
+ if(!sp_websock)
+ {
+ return -1;
+ }
- return this->call("registerShortcut", json);
+ struct json_object* j_obj = json_object_new_object();
+ struct json_object* val = json_object_new_string(application_id);
+ json_object_object_add(j_obj, ApplicationId, val);
+ json_object_object_add(j_obj, "parameter", json);
+
+ return this->call("registerShortcut", j_obj);
}
+
/**
- * update shortcut list
+ * update shortcut to launcher
*
- * Call HomeScreen Service's updateShortcut verb to notify shortcut list.
+ * Call HomeScreen Service's updateShortcut verb to update shortcut.
*
* #### Parameters
* - json [in] : This argument should be specified to the json parameters.
@@ -651,16 +657,22 @@ int LibHomeScreen::registerShortcut(json_object* json)
* - Returns 0 on success or -1 in case of error.
*
*/
-int LibHomeScreen::updateShortcut(json_object* json)
+int LibHomeScreen::updateShortcut(const char* application_id, json_object* json)
{
- if(!sp_websock)
- {
- return -1;
- }
+ if(!sp_websock)
+ {
+ return -1;
+ }
- return this->call("updateShortcut", json);
+ struct json_object* j_obj = json_object_new_object();
+ struct json_object* val = json_object_new_string(application_id);
+ json_object_object_add(j_obj, ApplicationId, val);
+ json_object_object_add(j_obj, "parameter", json);
+
+ return this->call("updateShortcut", j_obj);
}
+
/************* Callback Function *************/
void LibHomeScreen::on_hangup(void *closure, struct afb_wsj1 *wsj)