diff options
author | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-02-26 14:37:06 +0900 |
---|---|---|
committer | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-02-26 14:37:06 +0900 |
commit | 56a4aa79590b547966c27af5b8ea7d33c0063715 (patch) | |
tree | 8d80970c10936bf1b4b236ba3ea274a41bd1a70c | |
parent | c9353e7e1c309ecababa9b84182be7cb06a98834 (diff) |
Separate the part of define
To reduce the source code,
separate the part of define used in soundmanagaer.c
Change-Id: Idcc5815d6cb324cd2fc3b81cfa7eba578711b75c
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
-rw-r--r-- | src/sm-def.h | 57 | ||||
-rw-r--r-- | src/soundmanager.c | 53 |
2 files changed, 58 insertions, 52 deletions
diff --git a/src/sm-def.h b/src/sm-def.h new file mode 100644 index 0000000..6b917ee --- /dev/null +++ b/src/sm-def.h @@ -0,0 +1,57 @@ +#ifndef SOUNDMANAGER_DEFINE_H +#define SOUNDMANAGER_DEFINE_H + +#define AM_NAME "org.genivi.audiomanager" +#define AM_CMD_PATH "/org/genivi/audiomanager/commandinterface" +#define AM_ROUTE_PATH "/org/genivi/audiomanager/routinginterface" +#define SOUND_MANAGER_RETURN_INTERFACE "org.genivi.audiomanager.routing.soundmanager" +#define SOUND_MANAGER_BUS_NAME "org.genivi.audiomanager.routing.soundmanager" +#define SOUND_MANAGER_PATH "/org/genivi/audiomanager/routing/soundmanager" + +#define COMMAND_EVENT_NUM 10 +#define ROUTING_EVENT_NUM 10 +#define DEFAULT_SINK 1 +#define DEFAULT_SOURCE_CLASS_ID 101 +#define DYNAMIC_DOMAIN_ID 100 +#define DEFAULT_DOMAIN_ID 0 +#define DYNAMIC_SOURCE_ID 0 +#define DEFAULT_VOLUME 100 +#define DEFAULT_AVAILABLES 1 +#define DEFAULT_CONNECTION_FORMAT 2 +#define DEFAULT_INTERRUPT 0 +#define DEFAULT_SOURCE_STATE 2 +#define DS_CONTROLLED 1 + +#define EVENT_SUBSCRIBE_ERROR_CODE 100 + +#define KEY_SOURCE_ID "sourceID" +#define KEY_SINK_ID "sinkID" +#define KEY_SINK_NAME "sinkName" +#define KEY_MAIN_CONNECTION_ID "mainConnectionID" +#define KEY_DELAY "delay" +#define KEY_CONNECTION_STATE "connectionState" +#define KEY_CONNECTION_ID "connectionID" +#define KEY_VOLUME "volume" +#define KEY_VOLUME_STEP "volumeStep" +#define KEY_INTERRUPT "interrupt" +#define KEY_MUTE_STATE "muteState" + +#define KEY_DOMAIN_ID "domainID" +#define KEY_HANDLE "handle" +#define KEY_APPNAME "appname" +#define KEY_RAMP "ramp" +#define KEY_TIME "time" +#define KEY_SOURCE_STATE "sourceState" +#define KEY_SOURCE_CLASS_ID "sourceClassID" +#define KEY_SINK_CLASS_ID "sinkClassID" +#define KEY_ERROR "error" +#define KEY_SINK_DATA "sinkData" +#define KEY_SOURCE_DATA "sourceData" +#define KEY_INTERRUPT_STATE "interruptState" +#define KEY_AVAILABILITY "availability" +#define KEY_AVAILABILITY_REASON "availabilityReason" +#define KEY_LIST_VOLUMES "listVolumes" +#define KEY_PAYLOAD "payload" +#define KEY_CONNECTION_FORMAT "connectionFormat" + +#endif // SOUNDMANAGER_DEFINE_H
\ No newline at end of file diff --git a/src/soundmanager.c b/src/soundmanager.c index 829f6e3..6bc8a6b 100644 --- a/src/soundmanager.c +++ b/src/soundmanager.c @@ -22,31 +22,10 @@ #include <json-c/json.h> #include <glib.h> #include "soundmanager.h" +#include "sm-def.h" #include "sm-error.h" #include "sm-helper.h" -#define AM_NAME "org.genivi.audiomanager" -#define AM_CMD_PATH "/org/genivi/audiomanager/commandinterface" -#define AM_ROUTE_PATH "/org/genivi/audiomanager/routinginterface" -#define SOUND_MANAGER_RETURN_INTERFACE "org.genivi.audiomanager.routing.soundmanager" -#define SOUND_MANAGER_BUS_NAME "org.genivi.audiomanager.routing.soundmanager" -#define SOUND_MANAGER_PATH "/org/genivi/audiomanager/routing/soundmanager" - -#define COMMAND_EVENT_NUM 10 -#define ROUTING_EVENT_NUM 10 -#define DEFAULT_SINK 1 -#define DEFAULT_SOURCE_CLASS_ID 101 -#define DYNAMIC_DOMAIN_ID 100 -#define DEFAULT_DOMAIN_ID 0 -#define DYNAMIC_SOURCE_ID 0 -#define DEFAULT_VOLUME 100 -#define DEFAULT_AVAILABLES 1 -#define DEFAULT_CONNECTION_FORMAT 2 -#define DEFAULT_INTERRUPT 0 -#define DEFAULT_SOURCE_STATE 2 -#define DS_CONTROLLED 1 - -#define EVENT_SUBSCRIBE_ERROR_CODE 100 const static struct afb_binding_interface *afbitf; static AudiomanagerCommandinterface *am_cmd_bus; @@ -73,36 +52,6 @@ static struct afb_event ev_async_connect; static struct afb_event ev_async_disconnect; static struct afb_event ev_async_set_source_state; -#define KEY_SOURCE_ID "sourceID" -#define KEY_SINK_ID "sinkID" -#define KEY_SINK_NAME "sinkName" -#define KEY_MAIN_CONNECTION_ID "mainConnectionID" -#define KEY_DELAY "delay" -#define KEY_CONNECTION_STATE "connectionState" -#define KEY_CONNECTION_ID "connectionID" -#define KEY_VOLUME "volume" -#define KEY_VOLUME_STEP "volumeStep" -#define KEY_INTERRUPT "interrupt" -#define KEY_MUTE_STATE "muteState" - -#define KEY_DOMAIN_ID "domainID" -#define KEY_HANDLE "handle" -#define KEY_APPNAME "appname" -#define KEY_RAMP "ramp" -#define KEY_TIME "time" -#define KEY_SOURCE_STATE "sourceState" -#define KEY_SOURCE_CLASS_ID "sourceClassID" -#define KEY_SINK_CLASS_ID "sinkClassID" -#define KEY_ERROR "error" -#define KEY_SINK_DATA "sinkData" -#define KEY_SOURCE_DATA "sourceData" -#define KEY_INTERRUPT_STATE "interruptState" -#define KEY_AVAILABILITY "availability" -#define KEY_AVAILABILITY_REASON "availabilityReason" -#define KEY_LIST_VOLUMES "listVolumes" -#define KEY_PAYLOAD "payload" -#define KEY_CONNECTION_FORMAT "connectionFormat" - /* ********** Method of Sound Manager (API) ********** */ |