X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=doc%2Fapi-ref%2Fhtml%2Fdf%2Fd43%2Flibhomescreen_8hpp_source.html;h=bb84463377358f16d0d7da7eb0ed6d29f065d339;hb=31ff5ce755d00cf12ea2ffc96c33ed9acd36358f;hp=5e2f196dc2bf591a56c36bf9bf141ac101ce924a;hpb=bbb4ee8e9974c4b008da84a1e504120f70606c92;p=apps%2Fagl-service-homescreen.git diff --git a/doc/api-ref/html/df/d43/libhomescreen_8hpp_source.html b/doc/api-ref/html/df/d43/libhomescreen_8hpp_source.html index 5e2f196..bb84463 100644 --- a/doc/api-ref/html/df/d43/libhomescreen_8hpp_source.html +++ b/doc/api-ref/html/df/d43/libhomescreen_8hpp_source.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: include/libhomescreen.hpp Source File @@ -12,6 +11,9 @@ + @@ -29,19 +31,39 @@ - + - - - - + +
libhomescreen.hpp
-Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef LIBHOMESCREEN_H
18 #define LIBHOMESCREEN_H
19 #include <vector>
20 #include <map>
21 #include <string>
22 #include <functional>
23 #include <json-c/json.h>
24 #include <systemd/sd-event.h>
25 extern "C"
26 {
27 #include <afb/afb-binding.h>
28 #include <afb/afb-wsj1.h>
29 #include <afb/afb-ws-client.h>
30 }
31 
33 {
34 public:
35  LibHomeScreen();
37 
38  LibHomeScreen(const LibHomeScreen &) = delete;
39  LibHomeScreen &operator=(const LibHomeScreen &) = delete;
40 
41  // using handler_func = std::function<void(const char*)>;
42  using handler_func = std::function<void(json_object*)>;
43 
44  enum EventType {
48  };
49 
50  static const std::vector<std::string> api_list;
51  static const std::vector<std::string> event_list;
52 
53  /* Method */
54  int init(const int port, const std::string& token);
55 
56  int tapShortcut(const char* application_name);
57  int onScreenMessage(const char* display_message);
58  int onScreenReply(const char* reply_message);
59 
60  void set_event_handler(enum EventType et, handler_func f);
61 
62  void registerCallback(
63  void (*event_cb)(const std::string& event, struct json_object* event_contents),
64  void (*reply_cb)(struct json_object* reply_contents),
65  void (*hangup_cb)(void) = nullptr);
66 
67  int call(const std::string& verb, struct json_object* arg);
68  int call(const char* verb, struct json_object* arg);
69  int subscribe(const std::string& event_name);
70  int unsubscribe(const std::string& event_name);
71 
72 private:
73  int initialize_websocket();
74 
75  void (*onEvent)(const std::string& event, struct json_object* event_contents);
76  void (*onReply)(struct json_object* reply);
77  void (*onHangup)(void);
78 
79  struct afb_wsj1* sp_websock;
80  struct afb_wsj1_itf minterface;
81  sd_event* mploop;
82  std::string muri;
83 
84  int mport = 2000;
85  std::string mtoken = "hs";
86 
87  std::map<EventType, handler_func> handlers;
88 
89 public:
90  /* Don't use/ Internal only */
91  void on_hangup(void *closure, struct afb_wsj1 *wsj);
92  void on_call(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg);
93  void on_event(void *closure, const char *event, struct afb_wsj1_msg *msg);
94  void on_reply(void *closure, struct afb_wsj1_msg *msg);
95 };
96 
97 #endif /* LIBHOMESCREEN_H */
void on_event(void *closure, const char *event, struct afb_wsj1_msg *msg)
-
void on_reply(void *closure, struct afb_wsj1_msg *msg)
-
int onScreenReply(const char *reply_message)
+Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef LIBHOMESCREEN_H
18 #define LIBHOMESCREEN_H
19 #include <vector>
20 #include <map>
21 #include <string>
22 #include <functional>
23 #include <json-c/json.h>
24 #include <systemd/sd-event.h>
25 extern "C"
26 {
27 #include <afb/afb-wsj1.h>
28 #include <afb/afb-ws-client.h>
29 }
30 
32 {
33 public:
34  LibHomeScreen();
36 
37  LibHomeScreen(const LibHomeScreen &) = delete;
38  LibHomeScreen &operator=(const LibHomeScreen &) = delete;
39 
40  using handler_func = std::function<void(json_object*)>;
41 
42  enum EventType {
51  };
52 
53  /* Key for json obejct */
54  const char *_keyParameter = "parameter";
55  const char *_keyArea = "area";
56 
57  /* display area */
58  const char *_areaNormal = "normal";
59  const char *_areaFullScreen = "fullscreen";
60  const char *_areaSplitMain = "split.main";
61  const char *_areaSplitSub = "split.sub";
62 
63  static const std::vector<std::string> api_list;
64  static const std::vector<std::string> event_list;
65 
66  /* Method */
67  int init(const int port, const std::string& token);
68 
69  int tapShortcut(const char* application_id);
70  int onScreenMessage(const char* display_message);
71  int onScreenReply(const char* reply_message);
72 
73  void set_event_handler(enum EventType et, handler_func f);
74 
75  void registerCallback(
76  void (*event_cb)(const std::string& event, struct json_object* event_contents),
77  void (*reply_cb)(struct json_object* reply_contents),
78  void (*hangup_cb)(void) = nullptr);
79 
80  int call(const std::string& verb, struct json_object* arg);
81  int call(const char* verb, struct json_object* arg);
82  int subscribe(const std::string& event_name);
83  int unsubscribe(const std::string& event_name);
84 
85  int showWindow(const char* application_id, json_object* json);
86  int hideWindow(const char* application_id);
87  int replyShowWindow(const char* application_id, json_object* json);
88  int showNotification(json_object* json);
89  int showInformation(json_object* json);
90 
91 
92 private:
93  int initialize_websocket();
94 
95  void (*onEvent)(const std::string& event, struct json_object* event_contents);
96  void (*onReply)(struct json_object* reply);
97  void (*onHangup)(void);
98 
99  struct afb_wsj1* sp_websock;
100  struct afb_wsj1_itf minterface;
101  sd_event* mploop;
102  std::string muri;
103 
104  int mport = 2000;
105  std::string mtoken = "hs";
106 
107  std::map<EventType, handler_func> handlers;
108 
109 public:
110  /* Don't use/ Internal only */
111  void on_hangup(void *closure, struct afb_wsj1 *wsj);
112  void on_call(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg);
113  void on_event(void *closure, const char *event, struct afb_wsj1_msg *msg);
114  void on_reply(void *closure, struct afb_wsj1_msg *msg);
115 };
116 
117 #endif /* LIBHOMESCREEN_H */
void on_event(void *closure, const char *event, struct afb_wsj1_msg *msg)
+
void on_reply(void *closure, struct afb_wsj1_msg *msg)
+
int onScreenReply(const char *reply_message)
LibHomeScreen & operator=(const LibHomeScreen &)=delete
-
std::function< void(json_object *)> handler_func
-
void on_call(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg)
- - - +
const char * _areaFullScreen
+
std::function< void(json_object *)> handler_func
+
void on_call(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg)
+
const char * _areaSplitSub
+
int tapShortcut(const char *application_id)
+
int hideWindow(const char *application_id)
+
int showWindow(const char *application_id, json_object *json)
+
const char * _keyParameter
+
int replyShowWindow(const char *application_id, json_object *json)
+ + + + +
string token
Definition: simple-egl.cpp:61
+
int call(const std::string &verb, struct json_object *arg)
-
void on_hangup(void *closure, struct afb_wsj1 *wsj)
-
int tapShortcut(const char *application_name)
-
int subscribe(const std::string &event_name)
- - -
static const std::vector< std::string > event_list
-
int init(const int port, const std::string &token)
-
int onScreenMessage(const char *display_message)
- - -
static const std::vector< std::string > api_list
-
int unsubscribe(const std::string &event_name)
-
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)
- +
int showInformation(json_object *json)
+
void on_hangup(void *closure, struct afb_wsj1 *wsj)
+
int subscribe(const std::string &event_name)
+ + +
const char * _keyArea
+ + +
long port
Definition: simple-egl.cpp:60
+
static const std::vector< std::string > event_list
+
int init(const int port, const std::string &token)
+
const char * _areaSplitMain
+
const char * _areaNormal
+
int onScreenMessage(const char *display_message)
+ + +
static const std::vector< std::string > api_list
+
int unsubscribe(const std::string &event_name)
+
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)
+ +
int showNotification(json_object *json)