diff options
-rw-r--r-- | src/libsoundmanager.cpp | 52 | ||||
-rw-r--r-- | src/libsoundmanager.hpp | 10 |
2 files changed, 31 insertions, 31 deletions
diff --git a/src/libsoundmanager.cpp b/src/libsoundmanager.cpp index 45b7858..9ba3e21 100644 --- a/src/libsoundmanager.cpp +++ b/src/libsoundmanager.cpp @@ -64,29 +64,29 @@ static const std::vector<std::string> event_list{ static void _on_hangup_static(void *closure, struct afb_wsj1 *wsj) { - static_cast<LibSoundmanager*>(closure)->on_hangup(NULL,wsj); + static_cast<Soundmanager*>(closure)->on_hangup(NULL,wsj); } static void _on_call_static(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg) { - /* LibSoundmanager is not called from other process */ + /* Soundmanager is not called from other process */ } static void _on_event_static(void* closure, const char* event, struct afb_wsj1_msg *msg) { - static_cast<LibSoundmanager*>(closure)->on_event(NULL,event,msg); + static_cast<Soundmanager*>(closure)->on_event(NULL,event,msg); } static void _on_reply_static(void *closure, struct afb_wsj1_msg *msg) { - static_cast<LibSoundmanager*>(closure)->on_reply(NULL,msg); + static_cast<Soundmanager*>(closure)->on_reply(NULL,msg); } -LibSoundmanager::LibSoundmanager() +Soundmanager::Soundmanager() { } -LibSoundmanager::~LibSoundmanager() +Soundmanager::~Soundmanager() { if(mploop) { @@ -112,7 +112,7 @@ LibSoundmanager::~LibSoundmanager() * #### Note * */ -int LibSoundmanager::init(int port, const string& token) +int Soundmanager::init(int port, const string& token) { int ret; if(port > 0 && token.size() > 0) @@ -141,7 +141,7 @@ int LibSoundmanager::init(int port, const string& token) return 0; } -int LibSoundmanager::initialize_websocket() +int Soundmanager::initialize_websocket() { mploop = NULL; onEvent = nullptr; @@ -175,7 +175,7 @@ END: return -1; } -int LibSoundmanager::init_event(){ +int Soundmanager::init_event(){ /* subscribe most important event for sound right */ return subscribe(string("asyncSetSourceState")); } @@ -197,7 +197,7 @@ int LibSoundmanager::init_event(){ * 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 */ -void LibSoundmanager::register_callback( +void Soundmanager::register_callback( void (*event_cb)(const string& event, struct json_object* event_contents), void (*reply_cb)(struct json_object* reply_contents), void (*hangup_cb)(void)) @@ -221,7 +221,7 @@ void LibSoundmanager::register_callback( * 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 */ -void LibSoundmanager::register_callback( +void Soundmanager::register_callback( void (*reply_cb)(struct json_object* reply_contents), void (*hangup_cb)(void)) { @@ -244,7 +244,7 @@ void LibSoundmanager::register_callback( * mainConnectionID is returned by async reply function * */ -int LibSoundmanager::registerSource(const string& sourceName) +int Soundmanager::registerSource(const string& sourceName) { if(!sp_websock) { @@ -272,7 +272,7 @@ int LibSoundmanager::registerSource(const string& sourceName) * connectionID is returned by reply event * */ -int LibSoundmanager::connect(int sourceID, int sinkID) +int Soundmanager::connect(int sourceID, int sinkID) { if(!sp_websock) { @@ -304,7 +304,7 @@ int LibSoundmanager::connect(int sourceID, int sinkID) * Just "default" is usable. * */ -int LibSoundmanager::connect(int sourceID, const string& sinkName) +int Soundmanager::connect(int sourceID, const string& sinkName) { if(!sp_websock) { @@ -332,7 +332,7 @@ int LibSoundmanager::connect(int sourceID, const string& sinkName) * * */ -int LibSoundmanager::disconnect(int connectionID) +int Soundmanager::disconnect(int connectionID) { if(!sp_websock) { @@ -359,7 +359,7 @@ int LibSoundmanager::disconnect(int connectionID) * This function must be called when application get asyncSetSourceState event * Input handle number attached in asyncSetSourceState and error number(0 is acknowledge) */ -int LibSoundmanager::ackSetSourceState(int handle, int error) +int Soundmanager::ackSetSourceState(int handle, int error) { if(!sp_websock) { @@ -387,7 +387,7 @@ int LibSoundmanager::ackSetSourceState(int handle, int error) * To call Audio Manager's APIs, the application should set its function name, arguments to JSON format. * */ -int LibSoundmanager::call(const string& verb, struct json_object* arg) +int Soundmanager::call(const string& verb, struct json_object* arg) { int ret; if(!sp_websock) @@ -421,7 +421,7 @@ int LibSoundmanager::call(const string& verb, struct json_object* arg) * To call Audio Manager's APIs, the application should set its function name, arguments to JSON format. * */ -int LibSoundmanager::call(const char* verb, struct json_object* arg) +int Soundmanager::call(const char* verb, struct json_object* arg) { int ret; if(!sp_websock) @@ -454,7 +454,7 @@ int LibSoundmanager::call(const char* verb, struct json_object* arg) * Regarding the list of event name, please refer to CommandSender API and RountingSender API. * */ -int LibSoundmanager::subscribe(const string& event_name) +int Soundmanager::subscribe(const string& event_name) { if(!sp_websock) { @@ -483,7 +483,7 @@ int LibSoundmanager::subscribe(const string& event_name) * This function disables to get an event to your callback function. * */ -int LibSoundmanager::unsubscribe(const string& event_name) +int Soundmanager::unsubscribe(const string& event_name) { if(!sp_websock) { @@ -513,7 +513,7 @@ int LibSoundmanager::unsubscribe(const string& event_name) * This function must be called when application get asyncSetSourceState event * Input handle number attached in asyncSetSourceState and error number(0 is acknowledge) */ -void LibSoundmanager::set_event_handler(enum EventType_SM et, handler_fun f) +void Soundmanager::set_event_handler(enum EventType_SM et, handler_fun f) { if (et > 1 && et < NumItems) { this->handlers[et] = std::move(f); @@ -523,7 +523,7 @@ void LibSoundmanager::set_event_handler(enum EventType_SM et, handler_fun f) /************* Callback Function *************/ -void LibSoundmanager::on_hangup(void *closure, struct afb_wsj1 *wsj) +void Soundmanager::on_hangup(void *closure, struct afb_wsj1 *wsj) { DLOG("%s called", __FUNCTION__); if(onHangup != nullptr) @@ -532,7 +532,7 @@ void LibSoundmanager::on_hangup(void *closure, struct afb_wsj1 *wsj) } } -void LibSoundmanager::on_call(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg) +void Soundmanager::on_call(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg) { } @@ -543,7 +543,7 @@ void LibSoundmanager::on_call(void *closure, const char *api, const char *verb, * so you can get event name : struct json_object obj = json_object_object_get(msg,"event") */ -void LibSoundmanager::on_event(void *closure, const char *event, struct afb_wsj1_msg *msg) +void Soundmanager::on_event(void *closure, const char *event, struct afb_wsj1_msg *msg) { /* check event is for us */ string ev = string(event); @@ -563,7 +563,7 @@ void LibSoundmanager::on_event(void *closure, const char *event, struct afb_wsj1 json_object_put(ev_contents); } -void LibSoundmanager::on_reply(void *closure, struct afb_wsj1_msg *msg) +void Soundmanager::on_reply(void *closure, struct afb_wsj1_msg *msg) { struct json_object* reply = afb_wsj1_msg_object_j(msg); /*struct json_object *json_data = json_object_object_get(reply, "response"); @@ -586,7 +586,7 @@ void LibSoundmanager::on_reply(void *closure, struct afb_wsj1_msg *msg) json_object_put(reply); } -int LibSoundmanager::dispatch_event(const string &event , json_object* event_contents){ +int Soundmanager::dispatch_event(const string &event , json_object* event_contents){ //dipatch event EventType_SM x; diff --git a/src/libsoundmanager.hpp b/src/libsoundmanager.hpp index daa4695..8f40392 100644 --- a/src/libsoundmanager.hpp +++ b/src/libsoundmanager.hpp @@ -28,13 +28,13 @@ extern "C" #include <afb/afb-ws-client.h> } -class LibSoundmanager +class Soundmanager { public: - LibSoundmanager(); - ~LibSoundmanager(); - LibSoundmanager(const LibSoundmanager &) = delete; - LibSoundmanager &operator=(const LibSoundmanager &) = delete; + Soundmanager(); + ~Soundmanager(); + Soundmanager(const Soundmanager &) = delete; + Soundmanager &operator=(const Soundmanager &) = delete; int init(int port, const std::string& token); using handler_fun = std::function<void(struct json_object*)>; |