Sound Manager
|
#include <libsoundmanager.hpp>
Public Types | |
enum | EventType_SM { Event_AsyncSetSourceState = 1 } |
using | handler_fun = std::function< void(struct json_object *)> |
Public Member Functions | |
LibSoundmanager () | |
~LibSoundmanager () | |
LibSoundmanager (const LibSoundmanager &)=delete | |
LibSoundmanager & | operator= (const LibSoundmanager &)=delete |
int | init (int port, const std::string &token) |
int | registerSource (const std::string &sourceName) |
int | connect (int sourceID, int sinkID) |
int | connect (int sourceID, const std::string &sinkName) |
int | disconnect (int connectionID) |
int | ackSetSourceState (int handle, int error) |
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 | set_event_handler (enum EventType_SM et, handler_fun f) |
void | register_callback (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) |
void | register_callback (void(*reply_cb)(struct json_object *reply_contents), void(*hangup_cb)(void)=nullptr) |
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 32 of file libsoundmanager.hpp.
using LibSoundmanager::handler_fun = std::function<void(struct json_object*)> |
Definition at line 41 of file libsoundmanager.hpp.
Enumerator | |
---|---|
Event_AsyncSetSourceState |
Definition at line 43 of file libsoundmanager.hpp.
LibSoundmanager::LibSoundmanager | ( | ) |
Definition at line 96 of file libsoundmanager.cpp.
LibSoundmanager::~LibSoundmanager | ( | ) |
Definition at line 100 of file libsoundmanager.cpp.
|
delete |
int LibSoundmanager::ackSetSourceState | ( | int | handle, |
int | error | ||
) |
This function calls the ackSetSourceState of Audio Manager via WebSocket
This function must be called when application get asyncSetSourceState event Input handle number attached in asyncSetSourceState and error number(0 is acknowledge)
Definition at line 374 of file libsoundmanager.cpp.
int LibSoundmanager::call | ( | const std::string & | verb, |
struct json_object * | arg | ||
) |
int LibSoundmanager::call | ( | const char * | verb, |
struct json_object * | arg | ||
) |
This function calls the API of Audio Manager via WebSocket This function is overload function of "call"
To call Audio Manager's APIs, the application should set its function name, arguments to JSON format.
Definition at line 436 of file libsoundmanager.cpp.
int LibSoundmanager::connect | ( | int | sourceID, |
int | sinkID | ||
) |
This function calls connect of Audio Manager via WebSocket connect is to get sound right
This function must be called to get source right connectionID is
Definition at line 287 of file libsoundmanager.cpp.
int LibSoundmanager::connect | ( | int | sourceID, |
const std::string & | sinkName | ||
) |
int LibSoundmanager::disconnect | ( | int | connectionID | ) |
This function calls the disconnect of Audio Manager via WebSocket
Definition at line 347 of file libsoundmanager.cpp.
int LibSoundmanager::init | ( | int | port, |
const std::string & | token | ||
) |
This function is initialization function
Returns 0 on success or -1 in case of transmission error.
Definition at line 126 of file libsoundmanager.cpp.
void LibSoundmanager::on_call | ( | void * | closure, |
const char * | api, | ||
const char * | verb, | ||
struct afb_wsj1_msg * | msg | ||
) |
Definition at line 547 of file libsoundmanager.cpp.
void LibSoundmanager::on_event | ( | void * | closure, |
const char * | event, | ||
struct afb_wsj1_msg * | msg | ||
) |
Definition at line 558 of file libsoundmanager.cpp.
void LibSoundmanager::on_hangup | ( | void * | closure, |
struct afb_wsj1 * | wsj | ||
) |
Definition at line 538 of file libsoundmanager.cpp.
void LibSoundmanager::on_reply | ( | void * | closure, |
struct afb_wsj1_msg * | msg | ||
) |
Definition at line 578 of file libsoundmanager.cpp.
|
delete |
void LibSoundmanager::register_callback | ( | 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 |
||
) |
void LibSoundmanager::register_callback | ( | void(*)(struct json_object *reply_contents) | reply_cb, |
void(*)(void) | hangup_cb = nullptr |
||
) |
This function is overload of register_callback. This registers callback function for reply/event message from sound manager
Event callback is invoked by sound manager for event you subscribed. This function for convinience for user uses set_event_handler If you would like to get event, please call subscribe function before/after this function
Definition at line 236 of file libsoundmanager.cpp.
int LibSoundmanager::registerSource | ( | const std::string & | sourceName | ) |
This function calls registerSource of Audio Manager via WebSocket registerSource is registration as source for policy management
This function must be called to get source ID mainConnectionID is returned by async reply function
Definition at line 259 of file libsoundmanager.cpp.
void LibSoundmanager::set_event_handler | ( | enum EventType_SM | et, |
handler_fun | f | ||
) |
This function calls the ackSetSourceState of Audio Manager via WebSocket
This function must be called when application get asyncSetSourceState event Input handle number attached in asyncSetSourceState and error number(0 is acknowledge)
Definition at line 528 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 469 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 498 of file libsoundmanager.cpp.