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 CAmRoutingReceiver.h
18 * For further information see http://www.genivi.org/.
22 #ifndef ROUTINGRECEIVER_H_
23 #define ROUTINGRECEIVER_H_
25 #include "routing/IAmRoutingReceive.h"
30 class CAmSocketHandler;
32 class CAmDatabaseHandler;
33 class CAmRoutingSender;
34 class CAmControlSender;
37 * Implements the Receiving side of the RoutingPlugins.
39 class CAmRoutingReceiver: public IAmRoutingReceive
42 CAmRoutingReceiver(CAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler);
43 CAmRoutingReceiver(CAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler, CAmDbusWrapper *iDBusWrapper);
44 ~CAmRoutingReceiver();
45 void ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error);
46 void ackDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error);
47 void ackSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error);
48 void ackSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error);
49 void ackSetSourceState(const am_Handle_s handle, const am_Error_e error);
50 void ackSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error);
51 void ackSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error);
52 void ackSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error);
53 void ackSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error);
54 void ackCrossFading(const am_Handle_s handle, const am_HotSink_e hotSink, const am_Error_e error);
55 void ackSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume);
56 void ackSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume);
57 am_Error_e peekDomain(const std::string& name, am_domainID_t& domainID);
58 am_Error_e registerDomain(const am_Domain_s& domainData, am_domainID_t& domainID);
59 am_Error_e deregisterDomain(const am_domainID_t domainID);
60 am_Error_e registerGateway(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID);
61 am_Error_e deregisterGateway(const am_gatewayID_t gatewayID);
62 am_Error_e peekSink(const std::string& name, am_sinkID_t& sinkID);
63 am_Error_e registerSink(const am_Sink_s& sinkData, am_sinkID_t& sinkID);
64 am_Error_e deregisterSink(const am_sinkID_t sinkID);
65 am_Error_e peekSource(const std::string& name, am_sourceID_t& sourceID);
66 am_Error_e registerSource(const am_Source_s& sourceData, am_sourceID_t& sourceID);
67 am_Error_e deregisterSource(const am_sourceID_t sourceID);
68 am_Error_e registerCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID);
69 am_Error_e deregisterCrossfader(const am_crossfaderID_t crossfaderID);
70 am_Error_e peekSourceClassID(const std::string& name, am_sourceClass_t& sourceClassID);
71 am_Error_e peekSinkClassID(const std::string& name, am_sinkClass_t& sinkClassID);
72 void hookInterruptStatusChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState);
73 void hookDomainRegistrationComplete(const am_domainID_t domainID);
74 void hookSinkAvailablityStatusChange(const am_sinkID_t sinkID, const am_Availability_s& availability);
75 void hookSourceAvailablityStatusChange(const am_sourceID_t sourceID, const am_Availability_s& availability);
76 void hookDomainStateChange(const am_domainID_t domainID, const am_DomainState_e domainState);
77 void hookTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t delay);
78 void sendChangedData(const std::vector<am_EarlyData_s>& earlyData);
79 am_Error_e getDBusConnectionWrapper(CAmDbusWrapper*& dbusConnectionWrapper) const;
80 am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler) const;
81 void getInterfaceVersion(std::string& version) const;
82 void confirmRoutingReady(const uint16_t handle);
83 void confirmRoutingRundown(const uint16_t handle);
85 uint16_t getStartupHandle(); //!< returns a startup handle
86 uint16_t getRundownHandle(); //!< returns a rundown handle
88 void waitOnStartup(bool startup); //!< tells the RoutingReceiver to start waiting for all handles to be confirmed
89 void waitOnRundown(bool rundown); //!< tells the RoutingReceiver to start waiting for all handles to be confirmed
92 CAmDatabaseHandler *mpDatabaseHandler; //!< pointer to the databaseHandler
93 CAmRoutingSender *mpRoutingSender; //!< pointer to the routingSender
94 CAmControlSender *mpControlSender; //!< pointer to the controlSender
95 CAmSocketHandler *mpSocketHandler; //!< pointer to sockethandler
96 CAmDbusWrapper *mpDBusWrapper; //!< pointer to dbuswrapper
98 uint16_t handleCount; //!< counts all handles
99 std::vector<uint16_t> mListStartupHandles; //!< list of handles that wait for a confirm
100 std::vector<uint16_t> mListRundownHandles; //!< list of handles that wait for a confirm
101 bool mWaitStartup; //!< if true confirmation will be sent if list of handles = 0
102 bool mWaitRundown; //!< if true confirmation will be sent if list of handles = 0
108 #endif /* ROUTINGRECEIVER_H_ */