* added new interfaces & nsm support + nsm tests + fixed some unit tests + fixed...
[profile/ivi/genivi/genivi-audio-manager.git] / include / command / IAmCommandReceive.h
1 /**\r
2  * Copyright (C) 2012, BMW AG\r
3  *\r
4  * This file is part of GENIVI Project AudioManager.\r
5  *\r
6  * Contributions are licensed to the GENIVI Alliance under one or more\r
7  * Contribution License Agreements.\r
8  *\r
9  * \copyright\r
10  * This Source Code Form is subject to the terms of the\r
11  * Mozilla Public License, v. 2.0. If a  copy of the MPL was not distributed with\r
12  * this file, You can obtain one at http://mozilla.org/MPL/2.0/.\r
13  *\r
14  *\r
15  * \author Christian Mueller, christian.linke@bmw.de BMW 2011,2012\r
16  *\r
17  * \file\r
18  * For further information see http://www.genivi.org/.\r
19  *\r
20  * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN\r
21  */\r
22 #if !defined(EA_3888D932_2C16_4c2a_BD7C_E1F819C9A7F0__INCLUDED_)\r
23 #define EA_3888D932_2C16_4c2a_BD7C_E1F819C9A7F0__INCLUDED_\r
24 \r
25 #include <vector>\r
26 #include <string>\r
27 #include "audiomanagertypes.h"\r
28 namespace am {\r
29 class CAmDbusWrapper;\r
30 class CAmSocketHandler;\r
31 }\r
32
33
34 #include "audiomanagertypes.h"
35
36 #define CommandReceiveVersion "2.0" 
37 namespace am {
38         /**
39          * The interface towards the Controlling Instance (e.g HMI). It handles the communication towards the HMI and other system
40          * components who need to interact with the audiomanagement.
41          * There are two rules that have to be kept in mind when implementing against this interface:\n
42          * \warning
43          * 1. CALLS TO THIS INTERFACE ARE NOT THREAD SAFE !!!! \n
44          * 2. YOU MAY NOT CALL THE CALLING INTERFACE DURING AN SYNCHRONOUS OR ASYNCHRONOUS CALL THAT EXPECTS A RETURN VALUE.\n
45          * \details
46          * Violation these rules may lead to unexpected behavior! Nevertheless you can implement thread safe by using the deferred-
47          * call pattern described on the wiki which also helps to implement calls that are forbidden.\n
48          * For more information, please check CAmSerializer
49          * @author Christian Mueller
50          * @created 16-Dez-2012 15:58:14
51          */
52         class IAmCommandReceive
53         {
54
55         public:
56                 IAmCommandReceive() {
57
58                 }
59
60                 virtual ~IAmCommandReceive() {
61
62                 }
63
64                 /**
65                  * This function returns the version of the interface.
66                  * 
67                  * @param version
68                  */
69                 virtual void getInterfaceVersion(std::string& version) const =0;
70                 /**
71                  * connects a source to sink
72                  * @return E_OK on success, E_NOT_POSSIBLE on failure, E_ALREADY_EXISTS if the connection does already exists
73                  * 
74                  * @param sourceID
75                  * @param sinkID
76                  * @param mainConnectionID
77                  */
78                 virtual am_Error_e connect(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID) =0;
79                 /**
80                  * disconnects a mainConnection
81                  * @return E_OK on successes, E_NON_EXISTENT if the connection does not exist, E_NOT_POSSIBLE on error.
82                  * 
83                  * @param mainConnectionID
84                  */
85                 virtual am_Error_e disconnect(const am_mainConnectionID_t mainConnectionID) =0;
86                 /**
87                  * sets the volume for a sink
88                  * @return E_OK on success, E_UNKOWN on error, E_OUT_OF_RANGE in case the value is out of range
89                  * 
90                  * @param sinkID    the sink
91                  * @param volume    the volume
92                  */
93                 virtual am_Error_e setVolume(const am_sinkID_t sinkID, const am_mainVolume_t volume) =0;
94                 /**
95                  * This function is used to increment or decrement the current volume for a sink.
96                  * @return E_OK on success, E_UNKNOWN on error and E_OUT_OF_RANGE if the value is not in the given volume range.
97                  * 
98                  * @param sinkID
99                  * @param volumeStep    indicated the number of steps that should be incremented or decremented. Positive values here
100                  * inkrement, negative values decrement
101                  */
102                 virtual am_Error_e volumeStep(const am_sinkID_t sinkID, const int16_t volumeStep) =0;
103                 /**
104                  * sets the mute state of a sink
105                  * @return E_OK on success, E_UNKNOWN on error. If the mute state is already the desired one, the Daemon will return E_OK.
106                  * 
107                  * @param sinkID
108                  * @param muteState
109                  */
110                 virtual am_Error_e setSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState) =0;
111                 /**
112                  * This method is used to set sound properties, e.g. Equalizer Values. Since the capabilities of the system can differ,
113                  * the exact key value pairs can be extended in each product
114                  * @return E_OK on success, E_OUT_OF_RANGE if value exceeds range, E_UNKNOWN in case of an error
115                  * 
116                  * @param soundProperty
117                  * @param sinkID
118                  */
119                 virtual am_Error_e setMainSinkSoundProperty(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID) =0;
120                 /**
121                  * This method is used to set sound properties, e.g. Equalizer Values. Since the capabilities of the system can differ,
122                  * the exact key value pairs can be extended in each product
123                  * @return E_OK on success, E_OUT_OF_RANGE if value exceeds range, E_UNKNOWN in case of an error
124                  * 
125                  * @param soundProperty
126                  * @param sourceID
127                  */
128                 virtual am_Error_e setMainSourceSoundProperty(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID) =0;
129                 /**
130                  * is used to set a specific system property.
131                  * @return E_OK on success, E_OUT_OF_RANGE if value exceeds range, E_UNKNOWN in case of an error
132                  * 
133                  * @param property    the property that shall be set
134                  */
135                 virtual am_Error_e setSystemProperty(const am_SystemProperty_s& property) =0;
136                 /**
137                  * returns the actual list of MainConnections
138                  * @return E_OK on success, E_DATABASE_ERROR on error
139                  * 
140                  * @param listConnections    returns a list of all connections
141                  */
142                 virtual am_Error_e getListMainConnections(std::vector<am_MainConnectionType_s>& listConnections) const =0;
143                 /**
144                  * returns the actual list of Sinks
145                  * @return E_OK on success, E_DATABASE_ERROR on error
146                  * 
147                  * @param listMainSinks    the list of the sinks
148                  */
149                 virtual am_Error_e getListMainSinks(std::vector<am_SinkType_s>& listMainSinks) const =0;
150                 /**
151                  * returns the actual list of Sources
152                  * @return E_OK on success, E_DATABASE_ERROR on error
153                  * 
154                  * @param listMainSources    the list of sources
155                  */
156                 virtual am_Error_e getListMainSources(std::vector<am_SourceType_s>& listMainSources) const =0;
157                 /**
158                  * This is used to retrieve all source sound properties related to a source. Returns a vector of the sound properties and
159                  * values as pair
160                  * @return E_OK on success, E_DATABASE_ERROR on error
161                  * 
162                  * @param sinkID
163                  * @param listSoundProperties
164                  */
165                 virtual am_Error_e getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s>& listSoundProperties) const =0;
166                 /**
167                  * This is used to retrieve all source sound properties related to a source.
168                  * @return E_OK on success, E_DATABASE_ERROR on error
169                  * 
170                  * @param sourceID
171                  * @param listSourceProperties
172                  */
173                 virtual am_Error_e getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s>& listSourceProperties) const =0;
174                 /**
175                  * This is used to retrieve SourceClass Information of all source classes
176                  * @return E_OK on success, E_DATABASE_ERROR on error
177                  * 
178                  * @param listSourceClasses
179                  */
180                 virtual am_Error_e getListSourceClasses(std::vector<am_SourceClass_s>& listSourceClasses) const =0;
181                 /**
182                  * This is used to retrieve SinkClass Information of all sink classes
183                  * @return E_OK on success, E_DATABASE_ERROR on error
184                  * 
185                  * @param listSinkClasses
186                  */
187                 virtual am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const =0;
188                 /**
189                  * Retrieves a complete list of all systemProperties.
190                  * @return E_OK on success, E_DATABASE_ERROR on error
191                  * 
192                  * @param listSystemProperties
193                  */
194                 virtual am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const =0;
195                 /**
196                  * returns the delay in ms that the audiopath for the given mainConnection has
197                  * @return E_OK on success, E_NOT_POSSIBLE if timing information is not yet retrieved, E_DATABASE_ERROR on read error on
198                  * the database
199                  * 
200                  * @param mainConnectionID
201                  * @param delay
202                  */
203                 virtual am_Error_e getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t& delay) const =0;
204                 /**
205                  * this function is used to retrieve a pointer to the dBusConnectionWrapper
206                  * @return E_OK if pointer is valid, E_UKNOWN if AudioManager was compiled without DBus Support
207                  * 
208                  * @param dbusConnectionWrapper    This is a wrapper class that is needed to keep dbus inclusions away from the interface.
209                  * The DBusWrapperClass will return the pointer to the DbusConnection call (getDBusConnection)
210                  */
211                 virtual am_Error_e getDBusConnectionWrapper(CAmDbusWrapper*& dbusConnectionWrapper) const =0;
212                 /**
213                  * This function returns the pointer to the socketHandler. This can be used to integrate socket-based activites like
214                  * communication with the mainloop of the AudioManager.
215                  * returns E_OK if pointer is valid, E_UNKNOWN in case AudioManager was compiled without socketHandler support,
216                  * 
217                  * @param socketHandler
218                  */
219                 virtual am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler) const =0;
220                 /**
221                  * asynchronous confirmation of setCommandReady.
222                  * 
223                  * @param handle    the handle that was handed over by setCommandReady
224                  * @param error    E_OK if the ready command succeeded. E_UNKNOWN if an error happened.
225                  */
226                 virtual void confirmCommandReady(const uint16_t handle, const am_Error_e error) =0;
227                 /**
228                  * asynchronous confirmation of setCommandRundown
229                  * 
230                  * @param handle    the handle that was given via setCommandRundown
231                  * @param error    E_OK if the ready command succeeded. E_UNKNOWN if an error happened.
232                  */
233                 virtual void confirmCommandRundown(const uint16_t handle, const am_Error_e error) =0;
234                 /**
235                  * Rtrieves the list of MainNotifications for a sink.
236                  * 
237                  * @param sinkID    The sinkID
238                  * @param listMainNotificationConfigurations
239                  */
240                 virtual am_Error_e getListSinkMainNotificationConfigurations(const am_sinkID_t sinkID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations) const =0;
241                 /**
242                  * Rtrieves the list of MainNotifications for a source.
243                  * 
244                  * @param sourceID    The sourceID
245                  * @param listMainNotificationConfigurations
246                  */
247                 virtual am_Error_e getListSourceMainNotificationConfigurations(const am_sourceID_t sourceID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations) const =0;
248                 /**
249                  * sets a MainNotificationConfiuration. This can be used to turn on an off notifications an to change the mode of the
250                  * configuration.
251                  * 
252                  * @param sinkID    The sinkID of the MainNotification to be changed
253                  * @param mainNotificationConfiguration    The MainNotifiication that needs to be set
254                  */
255                 virtual am_Error_e setSinkMainNotificationConfiguration(const am_sinkID_t sinkID, const am_NotificationConfiguration_s mainNotificationConfiguration) =0;
256                 /**
257                  * sets a MainNotificationConfiuration. This can be used to turn on an off notifications an to change the mode of the
258                  * configuration.
259                  * 
260                  * @param sourceID    The sourceID of the MainNotification to be changed
261                  * @param mainNotificationConfiguration    The MainNotifiication that needs to be set
262                  */
263                 virtual am_Error_e setSourceMainNotificationConfiguration(const am_sourceID_t sourceID, const am_NotificationConfiguration_s mainNotificationConfiguration) =0;
264
265         };
266 }
267 #endif // !defined(EA_3888D932_2C16_4c2a_BD7C_E1F819C9A7F0__INCLUDED_)