2 * Copyright (C) 2012, BMW AG
4 * This file is part of GENIVI Project AudioManager.
6 * Contributions are licensed to the GENIVI Alliance under one or more
7 * Contribution License Agreements.
10 * This Source Code Form is subject to the terms of the
11 * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
12 * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
15 * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
17 * \file CAmControlReceiver.h
18 * For further information see http://www.genivi.org/.
22 #ifndef CONTRONLRECEIVER_H_
23 #define CONTRONLRECEIVER_H_
25 #include "control/IAmControlReceive.h"
30 class CAmSocketHandler;
31 class IAmDatabaseHandler;
32 class CAmRoutingSender;
33 class CAmCommandSender;
35 class CAmNodeStateCommunicator;
38 * This class is used to receive all commands from the control interface
40 class CAmControlReceiver: public IAmControlReceive
43 CAmControlReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmCommandSender *iCommandSender, CAmSocketHandler *iSocketHandler, CAmRouter* iRouter, CAmNodeStateCommunicator* iNodeStateCommunicator);
44 CAmControlReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmCommandSender *iCommandSender, CAmSocketHandler *iSocketHandler, CAmRouter* iRouter);
45 ~CAmControlReceiver();
46 am_Error_e getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s>& returnList);
47 am_Error_e connect(am_Handle_s& handle, am_connectionID_t& connectionID, const am_ConnectionFormat_e format, const am_sourceID_t sourceID, const am_sinkID_t sinkID);
48 am_Error_e disconnect(am_Handle_s& handle, const am_connectionID_t connectionID);
49 am_Error_e crossfade(am_Handle_s& handle, const am_HotSink_e hotSource, const am_crossfaderID_t crossfaderID, const am_RampType_e rampType, const am_time_t rampTime);
50 am_Error_e abortAction(const am_Handle_s handle);
51 am_Error_e setSourceState(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SourceState_e state);
52 am_Error_e setSinkVolume(am_Handle_s& handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time);
53 am_Error_e setSourceVolume(am_Handle_s& handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e rampType, const am_time_t time);
54 am_Error_e setSinkSoundProperties(am_Handle_s& handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s>& soundProperty);
55 am_Error_e setSinkSoundProperty(am_Handle_s& handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty);
56 am_Error_e setSourceSoundProperties(am_Handle_s& handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s>& soundProperty);
57 am_Error_e setSourceSoundProperty(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty);
58 am_Error_e setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState);
59 am_Error_e enterDomainDB(const am_Domain_s& domainData, am_domainID_t& domainID);
60 am_Error_e enterMainConnectionDB(const am_MainConnection_s& mainConnectionData, am_mainConnectionID_t& connectionID);
61 am_Error_e enterSinkDB(const am_Sink_s& sinkData, am_sinkID_t& sinkID);
62 am_Error_e enterCrossfaderDB(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID);
63 am_Error_e enterGatewayDB(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID);
64 am_Error_e enterSourceDB(const am_Source_s& sourceData, am_sourceID_t& sourceID);
65 am_Error_e enterSinkClassDB(const am_SinkClass_s& sinkClass, am_sinkClass_t& sinkClassID);
66 am_Error_e enterSourceClassDB(am_sourceClass_t& sourceClassID, const am_SourceClass_s& sourceClass);
67 am_Error_e changeSinkClassInfoDB(const am_SinkClass_s& sinkClass);
68 am_Error_e changeSourceClassInfoDB(const am_SourceClass_s& sourceClass);
69 am_Error_e enterSystemPropertiesListDB(const std::vector<am_SystemProperty_s>& listSystemProperties);
70 am_Error_e changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID);
71 am_Error_e changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState);
72 am_Error_e changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID);
73 am_Error_e changeSinkAvailabilityDB(const am_Availability_s& availability, const am_sinkID_t sinkID);
74 am_Error_e changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID);
75 am_Error_e changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID);
76 am_Error_e changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID);
77 am_Error_e changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID);
78 am_Error_e changeSourceAvailabilityDB(const am_Availability_s& availability, const am_sourceID_t sourceID);
79 am_Error_e changeSystemPropertyDB(const am_SystemProperty_s& property);
80 am_Error_e removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID);
81 am_Error_e removeSinkDB(const am_sinkID_t sinkID);
82 am_Error_e removeSourceDB(const am_sourceID_t sourceID);
83 am_Error_e removeGatewayDB(const am_gatewayID_t gatewayID);
84 am_Error_e removeCrossfaderDB(const am_crossfaderID_t crossfaderID);
85 am_Error_e removeDomainDB(const am_domainID_t domainID);
86 am_Error_e removeSinkClassDB(const am_sinkClass_t sinkClassID);
87 am_Error_e removeSourceClassDB(const am_sourceClass_t sourceClassID);
88 am_Error_e getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s& classInfo) const;
89 am_Error_e getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s& sinkClass) const;
90 am_Error_e getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s& sinkData) const;
91 am_Error_e getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s& sourceData) const;
92 am_Error_e getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s& gatewayData) const;
93 am_Error_e getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s& crossfaderData) const;
94 am_Error_e getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s& mainConnectionData) const;
95 am_Error_e getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t>& listSinkID) const;
96 am_Error_e getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t>& listSourceID) const;
97 am_Error_e getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t>& listCrossfadersID) const;
98 am_Error_e getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t>& listGatewaysID) const;
99 am_Error_e getListMainConnections(std::vector<am_MainConnection_s>& listMainConnections) const;
100 am_Error_e getListDomains(std::vector<am_Domain_s>& listDomains) const;
101 am_Error_e getListConnections(std::vector<am_Connection_s>& listConnections) const;
102 am_Error_e getListSinks(std::vector<am_Sink_s>& listSinks) const;
103 am_Error_e getListSources(std::vector<am_Source_s>& listSources) const;
104 am_Error_e getListSourceClasses(std::vector<am_SourceClass_s>& listSourceClasses) const;
105 am_Error_e getListHandles(std::vector<am_Handle_s>& listHandles) const;
106 am_Error_e getListCrossfaders(std::vector<am_Crossfader_s>& listCrossfaders) const;
107 am_Error_e getListGateways(std::vector<am_Gateway_s>& listGateways) const;
108 am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const;
109 am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const;
110 void setCommandReady();
111 void setCommandRundown();
112 void setRoutingReady();
113 void setRoutingRundown();
114 void confirmControllerReady(const am_Error_e error);
115 void confirmControllerRundown(const am_Error_e error);
116 am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler);
117 void getInterfaceVersion(std::string& version) const;
118 am_Error_e changeSourceDB(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) ;
119 am_Error_e changeSinkDB(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) ;
120 am_Error_e changeGatewayDB(const am_gatewayID_t gatewayID, const std::vector<am_ConnectionFormat_e>& listSourceConnectionFormats, const std::vector<am_ConnectionFormat_e>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix) ;
121 am_Error_e setVolumes(am_Handle_s& handle, const std::vector<am_Volumes_s>& listVolumes) ;
122 am_Error_e setSinkNotificationConfiguration(am_Handle_s& handle, const am_sinkID_t sinkID, const am_NotificationConfiguration_s& notificationConfiguration) ;
123 am_Error_e setSourceNotificationConfiguration(am_Handle_s& handle, const am_sourceID_t sourceID, const am_NotificationConfiguration_s& notificationConfiguration) ;
124 void sendMainSinkNotificationPayload(const am_sinkID_t sinkID, const am_NotificationPayload_s& notificationPayload) ;
125 void sendMainSourceNotificationPayload(const am_sourceID_t sourceID, const am_NotificationPayload_s& notificationPayload) ;
126 am_Error_e changeMainSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& mainNotificationConfiguration) ;
127 am_Error_e changeMainSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& mainNotificationConfiguration) ;
128 am_Error_e getRestartReasonPropertyNSM(NsmRestartReason_e& restartReason) ;
129 am_Error_e getShutdownReasonPropertyNSM(NsmShutdownReason_e& ShutdownReason) ;
130 am_Error_e getRunningReasonPropertyNSM(NsmRunningReason_e& nsmRunningReason) ;
131 NsmErrorStatus_e getNodeStateNSM(NsmNodeState_e& nsmNodeState) ;
132 NsmErrorStatus_e getSessionStateNSM(const std::string& sessionName, const NsmSeat_e seatID, NsmSessionState_e& sessionState) ;
133 NsmErrorStatus_e getApplicationModeNSM(NsmApplicationMode_e& applicationMode) ;
134 NsmErrorStatus_e registerShutdownClientNSM(const uint32_t shutdownMode, const uint32_t timeoutMs) ;
135 NsmErrorStatus_e unRegisterShutdownClientNSM(const uint32_t shutdownMode) ;
136 am_Error_e getInterfaceVersionNSM(uint32_t& version) ;
137 NsmErrorStatus_e sendLifecycleRequestCompleteNSM(const uint32_t RequestId, const NsmErrorStatus_e status) ;
140 IAmDatabaseHandler* mDatabaseHandler; //!< pointer tto the databasehandler
141 CAmRoutingSender* mRoutingSender; //!< pointer to the routing send interface.
142 CAmCommandSender* mCommandSender; //!< pointer to the command send interface
143 CAmSocketHandler* mSocketHandler; //!< pointer to the socketHandler
144 CAmRouter* mRouter; //!< pointer to the Router
145 CAmNodeStateCommunicator* mNodeStateCommunicator;
150 #endif /* CONTRONLRECEIVER_H_ */