Sound Manager  0.3
Data Structures | Macros | Functions | Variables
soundmanager.h File Reference

Sound Manager API. More...

#include <afb/afb-binding.h>
#include "dbus/audio_manager_interface.h"

Go to the source code of this file.

Data Structures

struct  event
 

Macros

#define _GNU_SOURCE
 
#define AFB_BINDING_VERSION   2
 

Functions

void connect (struct afb_req request)
 
void disconnect (struct afb_req request)
 
void setVolume (struct afb_req request)
 
void volumeStep (struct afb_req request)
 
void setSinkMuteState (struct afb_req request)
 
void getListMainConnections (struct afb_req request)
 
void getListMainSources (struct afb_req request)
 
void getListMainSinks (struct afb_req request)
 
void ackConnect (struct afb_req request)
 
void ackDisconnect (struct afb_req request)
 
void ackSetSourceState (struct afb_req request)
 
void registerSource (struct afb_req request)
 
void deregisterSource (struct afb_req request)
 
void subscribe (struct afb_req request)
 
void unsubscribe (struct afb_req request)
 
void streamOpen (struct afb_req req)
 
void streamClose (struct afb_req req)
 
void setStreamState (struct afb_req req)
 
int preinit ()
 
int sm_init ()
 
void onevent (const char *event, struct json_object *object)
 

Variables

const struct afb_verb_v2 binding_verbs []
 
const struct afb_binding_v2 afbBindingV2
 

Detailed Description

Sound Manager API.

Definition in file soundmanager.h.

Function Documentation

void ackConnect ( struct afb_req  request)

Call "ackConnect" function of Audio Manager. Return acknowledge of connect against asyncConnect

Parameters

  • handle : Handle id when you get on asyncConnect
  • connectionID : connection id when you got on connect return value
  • error : Error Number you would like to send. If error is 0, it means OK. If an application has some error, send error number in function then AM release resources the application got in connect.

Return

  • error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message. Even if there is no connection list, Sound Manager return success. So you should check the contents size of return json object

Note

void ackDisconnect ( struct afb_req  request)

Call "ackDisconnect" function of Audio Manager. Return acknowledge of disconnect against asyncDisconnect

Parameters

  • handle : Handle id when you get on asyncDisconnect
  • connectionID : connection id when you got on connect return value
  • error : Error Number you would like to send. If error is 0, it means OK. If an application has some error, send error number in function then AM

Return

  • error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message. Even if there is no connection list, Sound Manager return success. So you should check the contents size of return json object

Note

void ackSetSourceState ( struct afb_req  request)

Call "ackSetSourceState" function of Audio Manager. Return acknowledge of setSourceState against asyncSetSourceState.

Parameters

  • handle : Handle id when you get on asyncSetSourceState
  • error : Error Number you would like to send. If error is 0, it means OK. If an application has some errors, send error number in function

Return

  • error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.

Note

This function is very important for applications to realise the sequence of Audio Management. An Application which matches with sourceID in the parameter of asyncSetSourceState has to return ack to use this function

void connect ( struct afb_req  request)

Call "connect" function of Audio Manager. Getting resource right to output audio stream. Please input following keys with value into json string object in argument. In case of using libsoundmanager, json_object *jobj = json_object_new_object(); json_object_object_add(jobj, "sourceID", json_object_new_int(100)); json_object_object_add(jobj, "sinkID", json_object_new_int(100)); call("connect", jobj);

The order of arguments is not important.

Parameters

Request key

  • sourceID : Source ID getting in return value in registerSource or appname.
  • sinkID : Sink ID. This should be more than 0. If no request, defalut value is set by sound manager

This will be changed in near future because these arguments should be aliased like sinkID:100 -> sinkID:"speaker"

This will be modified after integrating

Return

  • error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.

Note

sourceID and sinkID should be more than 0

void deregisterSource ( struct afb_req  request)

Call "deregisterSource" function of Audio Manager. Deregister source(application) to Audio Manager Policy Management

Parameters

  • sourceID : sourceID returned in resisterSource

Return

  • error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.

Note

void disconnect ( struct afb_req  request)

Call "disconnect" function of Audio Manager. Release resource right to output audio stream.

Parameters

Request key

  • sourceID : Source ID getting in return value in registerSource or appname.

Return

  • error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.

Note

sourceID should be more than 0

void getListMainConnections ( struct afb_req  request)

Call "getListMainConnections" function of Audio Manager. Get mainc connection list

Parameters

Request key None

Return

  • error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message. Even if there is no connection list, Sound Manager return success.

Note

void getListMainSinks ( struct afb_req  request)

Call "getListMainSinks" function of Audio Manager. Get main sink list

Parameters

Request key None

Return

  • error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message. Even if there is no connection list, Sound Manager return success.

Note

void getListMainSources ( struct afb_req  request)

Call "getListMainSources" function of Audio Manager. Get main source list

Parameters

Request key None

Return

  • error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message. Even if there is no connection list, Sound Manager return success.

Note

void registerSource ( struct afb_req  request)

Call "registerSource" function of Audio Manager. Register source(application) to Audio Manager Policy Management Application must call this function on its initialization

Parameters

  • appname : Application unieque name [Option] It is not necessary to designate following argument, because these are default value is selected y soundmanager If you would like to set value, please input the following key and value
    • sourceClassID :
    • sourceState :

Return

  • error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.

Note

void setSinkMuteState ( struct afb_req  request)

Call "volumeStep" function of Audio Manager. Change volume step of sink

Parameters

Request key

  • sinkID : sinkID you would like to change mute state
  • muteState : muteState, 1 means mute, 2 means unmute. Or you can designate as "mute" or "unmute"

Return

  • error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.

Note

void setStreamState ( struct afb_req  req)

Application High Level API for AGL This function set stream state. This function set the availability and calls connect function of Audio Manager and returns the result of policy check.

Parameters

  • stream_id : Stream id which is returned in stream_open.
  • mute : Stream state as int

    Return

  • error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.

    Note

TODO : write note

void setVolume ( struct afb_req  request)

Call "setVolume" function of Audio Manager. Set sink volume.

Parameters

Request key

  • volume : volume value. The range of value should be [0-100]
  • sinkID : sinkID you would like to change volume at

Return

  • error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.

Note

void streamClose ( struct afb_req  req)

Application High Level API for AGL This function closes "stream". This function calls disconnect with registered connectionID translated with requested connection_id. If the connection is not created in Sound Manager, Sound Manager just returns with error message.

Parameters

  • stream_id : Stream id which is returned in stream_open.

Return

  • error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.

    Note

TODO : write note

void streamOpen ( struct afb_req  req)

Application High Level API for AGL This function opens "stream". "stream" means the routing from source to sink. This function calls registerSource and register the endpoint. If the endpoint is not registered in AudioManager, Sound Manager uses default value. audio_role will be translated to "sourceID", and "endpoint_id" will be translated to "sinkID".

Parameters

  • audio_role : audio role such like entertainment, emergency. This name is depends on the system architect. The name will be application name or will be the group(role) of application.
  • endpoint_type: The type of endpoint which means source/sink. As default, Sound Manager uses it as source. sink is not supported for now.
  • endpoint_id : Same as sinkID in Sound Manager.

Return

  • error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.
  • stream_id : Same as sourceID but key is different. This is for AHL.

    Note

TODO : write note

void subscribe ( struct afb_req  request)

Subscribe event

Parameters

  • event : Event name. Event list is written in libsoundmanager.hpp

Return

  • error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.

Note

void unsubscribe ( struct afb_req  request)

Unsubscribe event

Parameters

  • event : Event name. Event list is written in libsoundmanager.hpp

Return

  • error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.

Note

void volumeStep ( struct afb_req  request)

Call "volumeStep" function of Audio Manager. Change volume step of sink

Parameters

Request key

  • sinkID : sinkID you would to change volume step
  • volumeStep : Step size of volume

Return

  • error : Error status number. If error is 0, it means the request is accepted, otherwise error message is attached with error code in reply message.

Note

Variable Documentation

const struct afb_binding_v2 afbBindingV2
Initial value:
= {
.api = "soundmanager",
.specification = NULL,
.verbs = binding_verbs,
.preinit = preinit,
.init = sm_init,
.onevent = onevent
}

Definition at line 431 of file soundmanager.h.