AudioManager  7.5.11
Native Application Runtime Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
CAmControlSender.h
Go to the documentation of this file.
1 
24 #ifndef CONTROLSENDER_H_
25 #define CONTROLSENDER_H_
26 
27 #ifdef UNIT_TEST
28 #include "../test/IAmControlBackdoor.h"
29 #endif
30 
31 #include "IAmControl.h"
32 #include "CAmSocketHandler.h"
33 #include "unistd.h"
34 
35 namespace am
36 {
37 
42 {
43 public:
44  CAmControlSender(std::string controlPluginFile,CAmSocketHandler* sockethandler);
47  am_Error_e startupController(IAmControlReceive* controlreceiveinterface) ;
48  void setControllerReady() ;
49  void setControllerRundown(const int16_t signal) ;
50  am_Error_e hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID) ;
55  am_Error_e hookUserVolumeChange(const am_sinkID_t SinkID, const am_mainVolume_t newVolume) ;
56  am_Error_e hookUserVolumeStep(const am_sinkID_t SinkID, const int16_t increment) ;
57  am_Error_e hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState) ;
58  am_Error_e hookSystemRegisterDomain(const am_Domain_s& domainData, am_domainID_t& domainID) ;
61  am_Error_e hookSystemRegisterSink(const am_Sink_s& sinkData, am_sinkID_t& sinkID) ;
63  am_Error_e hookSystemRegisterSource(const am_Source_s& sourceData, am_sourceID_t& sourceID) ;
65  am_Error_e hookSystemRegisterGateway(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID) ;
66  am_Error_e hookSystemRegisterConverter(const am_Converter_s& converterData, am_converterID_t& converterID);
69  am_Error_e hookSystemRegisterCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID) ;
71  void hookSystemSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume) ;
72  void hookSystemSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume) ;
73  void hookSystemInterruptStateChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState) ;
74  void hookSystemSinkAvailablityStateChange(const am_sinkID_t sinkID, const am_Availability_s& availability) ;
75  void hookSystemSourceAvailablityStateChange(const am_sourceID_t sourceID, const am_Availability_s& availability) ;
76  void hookSystemDomainStateChange(const am_domainID_t domainID, const am_DomainState_e state) ;
77  void hookSystemReceiveEarlyData(const std::vector<am_EarlyData_s>& data) ;
78  void hookSystemSpeedChange(const am_speed_t speed) ;
79  void hookSystemTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time) ;
80  void cbAckConnect(const am_Handle_s handle, const am_Error_e errorID) ;
81  void cbAckDisconnect(const am_Handle_s handle, const am_Error_e errorID) ;
82  void cbAckCrossFade(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error) ;
83  void cbAckSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error) ;
84  void cbAckSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t voulme, const am_Error_e error) ;
85  void cbAckSetSourceState(const am_Handle_s handle, const am_Error_e error) ;
86  void cbAckSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error) ;
87  void cbAckSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error) ;
88  void cbAckSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error) ;
89  void cbAckSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error) ;
90  am_Error_e getConnectionFormatChoice(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_Route_s listRoute, const std::vector<am_CustomConnectionFormat_t> listPossibleConnectionFormats, std::vector<am_CustomConnectionFormat_t>& listPrioConnectionFormats) ;
91  void confirmCommandReady(const am_Error_e error) ;
92  void confirmRoutingReady(const am_Error_e error) ;
93  void confirmCommandRundown(const am_Error_e error) ;
94  void confirmRoutingRundown(const am_Error_e error) ;
95  void getInterfaceVersion(std::string& version) const ;
96  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_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) ;
97  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_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) ;
98  am_Error_e hookSystemUpdateGateway(const am_gatewayID_t gatewayID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFromats, const std::vector<bool>& convertionMatrix) ;
99  am_Error_e hookSystemUpdateConverter(const am_converterID_t converterID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFromats, const std::vector<bool>& convertionMatrix);
100  void cbAckSetVolume(const am_Handle_s handle, const std::vector<am_Volumes_s>& listVolumes, const am_Error_e error) ;
101  void cbAckSetSinkNotificationConfiguration(const am_Handle_s handle, const am_Error_e error) ;
102  void cbAckSetSourceNotificationConfiguration(const am_Handle_s handle, const am_Error_e error) ;
103  void hookSinkNotificationDataChanged(const am_sinkID_t sinkID, const am_NotificationPayload_s& payload) ;
104  void hookSourceNotificationDataChanged(const am_sourceID_t sourceID, const am_NotificationPayload_s& payload) ;
107  void hookSystemSingleTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t time);
108 
109  void receiverCallback(const pollfd pollfd, const sh_pollHandle_t handle, void* userData);
110  bool checkerCallback(const sh_pollHandle_t handle, void* userData);
111  bool dispatcherCallback(const sh_pollHandle_t handle, void* userData);
112 
113  void setControllerRundownSafe(int16_t signal)
114  {
115  int16_t p(signal);
116  ssize_t result(-1);
117  result = write(mPipe[1], &p, sizeof(p));
118  }
119 
123 
124 
125  //we need this here to call the rundown from the signal handler. In case everything screwed up
126  static void CallsetControllerRundown(int16_t signal)
127  {
128  if (mInstance)
129  mInstance->setControllerRundown(signal);
130  }
131 
132  //this static callback is used from the signal handler. It is used when a normal rundown is assumed and the mainloop is used to call rundown.
133  static void CallsetControllerRundownSafe(int16_t signal)
134  {
135  if (mInstance)
136  {
137  mInstance->setControllerRundownSafe(signal);
138  }
139  }
140 
141 #ifdef UNIT_TEST
142  friend class IAmControlBackdoor;
143 #endif
144 private:
145  int mPipe[2];
146  void* mlibHandle;
147  IAmControlSend* mController;
148  static CAmControlSender* mInstance;
149  int16_t mSignal;
150 };
151 
152 }
153 
154 #endif /* CONTROLSENDER_H_ */
uint16_t am_connectionID_t
a connection ID
bool checkerCallback(const sh_pollHandle_t handle, void *userData)
bool dispatcherCallback(const sh_pollHandle_t handle, void *userData)
am_Error_e hookUserVolumeChange(const am_sinkID_t SinkID, const am_mainVolume_t newVolume)
void getInterfaceVersion(std::string &version) const
void hookSystemSourceAvailablityStateChange(const am_sourceID_t sourceID, const am_Availability_s &availability)
am_Error_e hookSystemUpdateGateway(const am_gatewayID_t gatewayID, const std::vector< am_CustomConnectionFormat_t > &listSourceConnectionFormats, const std::vector< am_CustomConnectionFormat_t > &listSinkConnectionFromats, const std::vector< bool > &convertionMatrix)
void cbAckSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error)
uint16_t am_sinkClass_t
am_Error_e
the errors of the audiomanager.
am_InterruptState_e
am_Error_e hookUserSetMainSinkSoundProperty(const am_sinkID_t sinkID, const am_MainSoundProperty_s &soundProperty)
This struct holds information about the configuration for notifications.
am_Error_e hookSystemRegisterSink(const am_Sink_s &sinkData, am_sinkID_t &sinkID)
am_Error_e hookSystemDeregisterCrossfader(const am_crossfaderID_t crossfaderID)
Copyright (C) 2012 - 2014, BMW AG.
am_Error_e hookUserDisconnectionRequest(const am_mainConnectionID_t connectionID)
void hookSystemInterruptStateChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState)
void hookSystemDomainRegistrationComplete(const am_domainID_t domainID)
This struct describes the attribiutes of a sink.
This struct holds the payload of a notification.
void cbAckSetSinkNotificationConfiguration(const am_Handle_s handle, const am_Error_e error)
void confirmRoutingReady(const am_Error_e error)
template for a callback
void hookSinkNotificationDataChanged(const am_sinkID_t sinkID, const am_NotificationPayload_s &payload)
am_Error_e hookSystemDeregisterSink(const am_sinkID_t sinkID)
make private, not public template for a callback
This struct describes the attribiutes of a domain.
am_Error_e startupController(IAmControlReceive *controlreceiveinterface)
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_CustomConnectionFormat_t > &listConnectionFormats, const std::vector< am_MainSoundProperty_s > &listMainSoundProperties)
uint16_t am_crossfaderID_t
a crossfader ID
The am::CAmSocketHandler implements a mainloop for the AudioManager.
am_Error_e hookUserSetSystemProperty(const am_SystemProperty_s &property)
void setControllerRundownSafe(int16_t signal)
void confirmCommandReady(const am_Error_e error)
TAmShPollCheck< CAmControlSender > checkerCallbackT
void hookSystemSinkAvailablityStateChange(const am_sinkID_t sinkID, const am_Availability_s &availability)
int16_t am_timeSync_t
offset time that is introduced in milli seconds.
void hookSourceNotificationDataChanged(const am_sourceID_t sourceID, const am_NotificationPayload_s &payload)
uint16_t sh_pollHandle_t
this is a handle for a filedescriptor to be used with the SocketHandler
am_Error_e hookSystemRegisterSource(const am_Source_s &sourceData, am_sourceID_t &sourceID)
void receiverCallback(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)
void hookSystemDomainStateChange(const am_domainID_t domainID, const am_DomainState_e state)
am_Error_e hookSystemRegisterConverter(const am_Converter_s &converterData, am_converterID_t &converterID)
am_Error_e getConnectionFormatChoice(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_Route_s listRoute, const std::vector< am_CustomConnectionFormat_t > listPossibleConnectionFormats, std::vector< am_CustomConnectionFormat_t > &listPrioConnectionFormats)
void setControllerRundown(const int16_t signal)
void cbAckCrossFade(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error)
void cbAckSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
void cbAckDisconnect(const am_Handle_s handle, const am_Error_e errorID)
void cbAckSetSourceNotificationConfiguration(const am_Handle_s handle, const am_Error_e error)
am_Error_e hookSystemUpdateConverter(const am_converterID_t converterID, const std::vector< am_CustomConnectionFormat_t > &listSourceConnectionFormats, const std::vector< am_CustomConnectionFormat_t > &listSinkConnectionFromats, const std::vector< bool > &convertionMatrix)
CAmControlSender()
for testing only contructor - do not use !
struct describing system properties
void hookSystemSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume)
uint16_t am_converterID_t
a converter ID
struct describung mainsound property
am_Error_e hookUserSetMainSourceNotificationConfiguration(const am_sourceID_t sourceID, const am_NotificationConfiguration_s &notificationConfiguration)
TAmShPollFired< CAmControlSender > receiverCallbackT
am_Error_e hookUserSetMainSinkNotificationConfiguration(const am_sinkID_t sinkID, const am_NotificationConfiguration_s &notificationConfiguration)
void cbAckConnect(const am_Handle_s handle, const am_Error_e errorID)
void cbAckSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error)
a handle is used for asynchronous operations and is uniquely assigned for each of this operations ...
void hookSystemTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time)
am_Error_e hookSystemRegisterCrossfader(const am_Crossfader_s &crossfaderData, am_crossfaderID_t &crossfaderID)
template for a callback
uint16_t am_sourceID_t
a source ID
am_Error_e hookSystemRegisterGateway(const am_Gateway_s &gatewayData, am_gatewayID_t &gatewayID)
void cbAckSetSourceState(const am_Handle_s handle, const am_Error_e error)
am_Error_e hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState)
sends data to the commandInterface, takes the file of the library that needs to be loaded ...
am_Error_e hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t &mainConnectionID)
void cbAckSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error)
am_Error_e hookSystemDeregisterDomain(const am_domainID_t domainID)
This struct describes the attributes of a converter.
This interface is presented by the AudioManager controller.
Definition: IAmControl.h:675
a list of routing elements that lead from source to sink
am_Error_e hookUserSetMainSourceSoundProperty(const am_sourceID_t sourceID, const am_MainSoundProperty_s &soundProperty)
am_HotSink_e
describes the active sink of a crossfader.
int16_t am_volume_t
The unit is 0.1 db steps,The smallest value -3000 (=AM_MUTE).
This struct describes the attribiutes of a crossfader.
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_CustomConnectionFormat_t > &listConnectionFormats, const std::vector< am_MainSoundProperty_s > &listMainSoundProperties)
void hookSystemSpeedChange(const am_speed_t speed)
void confirmCommandRundown(const am_Error_e error)
uint16_t am_sourceClass_t
SPDX license identifier: MPL-2.0.
static void CallsetControllerRundownSafe(int16_t signal)
void cbAckSetVolume(const am_Handle_s handle, const std::vector< am_Volumes_s > &listVolumes, const am_Error_e error)
void hookSystemSingleTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t time)
this describes the availability of a sink or a source together with the latest change ...
This struct describes the attributes of a gateway.
This interface gives access to all important functions of the audiomanager that are used by the Audio...
Definition: IAmControl.h:56
am_Error_e hookSystemDeregisterConverter(const am_converterID_t converterID)
TAmShPollDispatch< CAmControlSender > dispatcherCallbackT
am_Error_e hookSystemDeregisterGateway(const am_gatewayID_t gatewayID)
uint16_t am_speed_t
speed
uint16_t am_domainID_t
a domain ID
void hookSystemSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume)
int16_t am_mainVolume_t
This is the volume presented on the command interface.
void cbAckSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error)
am_Error_e hookSystemDeregisterSource(const am_sourceID_t sourceID)
static void CallsetControllerRundown(int16_t signal)
void confirmRoutingRundown(const am_Error_e error)
uint16_t am_gatewayID_t
a gateway ID
This struct describes the attribiutes of a source.
uint16_t am_sinkID_t
a sink ID
uint16_t am_mainConnectionID_t
a mainConnection ID
void cbAckSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t voulme, const am_Error_e error)
am_Error_e hookSystemRegisterDomain(const am_Domain_s &domainData, am_domainID_t &domainID)
am_Error_e hookUserVolumeStep(const am_sinkID_t SinkID, const int16_t increment)
void hookSystemReceiveEarlyData(const std::vector< am_EarlyData_s > &data)