summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorchristian mueller <christian.ei.mueller@bmw.de>2012-03-01 19:12:55 +0100
committerchristian mueller <christian.ei.mueller@bmw.de>2012-03-01 19:12:55 +0100
commitdfcafbec34e0e454d9995551998af5d40a27c7ad (patch)
treed93d70fea7feb7004f6a2ce9bfce9b83d3469e42 /include
parentffccf1e2003cea4230413ccfdfd4cd6515484e4f (diff)
downloadaudiomanager-dfcafbec34e0e454d9995551998af5d40a27c7ad.tar.gz
* fix [GAM-28] problems in routingsender.cpp
* [GAM-27] major refactoring: bringing everything to standardized names * Enhancement of CAmSerializer.h * improvement of documentation * adoption & regeneration of inerfaces
Diffstat (limited to 'include')
-rw-r--r--include/audiomanagertypes.h819
-rw-r--r--include/command/IAmCommandReceive.h220
-rw-r--r--include/command/IAmCommandSend.h194
-rw-r--r--include/control/IAmControlReceive.h614
-rw-r--r--include/control/IAmControlSend.h388
-rw-r--r--include/projecttypes.h203
-rw-r--r--include/routing/IAmRoutingReceive.h348
-rw-r--r--include/routing/IAmRoutingSend.h204
-rw-r--r--include/shared/CAmDbusWrapper.h92
-rw-r--r--include/shared/CAmDltWrapper.h820
-rw-r--r--include/shared/CAmSerializer.h708
-rw-r--r--include/shared/CAmSocketHandler.h258
12 files changed, 4868 insertions, 0 deletions
diff --git a/include/audiomanagertypes.h b/include/audiomanagertypes.h
new file mode 100644
index 0000000..afc5519
--- /dev/null
+++ b/include/audiomanagertypes.h
@@ -0,0 +1,819 @@
+/** Copyright (c) 2012 GENIVI Alliance
+ * Copyright (c) 2012 BMW
+ *
+ * @author Christian Mueller, BMW
+ *
+ * @copyright
+ * {
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * }
+ *
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
+#if !defined(EA_1F9A0AD1_FF28_4de6_A5C7_2F570F618734__INCLUDED_)
+#define EA_1F9A0AD1_FF28_4de6_A5C7_2F570F618734__INCLUDED_
+
+#include <stdint.h>
+#include "projecttypes.h"
+#include <string>
+#include <vector>
+
+#define AM_MUTE -3000
+
+namespace am {
+ /**
+ * a domain ID
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ typedef uint16_t am_domainID_t;
+
+ /**
+ * a source ID
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ typedef uint16_t am_sourceID_t;
+
+ /**
+ * a sink ID
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ typedef uint16_t am_sinkID_t;
+
+ /**
+ * a gateway ID
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ typedef uint16_t am_gatewayID_t;
+
+ /**
+ * a crossfader ID
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ typedef uint16_t am_crossfaderID_t;
+
+ /**
+ * a connection ID
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ typedef uint16_t am_connectionID_t;
+
+ /**
+ * a mainConnection ID
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ typedef uint16_t am_mainConnectionID_t;
+
+ /**
+ * speed
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ typedef uint16_t am_speed_t;
+
+ /**
+ * The unit is 0.1 db steps,The smallest value -3000 (=AM_MUTE). The minimum and maximum can be limited by actual project.
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ typedef int16_t am_volume_t;
+
+ /**
+ * This is the volume presented on the command interface. It is in the duty of the Controller to change the volumes given here into meaningful values on the routing interface.
+ * The range of this type is customer specific.
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ typedef int16_t am_mainVolume_t;
+
+ /**
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ typedef uint16_t am_sourceClass_t;
+
+ /**
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ typedef uint16_t am_sinkClass_t;
+
+ /**
+ * time in ms!
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ typedef uint16_t am_time_t;
+
+ /**
+ * offset time that is introduced in milli seconds.
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ typedef int16_t am_timeSync_t;
+
+ /**
+ * with the help of this enum, sinks and sources can report their availability state
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ enum am_Availablility_e
+ {
+ /**
+ * default
+ */
+ A_UNKNOWN = 0,
+ /**
+ * The source / sink is available
+ */
+ A_AVAILABLE = 1,
+ /**
+ * the source / sink is not available
+ */
+ A_UNAVAILABLE = 2,
+ A_MAX
+ };
+
+ /**
+ * represents the connection state
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ enum am_ConnectionState_e
+ {
+ CS_UNKNOWN = 0,
+ /**
+ * This means the connection is just building up
+ */
+ CS_CONNECTING = 1,
+ /**
+ * the connection is ready to be used
+ */
+ CS_CONNECTED = 2,
+ /**
+ * the connection is in the course to be knocked down
+ */
+ CS_DISCONNECTING = 3,
+ /**
+ * only relevant for connectionStatechanged. Is send after the connection was removed
+ */
+ CS_DISCONNECTED = 4,
+ /**
+ * this means the connection is still build up but unused at the moment
+ */
+ CS_SUSPENDED = 5,
+ CS_MAX
+ };
+
+ /**
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ enum am_DomainState_e
+ {
+ /**
+ * default
+ */
+ DS_UNKNOWN = 0,
+ /**
+ * the domain is controlled by the daemon
+ */
+ DS_CONTROLLED = 1,
+ /**
+ * the domain is independent starting up
+ */
+ DS_INDEPENDENT_STARTUP = 1,
+ /**
+ * the domain is independent running down
+ */
+ DS_INDEPENDENT_RUNDOWN = 2,
+ DS_MAX
+ };
+
+ /**
+ * This enum characterizes the data of the EarlyData_t
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ enum am_EarlyDataType_e
+ {
+ /**
+ * default
+ */
+ ES_UNKNOWN = 0,
+ /**
+ * the source volume
+ */
+ ED_SOURCE_VOLUME = 1,
+ /**
+ * the sink volume
+ */
+ ED_SINK_VOLUME = 2,
+ /**
+ * a source property
+ */
+ ED_SOURCE_PROPERTY = 3,
+ /**
+ * a sink property
+ */
+ ED_SINK_PROPERTY = 4,
+ ED_MAX
+ };
+
+ /**
+ * the errors of the audiomanager. All possible errors are in here. This enum is used widely as return parameter.
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ enum am_Error_e
+ {
+ /**
+ * default
+ */
+ E_UNKNOWN = 0,
+ /**
+ * no error - positive reply
+ */
+ E_OK = 1,
+ /**
+ * value out of range
+ */
+ E_OUT_OF_RANGE = 2,
+ /**
+ * not used
+ */
+ E_NOT_USED = 3,
+ /**
+ * a database error occurred
+ */
+ E_DATABASE_ERROR = 4,
+ /**
+ * the desired object already exists
+ */
+ E_ALREADY_EXISTS = 5,
+ /**
+ * there is no change
+ */
+ E_NO_CHANGE = 6,
+ /**
+ * the desired action is not possible
+ */
+ E_NOT_POSSIBLE = 7,
+ /**
+ * the desired object is non existent
+ */
+ E_NON_EXISTENT = 8,
+ /**
+ * the asynchronous action was aborted
+ */
+ E_ABORTED = 9,
+ /**
+ * This error is returned in case a connect is issued with a connectionFormat that cannot be selected for the connection. This could be either due to the capabilities of a source or a sink or gateway compatibilities for example
+ */
+ E_WRONG_FORMAT = 10,
+ E_MAX
+ };
+
+ /**
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ enum am_MuteState_e
+ {
+ /**
+ * default
+ */
+ MS_UNKNOWN = 0,
+ /**
+ * the source / sink is muted
+ */
+ MS_MUTED = 1,
+ /**
+ * the source / sink is unmuted
+ */
+ MS_UNMUTED = 2,
+ MS_MAX
+ };
+
+ /**
+ * The source state reflects the state of the source
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ enum am_SourceState_e
+ {
+ SS_UNKNNOWN = 0,
+ /**
+ * The source can be activly heared
+ */
+ SS_ON = 1,
+ /**
+ * The source cannot be heared
+ */
+ SS_OFF = 2,
+ /**
+ * The source is paused. Meaning it cannot be heared but should be prepared to play again soon.
+ */
+ SS_PAUSED = 3,
+ SS_MAX
+ };
+
+ /**
+ * This enumeration is used to define the type of the action that is correlated to a handle.
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ enum am_Handle_e
+ {
+ H_UNKNOWN = 0,
+ H_CONNECT = 1,
+ H_DISCONNECT = 2,
+ H_SETSOURCESTATE = 3,
+ H_SETSINKVOLUME = 4,
+ H_SETSOURCEVOLUME = 5,
+ H_SETSINKSOUNDPROPERTY = 6,
+ H_SETSOURCESOUNDPROPERTY = 7,
+ H_SETSINKSOUNDPROPERTIES = 8,
+ H_SETSOURCESOUNDPROPERTIES = 9,
+ H_CROSSFADE = 10,
+ H_MAX
+ };
+
+ /**
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ enum am_InterruptState_e
+ {
+ /**
+ * default
+ */
+ IS_UNKNOWN = 0,
+ /**
+ * the interrupt state is off - no interrupt
+ */
+ IS_OFF = 1,
+ /**
+ * the interrupt state is interrupted - the interrupt is active
+ */
+ IS_INTERRUPTED = 2,
+ IS_MAX
+ };
+
+ /**
+ * describes the active sink of a crossfader.
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:36 PM
+ */
+ enum am_HotSink_e
+ {
+ /**
+ * default
+ */
+ HS_UNKNOWN = 0,
+ /**
+ * sinkA is active
+ */
+ HS_SINKA = 1,
+ /**
+ * sinkB is active
+ */
+ HS_SINKB = 2,
+ /**
+ * the crossfader is in the transition state
+ */
+ HS_INTERMEDIATE = 3,
+ HS_MAX
+ };
+
+ /**
+ * this describes the availability of a sink or a source together with the latest change
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:37 PM
+ */
+ struct am_Availability_s
+ {
+
+ public:
+ /**
+ * the current availability state
+ */
+ am_Availablility_e availability;
+ /**
+ * the reason for the last change. This can be used to trigger events that deal with state changes.
+ */
+ am_AvailabilityReason_e availabilityReason;
+
+ };
+
+ /**
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:37 PM
+ */
+ struct am_ClassProperty_s
+ {
+
+ public:
+ am_ClassProperty_e classProperty;
+ int16_t value;
+
+ };
+
+ /**
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:37 PM
+ */
+ struct am_Crossfader_s
+ {
+
+ public:
+ am_crossfaderID_t crossfaderID;
+ std::string name;
+ am_sinkID_t sinkID_A;
+ am_sinkID_t sinkID_B;
+ am_sourceID_t sourceID;
+ am_HotSink_e hotSink;
+
+ };
+
+ /**
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:37 PM
+ */
+ struct am_Gateway_s
+ {
+
+ public:
+ am_gatewayID_t gatewayID;
+ std::string name;
+ am_sinkID_t sinkID;
+ am_sourceID_t sourceID;
+ am_domainID_t domainSinkID;
+ am_domainID_t domainSourceID;
+ am_domainID_t controlDomainID;
+ std::vector<am_ConnectionFormat_e> listSourceFormats;
+ std::vector<am_ConnectionFormat_e> listSinkFormats;
+ /**
+ * This is matrix holding information about the conversion capability of the gateway, it's length is defined by the length(listSinkFormats) x length(listSourceFormats).
+ * If a SinkFormat can be converted into a SourceFormat, the vector will hold a 1, if no conversion is possible, a 0.
+ * The data is stored row orientated, where the rows are related to the sinksFormats and the columns to the sourceFormats. The first value will hold the conversion information from the first sourceFormat to the first sinkFormat for example and the seventh value the information about the 3rd sinkFormat to the 1st sourceFormat in case we would have 3 sourceFormats.
+ *
+ * This matrix
+ * 110 011 000 111 001
+ *
+ * reads as this:
+ * Source
+ * ** 1 2 3
+ * *********************
+ * S 1* 1 1 0
+ * i 2* 0 1 1
+ * n 3* 0 0 0
+ * k 4* 1 1 1
+ * 5* 0 0 1
+ */
+ std::vector<bool> convertionMatrix;
+
+ };
+
+ /**
+ * This represents one "hopp" in a route
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:37 PM
+ */
+ struct am_RoutingElement_s
+ {
+
+ public:
+ am_sourceID_t sourceID;
+ am_sinkID_t sinkID;
+ am_domainID_t domainID;
+ am_ConnectionFormat_e connectionFormat;
+
+ };
+
+ /**
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:37 PM
+ */
+ struct am_Route_s
+ {
+
+ public:
+ am_sourceID_t sourceID;
+ am_sinkID_t sinkID;
+ std::vector<am_RoutingElement_s> route;
+
+ };
+
+ /**
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:37 PM
+ */
+ struct am_SoundProperty_s
+ {
+
+ public:
+ am_SoundPropertyType_e type;
+ int16_t value;
+
+ };
+
+ /**
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:37 PM
+ */
+ struct am_SystemProperty_s
+ {
+
+ public:
+ /**
+ * the type that is set
+ */
+ am_SystemPropertyType_e type;
+ /**
+ * the value
+ */
+ int16_t value;
+
+ };
+
+ /**
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:38 PM
+ */
+ struct am_SinkClass_s
+ {
+
+ public:
+ am_sinkClass_t sinkClassID;
+ std::string name;
+ std::vector<am_ClassProperty_s> listClassProperties;
+
+ };
+
+ /**
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:38 PM
+ */
+ struct am_SourceClass_s
+ {
+
+ public:
+ /**
+ * the source ID
+ */
+ am_sourceClass_t sourceClassID;
+ std::string name;
+ std::vector<am_ClassProperty_s> listClassProperties;
+
+ };
+
+ /**
+ * this type holds all information of sources relevant to the HMI
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:38 PM
+ */
+ struct am_SourceType_s
+ {
+
+ public:
+ am_sourceID_t sourceID;
+ std::string name;
+ am_Availability_s availability;
+ am_sourceClass_t sourceClassID;
+
+ };
+
+ /**
+ * this type holds all information of sinks relevant to the HMI
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:38 PM
+ */
+ struct am_SinkType_s
+ {
+
+ public:
+ am_sinkID_t sinkID;
+ std::string name;
+ am_Availability_s availability;
+ am_mainVolume_t volume;
+ am_MuteState_e muteState;
+ am_sinkClass_t sinkClassID;
+
+ };
+
+ /**
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:38 PM
+ */
+ struct am_Handle_s
+ {
+
+ public:
+ am_Handle_e handleType:4;
+ uint16_t handle:12;
+
+ };
+
+ /**
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:38 PM
+ */
+ struct am_MainSoundProperty_s
+ {
+
+ public:
+ am_MainSoundPropertyType_e type;
+ int16_t value;
+
+ };
+
+ /**
+ * this type holds all information of connections relevant to the HMI
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:38 PM
+ */
+ struct am_MainConnectionType_s
+ {
+
+ public:
+ am_mainConnectionID_t mainConnectionID;
+ am_sourceID_t sourceID;
+ am_sinkID_t sinkID;
+ am_timeSync_t delay;
+ am_ConnectionState_e connectionState;
+
+ };
+
+ /**
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:39 PM
+ */
+ struct am_MainConnection_s
+ {
+
+ public:
+ am_mainConnectionID_t mainConnectionID;
+ am_ConnectionState_e connectionState;
+ /**
+ * the sinkID
+ */
+ am_sinkID_t sinkID;
+ /**
+ * the sourceID
+ */
+ am_sourceID_t sourceID;
+ am_timeSync_t delay;
+ std::vector<am_connectionID_t> listConnectionID;
+
+ };
+
+ /**
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:39 PM
+ */
+ struct am_Sink_s
+ {
+
+ public:
+ am_sinkID_t sinkID;
+ std::string name;
+ am_domainID_t domainID;
+ am_sinkClass_t sinkClassID;
+ am_volume_t volume;
+ bool visible;
+ am_Availability_s available;
+ am_MuteState_e muteState;
+ am_mainVolume_t mainVolume;
+ std::vector<am_SoundProperty_s> listSoundProperties;
+ std::vector<am_ConnectionFormat_e> listConnectionFormats;
+ std::vector<am_MainSoundProperty_s> listMainSoundProperties;
+
+ };
+
+ /**
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:39 PM
+ */
+ struct am_Source_s
+ {
+
+ public:
+ am_sourceID_t sourceID;
+ am_domainID_t domainID;
+ std::string name;
+ am_sourceClass_t sourceClassID;
+ am_SourceState_e sourceState;
+ am_volume_t volume;
+ bool visible;
+ am_Availability_s available;
+ am_InterruptState_e interruptState;
+ /**
+ * This list holds all soundProperties of the source
+ */
+ std::vector<am_SoundProperty_s> listSoundProperties;
+ /**
+ * list of the supported ConnectionFormats
+ */
+ std::vector<am_ConnectionFormat_e> listConnectionFormats;
+ /**
+ * This list holds all MainSoundProperties of the source (all the ones that can be set via the HMI)
+ */
+ std::vector<am_MainSoundProperty_s> listMainSoundProperties;
+
+ };
+
+ /**
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:39 PM
+ */
+ struct am_Domain_s
+ {
+
+ public:
+ am_domainID_t domainID;
+ std::string name;
+ std::string busname;
+ std::string nodename;
+ bool early;
+ bool complete;
+ am_DomainState_e state;
+
+ };
+
+ /**
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:39 PM
+ */
+ struct am_Connection_s
+ {
+
+ public:
+ am_connectionID_t connectionID;
+ am_sourceID_t sourceID;
+ am_sinkID_t sinkID;
+ am_timeSync_t delay;
+ am_ConnectionFormat_e connectionFormat;
+
+ };
+
+ /**
+ * data type depends of am_EarlyDataType_e:
+ * volume_t in case of ED_SOURCE_VOLUME, ED_SINK_VOLUME
+ * soundProperty_t in case of ED_SOURCE_PROPERTY, ED_SINK_PROPERTY
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:39 PM
+ */
+ union am_EarlyData_u
+ {
+
+ public:
+ am_volume_t volume;
+ am_SoundProperty_s soundProperty;
+
+ };
+
+ /**
+ * data type depends of am_EarlyDataType_e:
+ * sourceID in case of ED_SOURCE_VOLUME, ED_SOURCE_PROPERTY
+ * sinkID in case of ED_SINK_VOLUME, ED_SINK_PROPERTY
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:39 PM
+ */
+ union am_DataType_u
+ {
+
+ public:
+ am_sinkID_t sink;
+ am_sourceID_t source;
+
+ };
+
+ /**
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:40 PM
+ */
+ struct am_EarlyData_s
+ {
+
+ public:
+ am_EarlyDataType_e type;
+ am_DataType_u sinksource;
+ am_EarlyData_u data;
+
+ };
+}
+#endif // !defined(EA_1F9A0AD1_FF28_4de6_A5C7_2F570F618734__INCLUDED_)
diff --git a/include/command/IAmCommandReceive.h b/include/command/IAmCommandReceive.h
new file mode 100644
index 0000000..f56c838
--- /dev/null
+++ b/include/command/IAmCommandReceive.h
@@ -0,0 +1,220 @@
+/** Copyright (c) 2012 GENIVI Alliance
+ * Copyright (c) 2012 BMW
+ *
+ * @author Christian Mueller, BMW
+ *
+ * @copyright
+ * {
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * }
+ *
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
+#if !defined(EA_33827DF9_2BDB_4811_85B2_0EA4CD5519E4__INCLUDED_)
+#define EA_33827DF9_2BDB_4811_85B2_0EA4CD5519E4__INCLUDED_
+
+#include <vector>
+#include <string>
+#include "audiomanagertypes.h"
+namespace am {
+class CAmDbusWrapper;
+class CAmSocketHandler;
+}
+
+
+#define CommandReceiveVersion "1.0"
+namespace am {
+ /**
+ * 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.
+ * There are two rules that have to be kept in mind when implementing against this interface:\n<b>
+ * 1. CALLS TO THIS INTERFACE ARE NOT THREAD SAFE !!!! \n
+ * 2. YOU MAY NOT THE CALLING INTERFACE DURING AN SYNCHRONOUS OR ASYNCHRONOUS CALL THAT EXPECTS A RETURN VALUE.</b>\n
+ * 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
+ * For more information, please check CAmSerializer
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:42 PM
+ */
+ class IAmCommandReceive
+ {
+
+ public:
+ IAmCommandReceive() {
+
+ }
+
+ virtual ~IAmCommandReceive() {
+
+ }
+
+ /**
+ * connects a source to sink
+ * @return E_OK on success, E_NOT_POSSIBLE on failure, E_ALREADY_EXISTS if the connection does already exists
+ *
+ * @param sourceID
+ * @param sinkID
+ * @param mainConnectionID
+ */
+ virtual am_Error_e connect(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID) =0;
+ /**
+ * disconnects a mainConnection
+ * @return E_OK on successes, E_NON_EXISTENT if the connection does not exist, E_NOT_POSSIBLE on error.
+ *
+ * @param mainConnectionID
+ */
+ virtual am_Error_e disconnect(const am_mainConnectionID_t mainConnectionID) =0;
+ /**
+ * sets the volume for a sink
+ * @return E_OK on success, E_UNKOWN on error, E_OUT_OF_RANGE in case the value is out of range
+ *
+ * @param sinkID the sink
+ * @param volume the volume
+ */
+ virtual am_Error_e setVolume(const am_sinkID_t sinkID, const am_mainVolume_t volume) =0;
+ /**
+ * This function is used to increment or decrement the current volume for a sink.
+ * @return E_OK on success, E_UNKNOWN on error and E_OUT_OF_RANGE if the value is not in the given volume range.
+ *
+ * @param sinkID
+ * @param volumeStep indicated the number of steps that should be incremented or decremented. Positive values here inkrement, negative values decrement
+ */
+ virtual am_Error_e volumeStep(const am_sinkID_t sinkID, const int16_t volumeStep) =0;
+ /**
+ * sets the mute state of a sink
+ * @return E_OK on success, E_UNKNOWN on error. If the mute state is already the desired one, the Daemon will return E_OK.
+ *
+ * @param sinkID
+ * @param muteState
+ */
+ virtual am_Error_e setSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState) =0;
+ /**
+ * 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
+ * @return E_OK on success, E_OUT_OF_RANGE if value exceeds range, E_UNKNOWN in case of an error
+ *
+ * @param soundProperty
+ * @param sinkID
+ */
+ virtual am_Error_e setMainSinkSoundProperty(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID) =0;
+ /**
+ * 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
+ * @return E_OK on success, E_OUT_OF_RANGE if value exceeds range, E_UNKNOWN in case of an error
+ *
+ * @param soundProperty
+ * @param sourceID
+ */
+ virtual am_Error_e setMainSourceSoundProperty(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID) =0;
+ /**
+ * is used to set a specific system property.
+ * @return E_OK on success, E_OUT_OF_RANGE if value exceeds range, E_UNKNOWN in case of an error
+ *
+ * @param property the property that shall be set
+ */
+ virtual am_Error_e setSystemProperty(const am_SystemProperty_s& property) =0;
+ /**
+ * returns the actual list of MainConnections
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ *
+ * @param listConnections returns a list of all connections
+ */
+ virtual am_Error_e getListMainConnections(std::vector<am_MainConnectionType_s>& listConnections) const =0;
+ /**
+ * returns the actual list of Sinks
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ *
+ * @param listMainSinks the list of the sinks
+ */
+ virtual am_Error_e getListMainSinks(std::vector<am_SinkType_s>& listMainSinks) const =0;
+ /**
+ * returns the actual list of Sources
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ *
+ * @param listMainSources the list of sources
+ */
+ virtual am_Error_e getListMainSources(std::vector<am_SourceType_s>& listMainSources) const =0;
+ /**
+ * This is used to retrieve all source sound properties related to a source. Returns a vector of the sound properties and values as pair
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ *
+ * @param sinkID
+ * @param listSoundProperties
+ */
+ virtual am_Error_e getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s>& listSoundProperties) const =0;
+ /**
+ * This is used to retrieve all source sound properties related to a source.
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ *
+ * @param sourceID
+ * @param listSourceProperties
+ */
+ virtual am_Error_e getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s>& listSourceProperties) const =0;
+ /**
+ * This is used to retrieve SourceClass Information of all source classes
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ *
+ * @param listSourceClasses
+ */
+ virtual am_Error_e getListSourceClasses(std::vector<am_SourceClass_s>& listSourceClasses) const =0;
+ /**
+ * This is used to retrieve SinkClass Information of all sink classes
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ *
+ * @param listSinkClasses
+ */
+ virtual am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const =0;
+ /**
+ * Retrieves a complete list of all systemProperties.
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ *
+ * @param listSystemProperties
+ */
+ virtual am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const =0;
+ /**
+ * returns the delay in ms that the audiopath for the given mainConnection has
+ * @return E_OK on success, E_NOT_POSSIBLE if timing information is not yet retrieved, E_DATABASE_ERROR on read error on the database
+ *
+ * @param mainConnectionID
+ * @param delay
+ */
+ virtual am_Error_e getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t& delay) const =0;
+ /**
+ * this function is used to retrieve a pointer to the dBusConnectionWrapper
+ * @return E_OK if pointer is valid, E_UKNOWN if AudioManager was compiled without DBus Support
+ *
+ * @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)
+ */
+ virtual am_Error_e getDBusConnectionWrapper(CAmDbusWrapper*& dbusConnectionWrapper) const =0;
+ /**
+ * 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.
+ * returns E_OK if pointer is valid, E_UNKNOWN in case AudioManager was compiled without socketHandler support,
+ *
+ * @param socketHandler
+ */
+ virtual am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler) const =0;
+ /**
+ * This function returns the version of the interface.
+ *
+ * @param version
+ */
+ virtual void getInterfaceVersion(std::string& version) const =0;
+ /**
+ * asynchronous confirmation of setCommandReady.
+ *
+ * @param handle the handle that was handed over by setCommandReady
+ */
+ virtual void confirmCommandReady(const uint16_t handle) =0;
+ /**
+ * asynchronous confirmation of setCommandRundown
+ *
+ * @param handle the handle that was given via setCommandRundown
+ */
+ virtual void confirmCommandRundown(const uint16_t handle) =0;
+
+ };
+}
+#endif // !defined(EA_33827DF9_2BDB_4811_85B2_0EA4CD5519E4__INCLUDED_)
diff --git a/include/command/IAmCommandSend.h b/include/command/IAmCommandSend.h
new file mode 100644
index 0000000..0a447f9
--- /dev/null
+++ b/include/command/IAmCommandSend.h
@@ -0,0 +1,194 @@
+/** Copyright (c) 2012 GENIVI Alliance
+ * Copyright (c) 2012 BMW
+ *
+ * @author Christian Mueller, BMW
+ *
+ * @copyright
+ * {
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * }
+ *
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
+#if !defined(EA_E4CFF16E_3331_4608_971A_20131753B26D__INCLUDED_)
+#define EA_E4CFF16E_3331_4608_971A_20131753B26D__INCLUDED_
+
+#include <vector>
+#include <string>
+#include "audiomanagertypes.h"
+
+namespace am {
+class IAmCommandReceive;
+}
+
+#include "IAmCommandReceive.h"
+
+#define CommandSendVersion "1.0"
+namespace am {
+ /**
+ * This interface handles all communication from the AudioManagerDaemon towards the system. It is designed in such a way that only callbacks with no return types are implemented. So when the CommandInterfacePlugins are designed in such a way that they broadcast signals to any node who is interested in the particular information (like signals on Dbus for example), more information can be retrieved via the CommandReceiveInterface.
+ * There are two rules that have to be kept in mind when implementing against this interface:\n<b>
+ * 1. CALLS TO THIS INTERFACE ARE NOT THREAD SAFE !!!! \n
+ * 2. YOU MAY NOT THE CALLING INTERFACE DURING AN SYNCHRONOUS OR ASYNCHRONOUS CALL THAT EXPECTS A RETURN VALUE.</b>\n
+ * 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
+ * For more information, please check CAmSerializer
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:43 PM
+ */
+ class IAmCommandSend
+ {
+
+ public:
+ IAmCommandSend() {
+
+ }
+
+ virtual ~IAmCommandSend() {
+
+ }
+
+ /**
+ * This command starts the interface, the plugin itself. This is not meant to start communication with the HMI itself. It is a good idea to implement here everything that sets up the basic communication like DbusCommunication etc...
+ * Be aware of side effects with systemd and socketbased communication!
+ * @return E_OK on success, E_UNKNOWN on error
+ *
+ * @param commandreceiveinterface pointer to the receive interface. Is used to call the audiomanagerdaemon
+ */
+ virtual am_Error_e startupInterface(IAmCommandReceive* commandreceiveinterface) =0;
+ /**
+ * This function will indirectly be called by the Controller and is used to start the Communication. Before this command, all communication will be ignored by the AudioManager.
+ * After the Plugin is ready, it will asynchronously answer with condfirmCommandReady, the handle that is handed over must be returned.
+ *
+ * @param handle the handle uniquely idenfies the request
+ */
+ virtual void setCommandReady(const uint16_t handle) =0;
+ /**
+ * This function will indirectly be called by the Controller and is used to stop the Communication. After this command, all communication will be ignored by the AudioManager. The plugin has to be prepared that either the power will be switched off or the Interface is started again with setCommandReady
+ * After the Plugin is ready to rundown, it will asynchronously answer with condfirmCommandRundown, the handle that is handed over must be returned.
+ *
+ * @param handle This handle uniquly idenfies the request
+ */
+ virtual void setCommandRundown(const uint16_t handle) =0;
+ /**
+ * Callback that is called when the number of connections change
+ *
+ * @param mainConnection
+ */
+ virtual void cbNewMainConnection(const am_MainConnectionType_s mainConnection) =0;
+ /**
+ * Callback that is called when the number of connections change
+ *
+ * @param mainConnection
+ */
+ virtual void cbRemovedMainConnection(const am_mainConnectionID_t mainConnection) =0;
+ /**
+ * Callback that is called when the number of sinks change
+ *
+ * @param sink
+ */
+ virtual void cbNewSink(const am_SinkType_s& sink) =0;
+ /**
+ * Callback that is called when the number of sinks change
+ *
+ * @param sinkID
+ */
+ virtual void cbRemovedSink(const am_sinkID_t sinkID) =0;
+ /**
+ * Callback that is called when the number of sources change
+ *
+ * @param source
+ */
+ virtual void cbNewSource(const am_SourceType_s& source) =0;
+ /**
+ * Callback that is called when the number of sources change
+ *
+ * @param source
+ */
+ virtual void cbRemovedSource(const am_sourceID_t source) =0;
+ /**
+ * this callback is fired if the number of sink classes changed
+ */
+ virtual void cbNumberOfSinkClassesChanged() =0;
+ /**
+ * this callback is fired if the number of source classes changed
+ */
+ virtual void cbNumberOfSourceClassesChanged() =0;
+ /**
+ * This callback is called when the ConnectionState of a connection changed.
+ *
+ * @param connectionID
+ * @param connectionState
+ */
+ virtual void cbMainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState) =0;
+ /**
+ * this callback indicates that a sinkSoundProperty has changed.
+ *
+ * @param sinkID
+ * @param soundProperty
+ */
+ virtual void cbMainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty) =0;
+ /**
+ * this callback indicates that a sourceSoundProperty has changed.
+ *
+ * @param sourceID
+ * @param soundProperty
+ */
+ virtual void cbMainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty) =0;
+ /**
+ * this callback is called when the availability of a sink has changed
+ *
+ * @param sinkID
+ * @param availability
+ */
+ virtual void cbSinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s& availability) =0;
+ /**
+ * this callback is called when the availability of source has changed.
+ *
+ * @param sourceID
+ * @param availability
+ */
+ virtual void cbSourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s& availability) =0;
+ /**
+ * this callback indicates a volume change on the indicated sink
+ *
+ * @param sinkID
+ * @param volume
+ */
+ virtual void cbVolumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume) =0;
+ /**
+ * this callback indicates a mute state change on a sink.
+ *
+ * @param sinkID
+ * @param muteState
+ */
+ virtual void cbSinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState) =0;
+ /**
+ * is fired if a systemProperty changed
+ *
+ * @param systemProperty
+ */
+ virtual void cbSystemPropertyChanged(const am_SystemProperty_s& systemProperty) =0;
+ /**
+ * This callback is fired if the timinginformation for a mainConnectionID changed
+ *
+ * @param mainConnectionID
+ * @param time
+ */
+ virtual void cbTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time) =0;
+ /**
+ * returns the interface version as string.
+ *
+ * @param version
+ */
+ virtual void getInterfaceVersion(std::string& version) const =0;
+
+ };
+}
+#endif // !defined(EA_E4CFF16E_3331_4608_971A_20131753B26D__INCLUDED_)
diff --git a/include/control/IAmControlReceive.h b/include/control/IAmControlReceive.h
new file mode 100644
index 0000000..bc160aa
--- /dev/null
+++ b/include/control/IAmControlReceive.h
@@ -0,0 +1,614 @@
+/** Copyright (c) 2012 GENIVI Alliance
+ * Copyright (c) 2012 BMW
+ *
+ * @author Christian Mueller, BMW
+ *
+ * @copyright
+ * {
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * }
+ *
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
+#if !defined(EA_857044C8_1BA8_4972_9083_E7BDD50F6922__INCLUDED_)
+#define EA_857044C8_1BA8_4972_9083_E7BDD50F6922__INCLUDED_
+
+#include <vector>
+#include <string>
+#include "audiomanagertypes.h"
+namespace am {
+class CAmSocketHandler;
+}
+
+
+#define ControlReceiveVersion "1.0"
+namespace am {
+ /**
+ * This interface gives access to all important functions of the audiomanager that are used by the AudioManagerController to control the system.
+ * There are two rules that have to be kept in mind when implementing against this interface:\n<b>
+ * 1. CALLS TO THIS INTERFACE ARE NOT THREAD SAFE !!!! \n
+ * 2. YOU MAY NOT THE CALLING INTERFACE DURING AN SYNCHRONOUS OR ASYNCHRONOUS CALL THAT EXPECTS A RETURN VALUE.</b>\n
+ * 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
+ * For more information, please check CAmSerializer
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:43 PM
+ */
+ class IAmControlReceive
+ {
+
+ public:
+ IAmControlReceive() {
+
+ }
+
+ virtual ~IAmControlReceive() {
+
+ }
+
+ /**
+ * calculates a route from source to sink.
+ * @return E_OK on success, E_UNKNOWN on error
+ *
+ * @param onlyfree if true return only routes which use gateways that are not in use at the moment
+ * @param sourceID
+ * @param sinkID
+ * @param returnList this is a list of routes that are possible to take. unsorted! The longest could be first.
+ * In case not route can be found, the list will return empty.
+ */
+ virtual am_Error_e getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s>& returnList) =0;
+ /**
+ * With this function, elementary connects can be triggered by the controller.
+ * @return E_OK on success, E_UNKNOWN on error, E_WRONG_FORMAT of connectionFormats do not match, E_NO_CHANGE if the desired connection is already build up
+ *
+ * @param handle
+ * @param connectionID
+ * @param format
+ * @param sourceID
+ * @param sinkID
+ */
+ virtual 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) =0;
+ /**
+ * is used to disconnect a connection
+ * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if connection was not found, E_NO_CHANGE if no change is neccessary
+ *
+ * @param handle
+ * @param connectionID
+ */
+ virtual am_Error_e disconnect(am_Handle_s& handle, const am_connectionID_t connectionID) =0;
+ /**
+ * triggers a cross fade.
+ * @return E_OK on success, E_UNKNOWN on error E_NO_CHANGE if no change is neccessary
+ *
+ * @param handle
+ * @param hotSource this is the source that is going to be the active one after the fading
+ * @param crossfaderID
+ * @param rampType
+ * @param rampTime rampTime 0 means default value
+ */
+ virtual 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) =0;
+ /**
+ * with this method, all actions that have a handle assigned can be stopped.
+ * @return E_OK on success, E_UNKNOWN on error
+ *
+ * @param handle the handle of the action to be stopped
+ */
+ virtual am_Error_e abortAction(const am_Handle_s handle) =0;
+ /**
+ * this method sets a source state for a source. This function will trigger the callback cbAckSetSourceState
+ * @return E_OK on success, E_NO_CHANGE if the desired value is already correct, E_UNKNOWN on error, E_NO_CHANGE if no change is neccessary
+ *
+ * @param handle
+ * @param sourceID
+ * @param state
+ */
+ virtual am_Error_e setSourceState(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SourceState_e state) =0;
+ /**
+ * with this function, setting of sinks volumes is done. The behavior of the volume set is depended on the given ramp and time information.
+ * This function is not only used to ramp volume, but also to mute and direct set the level. Exact behavior is depended on the selected mute ramps.
+ * @return E_OK on success, E_NO_CHANGE if the volume is already on the desired value, E_OUT_OF_RANGE is the volume is out of range, E_UNKNOWN on every other error.
+ *
+ * @param handle
+ * @param sinkID
+ * @param volume
+ * @param ramp
+ * @param time
+ */
+ virtual 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) =0;
+ /**
+ * with this function, setting of source volumes is done. The behavior of the volume set is depended on the given ramp and time information.
+ * This function is not only used to ramp volume, but also to mute and direct set the level. Exact behavior is depended on the selected mute ramps.
+ * @return E_OK on success, E_NO_CHANGE if the volume is already on the desired value, E_OUT_OF_RANGE is the volume is out of range, E_UNKNOWN on every other error.
+ *
+ * @param handle
+ * @param sourceID
+ * @param volume
+ * @param rampType
+ * @param time
+ */
+ virtual 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) =0;
+ /**
+ * is used to set several sinkSoundProperties at a time
+ * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE if property is out of range, E_NO_CHANGE if no change is neccessary
+ *
+ * @param handle
+ * @param sinkID
+ * @param soundProperty
+ */
+ virtual am_Error_e setSinkSoundProperties(am_Handle_s& handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s>& soundProperty) =0;
+ /**
+ * is used to set sinkSoundProperties
+ * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE if property is out of range, E_NO_CHANGE if no change is neccessary
+ *
+ * @param handle
+ * @param sinkID
+ * @param soundProperty
+ */
+ virtual am_Error_e setSinkSoundProperty(am_Handle_s& handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty) =0;
+ /**
+ * is used to set several SourceSoundProperties at a time
+ * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE if property is out of range. E_NO_CHANGE if no change is neccessary
+ *
+ * @param handle
+ * @param sourceID
+ * @param soundProperty
+ */
+ virtual am_Error_e setSourceSoundProperties(am_Handle_s& handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s>& soundProperty) =0;
+ /**
+ * is used to set sourceSoundProperties
+ * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE if property is out of range. E_NO_CHANGE if no change is neccessary
+ *
+ * @param handle
+ * @param sourceID
+ * @param soundProperty
+ */
+ virtual am_Error_e setSourceSoundProperty(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty) =0;
+ /**
+ * sets the domain state of a domain
+ * @return E_OK on success, E_UNKNOWN on error, E_NO_CHANGE if no change is neccessary
+ *
+ * @param domainID
+ * @param domainState
+ */
+ virtual am_Error_e setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState) =0;
+ /**
+ * enters a domain in the database, creates and ID
+ * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the database, E_DATABASE_ERROR if the database had an error
+ *
+ * @param domainData domainID in am_Domain_s must be 0 here
+ * @param domainID
+ */
+ virtual am_Error_e enterDomainDB(const am_Domain_s& domainData, am_domainID_t& domainID) =0;
+ /**
+ * enters a mainconnection in the database, creates and ID
+ * @return E_OK on success, E_DATABASE_ERROR if the database had an error
+ *
+ * @param mainConnectionData the MainConnectionID is omitted since it is created during the registration
+ * @param connectionID
+ */
+ virtual am_Error_e enterMainConnectionDB(const am_MainConnection_s& mainConnectionData, am_mainConnectionID_t& connectionID) =0;
+ /**
+ * enters a sink in the database.
+ * The sinkID in am_Sink_s shall be 0 in case of a dynamic added source A sinkID greater than 100 will be assigned. If a specific sinkID with a value <100 is given, the given value will be used. This is for a static setup where the ID's are predefined.
+ * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the database, E_DATABASE_ERROR if the database had an error
+ *
+ * @param sinkData the sinkID will be omitted since it is created during the registration
+ * @param sinkID
+ */
+ virtual am_Error_e enterSinkDB(const am_Sink_s& sinkData, am_sinkID_t& sinkID) =0;
+ /**
+ * enters a crossfader in the database.
+ * The crossfaderID in am_Crossfader_s shall be 0 in case of a dynamic added source A crossfaderID greater than 100 will be assigned. If a specific crossfaderID with a value <100 is given, the given value will be used. This is for a static setup where the ID's are predefined.
+ * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the database, E_DATABASE_ERROR if the database had an error
+ *
+ * @param crossfaderData the ID in the data will be ignored since it is created during the registration
+ * @param crossfaderID
+ */
+ virtual am_Error_e enterCrossfaderDB(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID) =0;
+ /**
+ * enters a gateway in the database.
+ * The gatewayID in am_Gateway_s shall be 0 in case of a dynamic added source A gatewayID greater than 100 will be assigned. If a specific gatewayID with a value <100 is given, the given value will be used. This is for a static setup where the ID's are predefined.
+ * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the database, E_DATABASE_ERROR if the database had an error
+ *
+ * @param gatewayData In a fixed setup, the gatewayID must be below 100. In a dynamic setup, the gatewayID shall be 0! listSourceFormats and listSinkFormats are empty at registration time. Values are taken over when sources and sinks are registered.
+ * @param gatewayID
+ */
+ virtual am_Error_e enterGatewayDB(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID) =0;
+ /**
+ * enters a source in the database.
+ * The sourceID in am_Source_s shall be 0 in case of a dynamic added source A sourceID greater than 100 will be assigned. If a specific sourceID with a value <100 is given, the given value will be used. This is for a static setup where the ID's are predefined.
+ * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the database, E_DATABASE_ERROR if the database had an error
+ *
+ * @param sourceData sourceID is omitted here since it is created during registration
+ * @param sourceID
+ */
+ virtual am_Error_e enterSourceDB(const am_Source_s& sourceData, am_sourceID_t& sourceID) =0;
+ /**
+ * Enters a sourceClass into the database.
+ * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the database, E_DATABASE_ERROR if the database had an error
+ *
+ * @param sinkClass IDs given with the SinkCLassID are valid below 100 (static). If given as 0, sinkClass will be enterd dynamic and ID above 100 will be created.
+ * @param sinkClassID
+ */
+ virtual am_Error_e enterSinkClassDB(const am_SinkClass_s& sinkClass, am_sinkClass_t& sinkClassID) =0;
+ /**
+ * Enters a sourceClass into the database.
+ * The sourceClassID in am_sourceClass_s shall be 0 in case of a dynamic added source A sourceClassID greater than 100 will be assigned. If a specific sourceClassID with a value <100 is given, the given value will be used. This is for a static setup where the ID's are predefined.
+ * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the database, E_DATABASE_ERROR if the database had an error
+ *
+ * @param sourceClassID
+ * @param sourceClass IDs given with the SourceCLassID are valid below 100 (static). If given as 0, sourceClass will be enterd dynamic and ID above 100 will be created.
+ */
+ virtual am_Error_e enterSourceClassDB(am_sourceClass_t& sourceClassID, const am_SourceClass_s& sourceClass) =0;
+ /**
+ * changes class information of a sinkclass.
+ * The properties will overwrite the values of the sinkClassID given in the sinkClass.
+ * It is the duty of the controller to check if the property is valid. If it does not exist, the daemon will not return an error.
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if sinkClassID was not found.
+ *
+ * @param sinkClass if a SourceClass ID other than 0 is given, the classInformation replaces the existing one. In case of ClassID 0, a new classID is created and returned
+ */
+ virtual am_Error_e changeSinkClassInfoDB(const am_SinkClass_s& sinkClass) =0;
+ /**
+ * changes class information of a sourceClass.
+ * The properties will overwrite the values of the sourceClassID given in the sourceClass.
+ * It is the duty of the controller to check if the property is valid. If it does not exist, the daemon will not return an error.
+ * @return E_OK on success, E_DATABASE_ERROR on error and E_NON_EXISTENT if the ClassID does not exist.
+ *
+ * @param sourceClass if a SourceClass ID other than 0 is given, the classInformation replaces the existing one. In case of ClassID 0, a new classID is created and returned
+ */
+ virtual am_Error_e changeSourceClassInfoDB(const am_SourceClass_s& sourceClass) =0;
+ /**
+ * This function is used to enter the system Properties into the database.
+ * All entries in the database will be erased before entering the new List. It should only be called once at system startup.
+ * @return E_OK on success, E_DATABASE_ERROR if the database had an error
+ *
+ * @param listSystemProperties
+ */
+ virtual am_Error_e enterSystemPropertiesListDB(const std::vector<am_SystemProperty_s>& listSystemProperties) =0;
+ /**
+ * changes the mainConnectionState of MainConnection
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if mainconnection
+ *
+ * @param mainconnectionID
+ * @param listConnectionID
+ */
+ virtual am_Error_e changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID) =0;
+ /**
+ * changes the mainConnectionState of MainConnection
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if mainconnection
+ *
+ * @param mainconnectionID
+ * @param connectionState
+ */
+ virtual am_Error_e changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState) =0;
+ /**
+ * changes the sink volume of a sink
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if sink was not found
+ *
+ * @param mainVolume
+ * @param sinkID
+ */
+ virtual am_Error_e changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID) =0;
+ /**
+ * changes the availablility of a sink
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if sink was not found
+ *
+ * @param availability
+ * @param sinkID
+ */
+ virtual am_Error_e changeSinkAvailabilityDB(const am_Availability_s& availability, const am_sinkID_t sinkID) =0;
+ /**
+ * changes the domainstate of a domain
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if domain was not found
+ *
+ * @param domainState
+ * @param domainID
+ */
+ virtual am_Error_e changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID) =0;
+ /**
+ * changes the mute state of a sink
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if sink was not found
+ *
+ * @param muteState
+ * @param sinkID
+ */
+ virtual am_Error_e changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID) =0;
+ /**
+ * changes the mainsinksoundproperty of a sink
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if sink was not found
+ *
+ * @param soundProperty
+ * @param sinkID
+ */
+ virtual am_Error_e changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID) =0;
+ /**
+ * changes the mainsourcesoundproperty of a sink
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if source was not found
+ *
+ * @param soundProperty
+ * @param sourceID
+ */
+ virtual am_Error_e changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID) =0;
+ /**
+ * changes the availablility of a source
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if source was not found
+ *
+ * @param availability
+ * @param sourceID
+ */
+ virtual am_Error_e changeSourceAvailabilityDB(const am_Availability_s& availability, const am_sourceID_t sourceID) =0;
+ /**
+ * changes a systemProperty
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if property was not found
+ *
+ * @param property
+ */
+ virtual am_Error_e changeSystemPropertyDB(const am_SystemProperty_s& property) =0;
+ /**
+ * removes a mainconnection from the DB
+ * @return E_OK on success, E_NON_EXISTENT if main connection was not found, E_DATABASE_ERROR if the database had an error
+ *
+ * @param mainConnectionID
+ */
+ virtual am_Error_e removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID) =0;
+ /**
+ * removes a sink from the DB
+ * @return E_OK on success, E_NON_EXISTENT if sink was not found, E_DATABASE_ERROR if the database had an error
+ *
+ * @param sinkID
+ */
+ virtual am_Error_e removeSinkDB(const am_sinkID_t sinkID) =0;
+ /**
+ * removes a source from the DB
+ * @return E_OK on success, E_NON_EXISTENT if source was not found, E_DATABASE_ERROR if the database had an error
+ *
+ * @param sourceID
+ */
+ virtual am_Error_e removeSourceDB(const am_sourceID_t sourceID) =0;
+ /**
+ * removes a gateway from the DB
+ * @return E_OK on success, E_NON_EXISTENT if gateway was not found, E_DATABASE_ERROR if the database had an error
+ *
+ * @param gatewayID
+ */
+ virtual am_Error_e removeGatewayDB(const am_gatewayID_t gatewayID) =0;
+ /**
+ * removes a crossfader from the DB
+ * @return E_OK on success, E_NON_EXISTENT if crossfader was not found, E_DATABASE_ERROR if the database had an error
+ *
+ * @param crossfaderID
+ */
+ virtual am_Error_e removeCrossfaderDB(const am_crossfaderID_t crossfaderID) =0;
+ /**
+ * removes a domain from the DB
+ * @return E_OK on success, E_NON_EXISTENT if domain was not found, E_DATABASE_ERROR if the database had an error
+ *
+ * @param domainID
+ */
+ virtual am_Error_e removeDomainDB(const am_domainID_t domainID) =0;
+ /**
+ * removes a domain from the DB
+ * @return E_OK on success, E_NON_EXISTENT if domain was not found, E_DATABASE_ERROR if the database had an error
+ *
+ * @param sinkClassID
+ */
+ virtual am_Error_e removeSinkClassDB(const am_sinkClass_t sinkClassID) =0;
+ /**
+ * removes a domain from the DB
+ * @return E_OK on success, E_NON_EXISTENT if domain was not found, E_DATABASE_ERROR if the database had an error
+ *
+ * @param sourceClassID
+ */
+ virtual am_Error_e removeSourceClassDB(const am_sourceClass_t sourceClassID) =0;
+ /**
+ * returns the ClassInformation of a source
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if source was not found
+ *
+ * @param sourceID
+ * @param classInfo
+ */
+ virtual am_Error_e getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s& classInfo) const =0;
+ /**
+ * returns the ClassInformation of a sink
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if sink was not found
+ *
+ * @param sinkID
+ * @param sinkClass
+ */
+ virtual am_Error_e getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s& sinkClass) const =0;
+ /**
+ * returns the sinkData of a sink
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if sink was not found
+ *
+ * @param sinkID
+ * @param sinkData
+ */
+ virtual am_Error_e getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s& sinkData) const =0;
+ /**
+ * returns the sourcekData of a source
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if sink was not found
+ *
+ * @param sourceID
+ * @param sourceData
+ */
+ virtual am_Error_e getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s& sourceData) const =0;
+ /**
+ * return source and sink of a gateway
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if gateway was not found
+ *
+ * @param gatewayID
+ * @param gatewayData
+ */
+ virtual am_Error_e getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s& gatewayData) const =0;
+ /**
+ * returns sources and the sink of a crossfader
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if crossfader was not found
+ *
+ * @param crossfaderID
+ * @param crossfaderData
+ */
+ virtual am_Error_e getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s& crossfaderData) const =0;
+ /**
+ * returns sources and the sink of a crossfader
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if crossfader was not found
+ *
+ * @param mainConnectionID
+ * @param mainConnectionData
+ */
+ virtual am_Error_e getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s& mainConnectionData) const =0;
+ /**
+ * returns all sinks of a domain
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if domain was not found
+ *
+ * @param domainID
+ * @param listSinkID
+ */
+ virtual am_Error_e getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t>& listSinkID) const =0;
+ /**
+ * returns all source of a domain
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if domain was not found
+ *
+ * @param domainID
+ * @param listSourceID
+ */
+ virtual am_Error_e getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t>& listSourceID) const =0;
+ /**
+ * returns all crossfaders of a domain
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if domain was not found
+ *
+ * @param domainID
+ * @param listCrossfadersID
+ */
+ virtual am_Error_e getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t>& listCrossfadersID) const =0;
+ /**
+ * returns all gateways of a domain
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if domain was not found
+ *
+ * @param domainID
+ * @param listGatewaysID
+ */
+ virtual am_Error_e getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t>& listGatewaysID) const =0;
+ /**
+ * returns a complete list of all MainConnections
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ *
+ * @param listMainConnections
+ */
+ virtual am_Error_e getListMainConnections(std::vector<am_MainConnection_s>& listMainConnections) const =0;
+ /**
+ * returns a complete list of all domains
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ *
+ * @param listDomains
+ */
+ virtual am_Error_e getListDomains(std::vector<am_Domain_s>& listDomains) const =0;
+ /**
+ * returns a complete list of all Connections
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ *
+ * @param listConnections
+ */
+ virtual am_Error_e getListConnections(std::vector<am_Connection_s>& listConnections) const =0;
+ /**
+ * returns a list of all sinks
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ *
+ * @param listSinks
+ */
+ virtual am_Error_e getListSinks(std::vector<am_Sink_s>& listSinks) const =0;
+ /**
+ * returns a list of all sources
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ *
+ * @param listSources
+ */
+ virtual am_Error_e getListSources(std::vector<am_Source_s>& listSources) const =0;
+ /**
+ * returns a list of all source classes
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ *
+ * @param listSourceClasses
+ */
+ virtual am_Error_e getListSourceClasses(std::vector<am_SourceClass_s>& listSourceClasses) const =0;
+ /**
+ * returns a list of all handles
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ *
+ * @param listHandles
+ */
+ virtual am_Error_e getListHandles(std::vector<am_Handle_s>& listHandles) const =0;
+ /**
+ * returns a list of all crossfaders
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ *
+ * @param listCrossfaders
+ */
+ virtual am_Error_e getListCrossfaders(std::vector<am_Crossfader_s>& listCrossfaders) const =0;
+ /**
+ * returns a list of gateways
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ *
+ * @param listGateways
+ */
+ virtual am_Error_e getListGateways(std::vector<am_Gateway_s>& listGateways) const =0;
+ /**
+ * returns a list of all sink classes
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ *
+ * @param listSinkClasses
+ */
+ virtual am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const =0;
+ /**
+ * returns the list of SystemProperties
+ *
+ * @param listSystemProperties
+ */
+ virtual am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const =0;
+ /**
+ * sets the command interface to ready. Will send setCommandReady to each of the plugins. The corresponding answer is confirmCommandReady.
+ */
+ virtual void setCommandReady() =0;
+ /**
+ * sets the command interface into the rundown state. Will send setCommandRundown to each of the plugins. The corresponding answer is confirmCommandRundown.
+ */
+ virtual void setCommandRundown() =0;
+ /**
+ * sets the routinginterface to ready. Will send the command setRoutingReady to each of the plugins. The related answer is confirmRoutingReady.
+ */
+ virtual void setRoutingReady() =0;
+ /**
+ * sets the routinginterface to the rundown state. Will send the command setRoutingRundown to each of the plugins. The related answer is confirmRoutingRundown.
+ */
+ virtual void setRoutingRundown() =0;
+ /**
+ * acknowledges the setControllerReady call.
+ */
+ virtual void confirmControllerReady() =0;
+ /**
+ * acknowledges the setControllerRundown call.
+ */
+ virtual void confirmControllerRundown() =0;
+ /**
+ * 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.
+ * returns E_OK if pointer is valid, E_UNKNOWN in case AudioManager was compiled without socketHandler support,
+ *
+ * @param socketHandler
+ */
+ virtual am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler) =0;
+ /**
+ * This function returns the version of the interface
+ *
+ * @param version
+ */
+ virtual void getInterfaceVersion(std::string& version) const =0;
+
+ };
+}
+#endif // !defined(EA_857044C8_1BA8_4972_9083_E7BDD50F6922__INCLUDED_)
diff --git a/include/control/IAmControlSend.h b/include/control/IAmControlSend.h
new file mode 100644
index 0000000..edf6d2e
--- /dev/null
+++ b/include/control/IAmControlSend.h
@@ -0,0 +1,388 @@
+/** Copyright (c) 2012 GENIVI Alliance
+ * Copyright (c) 2012 BMW
+ *
+ * @author Christian Mueller, BMW
+ *
+ * @copyright
+ * {
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * }
+ *
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
+#if !defined(EA_4CA53F2D_FD24_4389_9279_AD92791BD0B6__INCLUDED_)
+#define EA_4CA53F2D_FD24_4389_9279_AD92791BD0B6__INCLUDED_
+
+#include <vector>
+#include <string>
+#include "audiomanagertypes.h"
+
+namespace am {
+class IAmControlReceive;
+}
+
+#define ControlSendVersion "1.0"
+namespace am {
+ /**
+ * This interface is presented by the AudioManager controller.
+ * All the hooks represent system events that need to be handled. The callback functions are used to handle for example answers to function calls on the AudioManagerCoreInterface.
+ * There are two rules that have to be kept in mind when implementing against this interface:\n<b>
+ * 1. CALLS TO THIS INTERFACE ARE NOT THREAD SAFE !!!! \n
+ * 2. YOU MAY NOT THE CALLING INTERFACE DURING AN SYNCHRONOUS OR ASYNCHRONOUS CALL THAT EXPECTS A RETURN VALUE.</b>\n
+ * 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
+ * For more information, please check CAmSerializer
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:44 PM
+ */
+ class IAmControlSend
+ {
+
+ public:
+ IAmControlSend() {
+
+ }
+
+ virtual ~IAmControlSend() {
+
+ }
+
+ /**
+ * Starts up the controller.
+ *
+ * @param controlreceiveinterface This is a pointer to the ControlReceiveInterface so that the controller knows to whom to communicate.
+ */
+ virtual am_Error_e startupController(IAmControlReceive* controlreceiveinterface) =0;
+ /**
+ * this message is used tell the controller that it should get ready. This message must be acknowledged via confirmControllerReady.
+ */
+ virtual void setControllerReady() =0;
+ /**
+ * this message tells the controller that he should prepare everything for the power to be switched off. This message must be acknowledged via confirmControllerRundown.
+ */
+ virtual void setControllerRundown() =0;
+ /**
+ * is called when a connection request comes in via the command interface
+ * @return E_OK on success, E_NOT_POSSIBLE on error, E_ALREADY_EXISTENT if already exists
+ *
+ * @param sourceID
+ * @param sinkID
+ * @param mainConnectionID
+ */
+ virtual am_Error_e hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID) =0;
+ /**
+ * is called when a disconnection request comes in via the command interface
+ * @return E_OK on success, E_NOT_POSSIBLE on error, E_NON_EXISTENT if connection does not exists
+ *
+ * @param connectionID
+ */
+ virtual am_Error_e hookUserDisconnectionRequest(const am_mainConnectionID_t connectionID) =0;
+ /**
+ * sets a user MainSinkSoundProperty
+ * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
+ *
+ * @param sinkID
+ * @param soundProperty
+ */
+ virtual am_Error_e hookUserSetMainSinkSoundProperty(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty) =0;
+ /**
+ * sets a user MainSourceSoundProperty
+ * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
+ *
+ * @param sourceID
+ * @param soundProperty
+ */
+ virtual am_Error_e hookUserSetMainSourceSoundProperty(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty) =0;
+ /**
+ * sets a user SystemProperty
+ * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
+ *
+ * @param property
+ */
+ virtual am_Error_e hookUserSetSystemProperty(const am_SystemProperty_s& property) =0;
+ /**
+ * sets a user volume
+ * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
+ *
+ * @param SinkID
+ * @param newVolume
+ */
+ virtual am_Error_e hookUserVolumeChange(const am_sinkID_t SinkID, const am_mainVolume_t newVolume) =0;
+ /**
+ * sets a user volume as increment
+ * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
+ *
+ * @param SinkID
+ * @param increment the steps
+ */
+ virtual am_Error_e hookUserVolumeStep(const am_sinkID_t SinkID, const int16_t increment) =0;
+ /**
+ * sets the mute state of a sink
+ * @return E_OK on success, E_UNKNOWN on error
+ *
+ * @param sinkID
+ * @param muteState true=muted
+ */
+ virtual am_Error_e hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState) =0;
+ /**
+ * is called when a routing adaptor registers its domain
+ * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXISTENT if already exists
+ *
+ * @param domainData ID is omitted here since it has not been created yet
+ * @param domainID
+ */
+ virtual am_Error_e hookSystemRegisterDomain(const am_Domain_s& domainData, am_domainID_t& domainID) =0;
+ /**
+ * is called when a routing adaptor wants to derigister a domain
+ * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if not found
+ *
+ * @param domainID
+ */
+ virtual am_Error_e hookSystemDeregisterDomain(const am_domainID_t domainID) =0;
+ /**
+ * is called when a domain registered all the elements
+ *
+ * @param domainID
+ */
+ virtual void hookSystemDomainRegistrationComplete(const am_domainID_t domainID) =0;
+ /**
+ * is called when a routing adaptor registers a sink
+ * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXISTENT if already exists
+ *
+ * @param sinkData Id is omitted here, since it has not been created yet
+ * @param sinkID
+ */
+ virtual am_Error_e hookSystemRegisterSink(const am_Sink_s& sinkData, am_sinkID_t& sinkID) =0;
+ /**
+ * is called when a routing adaptor deregisters a sink
+ * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if not found
+ *
+ * @param sinkID
+ */
+ virtual am_Error_e hookSystemDeregisterSink(const am_sinkID_t sinkID) =0;
+ /**
+ * is called when a routing adaptor registers a source
+ * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXISTENT if already exists
+ *
+ * @param sourceData ID is omitted here since it is not yet created
+ * @param sourceID
+ */
+ virtual am_Error_e hookSystemRegisterSource(const am_Source_s& sourceData, am_sourceID_t& sourceID) =0;
+ /**
+ * is called when a routing adaptor deregisters a source
+ * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if not found
+ *
+ * @param sourceID
+ */
+ virtual am_Error_e hookSystemDeregisterSource(const am_sourceID_t sourceID) =0;
+ /**
+ * is called when a routing adaptor registers a gateway
+ * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXISTENT if already exists
+ *
+ * @param gatewayData gatewayID is not set here since it is not created at this point of time
+ * @param gatewayID
+ */
+ virtual am_Error_e hookSystemRegisterGateway(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID) =0;
+ /**
+ * is called when a routing adaptor deregisters a gateway
+ * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if not found
+ *
+ * @param gatewayID
+ */
+ virtual am_Error_e hookSystemDeregisterGateway(const am_gatewayID_t gatewayID) =0;
+ /**
+ * is called when a routing adaptor registers a crossfader
+ * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXISTENT if already exists
+ *
+ * @param crossfaderData gatewayID is not set here since it is not created at this point of time
+ * @param crossfaderID
+ */
+ virtual am_Error_e hookSystemRegisterCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID) =0;
+ /**
+ * is called when a routing adaptor deregisters a crossfader
+ * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if not found
+ *
+ * @param crossfaderID
+ */
+ virtual am_Error_e hookSystemDeregisterCrossfader(const am_crossfaderID_t crossfaderID) =0;
+ /**
+ * volumeticks. therse are used to indicate volumechanges during a ramp
+ *
+ * @param handle
+ * @param sinkID
+ * @param volume
+ */
+ virtual void hookSystemSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume) =0;
+ /**
+ * volumeticks. therse are used to indicate volumechanges during a ramp
+ *
+ * @param handle
+ * @param sourceID
+ * @param volume
+ */
+ virtual void hookSystemSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume) =0;
+ /**
+ * is called when an low level interrupt changed its state
+ *
+ * @param sourceID
+ * @param interruptState
+ */
+ virtual void hookSystemInterruptStateChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState) =0;
+ /**
+ * id called when a sink changed its availability
+ *
+ * @param sinkID
+ * @param availability
+ */
+ virtual void hookSystemSinkAvailablityStateChange(const am_sinkID_t sinkID, const am_Availability_s& availability) =0;
+ /**
+ * id called when a source changed its availability
+ *
+ * @param sourceID
+ * @param availability
+ */
+ virtual void hookSystemSourceAvailablityStateChange(const am_sourceID_t sourceID, const am_Availability_s& availability) =0;
+ /**
+ * id called when domainstate was changed
+ *
+ * @param domainID
+ * @param state
+ */
+ virtual void hookSystemDomainStateChange(const am_domainID_t domainID, const am_DomainState_e state) =0;
+ /**
+ * when early data was received
+ *
+ * @param data
+ */
+ virtual void hookSystemReceiveEarlyData(const std::vector<am_EarlyData_s>& data) =0;
+ /**
+ * this hook provides information about speed changes.
+ * The quantization and sampling rate of the speed can be adjusted at compile time of the AudioManagerDaemon.
+ *
+ * @param speed
+ */
+ virtual void hookSystemSpeedChange(const am_speed_t speed) =0;
+ /**
+ * this hook is fired whenever the timing information of a mainconnection has changed.
+ *
+ * @param mainConnectionID
+ * @param time
+ */
+ virtual void hookSystemTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time) =0;
+ /**
+ * ack for connect
+ *
+ * @param handle
+ * @param errorID
+ */
+ virtual void cbAckConnect(const am_Handle_s handle, const am_Error_e errorID) =0;
+ /**
+ * ack for disconnect
+ *
+ * @param handle
+ * @param errorID
+ */
+ virtual void cbAckDisconnect(const am_Handle_s handle, const am_Error_e errorID) =0;
+ /**
+ * ack for crossfading
+ *
+ * @param handle
+ * @param hostsink
+ * @param error
+ */
+ virtual void cbAckCrossFade(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error) =0;
+ /**
+ * ack for sink volume changes
+ *
+ * @param handle
+ * @param volume
+ * @param error
+ */
+ virtual void cbAckSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error) =0;
+ /**
+ * ack for source volume changes
+ *
+ * @param handle the handle that is connected to the volume change
+ * @param voulme the volume after the action ended (the desired volume if everything went right, the actual one in case of abortion)
+ * @param error
+ */
+ virtual void cbAckSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t voulme, const am_Error_e error) =0;
+ /**
+ * ack for setting of source states
+ *
+ * @param handle
+ * @param error
+ */
+ virtual void cbAckSetSourceState(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * ack for setting of sourcesoundproperties
+ *
+ * @param handle
+ * @param error
+ */
+ virtual void cbAckSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * ack for setting of sourcesoundproperties
+ *
+ * @param handle
+ * @param error
+ */
+ virtual void cbAckSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * ack for setting of sinksoundproperties
+ *
+ * @param handle
+ * @param error
+ */
+ virtual void cbAckSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * ack for setting of sinksoundproperties
+ *
+ * @param handle
+ * @param error
+ */
+ virtual void cbAckSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * This function is used by the routing algorithm to retrieve a priorized list of connectionFormats from the Controller.
+ * @return E_OK in case of successfull priorisation.
+ *
+ * @param sourceID sourceID of source that shall be connected
+ * @param sinkID sinkID of sink that shall be connected
+ * @param listRoute This route is the one the priorized connectionFormats is for.
+ * @param listPossibleConnectionFormats list of possible connectionformats
+ * @param listPrioConnectionFormats the list return with prioos from the controller. Best choice on first position.
+ */
+ 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;
+ /**
+ * This function returns the version of the interface
+ * returns E_OK, E_UNKOWN if version is unknown.
+ *
+ * @param version
+ */
+ virtual void getInterfaceVersion(std::string& version) const =0;
+ /**
+ * confirms the setCommandReady call
+ */
+ virtual void confirmCommandReady() =0;
+ /**
+ * confirms the setRoutingReady call
+ */
+ virtual void confirmRoutingReady() =0;
+ /**
+ * confirms the setCommandRundown call
+ */
+ virtual void confirmCommandRundown() =0;
+ /**
+ * confirms the setRoutingRundown command
+ */
+ virtual void confirmRoutingRundown() =0;
+
+ };
+}
+#endif // !defined(EA_4CA53F2D_FD24_4389_9279_AD92791BD0B6__INCLUDED_)
diff --git a/include/projecttypes.h b/include/projecttypes.h
new file mode 100644
index 0000000..2c03d5a
--- /dev/null
+++ b/include/projecttypes.h
@@ -0,0 +1,203 @@
+/** Copyright (c) 2012 GENIVI Alliance
+ * Copyright (c) 2012 BMW
+ *
+ * @author Christian Mueller, BMW
+ *
+ * @copyright
+ * {
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * }
+ *
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
+#if !defined(EA_3B985F0B_FAF4_4ad9_B5EA_59C989D2321B__INCLUDED_)
+#define EA_3B985F0B_FAF4_4ad9_B5EA_59C989D2321B__INCLUDED_
+
+namespace am {
+ /**
+ * This enum classifies the format in which data is exchanged within a connection. The enum itself is project specific although there are some Genivi standard formats defined.
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:40 PM
+ */
+ enum am_ConnectionFormat_e
+ {
+ /**
+ * default
+ */
+ CF_UNKNOWN = 0,
+ /**
+ * plain mono
+ */
+ CF_GENIVI_MONO = 1,
+ /**
+ * stereo connection
+ */
+ CF_GENIVI_STEREO = 2,
+ /**
+ * analog connection
+ */
+ CF_GENIVI_ANALOG = 3,
+ /**
+ * automatic connection.
+ */
+ CF_GENIVI_AUTO = 4,
+ CF_MAX
+ };
+
+ /**
+ * This enum gives the information about reason for reason for Source/Sink change
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:40 PM
+ */
+ enum am_AvailabilityReason_e
+ {
+ /**
+ * default
+ */
+ AR_UNKNOWN = 0,
+ /**
+ * the availability changed because an new media was entered
+ */
+ AR_GENIVI_NEWMEDIA = 1,
+ /**
+ * the availability changed because the same media was entered
+ */
+ AR_GENIVI_SAMEMEDIA = 2,
+ /**
+ * the availability changed because there is no media
+ */
+ AR_GENIVI_NOMEDIA = 3,
+ /**
+ * the availability changed because of a temperature event
+ */
+ AR_GENIVI_TEMPERATURE = 4,
+ /**
+ * the availability changed because of a voltage event
+ */
+ AR_GENIVI_VOLTAGE = 5,
+ /**
+ * the availability changed because of fatal errors reading or accessing media
+ */
+ AR_GENIVI_ERRORMEDIA = 6,
+ AR_MAX
+ };
+
+ /**
+ * product specific identifier of property
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:40 PM
+ */
+ enum am_ClassProperty_e
+ {
+ /**
+ * default
+ */
+ CP_UNKNOWN = 0,
+ /**
+ * defines the source type of a source. Project specific, could be for example differentiation between interrupt source and main source.
+ */
+ CP_GENIVI_SOURCE_TYPE = 1,
+ /**
+ * defines the SINK_TYPE. Project specific
+ */
+ CP_GENIVI_SINK_TYPE = 2,
+ CP_MAX
+ };
+
+ /**
+ * The given ramp types here are just a possiblity. for products, different ramp types can be defined here.
+ * It is in the responsibility of the product to make sure that the routing plugins are aware of the ramp types used.
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:40 PM
+ */
+ enum am_RampType_e
+ {
+ RAMP_UNKNOWN = 0,
+ /**
+ * this ramp type triggers a direct setting of the value without a ramp
+ */
+ RAMP_GENIVI_DIRECT = 1,
+ /**
+ * This ramp type will set the volume as fast as possible.
+ */
+ RAMP_GENIVI_NO_PLOB = 2,
+ RAMP_GENIVI_EXP_INV = 3,
+ RAMP_GENIVI_LINEAR = 4,
+ RAMP_GENIVI_EXP = 5,
+ RAMP_MAX
+ };
+
+ /**
+ * sound properties. Within genivi only the standard properties are defined, for products these need to be extended.
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:40 PM
+ */
+ enum am_SoundPropertyType_e
+ {
+ /**
+ * default
+ */
+ SP_UNKNOWN = 0,
+ /**
+ * example treble value min =-10 max =10
+ */
+ SP_EXAMPLE_TREBLE = 1,
+ /**
+ * example mid value min =-10 max =10
+ */
+ SP_EXAMPLE_MID = 2,
+ /**
+ * example bass value min =-10 max =10
+ */
+ SP_EXAMPLE_BASS = 3,
+ SP_MAX
+ };
+
+ /**
+ * Here are all SoundProperties that can be set via the CommandInterface. Product specific
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:40 PM
+ */
+ enum am_MainSoundPropertyType_e
+ {
+ /**
+ * default
+ */
+ MSP_UNKNOWN = 0,
+ /**
+ * example value between -10 and +10
+ */
+ MSP_EXAMPLE_TREBLE = 1,
+ /**
+ * example value between -10 and +10
+ */
+ MSP_EXAMPLE_MID = 2,
+ /**
+ * example value between -10 and +10
+ */
+ MSP_EXAMPLE_BASS = 3,
+ MSP_MAX
+ };
+
+ /**
+ * describes the different system properties. Project specific
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:40 PM
+ */
+ enum am_SystemPropertyType_e
+ {
+ /**
+ * default
+ */
+ SYP_UNKNOWN = 0,
+ SYP_MAX
+ };
+}
+#endif // !defined(EA_3B985F0B_FAF4_4ad9_B5EA_59C989D2321B__INCLUDED_)
diff --git a/include/routing/IAmRoutingReceive.h b/include/routing/IAmRoutingReceive.h
new file mode 100644
index 0000000..d654d23
--- /dev/null
+++ b/include/routing/IAmRoutingReceive.h
@@ -0,0 +1,348 @@
+/** Copyright (c) 2012 GENIVI Alliance
+ * Copyright (c) 2012 BMW
+ *
+ * @author Christian Mueller, BMW
+ *
+ * @copyright
+ * {
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * }
+ *
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
+#if !defined(EA_8A0F2164_0638_43df_A114_D343F60C0938__INCLUDED_)
+#define EA_8A0F2164_0638_43df_A114_D343F60C0938__INCLUDED_
+
+#include <vector>
+#include <string>
+#include "audiomanagertypes.h"
+
+namespace am {
+class CAmDbusWrapper;
+class CAmSocketHandler;
+}
+
+
+#define RoutingReceiveVersion "1.0"
+namespace am {
+ /**
+ * Routing Receive sendInterface description. This class implements everything from RoutingAdapter -> Audiomanager
+ * There are two rules that have to be kept in mind when implementing against this interface:\n<b>
+ * 1. CALLS TO THIS INTERFACE ARE NOT THREAD SAFE !!!! \n
+ * 2. YOU MAY NOT THE CALLING INTERFACE DURING AN SYNCHRONOUS OR ASYNCHRONOUS CALL THAT EXPECTS A RETURN VALUE.</b>\n
+ * 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
+ * For more information, please check CAmSerializer
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:44 PM
+ */
+ class IAmRoutingReceive
+ {
+
+ public:
+ IAmRoutingReceive() {
+
+ }
+
+ virtual ~IAmRoutingReceive() {
+
+ }
+
+ /**
+ * acknowledges a asyncConnect
+ *
+ * @param handle
+ * @param connectionID
+ * @param error E_OK on success, E_ABORTED if action was aborted, E_UNKNOWN on error
+ */
+ virtual void ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error) =0;
+ /**
+ * acknowledges a asyncDisconnect
+ *
+ * @param handle
+ * @param connectionID
+ * @param error E_OK on success, E_ABORTED if action was aborted, E_UNKNOWN on error
+ */
+ virtual void ackDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error) =0;
+ /**
+ * acknowledges a asyncsetSinkVolume
+ *
+ * @param handle
+ * @param volume The current actual value that is set
+ * @param error E_OK on success, E_ABORTED if action was aborted, E_UNKNOWN on error
+ */
+ virtual void ackSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error) =0;
+ /**
+ * acknowledges a asyncsetSourceVolume
+ *
+ * @param handle handle that belongs to the change
+ * @param volume the current volume
+ * @param error E_OK on success, E_ABORTED if action was aborted, E_UNKNOWN on error
+ */
+ virtual void ackSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error) =0;
+ /**
+ * acknowlegde for asyncSetSourceState
+ *
+ * @param handle
+ * @param error E_OK on success, E_ABORTED if action was aborted, E_UNKNOWN on error
+ */
+ virtual void ackSetSourceState(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * acknowledges asyncSetSinkSoundProperties
+ *
+ * @param handle
+ * @param error E_OK on success, E_ABORTED if action was aborted, E_UNKNOWN on error
+ */
+ virtual void ackSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * acknowledges asyncSetSinkSoundProperty
+ *
+ * @param handle
+ * @param error E_OK on success, E_ABORTED if action was aborted, E_UNKNOWN on error
+ */
+ virtual void ackSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * acknowledges asyncSetSourceSoundProperties
+ *
+ * @param handle
+ * @param error E_OK on success, E_ABORTED if action was aborted, E_UNKNOWN on error
+ */
+ virtual void ackSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * acknowledges asyncSetSourceSoundProperty
+ *
+ * @param handle
+ * @param error E_OK on success, E_ABORTED if action was aborted, E_UNKNOWN on error
+ */
+ virtual void ackSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * acknowledges asyncCrossFade
+ *
+ * @param handle
+ * @param hotSink this is the current hot sink, HS_INTERMEDIATE is here when a crossfading action did not reach the end
+ * @param error E_OK on success, E_ABORTED if action was aborted, E_UNKNOWN on error
+ */
+ virtual void ackCrossFading(const am_Handle_s handle, const am_HotSink_e hotSink, const am_Error_e error) =0;
+ /**
+ * acknowledges a volume tick. This can be used to display volumechanges during ramps
+ *
+ * @param handle
+ * @param sourceID
+ * @param volume
+ */
+ virtual void ackSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume) =0;
+ /**
+ * acknowledges a volume tick. This can be used to display volumechanges during ramps
+ *
+ * @param handle
+ * @param sinkID
+ * @param volume
+ */
+ virtual void ackSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume) =0;
+ /**
+ * This function returns the ID to the given domainName. If already a domain is registered with this name, it will return the corresponding ID, if not it will reserve an ID but not register the domain. The other parameters of the domain will be overwritten when the domain is registered.
+ * @return E_OK on success, E_UNKNOWN on error
+ *
+ * @param name
+ * @param domainID
+ */
+ virtual am_Error_e peekDomain(const std::string& name, am_domainID_t& domainID) =0;
+ /**
+ * registers a domain
+ * @return E_OK on succes, E_ALREADY_EXISTENT if already registered E_UNKOWN on error
+ *
+ * @param domainData domainID in am_Domain_s must be 0!
+ * @param domainID
+ */
+ virtual am_Error_e registerDomain(const am_Domain_s& domainData, am_domainID_t& domainID) =0;
+ /**
+ * deregisters a domain. All sources, sinks, gateways and crossfaders from that domain will be removed as well.
+ * @return E_OK on succes, E_NON_EXISTENT if not found E_UNKOWN on error
+ *
+ * @param domainID < the nonde of the bus
+ */
+ virtual am_Error_e deregisterDomain(const am_domainID_t domainID) =0;
+ /**
+ * registers a gateway. @return E_OK on succes, E_ALREADY_EXISTENT if already registered E_UNKOWN on error
+ *
+ * @param gatewayData In a fixed setup, the gatewayID must be below 100. In a dynamic setup, the gatewayID shall be 0. listSourceFormats and listSinkFormats are empty at registration time. Values are taken over when sources and sinks are registered.
+ *
+ *
+ * @param gatewayID
+ */
+ virtual am_Error_e registerGateway(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID) =0;
+ /**
+ * deregisters a gateway. Also removes all sinks and sources of the controlling domain.
+ * @return E_OK on succes, E_NON_EXISTENT if not found E_UNKOWN on error
+ *
+ * @param gatewayID domainID of the control domain
+ */
+ virtual am_Error_e deregisterGateway(const am_gatewayID_t gatewayID) =0;
+ /**
+ * This function returns the ID to the given sinkName. If already a sink is registered with this name, it will return the corresponding ID, if not it will reserve an ID but not register the sink. The other parameters of the sink will be overwritten when the sink is registered.
+ * @return E_OK on success, E_UNKNOWN on error
+ *
+ * @param name ID is not valid since not created yet
+ * @param sinkID
+ */
+ virtual am_Error_e peekSink(const std::string& name, am_sinkID_t& sinkID) =0;
+ /**
+ * Registers a sink. If the sink is part of a gateway, the listconnectionFormats is copied to the gatewayInformation
+ * @return E_OK on succes, E_ALREADY_EXISTENT if already registered E_UNKOWN on error
+ *
+ * @param sinkData In a fixed setup, the sinkID within am_Sink_s must be below 100. In a dynamic setup the sinkID must be 0 in am_Sink_s.
+ * @param sinkID
+ */
+ virtual am_Error_e registerSink(const am_Sink_s& sinkData, am_sinkID_t& sinkID) =0;
+ /**
+ * deregisters a sink.
+ * @return E_OK on succes, E_NON_EXISTENT if not found E_UNKOWN on error
+ *
+ * @param sinkID
+ */
+ virtual am_Error_e deregisterSink(const am_sinkID_t sinkID) =0;
+ /**
+ * This function returns the ID to the given sourceName. If already a source is registered with this name, it will return the corresponding ID, if not it will reserve an ID but not register the source. The other parameters of the source will be overwritten when the source is registered.
+ * @return E_OK on success, E_UNKNOWN on error
+ *
+ * @param name
+ * @param sourceID
+ */
+ virtual am_Error_e peekSource(const std::string& name, am_sourceID_t& sourceID) =0;
+ /**
+ * registers a source. If the source is part of a gateway, the listconnectionFormats is copied to the gatewayInformation
+ * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXIST if either name or sourceID already exists
+ *
+ * @param sourceData In a fixed setup, the sourceID within am_Source_s must be below 100. In a dynamic setup the sourceID must be 0 in am_Source_s
+ * @param sourceID
+ */
+ virtual am_Error_e registerSource(const am_Source_s& sourceData, am_sourceID_t& sourceID) =0;
+ /**
+ * deregisters a source
+ * @return E_OK on succes, E_NON_EXISTENT if not found E_UNKOWN on error
+ *
+ * @param sourceID
+ */
+ virtual am_Error_e deregisterSource(const am_sourceID_t sourceID) =0;
+ /**
+ * this function registers a crossfader.
+ * @return E_OK on succes, E_ALREADY_EXISTENT if already registered E_UNKOWN on error
+ *
+ * @param crossfaderData in a fixed setup, the crossfaderID must be below 100. In a dynamic setup the crossfasderID shall be 0
+ * @param crossfaderID
+ */
+ virtual am_Error_e registerCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID) =0;
+ /**
+ * this function deregisters a crossfader. removes all sources and sinks assiated as well.
+ * @return E_OK on succes, E_NON_EXISTENT if not found E_UNKOWN on error
+ *
+ * @param crossfaderID
+ */
+ virtual am_Error_e deregisterCrossfader(const am_crossfaderID_t crossfaderID) =0;
+ /**
+ * this function peeks a sourceclassID. It is used by the RoutingPlugins to determine the SinkClassIDs of a sinkClass.
+ * @return E_OK on succes, E_DATABASE_ERROR on error
+ *
+ * @param name
+ * @param sourceClassID
+ */
+ virtual am_Error_e peekSourceClassID(const std::string& name, am_sourceClass_t& sourceClassID) =0;
+ /**
+ * this function peeks a sourceclassID. It is used by the RoutingPlugins to determine the SinkClassIDs of a sinkClass.
+ * @return E_OK on succes, E_DATABASE_ERROR on error
+ *
+ * @param name
+ * @param sinkClassID
+ */
+ virtual am_Error_e peekSinkClassID(const std::string& name, am_sinkClass_t& sinkClassID) =0;
+ /**
+ * is called when a low level interrupt changes it status.
+ *
+ * @param sourceID
+ * @param interruptState
+ */
+ virtual void hookInterruptStatusChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState) =0;
+ /**
+ * This hook is called when all elements from a domain are registered.
+ * Is used by the Controller to know when all expected domains are finally registered
+ *
+ * @param domainID
+ */
+ virtual void hookDomainRegistrationComplete(const am_domainID_t domainID) =0;
+ /**
+ * is called when a sink changes its availability
+ *
+ * @param sinkID
+ * @param availability
+ */
+ virtual void hookSinkAvailablityStatusChange(const am_sinkID_t sinkID, const am_Availability_s& availability) =0;
+ /**
+ * is called when a source changes its availability
+ *
+ * @param sourceID
+ * @param availability
+ */
+ virtual void hookSourceAvailablityStatusChange(const am_sourceID_t sourceID, const am_Availability_s& availability) =0;
+ /**
+ * is called when a domain changes its status. This used for early domains only
+ *
+ * @param domainID
+ * @param domainState
+ */
+ virtual void hookDomainStateChange(const am_domainID_t domainID, const am_DomainState_e domainState) =0;
+ /**
+ * is called when the timinginformation (delay) changed for a connection.
+ *
+ * @param connectionID
+ * @param delay
+ */
+ virtual void hookTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t delay) =0;
+ /**
+ * this function is used to send out all data that has been changed in an early state.
+ * @return E_OK on success, E_UNKNOWN on error
+ *
+ * @param earlyData
+ */
+ virtual void sendChangedData(const std::vector<am_EarlyData_s>& earlyData) =0;
+ /**
+ * this function is used to retrieve a pointer to the dBusConnectionWrapper
+ * @return E_OK if pointer is valid, E_UKNOWN if AudioManager was compiled without DBus Support
+ *
+ * @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)
+ */
+ virtual am_Error_e getDBusConnectionWrapper(CAmDbusWrapper*& dbusConnectionWrapper) const =0;
+ /**
+ * 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.
+ * returns E_OK if pointer is valid, E_UNKNOWN in case AudioManager was compiled without socketHandler support,
+ *
+ * @param socketHandler
+ */
+ virtual am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler) const =0;
+ /**
+ * This function returns the version of the interface
+ *
+ * @param version retrieves the verison of the interface
+ */
+ virtual void getInterfaceVersion(std::string& version) const =0;
+ /**
+ * confirms the setRoutingReady Command
+ *
+ * @param handle the handle that was given via setRoutingReady
+ */
+ virtual void confirmRoutingReady(const uint16_t handle) =0;
+ /**
+ * confirms the setRoutingRundown Command
+ *
+ * @param handle handle that was given via setRoutingRundown
+ */
+ virtual void confirmRoutingRundown(const uint16_t handle) =0;
+
+ };
+}
+#endif // !defined(EA_8A0F2164_0638_43df_A114_D343F60C0938__INCLUDED_)
diff --git a/include/routing/IAmRoutingSend.h b/include/routing/IAmRoutingSend.h
new file mode 100644
index 0000000..d22489b
--- /dev/null
+++ b/include/routing/IAmRoutingSend.h
@@ -0,0 +1,204 @@
+/** Copyright (c) 2012 GENIVI Alliance
+ * Copyright (c) 2012 BMW
+ *
+ * @author Christian Mueller, BMW
+ *
+ * @copyright
+ * {
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * }
+ *
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
+#if !defined(EA_98A8173D_A5F4_4ee2_B909_152612E7BF00__INCLUDED_)
+#define EA_98A8173D_A5F4_4ee2_B909_152612E7BF00__INCLUDED_
+
+#include <vector>
+#include <string>
+#include "audiomanagertypes.h"
+
+namespace am {
+class IAmRoutingReceive;
+}
+
+#include "IAmRoutingReceive.h"
+
+#define RoutingSendVersion "1.0"
+namespace am {
+ /**
+ * This class implements everything from Audiomanager -> RoutingAdapter
+ * There are two rules that have to be kept in mind when implementing against this interface:\n<b>
+ * 1. CALLS TO THIS INTERFACE ARE NOT THREAD SAFE !!!! \n
+ * 2. YOU MAY NOT THE CALLING INTERFACE DURING AN SYNCHRONOUS OR ASYNCHRONOUS CALL THAT EXPECTS A RETURN VALUE.</b>\n
+ * 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
+ * For more information, please check CAmSerializer
+ * @author Christian Mueller
+ * @created 29-Feb-2012 6:16:44 PM
+ */
+ class IAmRoutingSend
+ {
+
+ public:
+ IAmRoutingSend() {
+
+ }
+
+ virtual ~IAmRoutingSend() {
+
+ }
+
+ /**
+ * starts up the interface. In the implementations, here is the best place for init routines.
+ *
+ * @param routingreceiveinterface pointer to the receive interface
+ */
+ virtual am_Error_e startupInterface(IAmRoutingReceive* routingreceiveinterface) =0;
+ /**
+ * indicates that the routing now ready to be used. Should be used as trigger to register all sinks, sources, etc...
+ *
+ * @param handle handle that uniquely identifies the request
+ */
+ virtual void setRoutingReady(const uint16_t handle) =0;
+ /**
+ * indicates that the routing plugins need to be prepared to switch the power off or be ready again.
+ *
+ * @param handle the handle that uniquely identifies the request
+ */
+ virtual void setRoutingRundown(const uint16_t handle) =0;
+ /**
+ * aborts an asynchronous action.
+ * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if handle was not found
+ *
+ * @param handle
+ */
+ virtual am_Error_e asyncAbort(const am_Handle_s handle) =0;
+ /**
+ * connects a source to a sink
+ * @return E_OK on success, E_UNKNOWN on error, E_WRONG_FORMAT in case am_ConnectionFormat_e does not match
+ *
+ * @param handle
+ * @param connectionID
+ * @param sourceID
+ * @param sinkID
+ * @param connectionFormat
+ */
+ virtual am_Error_e asyncConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat) =0;
+ /**
+ * disconnect a connection with given connectionID
+ * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if connection was not found
+ *
+ * @param handle
+ * @param connectionID
+ */
+ virtual am_Error_e asyncDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID) =0;
+ /**
+ * this method is used to set the volume of a sink. This function is used to drive ramps, to mute or unmute or directly set the value. The difference is made through the ramptype.
+ * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE if new volume is out of range
+ *
+ * @param handle
+ * @param sinkID
+ * @param volume
+ * @param ramp
+ * @param time
+ */
+ virtual am_Error_e asyncSetSinkVolume(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time) =0;
+ /**
+ * sets the volume of a source. This method is used to set the volume of a sink. This function is used to drive ramps, to mute or unmute or directly set the value. The difference is made through the ramptype.
+ * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE if volume is out of range.
+ * triggers the acknowledge ackSourceVolumeChange
+ *
+ * @param handle
+ * @param sourceID
+ * @param volume
+ * @param ramp
+ * @param time
+ */
+ virtual am_Error_e asyncSetSourceVolume(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time) =0;
+ /**
+ * This function is used to set the source state of a particular source.
+ * @return E_OK on success, E_UNKNOWN on error
+ *
+ * @param handle
+ * @param sourceID
+ * @param state
+ */
+ virtual am_Error_e asyncSetSourceState(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state) =0;
+ /**
+ * this function sets the sinksoundproperty.
+ * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE in case the propery value is out of range
+ *
+ * @param handle
+ * @param sinkID
+ * @param listSoundProperties
+ */
+ virtual am_Error_e asyncSetSinkSoundProperties(const am_Handle_s handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s>& listSoundProperties) =0;
+ /**
+ * this function sets the sinksoundproperty.
+ * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE in case the propery value is out of range
+ *
+ * @param handle
+ * @param sinkID
+ * @param soundProperty
+ */
+ virtual am_Error_e asyncSetSinkSoundProperty(const am_Handle_s handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty) =0;
+ /**
+ * this function sets the sourcesoundproperty.
+ * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE in case the propery value is out of range
+ *
+ * @param handle
+ * @param sourceID
+ * @param listSoundProperties
+ */
+ virtual am_Error_e asyncSetSourceSoundProperties(const am_Handle_s handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s>& listSoundProperties) =0;
+ /**
+ * this function sets the sourcesoundproperty.
+ * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE in case the propery value is out of range
+ *
+ * @param handle
+ * @param sourceID
+ * @param soundProperty
+ */
+ virtual am_Error_e asyncSetSourceSoundProperty(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty) =0;
+ /**
+ * this function triggers crossfading.
+ * @return E_OK on success, E_UNKNOWN on error
+ *
+ * @param handle
+ * @param crossfaderID
+ * @param hotSink
+ * @param rampType
+ * @param time
+ */
+ virtual am_Error_e asyncCrossFade(const am_Handle_s handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time) =0;
+ /**
+ * this function is used for early and late audio functions to set the domain state
+ * @return E_OK on success, E_UNKNOWN on error
+ *
+ * @param domainID
+ * @param domainState
+ */
+ virtual am_Error_e setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState) =0;
+ /**
+ * this method is used to retrieve the busname during startup of the plugin. Needs to be implemented
+ * @return E_OK on success, E_UNKNOWN on error
+ *
+ * @param BusName
+ */
+ virtual am_Error_e returnBusName(std::string& BusName) const =0;
+ /**
+ * This function returns the version of the interface
+ *
+ * @param version
+ */
+ virtual void getInterfaceVersion(std::string& version) const =0;
+
+ };
+}
+#endif // !defined(EA_98A8173D_A5F4_4ee2_B909_152612E7BF00__INCLUDED_)
diff --git a/include/shared/CAmDbusWrapper.h b/include/shared/CAmDbusWrapper.h
new file mode 100644
index 0000000..26131c2
--- /dev/null
+++ b/include/shared/CAmDbusWrapper.h
@@ -0,0 +1,92 @@
+/** Copyright (c) 2012 GENIVI Alliance
+ * Copyright (c) 2012 BMW
+ *
+ * \author Christian Mueller, BMW
+ *
+ * \section license
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef DBUSWRAPPER_H_
+#define DBUSWRAPPER_H_
+
+#include <config.h>
+#include <dbus/dbus.h>
+#include <string>
+#include <list>
+#include "shared/CAmSocketHandler.h"
+
+namespace am
+{
+/**
+ * This wraps dbus and provides everything needed to anyone who wants to use dbus (including plugins)
+ */
+class CAmDbusWrapper
+{
+public:
+ CAmDbusWrapper(CAmSocketHandler* socketHandler);
+ virtual ~CAmDbusWrapper();
+
+ /**
+ * registers a callback that is entered as path below the main path.
+ * The configuration of the mainpath is done via DBusConfiguration.h
+ * @param vtable the vtable that holds a pointer to the callback that is called when the path is called from the dbus
+ * @param path the name of the path
+ * @param userdata pointer to the class that will handle the callback
+ */
+ void registerCallback(const DBusObjectPathVTable* vtable, const std::string& path, void* userdata);
+
+ /**
+ * returns the dbus connection
+ * @param connection pointer to the connection
+ */
+ void getDBusConnection(DBusConnection*& connection) const;
+
+ static dbus_bool_t addWatch(DBusWatch *watch, void *userData);
+ static void removeWatch(DBusWatch *watch, void *userData);
+ static void toogleWatch(DBusWatch *watch, void *userData);
+
+ static dbus_bool_t addTimeout(DBusTimeout *timeout, void* userData);
+ static void removeTimeout(DBusTimeout *timeout, void* userData);
+ static void toggleTimeout(DBusTimeout *timeout, void* userData);
+
+ bool dbusDispatchCallback(const sh_pollHandle_t handle, void* userData);
+ TAmShPollDispatch<CAmDbusWrapper> pDbusDispatchCallback;
+
+ void dbusFireCallback(const pollfd pollfd, const sh_pollHandle_t handle, void* userData);
+ TAmShPollFired<CAmDbusWrapper> pDbusFireCallback;
+
+ bool dbusCheckCallback(const sh_pollHandle_t handle, void* userData);
+ TAmShPollCheck<CAmDbusWrapper> pDbusCheckCallback;
+
+ void dbusTimerCallback(sh_timerHandle_t handle, void* userData);
+ TAmShTimerCallBack<CAmDbusWrapper> pDbusTimerCallback;
+
+private:
+ static CAmDbusWrapper* mpReference;
+ static DBusHandlerResult cbRootIntrospection(DBusConnection *conn, DBusMessage *msg, void *reference);
+ dbus_bool_t addWatchDelegate(DBusWatch * watch, void* userData);
+ void removeWatchDelegate(DBusWatch *watch, void *userData);
+ void toogleWatchDelegate(DBusWatch *watch, void *userData);
+ dbus_bool_t addTimeoutDelegate(DBusTimeout *timeout, void* userData);
+ void removeTimeoutDelegate(DBusTimeout *timeout, void* userData);
+ void toggleTimeoutDelegate(DBusTimeout *timeout, void* userData);
+ DBusObjectPathVTable mObjectPathVTable;
+ DBusConnection* mpDbusConnection;
+ DBusError mDBusError;
+ std::list<std::string> mListNodes;
+ std::vector<sh_timerHandle_t*> mpListTimerhandles;
+ CAmSocketHandler *mpSocketHandler;
+ std::map<DBusWatch*, sh_pollHandle_t> mMapHandleWatch;
+};
+
+}
+
+#endif /* DBUSWRAPPER_H_ */
diff --git a/include/shared/CAmDltWrapper.h b/include/shared/CAmDltWrapper.h
new file mode 100644
index 0000000..ea6f246
--- /dev/null
+++ b/include/shared/CAmDltWrapper.h
@@ -0,0 +1,820 @@
+/** Copyright (c) 2012 GENIVI Alliance
+ * Copyright (c) 2012 BMW
+ *
+ * \author Christian Mueller, BMW
+ *
+ * \section license
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef DLTWRAPPER_H_
+#define DLTWRAPPER_H_
+
+#include "config.h"
+
+#ifdef WITH_DLT
+#include <dlt/dlt.h>
+#else
+
+#include <stdint.h>
+
+namespace am {
+
+#define DLT_USER_BUF_MAX_SIZE 2048
+
+/**
+ * This structure is used for every context used in an application.
+ */
+typedef struct
+{
+ char contextID[4]; /**< context id */
+ int32_t log_level_pos; /**< offset in user-application context field */
+} DltContext;
+
+/**
+ * Definitions of DLT log level
+ */
+typedef enum
+{
+ DLT_LOG_DEFAULT = -1, /**< Default log level */
+ DLT_LOG_OFF = 0x00, /**< Log level off */
+ DLT_LOG_FATAL = 0x01, /**< fatal system error */
+ DLT_LOG_ERROR = 0x02, /**< error with impact to correct functionality */
+ DLT_LOG_WARN = 0x03, /**< warning, correct behaviour could not be ensured */
+ DLT_LOG_INFO = 0x04, /**< informational */
+ DLT_LOG_DEBUG = 0x05, /**< debug */
+ DLT_LOG_VERBOSE = 0x06 /**< highest grade of information */
+} DltLogLevelType;
+
+/**
+ * This structure is used for context data used in an application.
+ */
+typedef struct
+{
+ DltContext *handle; /**< pointer to DltContext */
+ char buffer[DLT_USER_BUF_MAX_SIZE]; /**< buffer for building log message*/
+ int32_t size; /**< payload size */
+ int32_t log_level; /**< log level */
+ int32_t trace_status; /**< trace status */
+ int32_t args_num; /**< number of arguments for extended header*/
+ uint8_t mcnt; /**< message counter */
+ char* context_description; /**< description of context */
+} DltContextData;
+
+#define DLT_DECLARE_CONTEXT(CONTEXT) \
+DltContext CONTEXT;
+
+
+#define DLT_IMPORT_CONTEXT(CONTEXT) \
+extern DltContext CONTEXT;
+
+}
+
+#endif
+
+#include <string>
+
+namespace am
+{
+
+/**
+ * Wraps around the dlt wrapper. This class is instantiated as a singleton and offers a default
+ * context (maincontext) that is registered to log to.
+ * Logging under the default context can simply be done with the logInfo/logError templates with up to 10 values at a time.
+ * For logging with a different context, you can use the log template. First register a context with registerContext.
+ */
+class CAmDltWrapper
+{
+public:
+ static CAmDltWrapper* instance(const bool enableNoDLTDebug = false);
+ void registerApp(const char *appid, const char * description);
+ void registerContext(DltContext& handle, const char *contextid, const char * description);
+ void unregisterContext(DltContext& handle);
+
+ void init(DltLogLevelType loglevel, DltContext* context = NULL);
+ void send();
+ void append(const int8_t value);
+ void append(const uint8_t value);
+ void append(const int16_t value);
+ void append(const uint16_t value);
+ void append(const int32_t value);
+ void append(const uint32_t value);
+ void append(const char*& value);
+ void append(const std::string& value);
+ void append(const bool value);
+#ifndef WITH_DLT
+ void enableNoDLTDebug(const bool enableNoDLTDebug = true);
+#endif
+ ~CAmDltWrapper();
+private:
+ CAmDltWrapper(const bool enableNoDLTDebug); //is private because of singleton pattern
+#ifndef WITH_DLT
+ template<class T> void appendNoDLT(T value);
+ bool mEnableNoDLTDebug;
+#endif
+ DltContext mDltContext; //!< the default context
+ DltContextData mDltContextData; //!< contextdata
+ static CAmDltWrapper* mpDLTWrapper; //!< pointer to the wrapper instance
+
+};
+
+/**
+ * returns the instance of the CAmDltWrapper
+ * @return
+ */
+inline CAmDltWrapper* getWrapper()
+{
+ return CAmDltWrapper::instance();
+}
+
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ */
+template<typename T> void logInfo(T value)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_INFO);
+ inst->append(value);
+ inst->send();
+}
+
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ * @param value1
+ */
+template<typename T, typename T1> void logInfo(T value, T1 value1)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_INFO);
+ inst->append(value);
+ inst->append(value1);
+ inst->send();
+}
+
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ */
+template<typename T, typename T1, typename T2> void logInfo(T value, T1 value1, T2 value2)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_INFO);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->send();
+}
+
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ */
+template<typename T, typename T1, typename T2, typename T3> void logInfo(T value, T1 value1, T2 value2, T3 value3)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_INFO);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->send();
+}
+
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ */
+template<typename T, typename T1, typename T2, typename T3, typename T4> void logInfo(T value, T1 value1, T2 value2, T3 value3, T4 value4)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_INFO);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->append(value4);
+ inst->send();
+}
+
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ */
+template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> void logInfo(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_INFO);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->append(value4);
+ inst->append(value5);
+ inst->send();
+}
+
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ */
+template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> void logInfo(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_INFO);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->append(value4);
+ inst->append(value5);
+ inst->append(value6);
+ inst->send();
+}
+
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ * @param value7
+ */
+template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> void logInfo(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_INFO);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->append(value4);
+ inst->append(value5);
+ inst->append(value6);
+ inst->append(value7);
+ inst->send();
+}
+
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ * @param value7
+ * @param value8
+ */
+template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> void logInfo(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_INFO);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->append(value4);
+ inst->append(value5);
+ inst->append(value6);
+ inst->append(value7);
+ inst->append(value8);
+ inst->send();
+}
+
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ * @param value7
+ * @param value8
+ * @param value9
+ */
+template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> void logInfo(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_ERROR);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->append(value4);
+ inst->append(value5);
+ inst->append(value6);
+ inst->append(value7);
+ inst->append(value8);
+ inst->append(value9);
+ inst->send();
+}
+
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ * @param value7
+ * @param value8
+ * @param value9
+ * @param value10
+ */
+template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> void logInfo(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_ERROR);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->append(value4);
+ inst->append(value5);
+ inst->append(value6);
+ inst->append(value7);
+ inst->append(value8);
+ inst->append(value9);
+ inst->append(value10);
+ inst->send();
+}
+
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ */
+template<typename T> void logError(T value)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_ERROR);
+ inst->append(value);
+ inst->send();
+}
+
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ * @param value1
+ */
+template<typename T, typename T1> void logError(T value, T1 value1)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_ERROR);
+ inst->append(value);
+ inst->append(value1);
+ inst->send();
+}
+
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ */
+template<typename T, typename T1, typename T2> void logError(T value, T1 value1, T2 value2)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_ERROR);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->send();
+}
+
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ */
+template<typename T, typename T1, typename T2, typename T3> void logError(T value, T1 value1, T2 value2, T3 value3)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_ERROR);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->send();
+}
+
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ */
+template<typename T, typename T1, typename T2, typename T3, typename T4> void logError(T value, T1 value1, T2 value2, T3 value3, T4 value4)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_ERROR);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->append(value4);
+ inst->send();
+}
+
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ */
+template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> void logError(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_ERROR);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->append(value4);
+ inst->append(value5);
+ inst->send();
+}
+
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ */
+template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> void logError(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_ERROR);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->append(value4);
+ inst->append(value5);
+ inst->append(value6);
+ inst->send();
+}
+
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ * @param value7
+ */
+template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> void logError(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_ERROR);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->append(value4);
+ inst->append(value5);
+ inst->append(value6);
+ inst->append(value7);
+ inst->send();
+}
+
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ * @param value7
+ * @param value8
+ */
+template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> void logError(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_ERROR);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->append(value4);
+ inst->append(value5);
+ inst->append(value6);
+ inst->append(value7);
+ inst->append(value8);
+ inst->send();
+}
+
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ * @param value7
+ * @param value8
+ * @param value9
+ */
+template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> void logError(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_ERROR);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->append(value4);
+ inst->append(value5);
+ inst->append(value6);
+ inst->append(value7);
+ inst->append(value8);
+ inst->append(value9);
+ inst->send();
+}
+
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ * @param value7
+ * @param value8
+ * @param value9
+ * @param value10
+ */
+template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> void logError(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(DLT_LOG_ERROR);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->append(value4);
+ inst->append(value5);
+ inst->append(value6);
+ inst->append(value7);
+ inst->append(value8);
+ inst->append(value9);
+ inst->append(value10);
+ inst->send();
+}
+
+/**
+ * logs a given value with a given context (register first!) and given loglevel
+ * @param context
+ * @param loglevel
+ * @param value
+ */
+template<typename T> void log(DltContext* const context, DltLogLevelType loglevel, T value)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(loglevel, context);
+ inst->append(value);
+ inst->send();
+}
+
+/**
+ * logs a given value with a given context (register first!) and given loglevel
+ * @param context
+ * @param loglevel
+ * @param value
+ * @param value1
+ */
+template<typename T, typename T1> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(loglevel, context);
+ inst->append(value);
+ inst->append(value1);
+ inst->send();
+}
+
+/**
+ * logs a given value with a given context (register first!) and given loglevel
+ * @param context
+ * @param loglevel
+ * @param value
+ * @param value1
+ * @param value2
+ */
+template<typename T, typename T1, typename T2> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1, T2 value2)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(loglevel, context);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->send();
+}
+
+/**
+ * logs a given value with a given context (register first!) and given loglevel
+ * @param context
+ * @param loglevel
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ */
+template<typename T, typename T1, typename T2, typename T3> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1, T2 value2, T3 value3)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(loglevel, context);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->send();
+}
+
+/**
+ * logs a given value with a given context (register first!) and given loglevel
+ * @param context
+ * @param loglevel
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ */
+template<typename T, typename T1, typename T2, typename T3, typename T4> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1, T2 value2, T3 value3, T4 value4)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(loglevel, context);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->append(value4);
+ inst->send();
+}
+
+/**
+ * logs a given value with a given context (register first!) and given loglevel
+ * @param context
+ * @param loglevel
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ */
+template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(loglevel, context);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->append(value4);
+ inst->append(value5);
+ inst->send();
+}
+
+/**
+ * logs a given value with a given context (register first!) and given loglevel
+ * @param context
+ * @param loglevel
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ */
+template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(loglevel, context);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->append(value4);
+ inst->append(value5);
+ inst->append(value6);
+ inst->send();
+}
+
+/**
+ * logs a given value with a given context (register first!) and given loglevel
+ * @param context
+ * @param loglevel
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ * @param value7
+ */
+template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(loglevel, context);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->append(value4);
+ inst->append(value5);
+ inst->append(value6);
+ inst->append(value7);
+ inst->send();
+}
+
+/**
+ * logs a given value with a given context (register first!) and given loglevel
+ * @param context
+ * @param loglevel
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ * @param value7
+ * @param value8
+ */
+template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8)
+{
+ CAmDltWrapper* inst(getWrapper());
+ inst->init(loglevel, context);
+ inst->append(value);
+ inst->append(value1);
+ inst->append(value2);
+ inst->append(value3);
+ inst->append(value4);
+ inst->append(value5);
+ inst->append(value6);
+ inst->append(value7);
+ inst->append(value8);
+ inst->send();
+}
+}
+
+#endif /* DLTWRAPPER_H_ */
diff --git a/include/shared/CAmSerializer.h b/include/shared/CAmSerializer.h
new file mode 100644
index 0000000..a27edaf
--- /dev/null
+++ b/include/shared/CAmSerializer.h
@@ -0,0 +1,708 @@
+/** Copyright (c) 2012 GENIVI Alliance
+ * Copyright (c) 2012 BMW
+ *
+ * \author Christian Mueller, BMW
+ *
+ * \section license
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef CAMSERIALIZER_H_
+#define CAMSERIALIZER_H_
+
+#include <pthread.h>
+#include <deque>
+#include <cassert>
+#include <memory>
+#include <stdexcept>
+#include "CAmDltWrapper.h"
+#include "CAmSocketHandler.h"
+
+//todo: performance improvement we could implement a memory pool that is more efficient here and avoids allocation and deallocation times.
+
+namespace am
+{
+/**
+ * magic class that does the serialization of functions calls
+ * The constructor must be called within the main threadcontext, after that using the
+ * overloaded template function call will serialize all calls and call them within the
+ * main thread context.\n
+ * If you want to use synchronous calls make sure that you use one instance of this class
+ * per thread otherwise you could be lost in never returning calls.
+ */
+class CAmSerializer
+{
+private:
+
+ /**
+ * Prototype for a delegate
+ */
+ class CAmDelegate
+ {
+ public:
+ virtual ~CAmDelegate(){};
+ virtual bool call(int* pipe)=0;
+
+ };
+
+ typedef CAmDelegate* CAmDelegagePtr; //!< pointer to a delegate
+
+ /**
+ * delegate template for no argument
+ */
+ template<class TClass> class CAmNoArgDelegate: public CAmDelegate
+ {
+ private:
+ TClass* mInstance;
+ void (TClass::*mFunction)();
+
+ public:
+ CAmNoArgDelegate(TClass* instance, void(TClass::*function)()) :
+ mInstance(instance), //
+ mFunction(function){};
+
+ bool call(int* pipe)
+ {
+ (void)pipe;
+ (*mInstance.*mFunction)();
+ return true;
+ };
+ };
+
+ /**
+ * delegate template for one argument
+ */
+ template<class TClass, typename Targ> class CAmOneArgDelegate: public CAmDelegate
+ {
+ private:
+ TClass* mInstance;
+ void (TClass::*mFunction)(Targ);
+ Targ mArgument;
+
+ public:
+ CAmOneArgDelegate(TClass* instance, void(TClass::*function)(Targ), Targ argument) :
+ mInstance(instance), //
+ mFunction(function), //
+ mArgument(argument) { };
+
+ bool call(int* pipe)
+ {
+ (void)pipe;
+ (*mInstance.*mFunction)(mArgument);
+ return true;
+ };
+ };
+
+ /**
+ * delegate template for two arguments
+ */
+ template<class TClass, typename Targ, typename Targ1> class CAmTwoArgDelegate: public CAmDelegate
+ {
+ private:
+ TClass* mInstance;
+ void (TClass::*mFunction)(Targ argument,Targ1 argument1);
+ Targ mArgument;
+ Targ1 mArgument1;
+
+ public:
+ CAmTwoArgDelegate(TClass* instance, void(TClass::*function)(Targ argument,Targ1 argument1), Targ argument, Targ1 argument1) :
+ mInstance(instance), //
+ mFunction(function), //
+ mArgument(argument), //
+ mArgument1(argument1){};
+
+ bool call(int* pipe)
+ {
+ (void)pipe;
+ (*mInstance.*mFunction)(mArgument,mArgument1);
+ return true;
+ };
+ };
+
+ /**
+ * delegate template for three arguments
+ */
+ template<class TClass, typename Targ, typename Targ1, typename Targ2> class CAmThreeArgDelegate: public CAmDelegate
+ {
+ private:
+ TClass* mInstance;
+ void (TClass::*mFunction)(Targ argument,Targ1 argument1,Targ2 argument2);
+ Targ mArgument;
+ Targ1 mArgument1;
+ Targ2 mArgument2;
+
+ public:
+ CAmThreeArgDelegate(TClass* instance, void(TClass::*function)(Targ argument,Targ1 argument1,Targ2 argument2), Targ argument, Targ1 argument1, Targ2 argument2) :
+ mInstance(instance), //
+ mFunction(function), //
+ mArgument(argument), //
+ mArgument1(argument1), //
+ mArgument2(argument2){};
+
+ bool call(int* pipe)
+ {
+ (void)pipe;
+ (*mInstance.*mFunction)(mArgument,mArgument1,mArgument2);
+ return true;
+ };
+ };
+
+ /**
+ * delegate template for four arguments
+ */
+ template<class TClass, typename Targ, typename Targ1, typename Targ2, typename Targ3> class CAmFourArgDelegate: public CAmDelegate
+ {
+ private:
+ TClass* mInstance;
+ void (TClass::*mFunction)(Targ argument, Targ1 argument1, Targ2 argument2, Targ3 argument3);
+ Targ mArgument;
+ Targ1 mArgument1;
+ Targ2 mArgument2;
+ Targ3 mArgument3;
+
+ public:
+ CAmFourArgDelegate(TClass* instance, void(TClass::*function)(Targ argument,Targ1 argument1,Targ2 argument2, Targ3 argument3), Targ argument, Targ1 argument1, Targ2 argument2, Targ3 argument3) :
+ mInstance(instance), //
+ mFunction(function), //
+ mArgument(argument), //
+ mArgument1(argument1), //
+ mArgument2(argument2), //
+ mArgument3(argument3){};
+
+ bool call(int* pipe)
+ {
+ (void)pipe;
+ (*mInstance.*mFunction)(mArgument,mArgument1,mArgument2,mArgument3);
+ return true;
+ };
+ };
+
+ /**
+ * Template for synchronous calls with no argument
+ */
+ template<class TClass, typename TretVal> class CAmSyncNoArgDelegate: public CAmDelegate
+ {
+ private:
+ TClass* mInstance;
+ TretVal (TClass::*mFunction)();
+ TretVal mRetval;
+
+ public:
+ friend class CAmSerializer;
+ CAmSyncNoArgDelegate(TClass* instance, TretVal(TClass::*function)()) :
+ mInstance(instance), //
+ mFunction(function), //
+ mRetval(){};
+
+ bool call(int* pipe)
+ {
+ mRetval = (*mInstance.*mFunction)();
+ write(pipe[1], this, sizeof(this));
+ return false;
+ };
+
+ TretVal returnResults()
+ {
+ return mRetval;
+ }
+ };
+
+ /**
+ * template for synchronous calls with one argument
+ */
+ template<class TClass, typename TretVal, typename Targ> class CAmSyncOneArgDelegate: public CAmDelegate
+ {
+ private:
+ TClass* mInstance;
+ TretVal (TClass::*mFunction)(Targ argument);
+ Targ mArgument;
+ TretVal mRetval;
+
+ public:
+ friend class CAmSerializer;
+ CAmSyncOneArgDelegate(TClass* instance, TretVal(TClass::*function)(Targ argument), Targ argument) :
+ mInstance(instance), //
+ mFunction(function), //
+ mArgument(argument), //
+ mRetval(){};
+
+ bool call(int* pipe)
+ {
+ mRetval = (*mInstance.*mFunction)(mArgument);
+ write(pipe[1], this, sizeof(this));
+ return false;
+ };
+
+ TretVal returnResults(Targ& argument)
+ {
+ argument=mArgument;
+ return mRetval;
+ }
+ };
+
+ /**
+ * template for synchronous calls with two arguments
+ */
+ template<class TClass, typename TretVal, typename TargCall, typename TargCall1, typename Targ, typename Targ1> class CAmSyncTwoArgDelegate: public CAmDelegate
+ {
+ private:
+ TClass* mInstance;
+ TretVal (TClass::*mFunction)(TargCall,TargCall1);
+ Targ mArgument;
+ Targ1 mArgument1;
+ TretVal mRetval;
+
+ public:
+ friend class CAmSerializer;
+ CAmSyncTwoArgDelegate(TClass* instance, TretVal(TClass::*function)(TargCall, TargCall1), Targ& argument, Targ1& argument1) :
+ mInstance(instance), //
+ mFunction(function), //
+ mArgument(argument), //
+ mArgument1(argument1), //
+ mRetval(){};
+
+ bool call(int* pipe)
+ {
+ mRetval = (*mInstance.*mFunction)(mArgument, mArgument1);
+ write(pipe[1], this, sizeof(this));
+ return false;
+ };
+
+ TretVal returnResults(Targ& argument, Targ1& argument1)
+ {
+ argument=mArgument;
+ argument1=mArgument1;
+ return mRetval;
+ }
+ };
+
+ /**
+ * template for synchronous calls with three arguments
+ */
+ template<class TClass, typename TretVal, typename Targ, typename Targ1, typename Targ2> class CAmSyncThreeArgDelegate: public CAmDelegate
+ {
+ private:
+ TClass* mInstance;
+ TretVal (TClass::*mFunction)(Targ argument, Targ1 argument1, Targ2 argument2);
+ Targ mArgument;
+ Targ1 mArgument1;
+ Targ2 mArgument2;
+ TretVal mRetval;
+
+ public:
+ CAmSyncThreeArgDelegate(TClass* instance, TretVal(TClass::*function)(Targ argument, Targ1 argument1, Targ2 argument2), Targ argument, Targ1 argument1,Targ2 argument2) :
+ mInstance(instance), //
+ mFunction(function), //
+ mArgument(argument), //
+ mArgument1(argument1), //
+ mArgument2(argument2), //
+ mRetval(){};
+
+ bool call(int* pipe)
+ {
+ mRetval = (*mInstance.*mFunction)(mArgument, mArgument1, mArgument2);
+ write(pipe[1], this, sizeof(this));
+ return false;
+ };
+
+ TretVal returnResults(Targ& argument, Targ1& argument1, Targ2& argument2)
+ {
+ argument=mArgument;
+ argument1=mArgument1;
+ argument2=mArgument2;
+ return mRetval;
+ }
+ };
+
+ /**
+ * template for synchronous calls with four arguments
+ */
+ template<class TClass, typename TretVal, typename Targ, typename Targ1, typename Targ2, typename Targ3> class CAmSyncFourArgDelegate: public CAmDelegate
+ {
+ private:
+ TClass* mInstance;
+ TretVal (TClass::*mFunction)(Targ argument, Targ1 argument1, Targ2 argument2, Targ3 argument3);
+ Targ mArgument;
+ Targ1 mArgument1;
+ Targ2 mArgument2;
+ Targ3 mArgument3;
+ TretVal mRetval;
+
+ CAmSyncFourArgDelegate(TClass* instance, TretVal(TClass::*function)(Targ argument, Targ1 argument1, Targ2 argument2, Targ3 argument3), Targ argument, Targ1 argument1, Targ2 argument2, Targ3 argument3) :
+ mInstance(instance), //
+ mFunction(function), //
+ mArgument(argument), //
+ mArgument1(argument1), //
+ mArgument2(argument2), //
+ mArgument3(argument3), //
+ mRetval(){};
+
+ bool call(int* pipe)
+ {
+ mRetval = (*mInstance.*mFunction)(mArgument, mArgument1, mArgument2, mArgument3);
+ write(pipe[1], this, sizeof(this));
+ return false;
+ };
+
+ TretVal returnResults(Targ& argument, Targ1& argument1, Targ2& argument2, Targ3& argument3)
+ {
+ argument=mArgument;
+ argument1=mArgument1;
+ argument2=mArgument2;
+ argument3=mArgument3;
+ return mRetval;
+ }
+ };
+
+ /**
+ * rings the line of the pipe and adds the delegate pointer to the queue
+ * @param p delegate pointer
+ */
+ inline void send(CAmDelegagePtr p)
+ {
+ if (write(mPipe[1], &p, sizeof(p)) == -1)
+ {
+ throw std::runtime_error("could not write to pipe !");
+ }
+ }
+ int mPipe[2]; //!< the pipe
+ int mReturnPipe[2]; //!< pipe handling returns
+ std::deque<CAmDelegagePtr> mListDelegatePoiters; //!< intermediate queue to store the pipe results
+
+public:
+
+ /**
+ * calls a function with no arguments threadsafe
+ * @param instance the instance of the class that shall be called
+ * @param function the function that shall be called as memberfunction pointer.
+ * Here is an example:
+ * @code
+ * class myClass
+ * {
+ * public:
+ * void myfunction();
+ * }
+ * CAmSerializer serial(&Sockethandler);
+ * myClass instanceMyClass;
+ * serial<CommandSender>(&instanceMyClass,&myClass::myfunction);
+ * @endcode
+ */
+ template<class TClass>
+ void asyncCall(TClass* instance, void(TClass::*function)())
+ {
+ CAmDelegagePtr p(new CAmNoArgDelegate<TClass>(instance, function));
+ send(p);
+ }
+
+ /**
+ * calls a function with one arguments asynchronously threadsafe
+ * @param instance the instance of the class that shall be called
+ * @param function the function that shall be called as memberfunction pointer.
+ * Here is an example:
+ * @code
+ * class myClass
+ * {
+ * public:
+ * void myfunction(int k);
+ * }
+ * CAmSerializer serial(&Sockethandler);
+ * myClass instanceMyClass;
+ * serial<CommandSender,int>(&instanceMyClass,&myClass::myfunction,k);
+ * @endcode
+ */
+ template<class TClass1, class Targ>
+ void asyncCall(TClass1* instance, void(TClass1::*function)(Targ), Targ argument)
+ {
+ CAmDelegagePtr p(new CAmOneArgDelegate<TClass1, Targ>(instance, function, argument));
+ send(p);
+ }
+
+ /**
+ * calls a function with two arguments asynchronously threadsafe. for more see asyncCall with one argument
+ * @param instance
+ * @param function
+ * @param argument
+ * @param argument1
+ */
+ template<class TClass1, class Targ, class Targ1>
+ void asyncCall(TClass1* instance, void(TClass1::*function)(Targ argument,Targ1 argument1), Targ argument, Targ1 argument1)
+ {
+ CAmDelegagePtr p(new CAmTwoArgDelegate<TClass1, Targ, Targ1>(instance, function, argument,argument1));
+ send(p);
+ }
+
+ /**
+ * calls a function with three arguments asynchronously threadsafe. for more see asyncCall with one argument
+ * @param instance
+ * @param function
+ * @param argument
+ * @param argument1 template<class TClass1, class TretVal, class Targ, class Targ1>
+ void syncCall(TClass1* instance, TretVal(TClass1::*function)(Targ,Targ1), TretVal& retVal, Targ& argument, Targ1& argument1)
+ {
+ CAmSyncTwoArgDelegate<TClass1, TretVal, Targ, Targ1>* p(new CAmSyncTwoArgDelegate<TClass1, TretVal, Targ, Targ1>(instance, function, argument, argument1));
+ send(static_cast<CAmDelegagePtr>(p));
+ int numReads;
+ CAmDelegagePtr ptr;
+ if ((numReads=read(mReturnPipe[0],&ptr, sizeof(ptr))) == -1)
+ {
+ logError("CAmSerializer::receiverCallback could not read pipe!");
+ throw std::runtime_error("CAmSerializer Could not read pipe!");
+ }
+ //working with friend class here is not the finest of all programming stiles but it works...
+ retVal=p->returnResults(argument,argument1);
+ }
+ * @param argument2
+ */
+ template<class TClass1, class Targ, class Targ1, class Targ2>
+ void asyncCall(TClass1* instance, void(TClass1::*function)(Targ argument,Targ1 argument1, Targ2 argument2), Targ argument, Targ1 argument1, Targ2 argument2)
+ {
+ CAmDelegagePtr p(new CAmThreeArgDelegate<TClass1, Targ, Targ1, Targ2>(instance, function, argument,argument1, argument2));
+ send(p);
+ }
+
+ /**
+ * calls a function with four arguments asynchronously threadsafe. for more see asyncCall with one argument
+ * @param instance
+ * @param function
+ * @param argument
+ * @param argument1
+ * @param argument2
+ * @param argument3
+ */
+ template<class TClass1, class Targ, class Targ1, class Targ2, class Targ3>
+ void asyncCall(TClass1* instance, void(TClass1::*function)(Targ argument,Targ1 argument1, Targ2 argument2, Targ3 argument3), Targ argument, Targ1 argument1, Targ2 argument2, Targ3 argument3)
+ {
+ CAmDelegagePtr p(new CAmFourArgDelegate<TClass1, Targ, Targ1, Targ2, Targ3>(instance, function, argument,argument1, argument2, argument3));
+ send(p);
+ }
+
+ /**
+ * calls a synchronous function with no arguments threadsafe
+ * @param instance the instance of the class that shall be called
+ * @param function the function that shall be called as memberfunction pointer.
+ * Here is an example:
+ * @code
+ * class myClass
+ * {
+ * public:
+ * am_Error_e myfunction();
+ * }
+ * CAmSerializer serial(&Sockethandler);
+ * myClass instanceMyClass;
+ * am_Error_e error;
+ * serial<CommandSender,am_Error_e>(&instanceMyClass,&myClass::myfunction, error);
+ * @endcode
+ * All arguments given to synchronous functions must be non-const since the results of the operations will be written back to the arguments.
+ *
+ */
+ template<class TClass1, class TretVal>
+ void syncCall(TClass1* instance, TretVal(TClass1::*function)(), TretVal& retVal)
+ {
+ CAmSyncNoArgDelegate<TClass1, TretVal>* p(new CAmSyncNoArgDelegate<TClass1, TretVal>(instance, function));
+ send(static_cast<CAmDelegagePtr>(p));
+ int numReads;
+ CAmDelegagePtr ptr;
+ if ((numReads=read(mReturnPipe[0],&ptr, sizeof(ptr))) == -1)
+ {
+ logError("CAmSerializer::receiverCallback could not read pipe!");
+ throw std::runtime_error("CAmSerializer Could not read pipe!");
+ }
+ //working with friend class here is not the finest of all programming stiles but it works...
+ retVal=p->returnResults();
+ delete p;
+ }
+
+ /**
+ * calls a function with one argument synchronous threadsafe
+ * @param instance the instance of the class that shall be called
+ * @param function the function that shall be called as memberfunction pointer.
+ * Here is an example:
+ * @code
+ * class myClass
+ * {
+ * public:
+ * am_Error_e myfunction(int k);
+ * }
+ * CAmSerializer serial(&Sockethandler);
+ * myClass instanceMyClass;
+ * am_Error_e error;
+ * int l;
+ * serial<CommandSender,am_Error_e,int>(&instanceMyClass,&myClass::myfunction,error,l);
+ * @endcode
+ * All arguments given to synchronous functions must be non-const since the results of the operations will be written back to the arguments.
+ */
+ template<class TClass1, class TretVal, class Targ>
+ void syncCall(TClass1* instance, TretVal(TClass1::*function)(Targ), TretVal& retVal,Targ& argument)
+ {
+ CAmSyncOneArgDelegate<TClass1, TretVal, Targ>* p(new CAmSyncOneArgDelegate<TClass1, TretVal, Targ>(instance, function, argument));
+ send(static_cast<CAmDelegagePtr>(p));
+ int numReads;
+ CAmDelegagePtr ptr;
+ if ((numReads=read(mReturnPipe[0],&ptr, sizeof(ptr))) == -1)
+ {
+ logError("CAmSerializer::receiverCallback could not read pipe!");
+ throw std::runtime_error("CAmSerializer Could not read pipe!");
+ }
+ //working with friend class here is not the finest of all programming stiles but it works...
+ retVal=p->returnResults(argument);
+ delete p;
+ }
+
+ /**
+ * calls a function with two arguments synchronously threadsafe. for more see syncCall with one argument
+ * @param instance
+ * @param function
+ * @param retVal
+ * @param argument
+ * @param argument1
+ */
+ template<class TClass1, class TretVal, class TargCall, class Targ1Call,class Targ, class Targ1>
+ void syncCall(TClass1* instance, TretVal(TClass1::*function)(TargCall,Targ1Call), TretVal& retVal, Targ& argument, Targ1& argument1)
+ {
+ CAmSyncTwoArgDelegate<TClass1, TretVal,TargCall,Targ1Call, Targ, Targ1>* p(new CAmSyncTwoArgDelegate<TClass1, TretVal,TargCall,Targ1Call, Targ, Targ1>(instance, function, argument, argument1));
+ send(dynamic_cast<CAmDelegagePtr>(p));
+
+ CAmDelegagePtr ptr;
+ if (read(mReturnPipe[0],&ptr, sizeof(ptr)) == -1)
+ {
+ logError("CAmSerializer::receiverCallback could not read pipe!");
+ throw std::runtime_error("CAmSerializer Could not read pipe!");
+ }
+ retVal=p->returnResults(argument,argument1);
+ delete p;
+ }
+
+ /**
+ * calls a function with three arguments synchronously threadsafe. for more see syncCall with one argument
+ * @param instance
+ * @param function
+ * @param retVal
+ * @param argument
+ * @param argument1
+ * @param argument2
+ */
+ template<class TClass1, class TretVal, class Targ, class Targ1, class Targ2>
+ void syncCall(TClass1* instance, TretVal(TClass1::*function)(Targ,Targ1,Targ2), TretVal& retVal, Targ& argument, Targ1& argument1, Targ2& argument2)
+ {
+ CAmSyncThreeArgDelegate<TClass1, TretVal, Targ, Targ1, Targ2>* p(new CAmSyncThreeArgDelegate<TClass1, TretVal, Targ, Targ1, Targ2>(instance, function, argument, argument1, argument2));
+ send(static_cast<CAmDelegagePtr>(p));
+ int numReads;
+ CAmDelegagePtr ptr;
+ if ((numReads=read(mReturnPipe[0],&ptr, sizeof(ptr))) == -1)
+ {
+ logError("CAmSerializer::receiverCallback could not read pipe!");
+ throw std::runtime_error("CAmSerializer Could not read pipe!");
+ }
+ //working with friend class here is not the finest of all programming stiles but it works...
+ retVal=p->returnResults(argument, argument1, argument2);
+ delete p;
+ }
+
+ /**
+ * calls a function with four arguments synchronously threadsafe. for more see syncCall with one argument
+ * @param instance
+ * @param function
+ * @param retVal
+ * @param argument
+ * @param argument1
+ * @param argument2
+ * @param argument3
+ */
+ template<class TClass1, class TretVal, class Targ, class Targ1, class Targ2, class Targ3>
+ void syncCall(TClass1* instance, TretVal(TClass1::*function)(Targ,Targ1,Targ2,Targ3), TretVal& retVal, Targ& argument, Targ1& argument1, Targ2& argument2, Targ3& argument3)
+ {
+ CAmSyncFourArgDelegate<TClass1, TretVal, Targ, Targ1, Targ2, Targ3>* p(new CAmSyncFourArgDelegate<TClass1, TretVal, Targ, Targ1, Targ2, Targ3>(instance, function, argument, argument1, argument2, argument3));
+ send(static_cast<CAmDelegagePtr>(p));
+ int numReads;
+ CAmDelegagePtr ptr;
+ if ((numReads=read(mReturnPipe[0],&ptr, sizeof(ptr))) == -1)
+ {
+ logError("CAmSerializer::receiverCallback could not read pipe!");
+ throw std::runtime_error("CAmSerializer Could not read pipe!");
+ }
+ //working with friend class here is not the finest of all programming stiles but it works...
+ retVal=p->returnResults(argument, argument1, argument2, argument3);
+ delete p;
+ }
+
+
+ void receiverCallback(const pollfd pollfd, const sh_pollHandle_t handle, void* userData)
+ {
+ (void) handle;
+ (void) userData;
+ int numReads;
+ CAmDelegagePtr listPointers[3];
+ if ((numReads=read(pollfd.fd,&listPointers, sizeof(listPointers))) == -1)
+ {
+ logError("CAmSerializer::receiverCallback could not read pipe!");
+ throw std::runtime_error("CAmSerializer Could not read pipe!");
+ }
+ mListDelegatePoiters.assign(listPointers, listPointers+(numReads/sizeof(CAmDelegagePtr)));
+ }
+
+ bool checkerCallback(const sh_pollHandle_t handle, void* userData)
+ {
+ (void) handle;
+ (void) userData;
+ if (mListDelegatePoiters.empty())
+ return false;
+ return true;
+ }
+
+ bool dispatcherCallback(const sh_pollHandle_t handle, void* userData)
+ {
+ (void) handle;
+ (void) userData;
+ CAmDelegagePtr delegatePoiter = mListDelegatePoiters.front();
+ mListDelegatePoiters.pop_front();
+ if(delegatePoiter->call(mReturnPipe))
+ delete delegatePoiter;
+ if (mListDelegatePoiters.empty())
+ return false;
+ return true;
+ }
+
+ TAmShPollFired<CAmSerializer> receiverCallbackT;
+ TAmShPollDispatch<CAmSerializer> dispatcherCallbackT;
+ TAmShPollCheck<CAmSerializer> checkerCallbackT;
+
+ /**
+ * The constructor must be called in the mainthread context !
+ * @param iSocketHandler pointer to the sockethandler
+ */
+ CAmSerializer(CAmSocketHandler *iSocketHandler) :
+ mPipe(), //
+ mListDelegatePoiters(), //
+ receiverCallbackT(this, &CAmSerializer::receiverCallback), //
+ dispatcherCallbackT(this, &CAmSerializer::dispatcherCallback), //
+ checkerCallbackT(this, &CAmSerializer::checkerCallback)
+ {
+ if (pipe(mPipe) == -1)
+ {
+ logError("CAmSerializer could not create pipe!");
+ throw std::runtime_error("CAmSerializer Could not open pipe!");
+ }
+
+ if (pipe(mReturnPipe) == -1)
+ {
+ logError("CAmSerializer could not create mReturnPipe!");
+ throw std::runtime_error("CAmSerializer Could not open mReturnPipe!");
+ }
+
+ short event = 0;
+ sh_pollHandle_t handle;
+ event |= POLLIN;
+ iSocketHandler->addFDPoll(mPipe[0], event, NULL, &receiverCallbackT, NULL, &dispatcherCallbackT, NULL, handle);
+ }
+
+ ~CAmSerializer(){}
+};
+} /* namespace am */
+#endif /* CAMSERIALIZER_H_ */
diff --git a/include/shared/CAmSocketHandler.h b/include/shared/CAmSocketHandler.h
new file mode 100644
index 0000000..e0ea797
--- /dev/null
+++ b/include/shared/CAmSocketHandler.h
@@ -0,0 +1,258 @@
+/** Copyright (c) 2012 GENIVI Alliance
+ * Copyright (c) 2012 BMW
+ *
+ * \author Christian Mueller, BMW
+ *
+ * \section license
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef SOCKETHANDLER_H_
+#define SOCKETHANDLER_H_
+
+#include "audiomanagertypes.h"
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <stdint.h>
+#include <sys/poll.h>
+#include <list>
+#include <map>
+#include <signal.h>
+
+namespace am
+{
+
+static volatile sig_atomic_t gDispatchDone = 0; //this global is used to stop the mainloop
+
+typedef uint16_t sh_timerHandle_t; //!<this is a handle for a timer to be used with the SocketHandler
+typedef uint16_t sh_pollHandle_t; //!<this is a handle for a filedescriptor to be used with the SocketHandler
+
+class CAmShPollPrepare;
+class CAmShPollCheck;
+class CAmShPollFired;
+class CAmShPollDispatch;
+class CAmShTimerCallBack;
+
+class CAmSocketHandler
+{
+public:
+ CAmSocketHandler();
+ virtual ~CAmSocketHandler();
+
+ am_Error_e addFDPoll(const int fd, const short event, CAmShPollPrepare *prepare, CAmShPollFired *fired, CAmShPollCheck *check, CAmShPollDispatch *dispatch, void* userData, sh_pollHandle_t& handle);
+ am_Error_e removeFDPoll(const sh_pollHandle_t handle);
+ am_Error_e updateEventFlags(const sh_pollHandle_t handle, const short events);
+ am_Error_e addTimer(const timespec timeouts, CAmShTimerCallBack*& callback, sh_timerHandle_t& handle, void* userData);
+ am_Error_e removeTimer(const sh_timerHandle_t handle);
+ am_Error_e restartTimer(const sh_timerHandle_t handle, const timespec timeouts);
+ am_Error_e stopTimer(const sh_timerHandle_t handle);
+ void start_listenting();
+ void stop_listening();
+private:
+ struct sh_timer_s //!<struct that holds information of timers
+ {
+ sh_timerHandle_t handle; //!<the handle of the timer
+ timespec countdown; //!<the countdown, this value is decreased every time the timer is up
+ timespec timeout; //!<the original timer value
+ CAmShTimerCallBack* callback; //!<the callbackfunction
+ void * userData; //!<saves a void pointer together with the rest.
+ };
+
+ class CAmShSubstractTime //!<functor to easy substract from each countdown value
+ {
+ private:
+ timespec param;
+ public:
+ CAmShSubstractTime(timespec param) :
+ param(param){}
+ void operator()(sh_timer_s& t) const;
+ };
+
+ struct sh_poll_s //!<struct that holds information about polls
+ {
+ sh_pollHandle_t handle; //!<handle to uniquely adress a filedesriptor
+ CAmShPollPrepare *prepareCB;
+ CAmShPollFired *firedCB;
+ CAmShPollCheck *checkCB;
+ CAmShPollDispatch *dispatchCB;
+ pollfd pollfdValue; //!<the array for polling the filedescriptors
+ void *userData; //!<userdata saved together with the callback.
+ };
+
+ typedef std::vector<pollfd> mListPollfd_t; //!<vector of filedescriptors
+ typedef std::vector<sh_poll_s> mListPoll_t; //!<list for the callbacks
+
+ class CAmShCopyPollfd
+ {
+ private:
+ mListPollfd_t& mArray;
+ public:
+ CAmShCopyPollfd(mListPollfd_t& dest) :
+ mArray(dest){}
+ void operator()(const sh_poll_s& row);
+ };
+
+ bool fdIsValid(const int fd) const;
+ void initTimer();
+ void timerUp();
+ int timespec2ms(const timespec& time);
+ timespec* insertTime(timespec& buffertime);
+ static bool compareCountdown(const sh_timer_s& a, const sh_timer_s& b)
+ {
+ return (a.countdown.tv_sec == b.countdown.tv_sec) ? (a.countdown.tv_nsec < b.countdown.tv_nsec) : (a.countdown.tv_sec < b.countdown.tv_sec);
+ }
+
+ static bool onlyFiredEvents(const pollfd& a)
+ {
+ return a.revents == 0 ? false : true;
+ }
+
+ //todo: maybe we could simplify mListActiveTimer to hold only the handle and the countdown ....
+ mListPollfd_t mfdPollingArray;
+ mListPoll_t mListPoll;
+ std::list<sh_timer_s> mListTimer; //!<list of all timers
+ std::list<sh_timer_s> mListActiveTimer; //!<list of all currently active timers
+ sh_timerHandle_t mNextTimer;
+ sh_timerHandle_t mLastInsertedHandle;
+ sh_pollHandle_t mLastInsertedPollHandle;
+ bool mRecreatePollfds;
+ timespec mTimeout;
+};
+
+/**
+ * classic functor for the BasicTimerCallback
+ */
+class CAmShTimerCallBack
+{
+public:
+ virtual void Call(const sh_timerHandle_t handle, void* userData)=0;
+ virtual ~CAmShTimerCallBack(){};
+};
+
+class CAmShPollPrepare
+{
+public:
+ virtual void Call(const sh_pollHandle_t handle, void* userData)=0;
+ virtual ~CAmShPollPrepare(){};
+};
+
+class CAmShPollFired
+{
+public:
+ virtual void Call(const pollfd pollfd, const sh_pollHandle_t handle, void* userData)=0;
+ virtual ~ CAmShPollFired(){};
+};
+
+class CAmShPollCheck
+{
+public:
+ virtual bool Call(const sh_pollHandle_t handle, void* userData)=0;
+ virtual ~ CAmShPollCheck(){};
+};
+
+class CAmShPollDispatch
+{
+public:
+ virtual bool Call(const sh_pollHandle_t handle, void* userData)=0;
+ virtual ~ CAmShPollDispatch() {};
+};
+
+/**
+ * template to create the functor for a class
+ */
+template<class TClass> class TAmShTimerCallBack: public CAmShTimerCallBack
+{
+private:
+ TClass* mInstance;
+ void (TClass::*mFunction)(sh_timerHandle_t handle, void* userData);
+
+public:
+ TAmShTimerCallBack(TClass* instance, void(TClass::*function)(sh_timerHandle_t handle, void* userData)) :
+ mInstance(instance),//
+ mFunction(function) {};
+
+ virtual void Call(sh_timerHandle_t handle, void* userData)
+ {
+ (*mInstance.*mFunction)(handle, userData);
+ }
+};
+
+/**
+ * template to create the functor for a class
+ */
+template<class TClass> class TAmShPollPrepare: public CAmShPollPrepare
+{
+private:
+ TClass* mInstance;
+ void (TClass::*mFunction)(const sh_timerHandle_t handle, void* userData);
+
+public:
+ TAmShPollPrepare(TClass* instance, void(TClass::*function)(const sh_timerHandle_t handle, void* userData)) :
+ mInstance(instance), //
+ mFunction(function){};
+
+ virtual void Call(const sh_timerHandle_t handle, void* userData)
+ {
+ (*mInstance.*mFunction)(handle, userData);
+ };
+};
+
+template<class TClass> class TAmShPollFired: public CAmShPollFired
+{
+private:
+ TClass* mInstance;
+ void (TClass::*mFunction)(const pollfd pollfd, const sh_pollHandle_t handle, void* userData);
+
+public:
+ TAmShPollFired(TClass* instance, void(TClass::*function)(const pollfd pollfd, const sh_pollHandle_t handle, void* userData)) :
+ mInstance(instance), //
+ mFunction(function){};
+
+ virtual void Call(const pollfd pollfd, const sh_pollHandle_t handle, void* userData)
+ {
+ (*mInstance.*mFunction)(pollfd, handle, userData);
+ };
+};
+
+template<class TClass> class TAmShPollCheck: public CAmShPollCheck
+{
+private:
+ TClass* mInstance;
+ bool (TClass::*mFunction)(const sh_pollHandle_t handle, void* userData);
+
+public:
+ TAmShPollCheck(TClass* instance, bool(TClass::*function)(const sh_pollHandle_t handle, void* userData)) :
+ mInstance(instance), //
+ mFunction(function){};
+
+ virtual bool Call(const sh_pollHandle_t handle, void* userData)
+ {
+ return (*mInstance.*mFunction)(handle, userData);
+ };
+};
+
+template<class TClass> class TAmShPollDispatch: public CAmShPollDispatch
+{
+private:
+ TClass* mInstance;
+ bool (TClass::*mFunction)(const sh_pollHandle_t handle, void* userData);
+
+public:
+ TAmShPollDispatch(TClass* instance, bool(TClass::*function)(const sh_pollHandle_t handle, void* userData)) :
+ mInstance(instance), //
+ mFunction(function) {};
+
+ virtual bool Call(const sh_pollHandle_t handle, void* userData)
+ {
+ return (*mInstance.*mFunction)(handle, userData);
+ };
+};
+} /* namespace am */
+#endif /* SOCKETHANDLER_H_ */