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