HomeScreenBinding
|
#include <libhomescreen.hpp>
Public Types | |
enum | EventType { Event_TapShortcut = 1, Event_OnScreenMessage } |
using | handler_func = std::function< void(const char *)> |
Public Member Functions | |
LibHomeScreen () | |
~LibHomeScreen () | |
LibHomeScreen (const LibHomeScreen &)=delete | |
LibHomeScreen & | operator= (const LibHomeScreen &)=delete |
int | init (const int port, const std::string &token) |
int | runEventloop () |
int | tapShortcut (const char *application_name) |
int | onScreenMessage (const char *display_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) |
int | call (const std::string &verb, struct json_object *arg) |
int | call (const char *verb, struct json_object *arg) |
int | subscribe (const std::string &event_name) |
int | unsubscribe (const std::string &event_name) |
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_reply (void *closure, struct afb_wsj1_msg *msg) |
Static Public Attributes | |
static const std::vector< std::string > | api_list |
static const std::vector< std::string > | event_list |
Definition at line 32 of file libhomescreen.hpp.
using LibHomeScreen::handler_func = std::function<void(const char*)> |
Definition at line 41 of file libhomescreen.hpp.
LibHomeScreen::LibHomeScreen | ( | ) |
LibHomeScreen::~LibHomeScreen | ( | ) |
destructor
Definition at line 93 of file libhomescreen.cpp.
|
delete |
int LibHomeScreen::call | ( | const std::string & | verb, |
struct json_object * | arg | ||
) |
int LibHomeScreen::call | ( | const char * | verb, |
struct json_object * | arg | ||
) |
This function calls the API of HomeScreen via WebSocket This function is overload function of "call"
To call HomeScreen's APIs, the application should set its function name, arguments to JSON format.
Definition at line 369 of file libhomescreen.cpp.
int LibHomeScreen::init | ( | const int | port, |
const std::string & | token | ||
) |
This function is initializer
Nothing
Use this constructor
Definition at line 119 of file libhomescreen.cpp.
void LibHomeScreen::on_call | ( | void * | closure, |
const char * | api, | ||
const char * | verb, | ||
struct afb_wsj1_msg * | msg | ||
) |
Definition at line 457 of file libhomescreen.cpp.
void LibHomeScreen::on_event | ( | void * | closure, |
const char * | event, | ||
struct afb_wsj1_msg * | msg | ||
) |
Definition at line 467 of file libhomescreen.cpp.
void LibHomeScreen::on_hangup | ( | void * | closure, |
struct afb_wsj1 * | wsj | ||
) |
Definition at line 448 of file libhomescreen.cpp.
void LibHomeScreen::on_reply | ( | void * | closure, |
struct afb_wsj1_msg * | msg | ||
) |
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 519 of file libhomescreen.cpp.
int LibHomeScreen::onScreenMessage | ( | const char * | display_message | ) |
HomeScreenアプリに表示するメッセージイベントの発行
各アプリからHomeScreenアプリケーションのOnScreenに表示するイベントを発行する
Definition at line 280 of file libhomescreen.cpp.
|
delete |
void LibHomeScreen::registerCallback | ( | void(*)(const std::string &event, struct json_object *event_contents) | event_cb, |
void(*)(struct json_object *reply_contents) | reply_cb, | ||
void(*)(void) | hangup_cb = nullptr |
||
) |
This function register callback function for reply/event message from home screen
Nothing
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 158 of file libhomescreen.cpp.
int LibHomeScreen::runEventloop | ( | ) |
This function start receiving the reply/event message from home screen
Nothing
Definition at line 224 of file libhomescreen.cpp.
void LibHomeScreen::set_event_handler | ( | enum EventType | et, |
handler_func | f | ||
) |
イベントハンドラの登録
各アプリからHomeScreenアプリケーションのOnScreenに表示するイベントを発行する
Nothing
Definition at line 305 of file libhomescreen.cpp.
int LibHomeScreen::subscribe | ( | const std::string & | event_name | ) |
Register callback function for each event
This function enables to get an event to your callback function.
Definition at line 401 of file libhomescreen.cpp.
int LibHomeScreen::tapShortcut | ( | const char * | application_name | ) |
ショートカットアイコンがタップされたイベントの発行
HomeScreenアプリケーションにて各アプリアイコンがタップされたときにイベントを発行する
Definition at line 256 of file libhomescreen.cpp.
int LibHomeScreen::unsubscribe | ( | const std::string & | event_name | ) |
Unregister callback function for each event
This function disables to get an event to your callback function.
Definition at line 430 of file libhomescreen.cpp.
|
static |
Definition at line 48 of file libhomescreen.hpp.
|
static |
Definition at line 49 of file libhomescreen.hpp.