Sound Manager
|
#include <libsoundmanager.hpp>
Public Member Functions | |
LibSoundmanager (const int port, const std::string &token) | |
~LibSoundmanager () | |
void | register_callback (void(*event_cb)(const std::string &event, struct json_object *event_contents), void(*reply_cb)(struct json_object *reply_contents)) |
int | run_eventloop () |
int | call (const std::string &verb, struct json_object *arg) |
int | call_sync (const std::string &verb, struct json_object *arg, struct json_object *ret) |
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) |
Definition at line 62 of file libsoundmanager.hpp.
LibSoundmanager::LibSoundmanager | ( | const int | port, |
const std::string & | token | ||
) |
LibSoundmanager::~LibSoundmanager | ( | ) |
Definition at line 93 of file libsoundmanager.cpp.
int LibSoundmanager::call | ( | const std::string & | verb, |
struct json_object * | arg | ||
) |
This function calls the API of Audio Manager via WebSocket
To call Audio Manager's APIs, the application should set its function name, arguments to JSON format.
Definition at line 217 of file libsoundmanager.cpp.
int LibSoundmanager::call_sync | ( | const std::string & | verb, |
struct json_object * | arg, | ||
struct json_object * | ret | ||
) |
Definition at line 236 of file libsoundmanager.cpp.
void LibSoundmanager::on_call | ( | void * | closure, |
const char * | api, | ||
const char * | verb, | ||
struct afb_wsj1_msg * | msg | ||
) |
Definition at line 347 of file libsoundmanager.cpp.
void LibSoundmanager::on_event | ( | void * | closure, |
const char * | event, | ||
struct afb_wsj1_msg * | msg | ||
) |
Definition at line 358 of file libsoundmanager.cpp.
void LibSoundmanager::on_hangup | ( | void * | closure, |
struct afb_wsj1 * | wsj | ||
) |
Definition at line 342 of file libsoundmanager.cpp.
void LibSoundmanager::on_reply | ( | void * | closure, |
struct afb_wsj1_msg * | msg | ||
) |
Definition at line 369 of file libsoundmanager.cpp.
void LibSoundmanager::register_callback | ( | void(*)(const std::string &event, struct json_object *event_contents) | event_cb, |
void(*)(struct json_object *reply_contents) | reply_cb | ||
) |
This function register callback function for reply/event message from sound manager
Event callback is invoked by sound manager for event you subscribed. If you would like to get event, please call subscribe function before/after this function
Definition at line 119 of file libsoundmanager.cpp.
int LibSoundmanager::run_eventloop | ( | ) |
This function start receiving the reply/event message from sound manager
Nothing
Definition at line 182 of file libsoundmanager.cpp.
int LibSoundmanager::subscribe | ( | const std::string & | event_name | ) |
Register callback function for each event
This function enables to get an event to your callback function. Regarding the list of event name, please refer to CommandSender API and RountingSender API.
Definition at line 255 of file libsoundmanager.cpp.
int LibSoundmanager::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 284 of file libsoundmanager.cpp.