some updates, new tests
[profile/ivi/genivi/genivi-audio-manager.git] / AudioManagerDaemon / src / CommandReceiver.cpp
1 /*
2  * CommandReceiver.cpp
3  *
4  *  Created on: Oct 24, 2011
5  *      Author: christian
6  */
7
8 #include "CommandReceiver.h"
9 #include <dlt/dlt.h>
10 #include <assert.h>
11
12 DLT_IMPORT_CONTEXT(AudioManager)
13
14 CommandReceiver::CommandReceiver (DatabaseHandler* iDatabaseHandler, DBusWrapper* iDBusWrapper, ControlSender* iControlSender)
15         : mDatabaseHandler(iDatabaseHandler),
16           mDBusWrapper(iDBusWrapper),
17           mControlSender(iControlSender)
18 {
19         assert(mDatabaseHandler!=NULL);
20         assert(mDBusWrapper!=NULL);
21         assert(mControlSender!=NULL);
22 }
23
24 CommandReceiver::~CommandReceiver()
25 {
26 }
27
28 am_Error_e CommandReceiver::connect(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t & mainConnectionID)
29 {
30         DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("CommandReceiver::connect got called:"),DLT_STRING("sourceID"),DLT_INT(sourceID), DLT_STRING("sinkID"), DLT_INT(sinkID));
31         return mControlSender->hookUserConnectionRequest(sourceID,sinkID,mainConnectionID);
32 }
33
34
35
36 am_Error_e CommandReceiver::disconnect(const am_mainConnectionID_t mainConnectionID)
37 {
38         DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("CommandReceiver::disconnect got called, mainConnectionID="),DLT_INT(mainConnectionID));
39         return mControlSender->hookUserDisconnectionRequest(mainConnectionID);
40 }
41
42
43
44 am_Error_e CommandReceiver::setVolume(const am_sinkID_t sinkID, const am_mainVolume_t volume)
45 {
46         DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("CommandReceiver::setVolume got called, sinkID="),DLT_INT(sinkID),DLT_STRING("volume="),DLT_INT(volume));
47         return mControlSender->hookUserVolumeChange(sinkID,volume);
48 }
49
50
51
52 am_Error_e CommandReceiver::volumeStep(const am_sinkID_t sinkID, const int16_t volumeStep)
53 {
54         DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("CommandReceiver::volumeStep got called, sinkID="),DLT_INT(sinkID),DLT_STRING("volumeStep="),DLT_INT(volumeStep));
55         return mControlSender->hookUserVolumeStep(sinkID,volumeStep);
56 }
57
58
59
60 am_Error_e CommandReceiver::setSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState)
61 {
62         DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("CommandReceiver::setSinkMuteState got called, sinkID="),DLT_INT(sinkID),DLT_STRING("muteState="),DLT_INT(muteState));
63         return mControlSender->hookUserSetSinkMuteState(sinkID,muteState);
64 }
65
66
67
68 am_Error_e CommandReceiver::setMainSinkSoundProperty(const am_MainSoundProperty_s & soundProperty, const am_sinkID_t sinkID)
69 {
70         DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("CommandReceiver::setMainSinkSoundProperty got called, sinkID="),DLT_INT(sinkID),DLT_STRING("soundPropertyType="),DLT_INT(soundProperty.type),DLT_STRING("soundPropertyValue="),DLT_INT(soundProperty.value));
71         return mControlSender->hookUserSetMainSinkSoundProperty(sinkID,soundProperty);
72 }
73
74
75
76 am_Error_e CommandReceiver::setMainSourceSoundProperty(const am_MainSoundProperty_s & soundProperty, const am_sourceID_t sourceID)
77 {
78         DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("CommandReceiver::setMainSourceSoundProperty got called, sourceID="),DLT_INT(sourceID),DLT_STRING("soundPropertyType="),DLT_INT(soundProperty.type),DLT_STRING("soundPropertyValue="),DLT_INT(soundProperty.value));
79         return mControlSender->hookUserSetMainSourceSoundProperty(sourceID,soundProperty);
80 }
81
82
83
84 am_Error_e CommandReceiver::setSystemProperty(const am_SystemProperty_s & property)
85 {
86         DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("CommandReceiver::setSystemProperty got called"),DLT_STRING("type="),DLT_INT(property.type),DLT_STRING("soundPropertyValue="),DLT_INT(property.value));
87         return mControlSender->hookUserSetSystemProperty(property);
88 }
89
90
91
92 am_Error_e CommandReceiver::getListMainConnections(std::vector<am_MainConnectionType_s> & listConnections) const
93 {
94         return mDatabaseHandler->getListVisibleMainConnections(listConnections);
95
96 }
97
98
99
100 am_Error_e CommandReceiver::getListMainSinks(std::vector<am_SinkType_s>& listMainSinks) const
101 {
102         return mDatabaseHandler->getListMainSinks(listMainSinks);
103 }
104
105
106
107 am_Error_e CommandReceiver::getListMainSources(std::vector<am_SourceType_s>& listMainSources) const
108 {
109         return mDatabaseHandler->getListMainSources(listMainSources);
110 }
111
112
113
114 am_Error_e CommandReceiver::getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s> & listSoundProperties) const
115 {
116         return mDatabaseHandler->getListMainSinkSoundProperties(sinkID,listSoundProperties);
117 }
118
119
120
121 am_Error_e CommandReceiver::getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s> & listSourceProperties) const
122 {
123         return mDatabaseHandler->getListMainSourceSoundProperties(sourceID,listSourceProperties);
124 }
125
126
127
128 am_Error_e CommandReceiver::getListSourceClasses(std::vector<am_SourceClass_s> & listSourceClasses) const
129 {
130         return mDatabaseHandler->getListSourceClasses(listSourceClasses);
131 }
132
133
134
135 am_Error_e CommandReceiver::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
136 {
137         return mDatabaseHandler->getListSinkClasses(listSinkClasses);
138 }
139
140
141
142 am_Error_e CommandReceiver::getListSystemProperties(std::vector<am_SystemProperty_s> & listSystemProperties) const
143 {
144         return mDatabaseHandler->getListSystemProperties(listSystemProperties);
145 }
146
147
148
149 am_Error_e CommandReceiver::getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t & delay) const
150 {
151         return mDatabaseHandler->getTimingInformation(mainConnectionID,delay);
152 }
153
154
155
156 am_Error_e CommandReceiver::getDBusConnectionWrapper(DBusWrapper*& dbusConnectionWrapper) const
157 {
158         dbusConnectionWrapper=mDBusWrapper;
159         return E_OK;
160 }
161
162
163
164
165
166
167