diff options
-rw-r--r-- | include/libsoundmanager.hpp | 4 | ||||
-rw-r--r-- | libsoundmanager/libsoundmanager.cpp | 88 |
2 files changed, 46 insertions, 46 deletions
diff --git a/include/libsoundmanager.hpp b/include/libsoundmanager.hpp index 55e23df..740675b 100644 --- a/include/libsoundmanager.hpp +++ b/include/libsoundmanager.hpp @@ -45,7 +45,7 @@ public: Event_AsyncSetSourceState_Off , Event_AsyncSetSourceState_Pause }; - + /* Method */ int registerSource(const std::string& sourceName); int connect(int sourceID, int sinkID); @@ -59,7 +59,7 @@ public: int unsubscribe(const std::string& event_name); void set_event_handler(enum EventType_AsyncSetSourceState et, handler_asyncSetSourceState f); void register_callback( - void (*event_cb)(const std::string& event, struct json_object* event_contents), + 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( diff --git a/libsoundmanager/libsoundmanager.cpp b/libsoundmanager/libsoundmanager.cpp index c61f9d2..c7caa7f 100644 --- a/libsoundmanager/libsoundmanager.cpp +++ b/libsoundmanager/libsoundmanager.cpp @@ -37,17 +37,17 @@ static bool has_verb(const std::string& verb); static const char API[] = "soundmanager"; static const std::vector<std::string> api_list{ - std::string("connect"), + std::string("connect"), std::string("disconnect"), - std::string("setVolume"), - std::string("volumeStep"), - std::string("setSinkMuteState"), - std::string("getListMainConnections"), + std::string("setVolume"), + std::string("volumeStep"), + std::string("setSinkMuteState"), + std::string("getListMainConnections"), std::string("ackConnect"), - std::string("ackDisconnect"), - std::string("ackSetSourceState"), - std::string("registerSource"), - std::string("deregisterSource"), + std::string("ackDisconnect"), + std::string("ackSetSourceState"), + std::string("registerSource"), + std::string("deregisterSource"), std::string("subscribe"), std::string("unsubscribe") }; @@ -55,13 +55,13 @@ static const std::vector<std::string> api_list{ static const std::vector<std::string> event_list{ std::string("newMainConnection"), std::string("volumeChanged"), - std::string("removedMainConnection"), - std::string("sinkMuteStateChanged"), - std::string("mainConnectionStateChanged"), - std::string("setRoutingReady"), - std::string("setRoutingRundown"), - std::string("asyncConnect"), - std::string("asyncSetSourceState") + std::string("removedMainConnection"), + std::string("sinkMuteStateChanged"), + std::string("mainConnectionStateChanged"), + std::string("setRoutingReady"), + std::string("setRoutingRundown"), + std::string("asyncConnect"), + std::string("asyncSetSourceState") }; static void _on_hangup_static(void *closure, struct afb_wsj1 *wsj) @@ -111,7 +111,7 @@ LibSoundmanager::~LibSoundmanager() /** * This function is initialization function - * + * * #### Parameters * - port [in] : This argument should be specified to the port number to be used for websocket * - token [in] : This argument should be specified to the token to be used for websocket @@ -197,7 +197,7 @@ int LibSoundmanager::init_event(){ /** * This function register callback function for reply/event message from sound manager - * + * * #### Parameters * - event_cb [in] : This argument should be specified to the callback for subscribed event * - reply_cb [in] : This argument should be specified to the reply callback for call function @@ -210,7 +210,7 @@ int LibSoundmanager::init_event(){ * If you would like to get event, please call subscribe function before/after this function */ void LibSoundmanager::register_callback( - void (*event_cb)(const string& event, struct json_object* event_contents), + void (*event_cb)(const string& event, struct json_object* event_contents), void (*reply_cb)(struct json_object* reply_contents), void (*hangup_cb)(void)) { @@ -251,10 +251,10 @@ int LibSoundmanager::run_eventloop() /** * This function calls registerSource of Audio Manager via WebSocket * registerSource is registration as source for policy management - * + * * #### Parameters * - sourceName [in] : This argument should be specified to the source name (e.g. "MediaPlayer") - * + * * #### Rreturn * - Returns 0 on success or -1 in case of error. * @@ -278,7 +278,7 @@ int LibSoundmanager::registerSource(const string& sourceName) /** * This function calls connect of Audio Manager via WebSocket * connect is to get sound right - * + * * #### Parameters * - sourceID [in] : This argument should be specified to the sourceID as int. This parameter is returned value of registerSource * - sinkID [in] : This argument should be specified to the sinkID as int. ID is specified by AudioManager @@ -311,7 +311,7 @@ int LibSoundmanager::connect(int sourceID, int sinkID) * #### Parameters * - sourceID [in] : This argument should be specified to the sourceID as int. This parameter is returned value of registerSource * - sinkName [in] : This argument should be specified to the sinkID as int. ID is aliased by SoundManager (e.g: "default") - * + * * #### Rreturn * - Returns 0 on success or -1 in case of error. * @@ -337,15 +337,15 @@ int LibSoundmanager::connect(int sourceID, const string& sinkName) /** * This function calls the disconnect of Audio Manager via WebSocket - * + * * #### Parameters * - connectionID [in] : This parameter is returned value of connect - * + * * #### Rreturn * - Returns 0 on success or -1 in case of error. * * #### Note - * + * * */ int LibSoundmanager::disconnect(int connectionID) @@ -362,12 +362,12 @@ int LibSoundmanager::disconnect(int connectionID) /** * This function calls the ackSetSourceState of Audio Manager via WebSocket - * + * * #### Parameters * - sourceID [in] : This parameter is returned value of ackSetSourceState * - handle [in] : This parameter is returned value of ackSetSourceState * - errno [in] : If you have some errors, input ohter than 0. 0 means acknowledge - * + * * #### Rreturn * - Returns 0 on success or -1 in case of error. * @@ -391,11 +391,11 @@ int LibSoundmanager::ackSetSourceState(int handle, int error) /** * This function calls the API of Audio Manager via WebSocket - * + * * #### Parameters * - verb [in] : This argument should be specified to the API name (e.g. "connect") * - arg [in] : This argument should be specified to the argument of API. And this argument expects JSON object - * + * * #### Rreturn * - Returns 0 on success or -1 in case of error. * @@ -425,17 +425,17 @@ int LibSoundmanager::call(const string& verb, struct json_object* arg) /** * This function calls the API of Audio Manager via WebSocket * This function is overload function of "call" - * + * * #### Parameters * - verb [in] : This argument should be specified to the API name (e.g. "connect") * - arg [in] : This argument should be specified to the argument of API. And this argument expects JSON object - * + * * #### Rreturn * - Returns 0 on success or -1 in case of error. * * #### Note * 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) { @@ -458,15 +458,15 @@ int LibSoundmanager::call(const char* verb, struct json_object* arg) /** * Register callback function for each event - * + * * #### Parameters * - event_name [in] : This argument should be specified to the event name - * + * * #### Rreturn * - Returns 0 on success or -1 in case of error. * * #### Note - * This function enables to get an event to your callback function. + * 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. * */ @@ -488,15 +488,15 @@ int LibSoundmanager::subscribe(const string& event_name) /** * Unregister callback function for each event - * + * * #### Parameters * - event_name [in] : This argument should be specified to the event name - * + * * #### Rreturn * - Returns 0 on success or -1 in case of error. * * #### Note - * This function disables to get an event to your callback function. + * This function disables to get an event to your callback function. * */ int LibSoundmanager::unsubscribe(const string& event_name) @@ -517,11 +517,11 @@ int LibSoundmanager::unsubscribe(const string& event_name) /** * This function calls the ackSetSourceState of Audio Manager via WebSocket - * + * * #### Parameters * - EventType_AsyncSetSourceState [in] : This parameter is EventType of soundmanager * - handler_func [in] : This parameter is callback function - * + * * #### Rreturn * - Returns 0 on success or -1 in case of error. * @@ -556,9 +556,9 @@ void LibSoundmanager::on_call(void *closure, const char *api, const char *verb, * event is like "soundmanager/newMainConnection" * msg is like {"event":"soundmanager\/newMainConnection","data":{"mainConnectionID":3,"sourceID":101,"sinkID":100,"delay":0,"connectionState":4},"jtype":"afb-event"})} * ^key^ ^^^^^^^^^^^^ value ^^^^^^^^^^^^ -* so you can get +* 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) { /* check event is for us */ @@ -618,7 +618,7 @@ void LibSoundmanager::on_reply(void *closure, struct afb_wsj1_msg *msg) { onReply(reply); } - json_object_put(reply); + json_object_put(reply); } int LibSoundmanager::dispatch_asyncSetSourceState(int sourceID, int handle, const string& sourceState){ |