* took over changes for bug 42 since patch did no longer apply cleanly
[profile/ivi/genivi/genivi-audio-manager.git] / include / control / IAmControlSend.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_89F9440C_319B_486f_BAB5_91FED9A658C2__INCLUDED_)\r
23 #define EA_89F9440C_319B_486f_BAB5_91FED9A658C2__INCLUDED_\r
24 \r
25 #include <vector>\r
26 #include <string>\r
27 #include "audiomanagertypes.h"\r
28 \r
29 namespace am {\r
30 class IAmControlReceive;\r
31 }
32
33 #include "IAmControlReceive.h"
34 #include "audiomanagertypes.h"
35 #include "NodeStateManager.h"
36
37 #define ControlSendVersion "2.0" 
38 namespace am {
39         /**
40          * This interface is presented by the AudioManager controller.
41          * All the hooks represent system events that need to be handled. The callback functions are used to handle for example
42          * answers to function calls on the AudioManagerCoreInterface.
43          * There are two rules that have to be kept in mind when implementing against this interface:\n
44          * \warning
45          * 1. CALLS TO THIS INTERFACE ARE NOT THREAD SAFE !!!! \n
46          * 2. YOU MAY NOT CALL THE CALLING INTERFACE DURING AN SYNCHRONOUS OR ASYNCHRONOUS CALL THAT EXPECTS A RETURN VALUE.\n
47          * \details
48          * Violation these rules may lead to unexpected behavior! Nevertheless you can implement thread safe by using the deferred-
49          * call pattern described on the wiki which also helps to implement calls that are forbidden.\n
50          * For more information, please check CAmSerializer
51          * @author Christian Mueller
52          * @created 17-Jan-2013 10:00:25
53          */
54         class IAmControlSend
55         {
56
57         public:
58                 IAmControlSend() {
59
60                 }
61
62                 virtual ~IAmControlSend() {
63
64                 }
65
66                 /**
67                  * This function returns the version of the interface
68                  * returns E_OK, E_UNKOWN if version is unknown.
69                  * 
70                  * @param version
71                  */
72                 virtual void getInterfaceVersion(std::string& version) const =0;
73                 /**
74                  * Starts up the controller.
75                  * 
76                  * @param controlreceiveinterface    This is a pointer to the ControlReceiveInterface so that the controller knows to whom
77                  * to communicate.
78                  */
79                 virtual am_Error_e startupController(IAmControlReceive* controlreceiveinterface) =0;
80                 /**
81                  * this message is used tell the controller that it should get ready. This message must be acknowledged via
82                  * confirmControllerReady.
83                  */
84                 virtual void setControllerReady() =0;
85                 /**
86                  * This message tells the controller that he should prepare everything for the power to be switched off. This message must
87                  * be acknowledged via confirmControllerRundown.
88                  * The method will give the signal as integer that was responsible for calling the setControllerRundown.
89                  * This function is called from the signal handler, either direct (when the program is killed) or from within the mainloop
90                  * (if the program is terminated).
91                  * 
92                  * @param signal    The signal NO that was responsible for the rundown. Can be:
93                  * SIGINT
94                  * SIGQUIT
95                  * SIGTERM
96                  * SIGHUP
97                  */
98                 virtual void setControllerRundown(const int16_t signal) =0;
99                 /**
100                  * is called when a connection request comes in via the command interface
101                  * @return E_OK on success, E_NOT_POSSIBLE on error, E_ALREADY_EXISTENT if already exists
102                  * 
103                  * @param sourceID
104                  * @param sinkID
105                  * @param mainConnectionID
106                  */
107                 virtual am_Error_e hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID) =0;
108                 /**
109                  * is called when a disconnection request comes in via the command interface
110                  * @return E_OK on success, E_NOT_POSSIBLE on error, E_NON_EXISTENT if connection does not exists
111                  * 
112                  * @param connectionID
113                  */
114                 virtual am_Error_e hookUserDisconnectionRequest(const am_mainConnectionID_t connectionID) =0;
115                 /**
116                  * sets a user MainSinkSoundProperty
117                  * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
118                  * 
119                  * @param sinkID
120                  * @param soundProperty
121                  */
122                 virtual am_Error_e hookUserSetMainSinkSoundProperty(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty) =0;
123                 /**
124                  * sets a user MainSourceSoundProperty
125                  * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
126                  * 
127                  * @param sourceID
128                  * @param soundProperty
129                  */
130                 virtual am_Error_e hookUserSetMainSourceSoundProperty(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty) =0;
131                 /**
132                  * sets a user SystemProperty
133                  * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
134                  * 
135                  * @param property
136                  */
137                 virtual am_Error_e hookUserSetSystemProperty(const am_SystemProperty_s& property) =0;
138                 /**
139                  * sets a user volume
140                  * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
141                  * 
142                  * @param SinkID
143                  * @param newVolume
144                  */
145                 virtual am_Error_e hookUserVolumeChange(const am_sinkID_t SinkID, const am_mainVolume_t newVolume) =0;
146                 /**
147                  * sets a user volume as increment
148                  * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
149                  * 
150                  * @param SinkID
151                  * @param increment    the steps
152                  */
153                 virtual am_Error_e hookUserVolumeStep(const am_sinkID_t SinkID, const int16_t increment) =0;
154                 /**
155                  * sets the mute state of a sink
156                  * @return E_OK on success, E_UNKNOWN on error
157                  * 
158                  * @param sinkID
159                  * @param muteState    true=muted
160                  */
161                 virtual am_Error_e hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState) =0;
162                 /**
163                  * is called when a routing adaptor registers its domain
164                  * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXISTENT if already exists
165                  * 
166                  * @param domainData    ID is omitted here since it has not been created yet
167                  * @param domainID
168                  */
169                 virtual am_Error_e hookSystemRegisterDomain(const am_Domain_s& domainData, am_domainID_t& domainID) =0;
170                 /**
171                  * is called when a routing adaptor wants to derigister a domain
172                  * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if not found
173                  * 
174                  * @param domainID
175                  */
176                 virtual am_Error_e hookSystemDeregisterDomain(const am_domainID_t domainID) =0;
177                 /**
178                  * is called when a domain registered all the elements
179                  * 
180                  * @param domainID
181                  */
182                 virtual void hookSystemDomainRegistrationComplete(const am_domainID_t domainID) =0;
183                 /**
184                  * is called when a routing adaptor registers a sink
185                  * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXISTENT if already exists
186                  * 
187                  * @param sinkData    Id is omitted here, since it has not been created yet
188                  * @param sinkID
189                  */
190                 virtual am_Error_e hookSystemRegisterSink(const am_Sink_s& sinkData, am_sinkID_t& sinkID) =0;
191                 /**
192                  * is called when a routing adaptor deregisters a sink
193                  * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if not found
194                  * 
195                  * @param sinkID
196                  */
197                 virtual am_Error_e hookSystemDeregisterSink(const am_sinkID_t sinkID) =0;
198                 /**
199                  * is called when a routing adaptor registers a source
200                  * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXISTENT if already exists
201                  * 
202                  * @param sourceData    ID is omitted here since it is not yet created
203                  * @param sourceID
204                  */
205                 virtual am_Error_e hookSystemRegisterSource(const am_Source_s& sourceData, am_sourceID_t& sourceID) =0;
206                 /**
207                  * is called when a routing adaptor deregisters a source
208                  * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if not found
209                  * 
210                  * @param sourceID
211                  */
212                 virtual am_Error_e hookSystemDeregisterSource(const am_sourceID_t sourceID) =0;
213                 /**
214                  * is called when a routing adaptor registers a gateway
215                  * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXISTENT if already exists
216                  * 
217                  * @param gatewayData    gatewayID is not set here since it is not created at this point of time
218                  * @param gatewayID
219                  */
220                 virtual am_Error_e hookSystemRegisterGateway(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID) =0;
221                 /**
222                  * is called when a routing adaptor deregisters a gateway
223                  * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if not found
224                  * 
225                  * @param gatewayID
226                  */
227                 virtual am_Error_e hookSystemDeregisterGateway(const am_gatewayID_t gatewayID) =0;
228                 /**
229                  * is called when a routing adaptor registers a crossfader
230                  * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXISTENT if already exists
231                  * 
232                  * @param crossfaderData    gatewayID is not set here since it is not created at this point of time
233                  * @param crossfaderID
234                  */
235                 virtual am_Error_e hookSystemRegisterCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID) =0;
236                 /**
237                  * is called when a routing adaptor deregisters a crossfader
238                  * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if not found
239                  * 
240                  * @param crossfaderID
241                  */
242                 virtual am_Error_e hookSystemDeregisterCrossfader(const am_crossfaderID_t crossfaderID) =0;
243                 /**
244                  * volumeticks. therse are used to indicate volumechanges during a ramp
245                  * 
246                  * @param handle
247                  * @param sinkID
248                  * @param volume
249                  */
250                 virtual void hookSystemSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume) =0;
251                 /**
252                  * volumeticks. therse are used to indicate volumechanges during a ramp
253                  * 
254                  * @param handle
255                  * @param sourceID
256                  * @param volume
257                  */
258                 virtual void hookSystemSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume) =0;
259                 /**
260                  * is called when an low level interrupt changed its state
261                  * 
262                  * @param sourceID
263                  * @param interruptState
264                  */
265                 virtual void hookSystemInterruptStateChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState) =0;
266                 /**
267                  * id called when a sink changed its availability
268                  * 
269                  * @param sinkID
270                  * @param availability
271                  */
272                 virtual void hookSystemSinkAvailablityStateChange(const am_sinkID_t sinkID, const am_Availability_s& availability) =0;
273                 /**
274                  * id called when a source changed its availability
275                  * 
276                  * @param sourceID
277                  * @param availability
278                  */
279                 virtual void hookSystemSourceAvailablityStateChange(const am_sourceID_t sourceID, const am_Availability_s& availability) =0;
280                 /**
281                  * id called when domainstate was changed
282                  * 
283                  * @param domainID
284                  * @param state
285                  */
286                 virtual void hookSystemDomainStateChange(const am_domainID_t domainID, const am_DomainState_e state) =0;
287                 /**
288                  * when early data was received
289                  * 
290                  * @param data
291                  */
292                 virtual void hookSystemReceiveEarlyData(const std::vector<am_EarlyData_s>& data) =0;
293                 /**
294                  * this hook provides information about speed changes.
295                  * The quantization and sampling rate of the speed can be adjusted at compile time of the AudioManagerDaemon.
296                  * 
297                  * @param speed
298                  */
299                 virtual void hookSystemSpeedChange(const am_speed_t speed) =0;
300                 /**
301                  * this hook is fired whenever the timing information of a mainconnection has changed.
302                  * 
303                  * @param mainConnectionID
304                  * @param time
305                  */
306                 virtual void hookSystemTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time) =0;
307                 /**
308                  * ack for connect
309                  * 
310                  * @param handle
311                  * @param errorID
312                  */
313                 virtual void cbAckConnect(const am_Handle_s handle, const am_Error_e errorID) =0;
314                 /**
315                  * ack for disconnect
316                  * 
317                  * @param handle
318                  * @param errorID
319                  */
320                 virtual void cbAckDisconnect(const am_Handle_s handle, const am_Error_e errorID) =0;
321                 /**
322                  * ack for crossfading
323                  * 
324                  * @param handle
325                  * @param hostsink
326                  * @param error
327                  */
328                 virtual void cbAckCrossFade(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error) =0;
329                 /**
330                  * ack for sink volume changes
331                  * 
332                  * @param handle
333                  * @param volume
334                  * @param error
335                  */
336                 virtual void cbAckSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error) =0;
337                 /**
338                  * ack for source volume changes
339                  * 
340                  * @param handle    the handle that is connected to the volume change
341                  * @param voulme    the volume after the action ended (the desired volume if everything went right, the actual one in case
342                  * of abortion)
343                  * @param error
344                  */
345                 virtual void cbAckSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t voulme, const am_Error_e error) =0;
346                 /**
347                  * ack for setting of source states
348                  * 
349                  * @param handle
350                  * @param error
351                  */
352                 virtual void cbAckSetSourceState(const am_Handle_s handle, const am_Error_e error) =0;
353                 /**
354                  * ack for setting of sourcesoundproperties
355                  * 
356                  * @param handle
357                  * @param error
358                  */
359                 virtual void cbAckSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error) =0;
360                 /**
361                  * ack for setting of sourcesoundproperties
362                  * 
363                  * @param handle
364                  * @param error
365                  */
366                 virtual void cbAckSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error) =0;
367                 /**
368                  * ack for setting of sinksoundproperties
369                  * 
370                  * @param handle
371                  * @param error
372                  */
373                 virtual void cbAckSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error) =0;
374                 /**
375                  * ack for setting of sinksoundproperties
376                  * 
377                  * @param handle
378                  * @param error
379                  */
380                 virtual void cbAckSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error) =0;
381                 /**
382                  * This function is used by the routing algorithm to retrieve a priorized list of connectionFormats from the Controller.
383                  * @return E_OK in case of successfull priorisation.
384                  * 
385                  * @param sourceID    sourceID of source that shall be connected
386                  * @param sinkID    sinkID of sink that shall be connected
387                  * @param listRoute    This route is the one the priorized connectionFormats is for.
388                  * @param listPossibleConnectionFormats    list of possible connectionformats
389                  * @param listPrioConnectionFormats    the list return with prioos from the controller. Best choice on first position.
390                  */
391                 virtual am_Error_e getConnectionFormatChoice(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_Route_s listRoute, const std::vector<am_ConnectionFormat_e> listPossibleConnectionFormats, std::vector<am_ConnectionFormat_e>& listPrioConnectionFormats) =0;
392                 /**
393                  * confirms the setCommandReady call
394                  * 
395                  * @param error    E_OK if everything went right. If a plugin returns an error, it will be forwared here
396                  */
397                 virtual void confirmCommandReady(const am_Error_e error) =0;
398                 /**
399                  * confirms the setRoutingReady call
400                  * 
401                  * @param error    E_OK if everything went right. If a plugin returns an error, it will be forwared here
402                  */
403                 virtual void confirmRoutingReady(const am_Error_e error) =0;
404                 /**
405                  * confirms the setCommandRundown call
406                  * 
407                  * @param error    E_OK if everything went right. If a plugin returns an error, it will be forwared here
408                  */
409                 virtual void confirmCommandRundown(const am_Error_e error) =0;
410                 /**
411                  * confirms the setRoutingRundown command
412                  * 
413                  * @param error    E_OK if everything went right. If a plugin returns an error, it will be forwared here
414                  */
415                 virtual void confirmRoutingRundown(const am_Error_e error) =0;
416                 /**
417                  * update form the SinkData
418                  * 
419                  * @param sinkID    the sinkID
420                  * @param sinkClassID
421                  * @param listSoundProperties
422                  * @param listConnectionFormats
423                  * @param listMainSoundProperties
424                  */
425                 virtual am_Error_e hookSystemUpdateSink(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_ConnectionFormat_e>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) =0;
426                 /**
427                  * update from the source Data
428                  * 
429                  * @param sourceID    the sourceID
430                  * @param sourceClassID
431                  * @param listSoundProperties
432                  * @param listConnectionFormats
433                  * @param listMainSoundProperties
434                  */
435                 virtual am_Error_e hookSystemUpdateSource(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_ConnectionFormat_e>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) =0;
436                 /**
437                  * updates the Gateway Data
438                  * 
439                  * @param gatewayID    the gatewayID
440                  * @param listSourceConnectionFormats
441                  * @param listSinkConnectionFormats
442                  * @param convertionMatrix
443                  */
444                 virtual am_Error_e hookSystemUpdateGateway(const am_gatewayID_t gatewayID, const std::vector<am_ConnectionFormat_e>& listSourceConnectionFormats, const std::vector<am_ConnectionFormat_e>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix) =0;
445                 /**
446                  * ack for mulitple volume changes
447                  * 
448                  * @param handle
449                  * @param listVolumes    the list of volumes with the current status
450                  * @param error
451                  */
452                 virtual void cbAckSetVolumes(const am_Handle_s handle, const std::vector<am_Volumes_s>& listVolumes, const am_Error_e error) =0;
453                 /**
454                  * The acknowledge of the sink notification configuration
455                  * 
456                  * @param handle    the handle
457                  * @param error    the error
458                  */
459                 virtual void cbAckSetSinkNotificationConfiguration(const am_Handle_s handle, const am_Error_e error) =0;
460                 /**
461                  * The acknowledge of the source notification configuration
462                  * 
463                  * @param handle    the handle
464                  * @param error    the error
465                  */
466                 virtual void cbAckSetSourceNotificationConfiguration(const am_Handle_s handle, const am_Error_e error) =0;
467                 /**
468                  * new sinkNotification data is there!
469                  * 
470                  * @param sinkID    the sinkID of the changed notification
471                  * @param payload    the payload
472                  */
473                 virtual void hookSinkNotificationDataChanged(const am_sinkID_t sinkID, const am_NotificationPayload_s& payload) =0;
474                 /**
475                  * new sourceNotification data is there!
476                  * 
477                  * @param sourceID    the sourceID of the changed notification
478                  * @param payload    the payload
479                  */
480                 virtual void hookSourceNotificationDataChanged(const am_sourceID_t sourceID, const am_NotificationPayload_s& payload) =0;
481                 /**
482                  * sets a user MainSinkNotificationConfiguration
483                  * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
484                  * 
485                  * @param sinkID
486                  * @param notificationConfiguration
487                  */
488                 virtual am_Error_e hookUserSetMainSinkNotificationConfiguration(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& notificationConfiguration) =0;
489                 /**
490                  * sets a user MainSourceNotificationConfiguration
491                  * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
492                  * 
493                  * @param sourceID
494                  * @param notificationConfiguration
495                  */
496                 virtual am_Error_e hookUserSetMainSourceNotificationConfiguration(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& notificationConfiguration) =0;
497                 /**
498                  * This hook is connected to the NodeState signal of the NodeStateManager
499                  * 
500                  * @param NodeStateId    The new current state of the node
501                  */
502                 virtual void hookSystemNodeStateChanged(const NsmNodeState_e NodeStateId) =0;
503                 /**
504                  * This hook is connected to the NodeApplicationMode signal of the NodeStateManager
505                  * 
506                  * @param ApplicationModeId    The new ApplicationMode
507                  */
508                 virtual void hookSystemNodeApplicationModeChanged(const NsmApplicationMode_e ApplicationModeId) =0;
509                 /**
510                  * the sessionstate change was send by the NSM
511                  * 
512                  * @param sessionName
513                  * @param seatID
514                  * @param sessionStateID
515                  */
516                 virtual void hookSystemSessionStateChanged(const std::string& sessionName, const NsmSeat_e seatID, const NsmSessionState_e sessionStateID) =0;
517                 /**
518                  * A lifecycle request comes in from the NSM and must be processed.
519                  * @return NsmErrorStatus_Ok if successful
520                  * The controller has to respond to this message with LifecycleRequestComplete.
521                  * 
522                  * @param Request    the shutdown request from the NSM. One of the types
523                  * 
524                  * NSM_SHUTDOWNTYPE_RUNUP, NSM_SHUTDOWNTYPE_NORMAL
525                  * NSM_SHUTDOWNTYPE_FAST
526                  * 
527                  * In order to receive this request, the controller needs to register for this request first via RegisterShutdownClient
528                  * @param RequestId    the requestID
529                  */
530                 virtual NsmErrorStatus_e hookSystemLifecycleRequest(const uint32_t Request, const uint32_t RequestId) =0;
531
532         };
533 }
534 #endif // !defined(EA_89F9440C_319B_486f_BAB5_91FED9A658C2__INCLUDED_)