17 #ifndef LIBHOMESCREEN_H 18 #define LIBHOMESCREEN_H 23 #include <json-c/json.h> 24 #include <systemd/sd-event.h> 27 #include <afb/afb-binding.h> 28 #include <afb/afb-wsj1.h> 29 #include <afb/afb-ws-client.h> 48 static const std::vector<std::string>
api_list;
52 int init(
const int port,
const std::string& token);
61 void (*event_cb)(
const std::string&
event,
struct json_object* event_contents),
62 void (*reply_cb)(
struct json_object* reply_contents),
63 void (*hangup_cb)(
void) =
nullptr);
65 int call(
const std::string& verb,
struct json_object* arg);
66 int call(
const char* verb,
struct json_object* arg);
67 int subscribe(
const std::string& event_name);
71 int initialize_websocket();
72 void (*onEvent)(
const std::string& event,
struct json_object* event_contents);
73 void (*onReply)(
struct json_object* reply);
74 void (*onHangup)(void);
76 struct afb_wsj1* sp_websock;
77 struct afb_wsj1_itf minterface;
82 std::string mtoken =
"hs";
84 std::map<EventType, handler_func> handlers;
88 void on_hangup(
void *closure,
struct afb_wsj1 *wsj);
89 void on_call(
void *closure,
const char *api,
const char *verb,
struct afb_wsj1_msg *msg);
90 void on_event(
void *closure,
const char *event,
struct afb_wsj1_msg *msg);
91 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)
LibHomeScreen & operator=(const LibHomeScreen &)=delete
void on_call(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg)
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
std::function< void(const char *)> handler_func
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)