aboutsummaryrefslogtreecommitdiffstats
path: root/doc/ApplicationGuide.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/ApplicationGuide.md')
-rw-r--r--doc/ApplicationGuide.md163
1 files changed, 94 insertions, 69 deletions
diff --git a/doc/ApplicationGuide.md b/doc/ApplicationGuide.md
index 85216df..083a553 100644
--- a/doc/ApplicationGuide.md
+++ b/doc/ApplicationGuide.md
@@ -21,7 +21,7 @@
- [Sequence](#Sequence)
- [Initialize](#InitializeSequence)
- [Tap Shortcut](#TapShortcutSequence)
- - [On Screen Message](#OnScreenMessageSequence)
+ - [On Screen Message / Reply Sequence](#OnScreenMessageSequence)
- [Sample code](#Sample\ code)
- [Limitation](#Limitation)
- [Next Plan](#Next\ Plan)
@@ -51,9 +51,9 @@ HomeScreenGUIはWindowManagerが提供するAPIを使用しています。
You can make HomeScreen object files by the following two stage operations.
-**Download recipe**
+**Download recipe**
-If repo is already done, please start with git clone
+If repo is already done, please start with git clone
```
$ mkdir WORK
@@ -64,7 +64,7 @@ $ git clone git clone https://gerrit.automotivelinux.org/gerrit/staging/meta-hmi
```
-Then you can get the following recipe.
+Then you can get the following recipe.
* `meta-hmi-framework/homescreen-2017`
@@ -107,20 +107,10 @@ libhs->init(port, token);
The port and token is provided by Application Framework
-Then assign the argument to JSON object
+Execute the "tapShortcut()" function.
```
-struct json_object* jobj = json_object_new_object();
-
-json_object_object_add(jobj, "application_name", json_object_new_string("MediaPlayer"));
-
-```
-
-
-And finally execute the "cal()" function.
-
-```
-libhs->call("tap_shortcut", jobj);
+libhs->tapShortcut("application_name");
```
Regarding the detail of tap_shortcut() API, please refer [this](#HomeScreen\ API) section.
@@ -139,7 +129,9 @@ See also our [Sample code](#Sample\ code).
1. HomeScreenGUIでショートカットアイコンがタップされたときに発行されるイベントを取得する
- 各アプリケーションは自身がアイコンタップにより起動(または表示)されたことを知るために、HomeScreenBinderに対してイベント登録を行い、そのイベントを取得することができます。
2. オンスクリーンにメッセージを表示する
- - T.B.D
+ - 各アプリケーションからメッセージを取得し、オンスクリーンに取得したメッセージを表示することができます。
+3. オンスクリーンからのReplayを取得する
+ - オンスクリーンを表示した際に、各アプリケーションに返答することができます。
* * *
@@ -161,28 +153,31 @@ The communication protocols between libhomescreen and upper binder, upper binder
"libhomescreen" and "HomeScreenBinding" provides several kinds of APIs.
### **<div id="Home\ Screen\ Specific\ API">HomeScreen Specific API</div>**
-
-- [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)
-- [onScreenMessage(const char *display_message)](api-ref/html/de/dd0/class_lib_home_screen.html#ac336482036a72b51a822725f1929523c)
+
+- [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)
+- [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)
- [set\_event\_handler(enum EventType et, handler_func f)](api-ref/html/de/dd0/class_lib_home_screen.html#ab1b0e08bf35415de9064afed899e9f85)
- [call (const string& verb, struct json_object* arg)](api-ref/html/de/dd0/class_lib_home_screen.html#a527b49dcfe581be6275d0eb2236ba37f)
- [call (const char* verb, struct json_object* arg)](api-ref/html/de/dd0/class_lib_home_screen.html#ab5e8e8ab7d53e0f114e9e907fcbb7643)
- [subscribe (const string& event_name)](api-ref/html/de/dd0/class_lib_home_screen.html#aa4c189807b75d070f567967f0d690738)
- [unsubscribe (const string& event_name)](api-ref/html/de/dd0/class_lib_home_screen.html#aac03a45cbd453ba69ddb00c1016930a6)
-
+
* * *
## **<div id="Sequence">Sequence</div>**
-### **<div id="InitializeSequence">Initialize</div>**
-![initialize.svg](parts/initialize.svg)
+### **<div id="InitializeSequence">Initialize Sequence</div>**
+![initialize-registercallback.svg](parts/initialize-registercallback.svg) * deprecated
+![initialize-set-event-handler](parts/initialize-set-event-handler.svg)
-### **<div id="TapShortcutSequence">Tap Shortcut</div>**
+### **<div id="TapShortcutSequence">Tap Shortcut Sequence</div>**
![tap_shortcut.svg](parts/tap_shortcut.svg)
-### **<div id="OnScreenMessageSequence">On Screen Message</div>**
+### **<div id="OnScreenMessageSequence">On Screen Message / Reply Sequence</div>**
![on_screen_message.svg](parts/on_screen_message.svg)
@@ -194,55 +189,85 @@ You can find sample implementation of HomeScreen as below.
### Appendix
```
-@startuml
-title Application initialization phase
-entity App
-entity HomeScreenBinder
-entity HomeScreenGUI
-App->HomeScreenBinder: init(port, token)
-App->HomeScreenBinder: subscribe()
-
-note over HomeScreenBinder
- Appが受信したいイベントを登録する
- ・tap_shortcut
-end note
-
-App->HomeScreenBinder: registerCallback()
-App->HomeScreenBinder: set_event_handler()
-
-note over HomeScreenBinder
- イベント受信のコールバック登録
- registerCallbackによる登録または
- set_event_handlerによる登録どちらかでOK
-end note
-
+@startuml
+title Application initialization phase (ex. registerCallback)
+entity App
+entity HomeScreenBinder
+entity HomeScreenGUI
+App->HomeScreenBinder: init(port, token)
+App->HomeScreenBinder: subscribe()
+
+note over HomeScreenBinder
+ Register the event the App wishes to receive
+ ・tap_shortcut
+ ・on_screen_message
+ ・on_screen_reply
+end note
+
+App->HomeScreenBinder: registerCallback()
+
@enduml
```
+
+```
+@startuml
+title Application initialization phase (ex. set_event_handler)
+entity App
+entity HomeScreenBinder
+entity HomeScreenGUI
+App->HomeScreenBinder: init(port, token)
+App->HomeScreenBinder: set_event_handler()
+
+note over HomeScreenBinder
+ setup event handler the App wishes to receive
+ ・LibHomeScreen::Event_TapShortcut
+ ・LibHomeScreen::Event_OnScreenMessage
+ ・LibHomeScreen::Event_OnScreenReply
+end note
+
+@enduml
+```
```
-@startuml
-title Application Callback Event TapShortcut phase
-entity App
-entity HomeScreenBinder
-entity HomeScreenGUI
-note over App
- Appは初期化時に
- TapShortcutのイベントを受け取る設定をしていること
-end note
-HomeScreenGUI->HomeScreenBinder: tapShortcut(application_name)
-HomeScreenBinder->App: eventCallback(application_name)
+@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
-
```
```
-@startuml
-title Application Callback Event TapShortcut phase
-entity App
-entity HomeScreenBinder
-entity HomeScreenGUI
-App->HomeScreenBinder: onScreenMessage(display_message)
-HomeScreenBinder->HomeScreenGUI: eventCallback(display_message)
+@startuml
+title Application Callback Event On Screen Message / Reply phase
+entity App
+entity HomeScreenBinder
+entity HomeScreenGUI
+
+HomeScreenGUI->HomeScreenBinder: set_event_handler()
+
+note over HomeScreenGUI
+ LibHomeScreen::Event_OnScreenMessage
+end note
+
+
+App->HomeScreenBinder: set_event_handler()
+
+note over App
+ LibHomeScreen::Event_OnScreenReply
+end note
+
+App->HomeScreenBinder: onScreenMessage(display_message)
+HomeScreenBinder->HomeScreenGUI: event_handler(display_message)
+HomeScreenGUI->HomeScreenBinder: onScreenReply(reply_message)
+HomeScreenBinder->App: event_handler(reply_message)
@enduml
-
``` \ No newline at end of file