17 #ifndef LIBHOMESCREEN_H 18 #define LIBHOMESCREEN_H 23 #include <json-c/json.h> 24 #include <systemd/sd-event.h> 27 #include <afb/afb-wsj1.h> 28 #include <afb/afb-ws-client.h> 63 static const std::vector<std::string>
api_list;
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);
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);
85 int showWindow(
const char* application_id, json_object* json);
93 int initialize_websocket();
95 void (*onEvent)(
const std::string& event,
struct json_object* event_contents);
96 void (*onReply)(
struct json_object* reply);
97 void (*onHangup)(void);
99 struct afb_wsj1* sp_websock;
100 struct afb_wsj1_itf minterface;
105 std::string mtoken =
"hs";
107 std::map<EventType, handler_func> handlers;
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);
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
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)
int call(const std::string &verb, struct json_object *arg)
int showInformation(json_object *json)
void on_hangup(void *closure, struct afb_wsj1 *wsj)
int subscribe(const std::string &event_name)
static const std::vector< std::string > event_list
int init(const int port, const std::string &token)
const char * _areaSplitMain
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)