X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=doc%2Fapi-ref%2Fhtml%2Fde%2Fdd0%2Fclass_lib_home_screen.html;fp=doc%2Fapi-ref%2Fhtml%2Fde%2Fdd0%2Fclass_lib_home_screen.html;h=66e6319c9b8cf39acebba2ce58ff71bed0342bd9;hb=31ff5ce755d00cf12ea2ffc96c33ed9acd36358f;hp=2181e107c80e40c0decf37c491d23ab6f05cc809;hpb=bbb4ee8e9974c4b008da84a1e504120f70606c92;p=apps%2Fagl-service-homescreen.git diff --git a/doc/api-ref/html/de/dd0/class_lib_home_screen.html b/doc/api-ref/html/de/dd0/class_lib_home_screen.html index 2181e10..66e6319 100644 --- a/doc/api-ref/html/de/dd0/class_lib_home_screen.html +++ b/doc/api-ref/html/de/dd0/class_lib_home_screen.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: LibHomeScreen Class Reference @@ -12,6 +11,9 @@ + @@ -29,19 +31,40 @@ - + - - - - + +
Public Types | Public Member Functions | +Public Attributes | Static Public Attributes | List of all members
@@ -72,9 +96,17 @@ $(function() { - @@ -90,17 +122,17 @@ Public Member Functions - + - - + + - + @@ -110,15 +142,40 @@ Public Member Functions + + + + + + + + + + - +

Public Types

enum  EventType { Event_TapShortcut = 1, +
enum  EventType {
+  Event_ShowWindow = 1, +Event_TapShortcut = 1, Event_OnScreenMessage, -Event_OnScreenReply +Event_OnScreenReply, +
+  Event_HideWindow, +Event_ReplyShowWindow, +Event_ShowNotification, +Event_ShowInformation +
}
 
using handler_func = std::function< void(json_object *)>
 
LibHomeScreenoperator= (const LibHomeScreen &)=delete
 
int init (const int port, const std::string &token)
int init (const int port, const std::string &token)
 
int tapShortcut (const char *application_name)
 
int tapShortcut (const char *application_id)
 
int onScreenMessage (const char *display_message)
 
int onScreenReply (const char *reply_message)
 
void set_event_handler (enum EventType et, handler_func f)
 
void 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)
void 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)
 
int call (const std::string &verb, struct json_object *arg)
 
 
int unsubscribe (const std::string &event_name)
 
int showWindow (const char *application_id, json_object *json)
 
int hideWindow (const char *application_id)
 
int replyShowWindow (const char *application_id, json_object *json)
 
int showNotification (json_object *json)
 
int showInformation (json_object *json)
 
void on_hangup (void *closure, struct afb_wsj1 *wsj)
 
void on_call (void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg)
 
void on_event (void *closure, const char *event, struct afb_wsj1_msg *msg)
void on_event (void *closure, const char *event, struct afb_wsj1_msg *msg)
 
void on_reply (void *closure, struct afb_wsj1_msg *msg)
 
+ + + + + + + + + + + + + +

+Public Attributes

const char * _keyParameter = "parameter"
 
const char * _keyArea = "area"
 
const char * _areaNormal = "normal"
 
const char * _areaFullScreen = "fullscreen"
 
const char * _areaSplitMain = "split.main"
 
const char * _areaSplitSub = "split.sub"
 
@@ -128,11 +185,9 @@ Static Public Attributes

Static Public Attributes

static const std::vector< std::string > api_list

Detailed Description

-

Definition at line 32 of file libhomescreen.hpp.

+

Definition at line 31 of file libhomescreen.hpp.

Member Typedef Documentation

- -

◆ handler_func

- +
@@ -142,14 +197,12 @@ Static Public Attributes
-

Definition at line 42 of file libhomescreen.hpp.

+

Definition at line 40 of file libhomescreen.hpp.

Member Enumeration Documentation

- -

◆ EventType

- +
@@ -159,22 +212,38 @@ Static Public Attributes
- - - + + + + + + + +
Enumerator
Event_TapShortcut 
Event_OnScreenMessage 
Event_OnScreenReply 
Enumerator
Event_ShowWindow  +
Event_TapShortcut  +
Event_OnScreenMessage  +
Event_OnScreenReply  +
Event_HideWindow  +
Event_ReplyShowWindow  +
Event_ShowNotification  +
Event_ShowInformation  +
-

Definition at line 44 of file libhomescreen.hpp.

-

Constructor & Destructor Documentation

- -

◆ LibHomeScreen() [1/2]

- +
@@ -188,13 +257,11 @@ Static Public Attributes

constructor

-

Definition at line 83 of file libhomescreen.cpp.

-
84 {
85 }
+

Definition at line 93 of file libhomescreen.cpp.

+
94 {
95 }
- -

◆ ~LibHomeScreen()

- +
@@ -208,13 +275,11 @@ Static Public Attributes

destructor

-

Definition at line 90 of file libhomescreen.cpp.

-
91 {
92  if(mploop)
93  {
94  sd_event_unref(mploop);
95  }
96  if(sp_websock != NULL)
97  {
98  afb_wsj1_unref(sp_websock);
99  }
100 }
+

Definition at line 100 of file libhomescreen.cpp.

+
101 {
102  if(mploop)
103  {
104  sd_event_unref(mploop);
105  }
106  if(sp_websock != NULL)
107  {
108  afb_wsj1_unref(sp_websock);
109  }
110 }
- -

◆ LibHomeScreen() [2/2]

- +
@@ -239,9 +304,7 @@ Static Public Attributes

Member Function Documentation

- -

◆ call() [1/2]

- +
@@ -267,9 +330,7 @@ Static Public Attributes - -

◆ call() [2/2]

- +
@@ -305,17 +366,45 @@ Static Public Attributes

Note

To call HomeScreen's APIs, the application should set its function name, arguments to JSON format.

-

Definition at line 360 of file libhomescreen.cpp.

-
361 {
362  int ret;
363  if(!sp_websock)
364  {
365  return -1;
366  }
367  if (!has_verb(string(verb)))
368  {
369  HMI_ERROR("libhomescreen","verb doesn't exit");
370  return -1;
371  }
372  ret = afb_wsj1_call_j(sp_websock, API, verb, arg, _on_reply_static, this);
373  if (ret < 0) {
374  HMI_ERROR("libhomescreen","Failed to call verb:%s",verb);
375  }
376  return ret;
377 }
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:18
-
static const char API[]
-
static bool has_verb(const string &verb)
-
static void _on_reply_static(void *closure, struct afb_wsj1_msg *msg)
+

Definition at line 377 of file libhomescreen.cpp.

+
378 {
379  int ret;
380  if(!sp_websock)
381  {
382  return -1;
383  }
384  if (!has_verb(string(verb)))
385  {
386  HMI_ERROR("libhomescreen","verb doesn't exit");
387  return -1;
388  }
389  ret = afb_wsj1_call_j(sp_websock, API, verb, arg, _on_reply_static, this);
390  if (ret < 0) {
391  HMI_ERROR("libhomescreen","Failed to call verb:%s",verb);
392  }
393  return ret;
394 }
static const char API[]
+
static bool has_verb(const string &verb)
+
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:38
+
static void _on_reply_static(void *closure, struct afb_wsj1_msg *msg)
- -

◆ init()

+ +
+
+
+ + + + + + + +
int LibHomeScreen::hideWindow (const char * application_id)
+
+

Sending hide window event

+

Call HomeScreen Service's hideWindow verb to release id's screen.

+

Parameters

+
    +
  • application_id [in] : This argument should be specified to the application's id.
  • +
+

Return

+
    +
  • Returns 0 on success or -1 in case of error.
  • +
+

Definition at line 503 of file libhomescreen.cpp.

+
504 {
505  if(!sp_websock)
506  {
507  return -1;
508  }
509 
510  struct json_object* j_obj = json_object_new_object();
511  struct json_object* val = json_object_new_string(application_id);
512  json_object_object_add(j_obj, ApplicationId, val);
513 
514  return this->call("hideWindow", j_obj);
515 }
static const char ApplicationId[]
+
int call(const std::string &verb, struct json_object *arg)
+
+
+
+
@@ -349,15 +438,15 @@ Static Public Attributes

Note

Use this constructor

-

Definition at line 116 of file libhomescreen.cpp.

-
117 {
118  int ret = 0;
119  if(port > 0 && token.size() > 0)
120  {
121  mport = port;
122  mtoken = token;
123  }
124  else
125  {
126  HMI_ERROR("libhomescreen","port and token should be > 0, Initial port and token uses.");
127  }
128 
129  ret = initialize_websocket();
130  if(ret != 0 )
131  {
132  HMI_ERROR("libhomescreen","Failed to initialize websocket");
133  }
134  else{
135  HMI_DEBUG("libhomescreen","Initialized");
136  }
137 
138  return ret;
139 }
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:18
-
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:22
+

Definition at line 126 of file libhomescreen.cpp.

+
127 {
128  int ret = 0;
129  if(port > 0 && token.size() > 0)
130  {
131  mport = port;
132  mtoken = token;
133  }
134  else
135  {
136  HMI_ERROR("libhomescreen","port and token should be > 0, Initial port and token uses.");
137  }
138 
139  ret = initialize_websocket();
140  if(ret != 0 )
141  {
142  HMI_ERROR("libhomescreen","Failed to initialize websocket");
143  }
144  else{
145  HMI_DEBUG("libhomescreen","Initialized");
146  }
147 
148  return ret;
149 }
string token
Definition: simple-egl.cpp:61
+
long port
Definition: simple-egl.cpp:60
+
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:38
+
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:42
- -

◆ on_call()

- +
@@ -393,13 +482,11 @@ Static Public Attributes
-

Definition at line 448 of file libhomescreen.cpp.

-
449 {
450 }
+

Definition at line 606 of file libhomescreen.cpp.

+
607 {
608 }
- -

◆ on_event()

- +
@@ -429,20 +516,23 @@ Static Public Attributes
-

Definition at line 458 of file libhomescreen.cpp.

-
459 {
460  HMI_DEBUG("libhomescreen","event: (%s) msg: (%s).", event, afb_wsj1_msg_object_s(msg));
461 
462  if (strstr(event, API) == NULL) {
463  return;
464  }
465 
466  struct json_object* ev_contents = afb_wsj1_msg_object_j(msg);
467  struct json_object *json_data = json_object_object_get(ev_contents, "data");
468 
469  if(onEvent != nullptr)
470  {
471  const string ev(event);
472  onEvent(ev, ev_contents);
473  }
474 
475  const char* event_only = strchr(event, '/');
476  if (event_only != nullptr) {
477  event_only = event_only + 1;
478  }
479 
480  if (strcasecmp(event_only, LibHomeScreen::event_list[0].c_str()) == 0) {
481  auto i = this->handlers.find(Event_TapShortcut);
482  if ( i != this->handlers.end() ) {
483  i->second(json_data);
484  }
485  }
486  else if (strcasecmp(event_only, LibHomeScreen::event_list[1].c_str()) == 0) {
487  auto i = this->handlers.find(Event_OnScreenMessage);
488  if ( i != this->handlers.end() ) {
489  i->second(json_data);
490  }
491  }
492  else if (strcasecmp(event_only, LibHomeScreen::event_list[2].c_str()) == 0) {
493  auto i = this->handlers.find(Event_OnScreenReply);
494  if ( i != this->handlers.end() ) {
495  i->second(json_data);
496  }
497  }
498 
499  json_object_put(ev_contents);
500 }
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:22
- -
static const char API[]
- - -
static const std::vector< std::string > event_list
- +

Definition at line 616 of file libhomescreen.cpp.

+
617 {
618  HMI_DEBUG("libhomescreen","event: (%s) msg: (%s).", event, afb_wsj1_msg_object_s(msg));
619 
620  if (strstr(event, API) == NULL) {
621  return;
622  }
623 
624  struct json_object* ev_contents = afb_wsj1_msg_object_j(msg);
625  struct json_object *json_data;
626  if(!json_object_object_get_ex(ev_contents, "data", &json_data)) {
627  HMI_ERROR("libhomescreen", "got ev_contents error.");
628  return;
629  }
630 
631  if(onEvent != nullptr)
632  {
633  const string ev(event);
634  onEvent(ev, ev_contents);
635  }
636 
637  const char* event_type = nullptr;
638  struct json_object *json_event_type;
639  if(json_object_object_get_ex(json_data, "type", &json_event_type)) {
640  event_type = json_object_get_string(json_event_type);
641  }
642  else {
643  HMI_WARNING("libhomescreen","event_type is null.");
644  return;
645  }
646 
647  if (strcasecmp(event_type, LibHomeScreen::event_list[0].c_str()) == 0) {
648  auto i = this->handlers.find(Event_ShowWindow);
649  if ( i != this->handlers.end() ) {
650  i->second(json_data);
651  }
652  }
653  else if (strcasecmp(event_type, LibHomeScreen::event_list[1].c_str()) == 0) {
654  auto i = this->handlers.find(Event_OnScreenMessage);
655  if ( i != this->handlers.end() ) {
656  i->second(json_data);
657  }
658  }
659  else if (strcasecmp(event_type, LibHomeScreen::event_list[2].c_str()) == 0) {
660  auto i = this->handlers.find(Event_OnScreenReply);
661  if ( i != this->handlers.end() ) {
662  i->second(json_data);
663  }
664  }
665  else if (strcasecmp(event_type, LibHomeScreen::event_list[3].c_str()) == 0) {
666  auto i = this->handlers.find(Event_HideWindow);
667  if ( i != this->handlers.end() ) {
668  i->second(json_data);
669  }
670  }
671  else if (strcasecmp(event_type, LibHomeScreen::event_list[4].c_str()) == 0) {
672  auto i = this->handlers.find(Event_ReplyShowWindow);
673  if ( i != this->handlers.end() ) {
674  i->second(json_data);
675  }
676  }
677  else if (strcasecmp(event_type, LibHomeScreen::event_list[5].c_str()) == 0) {
678  auto i = this->handlers.find(Event_ShowNotification);
679  if ( i != this->handlers.end() ) {
680  i->second(json_data);
681  }
682  }
683  else if (strcasecmp(event_type, LibHomeScreen::event_list[6].c_str()) == 0) {
684  auto i = this->handlers.find(Event_ShowInformation);
685  if ( i != this->handlers.end() ) {
686  i->second(json_data);
687  }
688  }
689 }
static const char API[]
+ + + + + + +
#define HMI_WARNING(prefix, args,...)
Definition: hmi-debug.h:39
+ +
static const std::vector< std::string > event_list
+
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:38
+
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:42
- -

◆ on_hangup()

- +
@@ -466,14 +556,12 @@ Static Public Attributes
-

Definition at line 439 of file libhomescreen.cpp.

-
440 {
441  HMI_DEBUG("libhomescreen","%s called", __FUNCTION__);
442  if(onHangup != nullptr)
443  {
444  onHangup();
445  }
446 }
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:22
+

Definition at line 597 of file libhomescreen.cpp.

+
598 {
599  HMI_DEBUG("libhomescreen","called");
600  if(onHangup != nullptr)
601  {
602  onHangup();
603  }
604 }
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:42
- -

◆ on_reply()

- +
@@ -498,14 +586,12 @@ Static Public Attributes

msg is like ({"response":{"verb":"subscribe","error":0},"jtype":"afb-reply","request":{"status":"success","info":"homescreen binder subscribe event name [on_screen_message]"}}) msg is like ({"response":{"verb":"tap_shortcut","error":0},"jtype":"afb-reply","request":{"status":"success","info":"afb_event_push event [tap_shortcut]"}})

-

Definition at line 506 of file libhomescreen.cpp.

-
507 {
508  HMI_DEBUG("libhomescreen","msg: (%s)", afb_wsj1_msg_object_s(msg));
509  if(onReply != nullptr)
510  {
511  struct json_object* reply = afb_wsj1_msg_object_j(msg);
512  onReply(reply);
513 
514  json_object_put(reply);
515  }
516 }
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:22
+

Definition at line 695 of file libhomescreen.cpp.

+
696 {
697  HMI_DEBUG("libhomescreen","msg: (%s)", afb_wsj1_msg_object_s(msg));
698  if(onReply != nullptr)
699  {
700  struct json_object* reply = afb_wsj1_msg_object_j(msg);
701  onReply(reply);
702  }
703 }
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:42
- -

◆ onScreenMessage()

- +
@@ -529,14 +615,12 @@ Static Public Attributes
  • Returns 0 on success or -1 in case of error.
  • -

    Definition at line 244 of file libhomescreen.cpp.

    -
    245 {
    246  if(!sp_websock)
    247  {
    248  return -1;
    249  }
    250 
    251  struct json_object* j_obj = json_object_new_object();
    252  struct json_object* val = json_object_new_string(display_message);
    253  json_object_object_add(j_obj, "display_message", val);
    254  return this->call("on_screen_message", j_obj);
    255 }
    int call(const std::string &verb, struct json_object *arg)
    +

    Definition at line 242 of file libhomescreen.cpp.

    +
    243 {
    244  if(!sp_websock)
    245  {
    246  return -1;
    247  }
    248 
    249  struct json_object* j_obj = json_object_new_object();
    250  struct json_object* val = json_object_new_string(display_message);
    251  json_object_object_add(j_obj, "display_message", val);
    252  return this->call("on_screen_message", j_obj);
    253 }
    int call(const std::string &verb, struct json_object *arg)
    - -

    ◆ onScreenReply()

    - +
    @@ -560,14 +644,12 @@ Static Public Attributes
  • Returns 0 on success or -1 in case of error.
  • -

    Definition at line 268 of file libhomescreen.cpp.

    -
    269 {
    270  if(!sp_websock)
    271  {
    272  return -1;
    273  }
    274 
    275  struct json_object* j_obj = json_object_new_object();
    276  struct json_object* val = json_object_new_string(reply_message);
    277  json_object_object_add(j_obj, "reply_message", val);
    278  return this->call("on_screen_reply", j_obj);
    279 }
    int call(const std::string &verb, struct json_object *arg)
    +

    Definition at line 266 of file libhomescreen.cpp.

    +
    267 {
    268  if(!sp_websock)
    269  {
    270  return -1;
    271  }
    272 
    273  struct json_object* j_obj = json_object_new_object();
    274  struct json_object* val = json_object_new_string(reply_message);
    275  json_object_object_add(j_obj, "reply_message", val);
    276  return this->call("on_screen_reply", j_obj);
    277 }
    int call(const std::string &verb, struct json_object *arg)
    - -

    ◆ operator=()

    - +
    @@ -591,16 +673,14 @@ Static Public Attributes - -

    ◆ registerCallback()

    - +
    - + @@ -633,13 +713,53 @@ Static Public Attributes

    Note

    Event callback is invoked by home screen for event you subscribed. If you would like to get event, please call subscribe function before/after this function

    -

    Definition at line 155 of file libhomescreen.cpp.

    -
    159 {
    160  onEvent = event_cb;
    161  onReply = reply_cb;
    162  onHangup = hangup_cb;
    163 }
    +

    Definition at line 165 of file libhomescreen.cpp.

    +
    169 {
    170  onEvent = event_cb;
    171  onReply = reply_cb;
    172  onHangup = hangup_cb;
    173 }
    - -

    ◆ set_event_handler()

    + +
    +
    +
    void LibHomeScreen::registerCallback (void(*)(const std::string &event, struct json_object *event_contents) void(*)(const std::string &event, struct json_object *event_contents)  event_cb,
    + + + + + + + + + + + + + + + + + +
    int LibHomeScreen::replyShowWindow (const char * application_id,
    json_object * json 
    )
    +
    +

    Sending reply onscreen message event

    +

    Call HomeScreen Service's replyShowWindow verb to reply onscreen message.

    +

    Parameters

    +
      +
    • application_id [in] : This argument should be specified to the onscreen reply to applilcation id.
    • +
    • json [in] : This argument should be specified to the json parameters.
    • +
    +

    Return

    +
      +
    • Returns 0 on success or -1 in case of error.
    • +
    +

    Definition at line 530 of file libhomescreen.cpp.

    +
    531 {
    532  if(!sp_websock)
    533  {
    534  return -1;
    535  }
    536 
    537  if (json == nullptr) {
    538  HMI_WARNING("libhomescreen", "replyShowWindow`s parameter is null");
    539  return -1;
    540  }
    541 
    542  struct json_object* j_obj = json_object_new_object();
    543  struct json_object* val = json_object_new_string(application_id);
    544  json_object_object_add(j_obj, ApplicationId, val);
    545  json_object_object_add(j_obj, "parameter", json);
    546 
    547  return this->call("replyShowWindow", j_obj);
    548 }
    static const char ApplicationId[]
    +
    int call(const std::string &verb, struct json_object *arg)
    +
    #define HMI_WARNING(prefix, args,...)
    Definition: hmi-debug.h:39
    +
    +
    +
    +
    @@ -670,20 +790,123 @@ Static Public Attributes
  • f [in] : event handler
  • Return

    -

    Nothing

    - -

    Definition at line 293 of file libhomescreen.cpp.

    -
    294 {
    295  if (et >= 1 && et <= 3) {
    296  switch (et) {
    297  case Event_TapShortcut:
    299  break;
    302  break;
    303  case Event_OnScreenReply:
    305  break;
    306  }
    307 
    308  this->handlers[et] = std::move(f);
    309  }
    310 }
    - -
    int subscribe(const std::string &event_name)
    -
    static const std::vector< std::string > event_list
    - +

    Nothing

    +

    Note

    +

    Don't release json_object by json_object_put in handler_func. The resource is released by libafbwsc library.

    + +

    Definition at line 295 of file libhomescreen.cpp.

    +
    296 {
    297  if (et >= 1 && et <= 7) {
    298  switch (et) {
    299 /* case Event_TapShortcut:
    300  this->subscribe(LibHomeScreen::event_list[0]);
    301  break;*/
    302  case Event_ShowWindow:
    304  break;
    307  break;
    308  case Event_OnScreenReply:
    310  break;
    311  case Event_HideWindow:
    313  break;
    316  break;
    319  break;
    322  break;
    323  }
    324 
    325  this->handlers[et] = std::move(f);
    326  }
    327 }
    + + + + +
    int subscribe(const std::string &event_name)
    + + +
    static const std::vector< std::string > event_list
    - -

    ◆ subscribe()

    + +
    +
    +
    + + + + + + + +
    int LibHomeScreen::showInformation (json_object * json)
    +
    +

    Sending show information event

    +

    Call HomeScreen Service's information verb to show notification on Information Bar.

    +

    Parameters

    +
      +
    • json [in] : This argument should be specified to the json parameters.
    • +
    +

    Return

    +
      +
    • Returns 0 on success or -1 in case of error.
    • +
    +

    Definition at line 584 of file libhomescreen.cpp.

    +
    585 {
    586  if(!sp_websock)
    587  {
    588  return -1;
    589  }
    590 
    591  return this->call("showInformation", json);
    592 }
    int call(const std::string &verb, struct json_object *arg)
    +
    +
    +
    + +
    +
    + + + + + + + + +
    int LibHomeScreen::showNotification (json_object * json)
    +
    +

    Sending show notification event

    +

    Call HomeScreen Service's notification verb to show notification on Status Bar.

    +

    Parameters

    +
      +
    • json [in] : This argument should be specified to the json parameters.
    • +
    +

    Return

    +
      +
    • Returns 0 on success or -1 in case of error.
    • +
    + +

    Definition at line 562 of file libhomescreen.cpp.

    +
    563 {
    564  if(!sp_websock)
    565  {
    566  return -1;
    567  }
    568 
    569  return this->call("showNotification", json);
    570 }
    int call(const std::string &verb, struct json_object *arg)
    +
    +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + +
    int LibHomeScreen::showWindow (const char * application_id,
    json_object * json 
    )
    +
    +

    Sending show window event

    +

    Call HomeScreen Service's showWindow verb to request display id's screen.

    +

    Parameters

    +
      +
    • application_id [in] : This argument should be specified to the application's id.
    • +
    • json [in] : This argument should be specified to the json parameters.
    • +
    +

    Return

    +
      +
    • Returns 0 on success or -1 in case of error.
    • +
    + +

    Definition at line 467 of file libhomescreen.cpp.

    +
    468 {
    469  if(!sp_websock)
    470  {
    471  return -1;
    472  }
    473 
    474  struct json_object* j_obj = json_object_new_object();
    475  struct json_object* val = json_object_new_string(application_id);
    476  json_object_object_add(j_obj, ApplicationId, val);
    477 
    478  if (json == nullptr) {
    479  struct json_object* j_json = json_object_new_object();
    480  struct json_object* value = json_object_new_string("normal");
    481  json_object_object_add(j_json, "area", value);
    482  json_object_object_add(j_obj, "parameter", j_json);
    483  }
    484  else {
    485  json_object_object_add(j_obj, "parameter", json);
    486  }
    487 
    488  return this->call("showWindow", j_obj);
    489 }
    static const char ApplicationId[]
    +
    int call(const std::string &verb, struct json_object *arg)
    +
    +
    +
    +
    @@ -708,16 +931,14 @@ Static Public Attributes

    Note

    This function enables to get an event to your callback function.

    -

    Definition at line 392 of file libhomescreen.cpp.

    -
    393 {
    394  if(!sp_websock)
    395  {
    396  return -1;
    397  }
    398  struct json_object* j_obj = json_object_new_object();
    399  json_object_object_add(j_obj, "event", json_object_new_string(event_name.c_str()));
    400 
    401  int ret = afb_wsj1_call_j(sp_websock, API, "subscribe", j_obj, _on_reply_static, this);
    402  if (ret < 0) {
    403  HMI_ERROR("libhomescreen","Failed to call verb:%s",__FUNCTION__);
    404  }
    405  return ret;
    406 }
    #define HMI_ERROR(prefix, args,...)
    Definition: hmi-debug.h:18
    -
    static const char API[]
    -
    static void _on_reply_static(void *closure, struct afb_wsj1_msg *msg)
    +

    Definition at line 409 of file libhomescreen.cpp.

    +
    410 {
    411  if(!sp_websock)
    412  {
    413  return -1;
    414  }
    415  struct json_object* j_obj = json_object_new_object();
    416  json_object_object_add(j_obj, "event", json_object_new_string(event_name.c_str()));
    417 
    418  int ret = afb_wsj1_call_j(sp_websock, API, "subscribe", j_obj, _on_reply_static, this);
    419  if (ret < 0) {
    420  HMI_ERROR("libhomescreen","Failed to call verb");
    421  }
    422  return ret;
    423 }
    static const char API[]
    +
    #define HMI_ERROR(prefix, args,...)
    Definition: hmi-debug.h:38
    +
    static void _on_reply_static(void *closure, struct afb_wsj1_msg *msg)
    - -

    ◆ tapShortcut()

    - +
    @@ -725,7 +946,7 @@ Static Public Attributes - +
    int LibHomeScreen::tapShortcut ( const char * application_name)application_id)
    @@ -734,21 +955,19 @@ Static Public Attributes

    When HomeScreen shortcut area is tapped, sending a event

    Parameters

      -
    • application_name [in] : Tapped application name (label)
    • +
    • application_id [in] : Tapped application id (label)

    Return

    • Returns 0 on success or -1 in case of error.
    -

    Definition at line 220 of file libhomescreen.cpp.

    -
    221 {
    222  if(!sp_websock)
    223  {
    224  return -1;
    225  }
    226 
    227  struct json_object* j_obj = json_object_new_object();
    228  struct json_object* val = json_object_new_string(application_name);
    229  json_object_object_add(j_obj, "application_name", val);
    230  return this->call("tap_shortcut", j_obj);
    231 }
    int call(const std::string &verb, struct json_object *arg)
    +

    Definition at line 222 of file libhomescreen.cpp.

    +
    223 {
    224  struct json_object* obj = json_object_new_object();
    225  struct json_object* val = json_object_new_string("normal");
    226  json_object_object_add(obj, "area", val);
    227 
    228  return showWindow(application_id, obj);
    229 }
    int showWindow(const char *application_id, json_object *json)
    - -

    ◆ unsubscribe()

    - +
    @@ -773,17 +992,99 @@ Static Public Attributes

    Note

    This function disables to get an event to your callback function.

    -

    Definition at line 421 of file libhomescreen.cpp.

    -
    422 {
    423  if(!sp_websock)
    424  {
    425  return -1;
    426  }
    427  struct json_object* j_obj = json_object_new_object();
    428  json_object_object_add(j_obj, "event", json_object_new_string(event_name.c_str()));
    429 
    430  int ret = afb_wsj1_call_j(sp_websock, API, "unsubscribe", j_obj, _on_reply_static, this);
    431  if (ret < 0) {
    432  HMI_ERROR("libhomescreen","Failed to call verb:%s",__FUNCTION__);
    433  }
    434  return ret;
    435 }
    #define HMI_ERROR(prefix, args,...)
    Definition: hmi-debug.h:18
    -
    static const char API[]
    -
    static void _on_reply_static(void *closure, struct afb_wsj1_msg *msg)
    +

    Definition at line 438 of file libhomescreen.cpp.

    +
    439 {
    440  if(!sp_websock)
    441  {
    442  return -1;
    443  }
    444  struct json_object* j_obj = json_object_new_object();
    445  json_object_object_add(j_obj, "event", json_object_new_string(event_name.c_str()));
    446 
    447  int ret = afb_wsj1_call_j(sp_websock, API, "unsubscribe", j_obj, _on_reply_static, this);
    448  if (ret < 0) {
    449  HMI_ERROR("libhomescreen","Failed to call verb");
    450  }
    451  return ret;
    452 }
    static const char API[]
    +
    #define HMI_ERROR(prefix, args,...)
    Definition: hmi-debug.h:38
    +
    static void _on_reply_static(void *closure, struct afb_wsj1_msg *msg)

    Member Data Documentation

    - -

    ◆ api_list

    + +
    +
    +
    + + + +
    const char* LibHomeScreen::_areaFullScreen = "fullscreen"
    +
    + +

    Definition at line 59 of file libhomescreen.hpp.

    + +
    +
    + +
    +
    + + + + +
    const char* LibHomeScreen::_areaNormal = "normal"
    +
    + +

    Definition at line 58 of file libhomescreen.hpp.

    + +
    +
    + +
    +
    + + + + +
    const char* LibHomeScreen::_areaSplitMain = "split.main"
    +
    + +

    Definition at line 60 of file libhomescreen.hpp.

    + +
    +
    + +
    +
    + + + + +
    const char* LibHomeScreen::_areaSplitSub = "split.sub"
    +
    +

    Definition at line 61 of file libhomescreen.hpp.

    + +
    +
    + +
    +
    + + + + +
    const char* LibHomeScreen::_keyArea = "area"
    +
    + +

    Definition at line 55 of file libhomescreen.hpp.

    + +
    +
    + +
    +
    + + + + +
    const char* LibHomeScreen::_keyParameter = "parameter"
    +
    + +

    Definition at line 54 of file libhomescreen.hpp.

    + +
    +
    +
    @@ -800,14 +1101,12 @@ Static Public Attributes
    -Initial value:
    {
    std::string("ping"),
    std::string("tap_shortcut"),
    std::string("on_screen_message"),
    std::string("on_screen_reply"),
    std::string("subscribe"),
    std::string("unsubscribe")
    }
    -

    Definition at line 50 of file libhomescreen.hpp.

    +Initial value:
    {
    std::string("ping"),
    std::string("tap_shortcut"),
    std::string("on_screen_message"),
    std::string("on_screen_reply"),
    std::string("subscribe"),
    std::string("unsubscribe"),
    std::string("showWindow"),
    std::string("hideWindow"),
    std::string("replyShowWindow"),
    std::string("showNotification"),
    std::string("showInformation")
    }
    +

    Definition at line 63 of file libhomescreen.hpp.

    - -

    ◆ event_list

    - +
    @@ -824,8 +1123,8 @@ Static Public Attributes
    -Initial value:
    {
    std::string("tap_shortcut"),
    std::string("on_screen_message"),
    std::string("on_screen_reply"),
    std::string("none")
    }
    -

    Definition at line 51 of file libhomescreen.hpp.

    +Initial value:
    {
    std::string("showWindow"),
    std::string("on_screen_message"),
    std::string("on_screen_reply"),
    std::string("hideWindow"),
    std::string("replyShowWindow"),
    std::string("showNotification"),
    std::string("showInformation"),
    std::string("none")
    }
    +

    Definition at line 64 of file libhomescreen.hpp.

    @@ -838,7 +1137,7 @@ Static Public Attributes