summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2018-11-14 11:14:57 +0800
committerwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2018-11-21 15:09:02 +0800
commitfdeea80c0f5b22fb50e176c98c85dace9b99edd5 (patch)
tree9481b281c16ce02fa26e5b708d4c7ea8de678134
parent6de11471bf8cc70c5a11f947dea5a2afc9bef716 (diff)
add new features in homescreen-service and homescreenguppy_6.99.2guppy_6.99.1guppy/6.99.2guppy/6.99.16.99.26.99.1
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: Idc13e290ef08bfb6a3801b923abfb59e388bb2bb Signed-off-by: wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
-rw-r--r--src/qlibhomescreen.cpp133
-rw-r--r--src/qlibhomescreen.h16
2 files changed, 146 insertions, 3 deletions
diff --git a/src/qlibhomescreen.cpp b/src/qlibhomescreen.cpp
index aded770..f769469 100644
--- a/src/qlibhomescreen.cpp
+++ b/src/qlibhomescreen.cpp
@@ -178,5 +178,134 @@ void QLibHomeScreen::set_event_handler(enum QEventType et, handler_fun f)
void QLibHomeScreen::tapShortcut(QString application_id)
{
HMI_DEBUG("qlibhomescreen","tapShortcut %s", application_id.toStdString().c_str());
- this->mp_hs->tapShortcut(application_id.toStdString().c_str());
-} \ No newline at end of file
+ mp_hs->showWindow(application_id.toStdString().c_str(), nullptr);
+}
+
+/**
+ * show application by application id
+ *
+ * #### Parameters
+ * - application_id : application id
+ * - json : json parameters
+ *
+ * #### Return
+ * - None.
+ *
+ */
+void QLibHomeScreen::showWindow(QString application_id, json_object* json)
+{
+ mp_hs->showWindow(application_id.toStdString().c_str(), json);
+}
+
+/**
+ * show application by application id, json string
+ *
+ * #### Parameters
+ * - application_id : application id
+ * - json : json parameters
+ *
+ * #### Return
+ * - None.
+ *
+ */
+void QLibHomeScreen::showWindow(QString application_id, QString json)
+{
+ if(json.isNull())
+ mp_hs->showWindow(application_id.toStdString().c_str(), nullptr);
+ else
+ mp_hs->showWindow(application_id.toStdString().c_str(), json_tokener_parse(json.toStdString().c_str()));
+}
+
+/**
+ * hide application by application id
+ *
+ * #### Parameters
+ * - application_id : application id
+ *
+ * #### Return
+ * - None.
+ *
+ */
+void QLibHomeScreen::hideWindow(QString application_id)
+{
+ mp_hs->hideWindow(application_id.toStdString().c_str());
+}
+
+/**
+ * send onscreen or software keyboard message to application
+ *
+ * #### Parameters
+ * - application_id : application id
+ * - json : json parameters
+ *
+ * #### Return
+ * - None.
+ *
+ */
+void QLibHomeScreen::replyShowWindow(QString application_id, json_object* json)
+{
+ mp_hs->replyShowWindow(application_id.toStdString().c_str(), json);
+}
+
+/**
+ * send onscreen or software keyboard message to application
+ *
+ * #### Parameters
+ * - application_id : application id
+ * - json : json parameters
+ *
+ * #### Return
+ * - None.
+ *
+ */
+void QLibHomeScreen::replyShowWindow(QString application_id, QString json)
+{
+ if(json.isNull())
+ mp_hs->replyShowWindow(application_id.toStdString().c_str(), nullptr);
+ else
+ mp_hs->replyShowWindow(application_id.toStdString().c_str(), json_tokener_parse(json.toStdString().c_str()));
+}
+
+/**
+ * show information
+ *
+ * use libhomescreen api to push information to menubarApp
+ *
+ * #### Parameters
+ * - params : json parameters
+ *
+ * #### Return
+ * - None.
+ *
+ */
+void QLibHomeScreen::showInformation(QString info)
+{
+ struct json_object* j_obj = json_object_new_object();
+ struct json_object* val = json_object_new_string(info.toStdString().c_str());
+ json_object_object_add(j_obj, "info", val);
+
+ mp_hs->showInformation(j_obj);
+}
+
+/**
+ * show notification
+ *
+ * use libhomescreen api to push notification to menubarApp
+ *
+ * #### Parameters
+ * - params : json parameters
+ *
+ * #### Resturn
+ * - None.
+ *
+ */
+void QLibHomeScreen::showNotification(QString icon, QString text)
+{
+ struct json_object* j_obj = json_object_new_object();
+ struct json_object* val_icon = json_object_new_string(icon.toStdString().c_str());
+ struct json_object* val_text = json_object_new_string(text.toStdString().c_str());
+ json_object_object_add(j_obj, "icon", val_icon);
+ json_object_object_add(j_obj, "text", val_text);
+
+ mp_hs->showNotification(j_obj);
+}
diff --git a/src/qlibhomescreen.h b/src/qlibhomescreen.h
index bf43963..e613de3 100644
--- a/src/qlibhomescreen.h
+++ b/src/qlibhomescreen.h
@@ -34,16 +34,30 @@ public:
enum QEventType {
Event_TapShortcut = LibHomeScreen::Event_TapShortcut,
- Event_OnScreenReply = LibHomeScreen::Event_OnScreenReply
+ Event_ShowWindow = LibHomeScreen::Event_ShowWindow,
+ Event_OnScreenMessage = LibHomeScreen::Event_OnScreenMessage,
+ Event_OnScreenReply = LibHomeScreen::Event_OnScreenReply,
+ Event_HideWindow = LibHomeScreen::Event_HideWindow,
+ Event_ReplyShowWindow = LibHomeScreen::Event_ReplyShowWindow,
+ Event_ShowNotification = LibHomeScreen::Event_ShowNotification,
+ Event_ShowInformation = LibHomeScreen::Event_ShowInformation
};
using handler_fun = std::function<void(json_object *object)>;
void init(int port, const QString &token);
void set_event_handler(enum QEventType et, handler_fun f);
+ void showWindow(QString application_id, json_object* json);
+ void replyShowWindow(QString application_id, json_object* json);
+ Q_INVOKABLE void showInformation(QString info);
+ Q_INVOKABLE void showNotification(QString icon, QString text);
+
Q_INVOKABLE int onScreenMessage(const QString &message);
Q_INVOKABLE int subscribe(const QString &eventName);
Q_INVOKABLE int unsubscribe(const QString &eventName);
Q_INVOKABLE void tapShortcut(QString application_id);
+ Q_INVOKABLE void showWindow(QString application_id, QString json);
+ Q_INVOKABLE void hideWindow(QString application_id);
+ Q_INVOKABLE void replyShowWindow(QString application_id, QString json);
signals: