Sound Manager
LibSoundmanager Class Reference

#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)
 

Detailed Description

Definition at line 62 of file libsoundmanager.hpp.

Constructor & Destructor Documentation

◆ LibSoundmanager()

LibSoundmanager::LibSoundmanager ( const int  port,
const std::string &  token 
)

◆ ~LibSoundmanager()

LibSoundmanager::~LibSoundmanager ( )

Definition at line 93 of file libsoundmanager.cpp.

Member Function Documentation

◆ call()

int LibSoundmanager::call ( const std::string &  verb,
struct json_object *  arg 
)

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.

Note

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.

◆ call_sync()

int LibSoundmanager::call_sync ( const std::string &  verb,
struct json_object *  arg,
struct json_object *  ret 
)

Definition at line 236 of file libsoundmanager.cpp.

◆ on_call()

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.

◆ on_event()

void LibSoundmanager::on_event ( void *  closure,
const char *  event,
struct afb_wsj1_msg *  msg 
)

Definition at line 358 of file libsoundmanager.cpp.

◆ on_hangup()

void LibSoundmanager::on_hangup ( void *  closure,
struct afb_wsj1 *  wsj 
)

Definition at line 342 of file libsoundmanager.cpp.

◆ on_reply()

void LibSoundmanager::on_reply ( void *  closure,
struct afb_wsj1_msg *  msg 
)

Definition at line 369 of file libsoundmanager.cpp.

◆ register_callback()

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

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

Rreturn

  • Returns 0 on success or -1 in case of error.

Note

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.

◆ run_eventloop()

int LibSoundmanager::run_eventloop ( )

This function start receiving the reply/event message from sound manager

Parameters

Nothing

Rreturn

  • Returns thread_id on success or -1 in case of error.

Note

Definition at line 182 of file libsoundmanager.cpp.

◆ subscribe()

int LibSoundmanager::subscribe ( const std::string &  event_name)

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. Regarding the list of event name, please refer to CommandSender API and RountingSender API.

Definition at line 255 of file libsoundmanager.cpp.

◆ unsubscribe()

int LibSoundmanager::unsubscribe ( const std::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.

Definition at line 284 of file libsoundmanager.cpp.


The documentation for this class was generated from the following files: