Renamed CAmDatabaseHandler to CAmDatabaseHandlerSQLite and CAmMapHandler to CAmDatabaseHandlerMap.
Changed std::map to std::unordered_map.
Added to the cmake configuration a definition, which defines the capacity of the source and sink maps.
Signed-off-by: Christian Linke <christian.linke@bmw.de>
src/CAmSocketHandler.cpp
src/CAmDltWrapper.cpp
)
-
+
+# Preallocation variable for the map.
+IF(NOT WITH_DATABASE_STORAGE )
+ set (AM_MAP_CAPACITY 10)
+ add_definitions( -DAM_MAP_CAPACITY=${AM_MAP_CAPACITY} )
+ENDIF(NOT WITH_DATABASE_STORAGE)
IF(WITH_TELNET)
SET (AUDIOMAN_SRCS_CXX
IF(WITH_DATABASE_STORAGE)
SET (AUDIOMAN_SRCS_CXX
${AUDIOMAN_SRCS_CXX}
- src/CAmDatabaseHandler.cpp
+ src/CAmDatabaseHandlerSQLite.cpp
)
ELSE(WITH_DATABASE_STORAGE)
SET (AUDIOMAN_SRCS_CXX
${AUDIOMAN_SRCS_CXX}
- src/CAmMapHandler.cpp
+ src/CAmDatabaseHandlerMap.cpp
)
ENDIF(WITH_DATABASE_STORAGE)
namespace am
{
-class CAmDatabaseHandlerInterface;
+class IAmDatabaseHandler;
class CAmControlSender;
class CAmDbusWrapper;
class CAmSocketHandler;
class CAmCommandReceiver: public IAmCommandReceive
{
public:
- CAmCommandReceiver(CAmDatabaseHandlerInterface* iDatabaseHandler, CAmControlSender* iControlSender, CAmSocketHandler* iSocketHandler);
- CAmCommandReceiver(CAmDatabaseHandlerInterface* iDatabaseHandler, CAmControlSender* iControlSender, CAmSocketHandler* iSocketHandler, CAmDbusWrapper* iDBusWrapper);
+ CAmCommandReceiver(IAmDatabaseHandler* iDatabaseHandler, CAmControlSender* iControlSender, CAmSocketHandler* iSocketHandler);
+ CAmCommandReceiver(IAmDatabaseHandler* iDatabaseHandler, CAmControlSender* iControlSender, CAmSocketHandler* iSocketHandler, CAmDbusWrapper* iDBusWrapper);
~CAmCommandReceiver();
am_Error_e connect(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID);
am_Error_e disconnect(const am_mainConnectionID_t mainConnectionID);
void waitOnRundown(bool rundown); //!< tells the ComandReceiver to start waiting for all handles to be confirmed
private:
- CAmDatabaseHandlerInterface* mDatabaseHandler; //!< pointer to the databasehandler
+ IAmDatabaseHandler* mDatabaseHandler; //!< pointer to the databasehandler
CAmControlSender* mControlSender; //!< pointer to the control sender
CAmDbusWrapper* mDBusWrapper; //!< pointer to the dbuswrapper
CAmSocketHandler* mSocketHandler; //!< pointer to the SocketHandler
{
class CAmSocketHandler;
-class CAmDatabaseHandlerInterface;
+class IAmDatabaseHandler;
class CAmRoutingSender;
class CAmCommandSender;
class CAmRouter;
class CAmControlReceiver: public IAmControlReceive
{
public:
- CAmControlReceiver(CAmDatabaseHandlerInterface *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmCommandSender *iCommandSender, CAmSocketHandler *iSocketHandler, CAmRouter* iRouter, CAmNodeStateCommunicator* iNodeStateCommunicator);
- CAmControlReceiver(CAmDatabaseHandlerInterface *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmCommandSender *iCommandSender, CAmSocketHandler *iSocketHandler, CAmRouter* iRouter);
+ CAmControlReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmCommandSender *iCommandSender, CAmSocketHandler *iSocketHandler, CAmRouter* iRouter, CAmNodeStateCommunicator* iNodeStateCommunicator);
+ CAmControlReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmCommandSender *iCommandSender, CAmSocketHandler *iSocketHandler, CAmRouter* iRouter);
~CAmControlReceiver();
am_Error_e getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s>& returnList);
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);
NsmErrorStatus_e sendLifecycleRequestCompleteNSM(const uint32_t RequestId, const NsmErrorStatus_e status) ;
private:
- CAmDatabaseHandlerInterface* mDatabaseHandler; //!< pointer tto the databasehandler
+ IAmDatabaseHandler* mDatabaseHandler; //!< pointer tto the databasehandler
CAmRoutingSender* mRoutingSender; //!< pointer to the routing send interface.
CAmCommandSender* mCommandSender; //!< pointer to the command send interface
CAmSocketHandler* mSocketHandler; //!< pointer to the socketHandler
--- /dev/null
+/**
+ * Copyright (C) 2012, BMW AG
+ *
+ * This file is part of GENIVI Project AudioManager.
+ *
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
+ *
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ *
+* \author Aleksandar Donchev, aleksander.donchev@partner.bmw.de BMW 2013
+ *
+ * \file CAmDatabaseHandlerMap.h
+ * For further information see http://www.genivi.org/.
+ *
+ */
+
+#ifndef MAPHANDLER_H_
+#define MAPHANDLER_H_
+
+#include "IAmDatabaseHandler.h"
+#include <stdint.h>
+#include <limits.h>
+#include <sstream>
+#include <iostream>
+#include <unordered_map>
+
+
+
+namespace am
+{
+#ifndef AM_MAP_CAPACITY
+ #ifdef WITH_DATABASE_STORAGE
+ #define AM_MAP_CAPACITY @AM_MAP_CAPACITY@
+ #else
+ #define AM_MAP_CAPACITY 0
+ #endif
+#endif
+#define AM_MAP std::unordered_map
+
+//todo: check the enum values before entering & changing in the database.
+//todo: change asserts for dynamic boundary checks into failure answers.#
+//todo: check autoincrement boundary and set to 16bit limits
+//todo: If the sink is part of a gateway, the listconnectionFormats is copied to the gatewayInformation. Check this statement for sinks & sources
+//todo: exchange last_insert_row id to be more safe
+//todo: create test to ensure uniqueness of names throughout the database
+//todo: enforce the uniqueness of names
+
+/**
+ * This class handles and abstracts the database
+ */
+class CAmDatabaseHandlerMap : public IAmDatabaseHandler
+{
+ CAmDatabaseObserver *mpDatabaseObserver; //!< pointer to the Observer
+ bool mFirstStaticSink; //!< bool for dynamic range handling
+ bool mFirstStaticSource; //!< bool for dynamic range handling
+ bool mFirstStaticGateway; //!< bool for dynamic range handling
+ bool mFirstStaticSinkClass; //!< bool for dynamic range handling
+ bool mFirstStaticSourceClass; //!< bool for dynamic range handling
+ bool mFirstStaticCrossfader; //!< bool for dynamic range handling
+ ListConnectionFormat mListConnectionFormat; //!< list of connection formats
+
+public:
+ CAmDatabaseHandlerMap();
+ virtual ~CAmDatabaseHandlerMap();
+ am_Error_e enterDomainDB(const am_Domain_s& domainData, am_domainID_t& domainID);
+ am_Error_e enterMainConnectionDB(const am_MainConnection_s& mainConnectionData, am_mainConnectionID_t& connectionID);
+ am_Error_e enterSinkDB(const am_Sink_s& sinkData, am_sinkID_t& sinkID);
+ am_Error_e enterCrossfaderDB(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID);
+ am_Error_e enterGatewayDB(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID);
+ am_Error_e enterSourceDB(const am_Source_s& sourceData, am_sourceID_t& sourceID);
+ am_Error_e enterConnectionDB(const am_Connection_s& connection, am_connectionID_t& connectionID);
+ am_Error_e enterSinkClassDB(const am_SinkClass_s& sinkClass, am_sinkClass_t& sinkClassID);
+ am_Error_e enterSourceClassDB(am_sourceClass_t& sourceClassID, const am_SourceClass_s& sourceClass);
+ am_Error_e enterSystemProperties(const std::vector<am_SystemProperty_s>& listSystemProperties);
+ am_Error_e changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID);
+ am_Error_e changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState);
+ am_Error_e changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID);
+ am_Error_e changeSinkAvailabilityDB(const am_Availability_s& availability, const am_sinkID_t sinkID);
+ am_Error_e changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID);
+ am_Error_e changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID);
+ am_Error_e changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID);
+ am_Error_e changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID);
+ am_Error_e changeSourceSoundPropertyDB(const am_SoundProperty_s& soundProperty, const am_sourceID_t sourceID);
+ am_Error_e changeSinkSoundPropertyDB(const am_SoundProperty_s& soundProperty, const am_sinkID_t sinkID);
+ am_Error_e changeSourceAvailabilityDB(const am_Availability_s& availability, const am_sourceID_t sourceID);
+ am_Error_e changeSystemPropertyDB(const am_SystemProperty_s& property);
+ am_Error_e changeDelayMainConnection(const am_timeSync_t & delay, const am_mainConnectionID_t & connectionID);
+ am_Error_e changeSinkClassInfoDB(const am_SinkClass_s& sinkClass);
+ am_Error_e changeSourceClassInfoDB(const am_SourceClass_s& sourceClass);
+ am_Error_e changeConnectionTimingInformation(const am_connectionID_t connectionID, const am_timeSync_t delay);
+ am_Error_e changeConnectionFinal(const am_connectionID_t connectionID);
+ am_Error_e changeSourceState(const am_sourceID_t sourceID, const am_SourceState_e sourceState);
+ am_Error_e changeSinkVolume(const am_sinkID_t sinkID, const am_volume_t volume);
+ am_Error_e changeSourceVolume(const am_sourceID_t sourceID, const am_volume_t volume);
+ am_Error_e changeCrossFaderHotSink(const am_crossfaderID_t crossfaderID, const am_HotSink_e hotsink);
+ am_Error_e removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID);
+ am_Error_e removeSinkDB(const am_sinkID_t sinkID);
+ am_Error_e removeSourceDB(const am_sourceID_t sourceID);
+ am_Error_e removeGatewayDB(const am_gatewayID_t gatewayID);
+ am_Error_e removeCrossfaderDB(const am_crossfaderID_t crossfaderID);
+ am_Error_e removeDomainDB(const am_domainID_t domainID);
+ am_Error_e removeSinkClassDB(const am_sinkClass_t sinkClassID);
+ am_Error_e removeSourceClassDB(const am_sourceClass_t sourceClassID);
+ am_Error_e removeConnection(const am_connectionID_t connectionID);
+ am_Error_e getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s& classInfo) const;
+ am_Error_e getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s& sinkClass) const;
+ am_Error_e getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s& gatewayData) const;
+ am_Error_e getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s& sinkData) const;
+ am_Error_e getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s& sourceData) const;
+ am_Error_e getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s& crossfaderData) const;
+ am_Error_e getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s& mainConnectionData) const;
+ am_Error_e getSinkVolume(const am_sinkID_t sinkID, am_volume_t& volume) const;
+ am_Error_e getSourceVolume(const am_sourceID_t sourceID, am_volume_t& volume) const;
+ am_Error_e getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_SoundPropertyType_e propertyType, int16_t& value) const;
+ am_Error_e getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_SoundPropertyType_e propertyType, int16_t& value) const;
+ am_Error_e getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t>& listSinkID) const;
+ am_Error_e getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t>& listSourceID) const;
+ am_Error_e getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t>& listGatewaysID) const;
+ am_Error_e getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t>& listGatewaysID) const;
+ am_Error_e getListMainConnections(std::vector<am_MainConnection_s>& listMainConnections) const;
+ am_Error_e getListDomains(std::vector<am_Domain_s>& listDomains) const;
+ am_Error_e getListConnections(std::vector<am_Connection_s>& listConnections) const;
+ am_Error_e getListSinks(std::vector<am_Sink_s>& listSinks) const;
+ am_Error_e getListSources(std::vector<am_Source_s>& lisSources) const;
+ am_Error_e getListSourceClasses(std::vector<am_SourceClass_s>& listSourceClasses) const;
+ am_Error_e getListCrossfaders(std::vector<am_Crossfader_s>& listCrossfaders) const;
+ am_Error_e getListGateways(std::vector<am_Gateway_s>& listGateways) const;
+ am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const;
+ am_Error_e getListVisibleMainConnections(std::vector<am_MainConnectionType_s>& listConnections) const;
+ am_Error_e getListMainSinks(std::vector<am_SinkType_s>& listMainSinks) const;
+ am_Error_e getListMainSources(std::vector<am_SourceType_s>& listMainSources) const;
+ am_Error_e getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s>& listSoundProperties) const;
+ am_Error_e getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s>& listSourceProperties) const;
+ am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const;
+ am_Error_e getListSinkConnectionFormats(const am_sinkID_t sinkID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const;
+ am_Error_e getListSourceConnectionFormats(const am_sourceID_t sourceID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const;
+ am_Error_e getListGatewayConnectionFormats(const am_gatewayID_t gatewayID, std::vector<bool> & listConnectionFormat) const;
+ am_Error_e getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t& delay) const;
+ am_Error_e getDomainOfSource(const am_sourceID_t sourceID, am_domainID_t& domainID) const;
+ am_Error_e getDomainOfSink(const am_sinkID_t sinkID, am_domainID_t& domainID) const;
+ am_Error_e getSoureState(const am_sourceID_t sourceID, am_SourceState_e& sourceState) const;
+ am_Error_e getDomainState(const am_domainID_t domainID, am_DomainState_e& state) const;
+ am_Error_e getRoutingTree(bool onlyfree, CAmRoutingTree& tree, std::vector<CAmRoutingTreeItem*>& flatTree);
+ am_Error_e peekDomain(const std::string& name, am_domainID_t& domainID);
+ am_Error_e peekSink(const std::string& name, am_sinkID_t& sinkID);
+ am_Error_e peekSource(const std::string& name, am_sourceID_t& sourceID);
+ am_Error_e peekSinkClassID(const std::string& name, am_sinkClass_t& sinkClassID);
+ am_Error_e peekSourceClassID(const std::string& name, am_sourceClass_t& sourceClassID);
+ am_Error_e changeSourceDB(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_ConnectionFormat_e>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties);
+ am_Error_e changeSinkDB(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_ConnectionFormat_e>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties);
+ am_Error_e getListMainSinkNotificationConfigurations(const am_sinkID_t sinkID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations);
+ am_Error_e getListMainSourceNotificationConfigurations(const am_sourceID_t sourceID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations);
+ am_Error_e changeMainSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s mainNotificationConfiguration);
+ am_Error_e changeMainSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s mainNotificationConfiguration);
+ am_Error_e changeGatewayDB(const am_gatewayID_t gatewayID, const std::vector<am_ConnectionFormat_e>& listSourceConnectionFormats, const std::vector<am_ConnectionFormat_e>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix);
+ am_Error_e changeSinkNotificationConfigurationDB(const am_sinkID_t sinkID,const am_NotificationConfiguration_s notificationConfiguration);
+ am_Error_e changeSourceNotificationConfigurationDB(const am_sourceID_t sourceID,const am_NotificationConfiguration_s notificationConfiguration);
+
+ bool existMainConnection(const am_mainConnectionID_t mainConnectionID) const;
+ bool existcrossFader(const am_crossfaderID_t crossfaderID) const;
+ bool existConnection(const am_Connection_s & connection) const;
+ bool existConnectionID(const am_connectionID_t connectionID) const;
+ bool existSource(const am_sourceID_t sourceID) const;
+ bool existSourceNameOrID(const am_sourceID_t sourceID, const std::string& name) const;
+ bool existSourceName(const std::string& name) const;
+ bool existSink(const am_sinkID_t sinkID) const;
+ bool existSinkNameOrID(const am_sinkID_t sinkID, const std::string& name) const;
+ bool existSinkName(const std::string& name) const;
+ bool existDomain(const am_domainID_t domainID) const;
+ bool existGateway(const am_gatewayID_t gatewayID) const;
+ bool existSinkClass(const am_sinkClass_t sinkClassID) const;
+ bool existSourceClass(const am_sourceClass_t sourceClassID) const;
+ void registerObserver(CAmDatabaseObserver *iObserver);
+ bool sourceVisible(const am_sourceID_t sourceID) const;
+ bool sinkVisible(const am_sinkID_t sinkID) const;
+
+ void dump( std::ostream & output );
+ /**
+ * The following structures extend the base structures with the field 'reserved'.
+ */
+
+#define AM_TYPEDEF_SUBCLASS_BEGIN(Subclass, Class) \
+ typedef struct Subclass : public Class\
+ {\
+ Subclass & operator=(const Subclass & anObject) \
+ {\
+ if (this != &anObject)\
+ {\
+ Class::operator=(anObject);\
+ }\
+ return *this;\
+ };\
+ Subclass & operator=(const Class & anObject)\
+ {\
+ if (this != &anObject)\
+ Class::operator=(anObject);\
+ return *this;\
+ };\
+ void getDescription (std::string & outString) const;\
+
+#define AM_TYPEDEF_SUBCLASS_RESERVED_FLAG_BEGIN(Subclass, Class) \
+ typedef struct Subclass : public Class\
+ {\
+ bool reserved;\
+ Subclass():Class(), reserved(false)\
+ {};\
+ Subclass & operator=(const Subclass & anObject)\
+ {\
+ if (this != &anObject)\
+ {\
+ Class::operator=(anObject);\
+ reserved = anObject.reserved;\
+ }\
+ return *this;\
+ };\
+ Subclass & operator=(const Class & anObject)\
+ {\
+ if (this != &anObject)\
+ Class::operator=(anObject);\
+ return *this;\
+ };\
+ void getDescription (std::string & outString) const;\
+
+#define AM_TYPEDEF_SUBCLASS_END(Typedef) } Typedef; \
+
+ AM_TYPEDEF_SUBCLASS_RESERVED_FLAG_BEGIN(am_Domain_Database_s,am_Domain_s)
+ AM_TYPEDEF_SUBCLASS_END(CAmDomain)
+
+ AM_TYPEDEF_SUBCLASS_RESERVED_FLAG_BEGIN(am_Sink_Database_s,am_Sink_s)
+ void getSinkType(am_SinkType_s & sinkType) const;\
+ AM_TYPEDEF_SUBCLASS_END(CAmSink)
+
+ AM_TYPEDEF_SUBCLASS_RESERVED_FLAG_BEGIN(am_Source_Database_s,am_Source_s)
+ void getSourceType(am_SourceType_s & sourceType) const;\
+ AM_TYPEDEF_SUBCLASS_END(CAmSource)
+
+ AM_TYPEDEF_SUBCLASS_RESERVED_FLAG_BEGIN(am_Connection_Database_s,am_Connection_s)
+ AM_TYPEDEF_SUBCLASS_END(CAmConnection)
+
+ /**
+ * The following structures extend the base structures with print capabilities.
+ */
+ AM_TYPEDEF_SUBCLASS_BEGIN(am_MainConnection_Database_s, am_MainConnection_s)
+ void getMainConnectionType(am_MainConnectionType_s & connectionType) const;\
+ AM_TYPEDEF_SUBCLASS_END(CAmMainConnection)
+
+ AM_TYPEDEF_SUBCLASS_BEGIN(am_SourceClass_Database_s, am_SourceClass_s)
+ AM_TYPEDEF_SUBCLASS_END(CAmSourceClass)
+
+ AM_TYPEDEF_SUBCLASS_BEGIN(am_SinkClass_Database_s, am_SinkClass_s)
+ AM_TYPEDEF_SUBCLASS_END(CAmSinkClass)
+
+ AM_TYPEDEF_SUBCLASS_BEGIN(am_Gateway_Database_s, am_Gateway_s)
+ AM_TYPEDEF_SUBCLASS_END(CAmGateway)
+
+ AM_TYPEDEF_SUBCLASS_BEGIN(am_Crossfader_Database_s, am_Crossfader_s)
+ AM_TYPEDEF_SUBCLASS_END(CAmCrossfader)
+
+ private:
+
+ typedef AM_MAP<am_domainID_t, CAmDomain> CAmMapDomain;
+ typedef AM_MAP<am_sourceClass_t, CAmSourceClass> CAmMapSourceClass;
+ typedef AM_MAP<am_sinkClass_t, CAmSinkClass> CAmMapSinkClass;
+ typedef AM_MAP<am_sinkID_t, CAmSink> CAmMapSink;
+ typedef AM_MAP<am_sourceID_t, CAmSource> CAmMapSource;
+ typedef AM_MAP<am_gatewayID_t, CAmGateway> CAmMapGateway;
+ typedef AM_MAP<am_crossfaderID_t, CAmCrossfader> CAmMapCrossfader;
+ typedef AM_MAP<am_connectionID_t, CAmConnection> CAmMapConnection;
+ typedef AM_MAP<am_mainConnectionID_t, CAmMainConnection> CAmMapMainConnection;
+ typedef std::vector<am_SystemProperty_s> CAmVectorSystemProperties;
+ typedef struct CAmMappedData
+ {
+ int16_t mCurrentDomainID;
+ int16_t mCurrentSourceClassesID;
+ int16_t mCurrentSinkClassesID;
+ int16_t mCurrentSinkID;
+ int16_t mCurrentSourceID;
+ int16_t mCurrentGatewayID;
+ int16_t mCurrentCrossfaderID;
+ int16_t mCurrentConnectionID;
+ int16_t mCurrentMainConnectionID;
+ int16_t mDefaultIDLimit;
+
+ CAmVectorSystemProperties mSystemProperties;
+ CAmMapDomain mDomainMap;
+ CAmMapSourceClass mSourceClassesMap;
+ CAmMapSinkClass mSinkClassesMap;
+ CAmMapSink mSinkMap;
+ CAmMapSource mSourceMap;
+ CAmMapGateway mGatewayMap;
+ CAmMapCrossfader mCrossfaderMap;
+ CAmMapConnection mConnectionMap;
+ CAmMapMainConnection mMainConnectionMap;
+
+ CAmMappedData(): //For Domain, MainConnections, Connections we don't have static IDs.
+ mCurrentDomainID(1), mCurrentSourceClassesID(DYNAMIC_ID_BOUNDARY), mCurrentSinkClassesID(DYNAMIC_ID_BOUNDARY),
+ mCurrentSinkID(DYNAMIC_ID_BOUNDARY), mCurrentSourceID(DYNAMIC_ID_BOUNDARY), mCurrentGatewayID(DYNAMIC_ID_BOUNDARY),
+ mCurrentCrossfaderID(DYNAMIC_ID_BOUNDARY), mCurrentConnectionID(1), mCurrentMainConnectionID(1),
+ mDefaultIDLimit(SHRT_MAX),
+
+ mSystemProperties(),
+ mDomainMap(),mSourceClassesMap(), mSinkClassesMap(), mSinkMap(AM_MAP_CAPACITY), mSourceMap(AM_MAP_CAPACITY),
+ mGatewayMap(), mCrossfaderMap(), mConnectionMap(), mMainConnectionMap()
+ {};
+
+ bool increaseID(int16_t * resultID, int16_t * sourceID,
+ int16_t const desiredStaticID, int16_t const preferedStaticIDBoundary );
+ template <class TPrintObject> void print (const TPrintObject & t, std::ostream & output) const
+ {
+ std::string description("");
+ t.getDescription( description );
+ output << description;
+ }
+ template <typename TPrintMapKey,class TPrintMapObject> void printMap (const AM_MAP<TPrintMapKey, TPrintMapObject> & t, std::ostream & output) const
+ {
+ typename AM_MAP<TPrintMapKey, TPrintMapObject>::const_iterator iter = t.begin();
+ for(; iter!=t.end(); iter++)
+ print(iter->second, output);
+ }
+ } CAmMappedData;
+
+ CAmMappedData mMappedData;
+
+ am_timeSync_t calculateMainConnectionDelay(const am_mainConnectionID_t mainConnectionID) const; //!< calculates a new main connection delay
+ int16_t calculateDelayForRoute(const std::vector<am_connectionID_t>& listConnectionID);
+ bool insertSinkDB(const am_Sink_s & sinkData, am_sinkID_t & sinkID);
+ bool insertCrossfaderDB(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID);
+ bool insertGatewayDB(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID);
+ bool insertSourceDB(const am_Source_s & sourceData, am_sourceID_t & sourceID);
+ bool insertSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID);
+ bool insertSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass);
+};
+
+}
+
+#endif /* MAPHANDLER_H_ */
*
* \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
*
- * \file CAmDatabaseHandler.h
+ * \file CAmDatabaseHandlerSQLite.h
* For further information see http://www.genivi.org/.
*
*/
#ifndef DATABASEHANDLER_H_
#define DATABASEHANDLER_H_
-#include "CAmDatabaseHandlerInterface.h"
+#include "IAmDatabaseHandler.h"
#include <map>
#include <sqlite3.h>
/**
* This class handles and abstracts the database
*/
-class CAmDatabaseHandler : public CAmDatabaseHandlerInterface
+class CAmDatabaseHandlerSQLite : public IAmDatabaseHandler
{
private:
am_timeSync_t calculateMainConnectionDelay(const am_mainConnectionID_t mainConnectionID) const; //!< calculates a new main connection delay
+
+ CAmDatabaseObserver *mpDatabaseObserver; //!< pointer to the Observer
+ bool mFirstStaticSink; //!< bool for dynamic range handling
+ bool mFirstStaticSource; //!< bool for dynamic range handling
+ bool mFirstStaticGateway; //!< bool for dynamic range handling
+ bool mFirstStaticSinkClass; //!< bool for dynamic range handling
+ bool mFirstStaticSourceClass; //!< bool for dynamic range handling
+ bool mFirstStaticCrossfader; //!< bool for dynamic range handling
+ ListConnectionFormat mListConnectionFormat; //!< list of connection formats
+ sqlite3 *mpDatabase; //!< pointer to the database
+ std::string mPath; //!< path to the database
bool sqQuery(const std::string& query); //!< queries the database
bool openDatabase(); //!< opens the database
void createTables(); //!< creates all tables from the static table
- sqlite3 *mpDatabase; //!< pointer to the database
- std::string mPath; //!< path to the database
-
public:
- CAmDatabaseHandler();
- CAmDatabaseHandler(std::string databasePath);
- ~CAmDatabaseHandler();
+ CAmDatabaseHandlerSQLite();
+ CAmDatabaseHandlerSQLite(std::string databasePath);
+ virtual ~CAmDatabaseHandlerSQLite();
am_Error_e enterDomainDB(const am_Domain_s& domainData, am_domainID_t& domainID);
am_Error_e enterMainConnectionDB(const am_MainConnection_s& mainConnectionData, am_mainConnectionID_t& connectionID);
am_Error_e enterSinkDB(const am_Sink_s& sinkData, am_sinkID_t& sinkID);
void registerObserver(CAmDatabaseObserver *iObserver);
bool sourceVisible(const am_sourceID_t sourceID) const;
bool sinkVisible(const am_sinkID_t sinkID) const;
+ void dump( std::ostream & output) { output << __FUNCTION__ << " not implemented!"; };
};
}
namespace am
{
-class CAmDatabaseHandlerInterface;
+class IAmDatabaseHandler;
class CAmControlSender;
/**
class CAmRouter
{
public:
- CAmRouter(CAmDatabaseHandlerInterface* iDatabaseHandler, CAmControlSender* iSender);
+ CAmRouter(IAmDatabaseHandler* iDatabaseHandler, CAmControlSender* iSender);
~CAmRouter();
am_Error_e getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s>& returnList);
am_Error_e findBestWay(am_sinkID_t sinkID, am_sourceID_t sourceID, std::vector<am_RoutingElement_s>& listRoute, std::vector<am_RoutingElement_s>::iterator routeIterator, std::vector<am_gatewayID_t>::iterator gatewayIterator);
void listPossibleConnectionFormats(const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_ConnectionFormat_e>& listFormats) const;
void listRestrictedOutputFormatsGateways(const am_gatewayID_t gatewayID, const am_ConnectionFormat_e sinkConnectionFormat, std::vector<am_ConnectionFormat_e>& listFormats) const;
- CAmDatabaseHandlerInterface* mpDatabaseHandler; //!< pointer to database handler
+ IAmDatabaseHandler* mpDatabaseHandler; //!< pointer to database handler
CAmControlSender* mpControlSender; //!< pointer the controlsender - is used to retrieve information for the optimal route
};
class CAmSocketHandler;
class CAmDbusWrapper;
-class CAmDatabaseHandlerInterface;
+class IAmDatabaseHandler;
class CAmRoutingSender;
class CAmControlSender;
class CAmRoutingReceiver: public IAmRoutingReceive
{
public:
- CAmRoutingReceiver(CAmDatabaseHandlerInterface *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler);
- CAmRoutingReceiver(CAmDatabaseHandlerInterface *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler, CAmDbusWrapper *iDBusWrapper);
+ CAmRoutingReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler);
+ CAmRoutingReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler, CAmDbusWrapper *iDBusWrapper);
~CAmRoutingReceiver();
void ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error);
void ackDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error);
void waitOnRundown(bool rundown); //!< tells the RoutingReceiver to start waiting for all handles to be confirmed
private:
- CAmDatabaseHandlerInterface *mpDatabaseHandler; //!< pointer to the databaseHandler
+ IAmDatabaseHandler *mpDatabaseHandler; //!< pointer to the databaseHandler
CAmRoutingSender *mpRoutingSender; //!< pointer to the routingSender
CAmControlSender *mpControlSender; //!< pointer to the controlSender
CAmSocketHandler *mpSocketHandler; //!< pointer to sockethandler
{
class CAmTelnetServer;
-class CAmDatabaseHandlerInterface;
+class IAmDatabaseHandler;
class CAmCommandSender;
class CAmRoutingSender;
class CAmControlSender;
eRootState = 0, eListState, eInfoState, eGetState, eSetState
};
- CAmTelnetMenuHelper(CAmSocketHandler *iSocketHandler, CAmCommandSender *iCommandSender, CAmCommandReceiver *iCommandReceiver, CAmRoutingSender *iRoutingSender, CAmRoutingReceiver *iRoutingReceiver, CAmControlSender *iControlSender, CAmControlReceiver *iControlReceiver, CAmDatabaseHandlerInterface *iDatabasehandler, CAmRouter *iRouter, CAmTelnetServer *iTelnetServer);
+ CAmTelnetMenuHelper(CAmSocketHandler *iSocketHandler, CAmCommandSender *iCommandSender, CAmCommandReceiver *iCommandReceiver, CAmRoutingSender *iRoutingSender, CAmRoutingReceiver *iRoutingReceiver, CAmControlSender *iControlSender, CAmControlReceiver *iControlReceiver, IAmDatabaseHandler *iDatabasehandler, CAmRouter *iRouter, CAmTelnetServer *iTelnetServer);
~CAmTelnetMenuHelper();
CAmRoutingReceiver *mpRoutingReceiver;
CAmControlSender *mpControlSender;
CAmControlReceiver *mpControlReceiver;
- CAmDatabaseHandlerInterface *mpDatabasehandler;
+ IAmDatabaseHandler *mpDatabasehandler;
CAmRouter *mpRouter;
tCommandMap mRootCommands;
namespace am
{
-class CAmDatabaseHandlerInterface;
+class IAmDatabaseHandler;
class CAmCommandSender;
class CAmRoutingSender;
class CAmControlSender;
class CAmTelnetServer
{
public:
- CAmTelnetServer(CAmSocketHandler *iSocketHandler, CAmCommandSender *iCommandSender, CAmCommandReceiver *iCommandReceiver, CAmRoutingSender *iRoutingSender, CAmRoutingReceiver *iRoutingReceiver, CAmControlSender *iControlSender, CAmControlReceiver *iControlReceiver, CAmDatabaseHandlerInterface *iDatabasehandler, CAmRouter *iRouter, unsigned int servPort, unsigned int maxConnections);
+ CAmTelnetServer(CAmSocketHandler *iSocketHandler, CAmCommandSender *iCommandSender, CAmCommandReceiver *iCommandReceiver, CAmRoutingSender *iRoutingSender, CAmRoutingReceiver *iRoutingReceiver, CAmControlSender *iControlSender, CAmControlReceiver *iControlReceiver, IAmDatabaseHandler *iDatabasehandler, CAmRouter *iRouter, unsigned int servPort, unsigned int maxConnections);
~CAmTelnetServer();
void connectSocket(const pollfd pfd, const sh_pollHandle_t handle, void* userData);
void disconnectClient(int filedescriptor);
CAmRoutingReceiver *mpRoutingReceiver;
CAmControlSender *mpControlSender;
CAmControlReceiver *mpControlReceiver;
- CAmDatabaseHandlerInterface *mpDatabasehandler;
+ IAmDatabaseHandler *mpDatabasehandler;
CAmRouter *mpRouter;
sh_pollHandle_t mConnecthandle;
std::queue<std::string> mListMessages;
* This class handles and abstracts the database
*/
-class CAmDatabaseHandlerInterface
+class IAmDatabaseHandler
{
protected:
virtual am_timeSync_t calculateMainConnectionDelay(const am_mainConnectionID_t mainConnectionID) const = 0; //!< calculates a new main connection delay
- CAmDatabaseObserver *mpDatabaseObserver; //!< pointer to the Observer
- bool mFirstStaticSink; //!< bool for dynamic range handling
- bool mFirstStaticSource; //!< bool for dynamic range handling
- bool mFirstStaticGateway; //!< bool for dynamic range handling
- bool mFirstStaticSinkClass; //!< bool for dynamic range handling
- bool mFirstStaticSourceClass; //!< bool for dynamic range handling
- bool mFirstStaticCrossfader; //!< bool for dynamic range handling
- ListConnectionFormat mListConnectionFormat; //!< list of connection formats
-
public:
- CAmDatabaseHandlerInterface(): mpDatabaseObserver(NULL), //
- mFirstStaticSink(true), //
- mFirstStaticSource(true), //
- mFirstStaticGateway(true), //
- mFirstStaticSinkClass(true), //
- mFirstStaticSourceClass(true), //
- mFirstStaticCrossfader(true), //
- mListConnectionFormat()
- {};
- virtual ~CAmDatabaseHandlerInterface() {};
+// IAmDatabaseHandler();
+// virtual ~IAmDatabaseHandler();
virtual am_Error_e enterDomainDB(const am_Domain_s& domainData, am_domainID_t& domainID) = 0;
virtual am_Error_e enterMainConnectionDB(const am_MainConnection_s& mainConnectionData, am_mainConnectionID_t& connectionID) = 0;
virtual bool sourceVisible(const am_sourceID_t sourceID) const = 0;
virtual bool sinkVisible(const am_sinkID_t sinkID) const = 0;
- virtual void dump( std::ostream & output) { output << __FUNCTION__ << " not implemented!"; };
+ virtual void dump( std::ostream & output) = 0 ;
};
}
#include "CAmCommandReceiver.h"
#include <cassert>
#include <algorithm>
-#include "CAmDatabaseHandlerInterface.h"
+#include "IAmDatabaseHandler.h"
#include "CAmControlSender.h"
#include "shared/CAmDltWrapper.h"
#include "shared/CAmSocketHandler.h"
namespace am
{
-CAmCommandReceiver::CAmCommandReceiver(CAmDatabaseHandlerInterface *iDatabaseHandler, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler) :
+CAmCommandReceiver::CAmCommandReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler) :
mDatabaseHandler(iDatabaseHandler), //
mControlSender(iControlSender), //
mDBusWrapper(NULL), //
assert(mControlSender!=NULL);
}
-CAmCommandReceiver::CAmCommandReceiver(CAmDatabaseHandlerInterface *iDatabaseHandler, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler, CAmDbusWrapper *iDBusWrapper) :
+CAmCommandReceiver::CAmCommandReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler, CAmDbusWrapper *iDBusWrapper) :
mDatabaseHandler(iDatabaseHandler), //
mControlSender(iControlSender), //
mDBusWrapper(iDBusWrapper), //
#include <stdlib.h>
#include <stdexcept>
#include "config.h"
-#include "CAmDatabaseHandlerInterface.h"
+#include "IAmDatabaseHandler.h"
#include "CAmRoutingSender.h"
#include "CAmCommandSender.h"
#include "CAmRouter.h"
namespace am {
-CAmControlReceiver::CAmControlReceiver(CAmDatabaseHandlerInterface *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmCommandSender *iCommandSender, CAmSocketHandler *iSocketHandler, CAmRouter* iRouter, CAmNodeStateCommunicator* iNodeStateCommunicator) :
+CAmControlReceiver::CAmControlReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmCommandSender *iCommandSender, CAmSocketHandler *iSocketHandler, CAmRouter* iRouter, CAmNodeStateCommunicator* iNodeStateCommunicator) :
mDatabaseHandler(iDatabaseHandler), //
mRoutingSender(iRoutingSender), //
mCommandSender(iCommandSender), //
assert(iNodeStateCommunicator!=NULL);
}
-CAmControlReceiver::CAmControlReceiver(CAmDatabaseHandlerInterface *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmCommandSender *iCommandSender, CAmSocketHandler *iSocketHandler, CAmRouter* iRouter) :
+CAmControlReceiver::CAmControlReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmCommandSender *iCommandSender, CAmSocketHandler *iSocketHandler, CAmRouter* iRouter) :
mDatabaseHandler(iDatabaseHandler), //
mRoutingSender(iRoutingSender), //
mCommandSender(iCommandSender), //
*
* \author Aleksandar Donchev, aleksander.donchev@partner.bmw.de BMW 2013
*
- * \file CAmMapHandler.cpp
+ * \file CAmDatabaseHandlerMap.cpp
* For further information see http://www.genivi.org/.
*
*/
-#include "CAmMapHandler.h"
+#include "CAmDatabaseHandlerMap.h"
#include <iostream>
#include <cassert>
#include <stdexcept>
bool compareSinkObjectByName(const void *anObject, const void *aValue, void *)
{
- return (anObject && aValue)?((const std::string *)aValue)->compare(((const CAmMapHandler::am_Sink_Database_s *)anObject)->name)==0:false;
+ return (anObject && aValue)?((const std::string *)aValue)->compare(((const CAmDatabaseHandlerMap::am_Sink_Database_s *)anObject)->name)==0:false;
}
bool compareSourceObjectByName(const void *anObject, const void *aValue, void *)
{
- return (anObject && aValue)?((const std::string *)aValue)->compare(((const CAmMapHandler::am_Source_Database_s *)anObject)->name)==0:false;
+ return (anObject && aValue)?((const std::string *)aValue)->compare(((const CAmDatabaseHandlerMap::am_Source_Database_s *)anObject)->name)==0:false;
}
bool compareSinkClassObjectByName(const void *anObject, const void *aValue, void *)
if(anObject && aValue)
{
bool flag = (contextOrNull!=NULL)?*((bool*)contextOrNull):true;
- return flag==((const CAmMapHandler::am_Sink_Database_s *)anObject)->reserved &&
+ return flag==((const CAmDatabaseHandlerMap::am_Sink_Database_s *)anObject)->reserved &&
((const std::string *)aValue)->compare(((const am_Sink_s *)anObject)->name)==0;
}
return false;
{
if(anObject && aValue)
{
- return 0==((const CAmMapHandler::am_Connection_Database_s *)anObject)->reserved &&
- ((const CAmMapHandler::am_Connection_Database_s *)aValue)->sinkID == ((const CAmMapHandler::am_Connection_Database_s *)anObject)->sinkID &&
- ((const CAmMapHandler::am_Connection_Database_s *)aValue)->sourceID == ((const CAmMapHandler::am_Connection_Database_s *)anObject)->sourceID &&
- ((const CAmMapHandler::am_Connection_Database_s *)aValue)->connectionFormat == ((const CAmMapHandler::am_Connection_Database_s *)anObject)->connectionFormat;
+ return 0==((const CAmDatabaseHandlerMap::am_Connection_Database_s *)anObject)->reserved &&
+ ((const CAmDatabaseHandlerMap::am_Connection_Database_s *)aValue)->sinkID == ((const CAmDatabaseHandlerMap::am_Connection_Database_s *)anObject)->sinkID &&
+ ((const CAmDatabaseHandlerMap::am_Connection_Database_s *)aValue)->sourceID == ((const CAmDatabaseHandlerMap::am_Connection_Database_s *)anObject)->sourceID &&
+ ((const CAmDatabaseHandlerMap::am_Connection_Database_s *)aValue)->connectionFormat == ((const CAmDatabaseHandlerMap::am_Connection_Database_s *)anObject)->connectionFormat;
}
return false;
}
if(anObject && aValue)
{
bool flag = (contextOrNull!=NULL)?*((bool*)contextOrNull):true;
- return flag==((const CAmMapHandler::am_Source_Database_s *)anObject)->reserved &&
- ((const std::string *)aValue)->compare(((const CAmMapHandler::am_Source_Database_s *)anObject)->name)==0;
+ return flag==((const CAmDatabaseHandlerMap::am_Source_Database_s *)anObject)->reserved &&
+ ((const std::string *)aValue)->compare(((const CAmDatabaseHandlerMap::am_Source_Database_s *)anObject)->name)==0;
}
return false;
}
/* Domain */
-void CAmMapHandler::CAmDomain::getDescription (std::string & outString) const
+void CAmDatabaseHandlerMap::CAmDomain::getDescription (std::string & outString) const
{
std::ostringstream fmt;
fmt << "Domain(" << name.c_str() << ") id(" << domainID << ")" << std::endl <<
/* Source */
-void CAmMapHandler::CAmSource::getSourceType(am_SourceType_s & sourceType) const
+void CAmDatabaseHandlerMap::CAmSource::getSourceType(am_SourceType_s & sourceType) const
{
sourceType.name = name;
sourceType.sourceClassID = sourceClassID;
sourceType.sourceID = sourceID;
}
-void CAmMapHandler::CAmSource::getDescription (std::string & outString) const
+void CAmDatabaseHandlerMap::CAmSource::getDescription (std::string & outString) const
{
std::ostringstream fmt;
fmt << "Source(" << name.c_str() << ") id(" << sourceID << ")" << std::endl <<
/* Sink */
-void CAmMapHandler::CAmSink::getDescription (std::string & outString) const
+void CAmDatabaseHandlerMap::CAmSink::getDescription (std::string & outString) const
{
std::ostringstream fmt;
fmt << "Sink(" << name.c_str() << ") id(" << sinkID << ")" << std::endl <<
outString = fmt.str();
}
-void CAmMapHandler::CAmSink::getSinkType(am_SinkType_s & sinkType) const
+void CAmDatabaseHandlerMap::CAmSink::getSinkType(am_SinkType_s & sinkType) const
{
sinkType.name = name;
sinkType.sinkID = sinkID;
/* Connection */
-void CAmMapHandler::CAmConnection::getDescription (std::string & outString) const
+void CAmDatabaseHandlerMap::CAmConnection::getDescription (std::string & outString) const
{
std::ostringstream fmt;
fmt << "Connection id(" << connectionID << ") " << std::endl <<
/* Main Connection */
-void CAmMapHandler::CAmMainConnection::getDescription (std::string & outString) const
+void CAmDatabaseHandlerMap::CAmMainConnection::getDescription (std::string & outString) const
{
std::ostringstream fmt;
fmt << "MainConnection id(" << mainConnectionID << ") " << std::endl <<
outString = fmt.str();
}
-void CAmMapHandler::am_MainConnection_Database_s::getMainConnectionType(am_MainConnectionType_s & connectionType) const
+void CAmDatabaseHandlerMap::am_MainConnection_Database_s::getMainConnectionType(am_MainConnectionType_s & connectionType) const
{
connectionType.mainConnectionID = mainConnectionID;
connectionType.sourceID = sourceID;
/* Source Class */
-void CAmMapHandler::CAmSourceClass::getDescription (std::string & outString) const
+void CAmDatabaseHandlerMap::CAmSourceClass::getDescription (std::string & outString) const
{
std::ostringstream fmt;
fmt << "Source class(" << name.c_str() << ") id(" << sourceClassID << ")\n" <<
/* Sink Class */
-void CAmMapHandler::CAmSinkClass::getDescription (std::string & outString) const
+void CAmDatabaseHandlerMap::CAmSinkClass::getDescription (std::string & outString) const
{
std::ostringstream fmt;
fmt << "Sink class(" << name.c_str() << ") id(" << sinkClassID << ")\n" <<
/* Gateway */
-void CAmMapHandler::CAmGateway::getDescription (std::string & outString) const
+void CAmDatabaseHandlerMap::CAmGateway::getDescription (std::string & outString) const
{
std::ostringstream fmt;
fmt << "Gateway(" << name.c_str() << ") id(" << gatewayID << ")\n" <<
/* Crossfader */
-void CAmMapHandler::CAmCrossfader::getDescription (std::string & outString) const
+void CAmDatabaseHandlerMap::CAmCrossfader::getDescription (std::string & outString) const
{
std::ostringstream fmt;
fmt << "Crossfader(" << name.c_str() << ") id(" << crossfaderID << ")\n" <<
outString = fmt.str();
}
-template <typename TPrintMapKey,class TPrintMapObject> void CAmMapHandler::printMap (const AM_MAP<TPrintMapKey, TPrintMapObject> & t, std::ostream & output) const
-{
- typename AM_MAP<TPrintMapKey, TPrintMapObject>::const_iterator iter = t.begin();
- for(; iter!=t.end(); iter++)
- print(iter->second, output);
-}
-
-template <class TPrintObject> void CAmMapHandler::print (const TPrintObject & t, std::ostream & output) const
-{
- std::string description("");
- t.getDescription( description );
- output << description;
-}
-
-bool CAmMapHandler::CAmMappedData::increaseID(int16_t * resultID, int16_t * sourceID,
+bool CAmDatabaseHandlerMap::CAmMappedData::increaseID(int16_t * resultID, int16_t * sourceID,
int16_t const desiredStaticID = 0, int16_t const preferedStaticIDBoundary = DYNAMIC_ID_BOUNDARY)
{
if( desiredStaticID > 0 && desiredStaticID < preferedStaticIDBoundary )
*resultID = desiredStaticID;
return true;
}
- else if( *sourceID < mDefaultIDLimit-1 ) //SHRT_MAX or the max limit is reserved and not used!!!
+ else if( *sourceID < mDefaultIDLimit-1 ) //The last used value is the 'limit' - 1. e.g. SHRT_MAX - 1, SHRT_MAX is reserved.
{
*resultID = (*sourceID)++;
return true;
return (o.str());
}
-CAmMapHandler::CAmMapHandler():CAmDatabaseHandlerInterface(), mMappedData()
+CAmDatabaseHandlerMap::CAmDatabaseHandlerMap():mpDatabaseObserver(NULL), //
+ mFirstStaticSink(true), //
+ mFirstStaticSource(true), //
+ mFirstStaticGateway(true), //
+ mFirstStaticSinkClass(true), //
+ mFirstStaticSourceClass(true), //
+ mFirstStaticCrossfader(true), //
+ mListConnectionFormat(), //
+ mMappedData()
{
logInfo(__PRETTY_FUNCTION__,"Init");
}
-CAmMapHandler::~CAmMapHandler()
+CAmDatabaseHandlerMap::~CAmDatabaseHandlerMap()
{
logInfo(__PRETTY_FUNCTION__,"Destroy");
+ mpDatabaseObserver = NULL;
}
-am_Error_e CAmMapHandler::enterDomainDB(const am_Domain_s & domainData, am_domainID_t & domainID)
+am_Error_e CAmDatabaseHandlerMap::enterDomainDB(const am_Domain_s & domainData, am_domainID_t & domainID)
{
assert(domainData.domainID==0);
assert(!domainData.name.empty());
}
}
-int16_t CAmMapHandler::calculateDelayForRoute(const std::vector<am_connectionID_t>& listConnectionID)
+int16_t CAmDatabaseHandlerMap::calculateDelayForRoute(const std::vector<am_connectionID_t>& listConnectionID)
{
int16_t delay = 0;
std::vector<am_connectionID_t>::const_iterator elementIterator = listConnectionID.begin();
return delay;
}
-am_Error_e CAmMapHandler::enterMainConnectionDB(const am_MainConnection_s & mainConnectionData, am_mainConnectionID_t & connectionID)
+am_Error_e CAmDatabaseHandlerMap::enterMainConnectionDB(const am_MainConnection_s & mainConnectionData, am_mainConnectionID_t & connectionID)
{
assert(mainConnectionData.mainConnectionID==0);
assert(mainConnectionData.connectionState>=CS_UNKNOWN && mainConnectionData.connectionState<=CS_MAX);
* Helper method, that inserts a new struct in the map and copies the given into it.
* This method uses the increaseID function to secure the global id is properly increased.
**/
-bool CAmMapHandler::insertSinkDB(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
+bool CAmDatabaseHandlerMap::insertSinkDB(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
{
int16_t nextID = 0;
if( mMappedData.increaseID(&nextID, &mMappedData.mCurrentSinkID, sinkData.sinkID) )
}
}
-am_Error_e CAmMapHandler::enterSinkDB(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
+am_Error_e CAmDatabaseHandlerMap::enterSinkDB(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
{
assert(sinkData.sinkID<DYNAMIC_ID_BOUNDARY);
assert(sinkData.domainID!=0);
return (E_OK);
}
-bool CAmMapHandler::insertCrossfaderDB(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
+bool CAmDatabaseHandlerMap::insertCrossfaderDB(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
{
int16_t nextID = 0;
if(mMappedData.increaseID(&nextID, &mMappedData.mCurrentCrossfaderID, crossfaderData.crossfaderID))
}
}
-am_Error_e CAmMapHandler::enterCrossfaderDB(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
+am_Error_e CAmDatabaseHandlerMap::enterCrossfaderDB(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
{
assert(crossfaderData.crossfaderID<DYNAMIC_ID_BOUNDARY);
assert(crossfaderData.hotSink>=HS_UNKNOWN && crossfaderData.hotSink<=HS_MAX);
return (E_OK);
}
-bool CAmMapHandler::insertGatewayDB(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
+bool CAmDatabaseHandlerMap::insertGatewayDB(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
{
int16_t nextID = 0;
if(mMappedData.increaseID(&nextID, &mMappedData.mCurrentGatewayID, gatewayData.gatewayID))
}
}
-am_Error_e CAmMapHandler::enterGatewayDB(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
+am_Error_e CAmDatabaseHandlerMap::enterGatewayDB(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
{
assert(gatewayData.gatewayID<DYNAMIC_ID_BOUNDARY);
assert(gatewayData.sinkID!=0);
return (E_OK);
}
-void CAmMapHandler::dump( std::ostream & output )
+void CAmDatabaseHandlerMap::dump( std::ostream & output )
{
output << std::endl << "****************** DUMP START ******************" << std::endl;
- printMap(mMappedData.mDomainMap, output);
- printMap(mMappedData.mSourceMap, output);
- printMap(mMappedData.mSinkMap, output);
- printMap(mMappedData.mSourceClassesMap, output);
- printMap(mMappedData.mSinkClassesMap, output);
- printMap(mMappedData.mConnectionMap, output);
- printMap(mMappedData.mMainConnectionMap, output);
- printMap(mMappedData.mCrossfaderMap, output);
- printMap(mMappedData.mGatewayMap, output);
+ mMappedData.printMap(mMappedData.mDomainMap, output);
+ mMappedData.printMap(mMappedData.mSourceMap, output);
+ mMappedData.printMap(mMappedData.mSinkMap, output);
+ mMappedData.printMap(mMappedData.mSourceClassesMap, output);
+ mMappedData.printMap(mMappedData.mSinkClassesMap, output);
+ mMappedData.printMap(mMappedData.mConnectionMap, output);
+ mMappedData.printMap(mMappedData.mMainConnectionMap, output);
+ mMappedData.printMap(mMappedData.mCrossfaderMap, output);
+ mMappedData.printMap(mMappedData.mGatewayMap, output);
CAmVectorSystemProperties::const_iterator iter = mMappedData.mSystemProperties.begin();
output << "System properties" << "\n";
for(; iter!=mMappedData.mSystemProperties.end(); iter++)
output << std::endl << "****************** DUMP END ******************" << std::endl;
}
-bool CAmMapHandler::insertSourceDB(const am_Source_s & sourceData, am_sourceID_t & sourceID)
+bool CAmDatabaseHandlerMap::insertSourceDB(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
int16_t nextID = 0;
if(mMappedData.increaseID(&nextID, &mMappedData.mCurrentSourceID, sourceData.sourceID))
}
}
-am_Error_e CAmMapHandler::enterSourceDB(const am_Source_s & sourceData, am_sourceID_t & sourceID)
+am_Error_e CAmDatabaseHandlerMap::enterSourceDB(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
assert(sourceData.sourceID<DYNAMIC_ID_BOUNDARY);
assert(sourceData.domainID!=0);
return (E_OK);
}
-am_Error_e CAmMapHandler::enterConnectionDB(const am_Connection_s& connection, am_connectionID_t& connectionID)
+am_Error_e CAmDatabaseHandlerMap::enterConnectionDB(const am_Connection_s& connection, am_connectionID_t& connectionID)
{
assert(connection.connectionID==0);
assert(connection.sinkID!=0);
return (E_OK);
}
-bool CAmMapHandler::insertSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID)
+bool CAmDatabaseHandlerMap::insertSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID)
{
int16_t nextID = 0;
if(mMappedData.increaseID(&nextID, &mMappedData.mCurrentSinkClassesID, sinkClass.sinkClassID))
}
}
-am_Error_e CAmMapHandler::enterSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID)
+am_Error_e CAmDatabaseHandlerMap::enterSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID)
{
assert(sinkClass.sinkClassID<DYNAMIC_ID_BOUNDARY);
assert(!sinkClass.name.empty());
return (E_OK);
}
-bool CAmMapHandler::insertSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass)
+bool CAmDatabaseHandlerMap::insertSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass)
{
int16_t nextID = 0;
if(mMappedData.increaseID(&nextID, &mMappedData.mCurrentSourceClassesID, sourceClass.sourceClassID))
}
}
-am_Error_e CAmMapHandler::enterSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass)
+am_Error_e CAmDatabaseHandlerMap::enterSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass)
{
assert(sourceClass.sourceClassID<DYNAMIC_ID_BOUNDARY);
assert(!sourceClass.name.empty());
return (E_OK);
}
-am_Error_e CAmMapHandler::enterSystemProperties(const std::vector<am_SystemProperty_s> & listSystemProperties)
+am_Error_e CAmDatabaseHandlerMap::enterSystemProperties(const std::vector<am_SystemProperty_s> & listSystemProperties)
{
assert(!listSystemProperties.empty());
return (E_OK);
}
-am_Error_e CAmMapHandler::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID)
+am_Error_e CAmDatabaseHandlerMap::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID)
{
assert(mainconnectionID!=0);
if (!existMainConnection(mainconnectionID))
return (E_OK);
}
-am_Error_e CAmMapHandler::changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState)
+am_Error_e CAmDatabaseHandlerMap::changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState)
{
assert(mainconnectionID!=0);
assert(connectionState>=CS_UNKNOWN && connectionState<=CS_MAX);
return (E_OK);
}
-am_Error_e CAmMapHandler::changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID)
+am_Error_e CAmDatabaseHandlerMap::changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID)
{
assert(sinkID!=0);
return (E_OK);
}
-am_Error_e CAmMapHandler::changeSinkAvailabilityDB(const am_Availability_s & availability, const am_sinkID_t sinkID)
+am_Error_e CAmDatabaseHandlerMap::changeSinkAvailabilityDB(const am_Availability_s & availability, const am_sinkID_t sinkID)
{
assert(sinkID!=0);
assert(availability.availability>=A_UNKNOWN && availability.availability<=A_MAX);
return (E_OK);
}
-am_Error_e CAmMapHandler::changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID)
+am_Error_e CAmDatabaseHandlerMap::changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID)
{
assert(domainID!=0);
assert(domainState>=DS_UNKNOWN && domainState<=DS_MAX);
return (E_OK);
}
-am_Error_e CAmMapHandler::changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID)
+am_Error_e CAmDatabaseHandlerMap::changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID)
{
assert(sinkID!=0);
assert(muteState>=MS_UNKNOWN && muteState<=MS_MAX);
return (E_OK);
}
-am_Error_e CAmMapHandler::changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sinkID_t sinkID)
+am_Error_e CAmDatabaseHandlerMap::changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sinkID_t sinkID)
{
assert(soundProperty.type>=MSP_UNKNOWN && soundProperty.type<=MSP_MAX);
assert(sinkID!=0);
return (E_OK);
}
-am_Error_e CAmMapHandler::changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sourceID_t sourceID)
+am_Error_e CAmDatabaseHandlerMap::changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sourceID_t sourceID)
{
assert(soundProperty.type>=MSP_UNKNOWN && soundProperty.type<=MSP_MAX);
assert(sourceID!=0);
return (E_OK);
}
-am_Error_e CAmMapHandler::changeSourceAvailabilityDB(const am_Availability_s & availability, const am_sourceID_t sourceID)
+am_Error_e CAmDatabaseHandlerMap::changeSourceAvailabilityDB(const am_Availability_s & availability, const am_sourceID_t sourceID)
{
assert(sourceID!=0);
assert(availability.availability>=A_UNKNOWN && availability.availability<=A_MAX);
return (E_OK);
}
-am_Error_e CAmMapHandler::changeSystemPropertyDB(const am_SystemProperty_s & property)
+am_Error_e CAmDatabaseHandlerMap::changeSystemPropertyDB(const am_SystemProperty_s & property)
{
assert(property.type>=SYP_UNKNOWN && property.type<=SYP_MAX);
return (E_OK);
}
-am_Error_e CAmMapHandler::removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID)
+am_Error_e CAmDatabaseHandlerMap::removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID)
{
assert(mainConnectionID!=0);
return (E_OK);
}
-am_Error_e CAmMapHandler::removeSinkDB(const am_sinkID_t sinkID)
+am_Error_e CAmDatabaseHandlerMap::removeSinkDB(const am_sinkID_t sinkID)
{
assert(sinkID!=0);
return (E_OK);
}
-am_Error_e CAmMapHandler::removeSourceDB(const am_sourceID_t sourceID)
+am_Error_e CAmDatabaseHandlerMap::removeSourceDB(const am_sourceID_t sourceID)
{
assert(sourceID!=0);
return (E_OK);
}
-am_Error_e CAmMapHandler::removeGatewayDB(const am_gatewayID_t gatewayID)
+am_Error_e CAmDatabaseHandlerMap::removeGatewayDB(const am_gatewayID_t gatewayID)
{
assert(gatewayID!=0);
return (E_OK);
}
-am_Error_e CAmMapHandler::removeCrossfaderDB(const am_crossfaderID_t crossfaderID)
+am_Error_e CAmDatabaseHandlerMap::removeCrossfaderDB(const am_crossfaderID_t crossfaderID)
{
assert(crossfaderID!=0);
return (E_OK);
}
-am_Error_e CAmMapHandler::removeDomainDB(const am_domainID_t domainID)
+am_Error_e CAmDatabaseHandlerMap::removeDomainDB(const am_domainID_t domainID)
{
assert(domainID!=0);
return (E_OK);
}
-am_Error_e CAmMapHandler::removeSinkClassDB(const am_sinkClass_t sinkClassID)
+am_Error_e CAmDatabaseHandlerMap::removeSinkClassDB(const am_sinkClass_t sinkClassID)
{
assert(sinkClassID!=0);
return (E_OK);
}
-am_Error_e CAmMapHandler::removeSourceClassDB(const am_sourceClass_t sourceClassID)
+am_Error_e CAmDatabaseHandlerMap::removeSourceClassDB(const am_sourceClass_t sourceClassID)
{
assert(sourceClassID!=0);
return (E_OK);
}
-am_Error_e CAmMapHandler::removeConnection(const am_connectionID_t connectionID)
+am_Error_e CAmDatabaseHandlerMap::removeConnection(const am_connectionID_t connectionID)
{
assert(connectionID!=0);
return (E_OK);
}
-am_Error_e CAmMapHandler::getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s & classInfo) const
+am_Error_e CAmDatabaseHandlerMap::getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s & classInfo) const
{
assert(sourceID!=0);
return (E_OK);
}
-am_Error_e CAmMapHandler::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s & sinkData) const
+am_Error_e CAmDatabaseHandlerMap::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s & sinkData) const
{
assert(sinkID!=0);
return (E_OK);
}
-am_Error_e CAmMapHandler::getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s & sourceData) const
+am_Error_e CAmDatabaseHandlerMap::getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s & sourceData) const
{
assert(sourceID!=0);
return (E_OK);
}
-am_Error_e am::CAmMapHandler::getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s & mainConnectionData) const
+am_Error_e am::CAmDatabaseHandlerMap::getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s & mainConnectionData) const
{
assert(mainConnectionID!=0);
if (!existMainConnection(mainConnectionID))
return (E_OK);
}
-am_Error_e CAmMapHandler::changeSinkClassInfoDB(const am_SinkClass_s& sinkClass)
+am_Error_e CAmDatabaseHandlerMap::changeSinkClassInfoDB(const am_SinkClass_s& sinkClass)
{
assert(sinkClass.sinkClassID!=0);
assert(!sinkClass.listClassProperties.empty());
return (E_OK);
}
-am_Error_e CAmMapHandler::changeSourceClassInfoDB(const am_SourceClass_s& sourceClass)
+am_Error_e CAmDatabaseHandlerMap::changeSourceClassInfoDB(const am_SourceClass_s& sourceClass)
{
assert(sourceClass.sourceClassID!=0);
assert(!sourceClass.listClassProperties.empty());
return (E_OK);
}
-am_Error_e CAmMapHandler::getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s & sinkClass) const
+am_Error_e CAmDatabaseHandlerMap::getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s & sinkClass) const
{
assert(sinkID!=0);
return (E_OK);
}
-am_Error_e CAmMapHandler::getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s & gatewayData) const
+am_Error_e CAmDatabaseHandlerMap::getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s & gatewayData) const
{
assert(gatewayID!=0);
if (!existGateway(gatewayID))
}
-am_Error_e CAmMapHandler::getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s & crossfaderData) const
+am_Error_e CAmDatabaseHandlerMap::getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s & crossfaderData) const
{
assert(crossfaderID!=0);
if (!existcrossFader(crossfaderID))
return (E_OK);
}
-am_Error_e CAmMapHandler::getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t> & listSinkID) const
+am_Error_e CAmDatabaseHandlerMap::getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t> & listSinkID) const
{
assert(domainID!=0);
listSinkID.clear();
return (E_OK);
}
-am_Error_e CAmMapHandler::getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t> & listSourceID) const
+am_Error_e CAmDatabaseHandlerMap::getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t> & listSourceID) const
{
assert(domainID!=0);
listSourceID.clear();
return (E_OK);
}
-am_Error_e CAmMapHandler::getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t> & listCrossfader) const
+am_Error_e CAmDatabaseHandlerMap::getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t> & listCrossfader) const
{
assert(domainID!=0);
listCrossfader.clear();
}
-am_Error_e CAmMapHandler::getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t> & listGatewaysID) const
+am_Error_e CAmDatabaseHandlerMap::getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t> & listGatewaysID) const
{
assert(domainID!=0);
listGatewaysID.clear();
return (E_OK);
}
-am_Error_e CAmMapHandler::getListMainConnections(std::vector<am_MainConnection_s> & listMainConnections) const
+am_Error_e CAmDatabaseHandlerMap::getListMainConnections(std::vector<am_MainConnection_s> & listMainConnections) const
{
listMainConnections.clear();
return (E_OK);
}
-am_Error_e CAmMapHandler::getListDomains(std::vector<am_Domain_s> & listDomains) const
+am_Error_e CAmDatabaseHandlerMap::getListDomains(std::vector<am_Domain_s> & listDomains) const
{
listDomains.clear();
return (E_OK);
}
-am_Error_e CAmMapHandler::getListConnections(std::vector<am_Connection_s> & listConnections) const
+am_Error_e CAmDatabaseHandlerMap::getListConnections(std::vector<am_Connection_s> & listConnections) const
{
listConnections.clear();
return (E_OK);
}
-am_Error_e CAmMapHandler::getListSinks(std::vector<am_Sink_s> & listSinks) const
+am_Error_e CAmDatabaseHandlerMap::getListSinks(std::vector<am_Sink_s> & listSinks) const
{
listSinks.clear();
return (E_OK);
}
-am_Error_e CAmMapHandler::getListSources(std::vector<am_Source_s> & listSources) const
+am_Error_e CAmDatabaseHandlerMap::getListSources(std::vector<am_Source_s> & listSources) const
{
listSources.clear();
return (E_OK);
}
-am_Error_e CAmMapHandler::getListSourceClasses(std::vector<am_SourceClass_s> & listSourceClasses) const
+am_Error_e CAmDatabaseHandlerMap::getListSourceClasses(std::vector<am_SourceClass_s> & listSourceClasses) const
{
listSourceClasses.clear();
return (E_OK);
}
-am_Error_e CAmMapHandler::getListCrossfaders(std::vector<am_Crossfader_s> & listCrossfaders) const
+am_Error_e CAmDatabaseHandlerMap::getListCrossfaders(std::vector<am_Crossfader_s> & listCrossfaders) const
{
listCrossfaders.clear();
return (E_OK);
}
-am_Error_e CAmMapHandler::getListGateways(std::vector<am_Gateway_s> & listGateways) const
+am_Error_e CAmDatabaseHandlerMap::getListGateways(std::vector<am_Gateway_s> & listGateways) const
{
listGateways.clear();
return (E_OK);
}
-am_Error_e CAmMapHandler::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
+am_Error_e CAmDatabaseHandlerMap::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
{
listSinkClasses.clear();
return (E_OK);
}
-am_Error_e CAmMapHandler::getListVisibleMainConnections(std::vector<am_MainConnectionType_s> & listConnections) const
+am_Error_e CAmDatabaseHandlerMap::getListVisibleMainConnections(std::vector<am_MainConnectionType_s> & listConnections) const
{
listConnections.clear();
am_MainConnectionType_s temp;
return (E_OK);
}
-am_Error_e CAmMapHandler::getListMainSinks(std::vector<am_SinkType_s> & listMainSinks) const
+am_Error_e CAmDatabaseHandlerMap::getListMainSinks(std::vector<am_SinkType_s> & listMainSinks) const
{
listMainSinks.clear();
am_SinkType_s sinkType;
return (E_OK);
}
-am_Error_e CAmMapHandler::getListMainSources(std::vector<am_SourceType_s> & listMainSources) const
+am_Error_e CAmDatabaseHandlerMap::getListMainSources(std::vector<am_SourceType_s> & listMainSources) const
{
listMainSources.clear();
am_SourceType_s temp;
return (E_OK);
}
-am_Error_e CAmMapHandler::getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s> & listSoundProperties) const
+am_Error_e CAmDatabaseHandlerMap::getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s> & listSoundProperties) const
{
assert(sinkID!=0);
if (!existSink(sinkID))
return (E_OK);
}
-am_Error_e CAmMapHandler::getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s> & listSourceProperties) const
+am_Error_e CAmDatabaseHandlerMap::getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s> & listSourceProperties) const
{
assert(sourceID!=0);
if (!existSource(sourceID))
return (E_OK);
}
-am_Error_e CAmMapHandler::getListSystemProperties(std::vector<am_SystemProperty_s> & listSystemProperties) const
+am_Error_e CAmDatabaseHandlerMap::getListSystemProperties(std::vector<am_SystemProperty_s> & listSystemProperties) const
{
listSystemProperties = mMappedData.mSystemProperties;
return (E_OK);
}
-am_Error_e am::CAmMapHandler::getListSinkConnectionFormats(const am_sinkID_t sinkID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const
+am_Error_e am::CAmDatabaseHandlerMap::getListSinkConnectionFormats(const am_sinkID_t sinkID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const
{
if (!existSink(sinkID))
return E_NON_EXISTENT;
return (E_OK);
}
-am_Error_e am::CAmMapHandler::getListSourceConnectionFormats(const am_sourceID_t sourceID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const
+am_Error_e am::CAmDatabaseHandlerMap::getListSourceConnectionFormats(const am_sourceID_t sourceID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const
{
if (!existSource(sourceID))
return E_NON_EXISTENT;
return (E_OK);
}
-am_Error_e am::CAmMapHandler::getListGatewayConnectionFormats(const am_gatewayID_t gatewayID, std::vector<bool> & listConnectionFormat) const
+am_Error_e am::CAmDatabaseHandlerMap::getListGatewayConnectionFormats(const am_gatewayID_t gatewayID, std::vector<bool> & listConnectionFormat) const
{
ListConnectionFormat::const_iterator iter = mListConnectionFormat.begin();
iter = mListConnectionFormat.find(gatewayID);
return (E_OK);
}
-am_Error_e CAmMapHandler::getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t & delay) const
+am_Error_e CAmDatabaseHandlerMap::getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t & delay) const
{
assert(mainConnectionID!=0);
if (!existMainConnection(mainConnectionID))
return (E_OK);
}
-am_Error_e CAmMapHandler::changeDelayMainConnection(const am_timeSync_t & delay, const am_mainConnectionID_t & connectionID)
+am_Error_e CAmDatabaseHandlerMap::changeDelayMainConnection(const am_timeSync_t & delay, const am_mainConnectionID_t & connectionID)
{
assert(connectionID!=0);
if (!existMainConnection(connectionID))
* @param mainConnectionID to be checked for
* @return true if it exists
*/
-bool CAmMapHandler::existMainConnection(const am_mainConnectionID_t mainConnectionID) const
+bool CAmDatabaseHandlerMap::existMainConnection(const am_mainConnectionID_t mainConnectionID) const
{
return existsObjectWithKeyInMap(mainConnectionID, mMappedData.mMainConnectionMap);
}
* @param sourceID to be checked for
* @return true if it exists
*/
-bool CAmMapHandler::existSource(const am_sourceID_t sourceID) const
+bool CAmDatabaseHandlerMap::existSource(const am_sourceID_t sourceID) const
{
am_Source_Database_s const * source = objectWithKeyIfExistsInMap(sourceID, mMappedData.mSourceMap);
if( NULL!=source )
* @param name the name
* @return true if it exits
*/
-bool CAmMapHandler::existSourceNameOrID(const am_sourceID_t sourceID, const std::string & name) const
+bool CAmDatabaseHandlerMap::existSourceNameOrID(const am_sourceID_t sourceID, const std::string & name) const
{
bool returnVal = false;
CAmMapSource::const_iterator elementIterator = mMappedData.mSourceMap.begin();
* @param name the name
* @return true if it exits
*/
-bool CAmMapHandler::existSourceName(const std::string & name) const
+bool CAmDatabaseHandlerMap::existSourceName(const std::string & name) const
{
return existSourceNameOrID(SHRT_MAX, name);
}
* @param sinkID to be checked for
* @return true if it exists
*/
-bool CAmMapHandler::existSink(const am_sinkID_t sinkID) const
+bool CAmDatabaseHandlerMap::existSink(const am_sinkID_t sinkID) const
{
bool returnVal = false;
CAmMapSink::const_iterator elementIterator = mMappedData.mSinkMap.begin();
* @param name the name
* @return true if it exists.
*/
-bool CAmMapHandler::existSinkNameOrID(const am_sinkID_t sinkID, const std::string & name) const
+bool CAmDatabaseHandlerMap::existSinkNameOrID(const am_sinkID_t sinkID, const std::string & name) const
{
bool returnVal = false;
CAmMapSink::const_iterator elementIterator = mMappedData.mSinkMap.begin();
* @param name the name
* @return true if it exists
*/
-bool CAmMapHandler::existSinkName(const std::string & name) const
+bool CAmDatabaseHandlerMap::existSinkName(const std::string & name) const
{
return existSinkNameOrID(SHRT_MAX, name);
}
* @param domainID to be checked for
* @return true if it exists
*/
-bool CAmMapHandler::existDomain(const am_domainID_t domainID) const
+bool CAmDatabaseHandlerMap::existDomain(const am_domainID_t domainID) const
{
am_Domain_Database_s const * source = objectWithKeyIfExistsInMap(domainID, mMappedData.mDomainMap);
if( NULL!=source )
* @param gatewayID to be checked for
* @return true if it exists
*/
-bool CAmMapHandler::existGateway(const am_gatewayID_t gatewayID) const
+bool CAmDatabaseHandlerMap::existGateway(const am_gatewayID_t gatewayID) const
{
return existsObjectWithKeyInMap(gatewayID, mMappedData.mGatewayMap);
}
-am_Error_e CAmMapHandler::getDomainOfSource(const am_sourceID_t sourceID, am_domainID_t & domainID) const
+am_Error_e CAmDatabaseHandlerMap::getDomainOfSource(const am_sourceID_t sourceID, am_domainID_t & domainID) const
{
assert(sourceID!=0);
return E_NON_EXISTENT;
}
-am_Error_e am::CAmMapHandler::getDomainOfSink(const am_sinkID_t sinkID, am_domainID_t & domainID) const
+am_Error_e am::CAmDatabaseHandlerMap::getDomainOfSink(const am_sinkID_t sinkID, am_domainID_t & domainID) const
{
assert(sinkID!=0);
* @param sinkClassID
* @return true if it exists
*/
-bool CAmMapHandler::existSinkClass(const am_sinkClass_t sinkClassID) const
+bool CAmDatabaseHandlerMap::existSinkClass(const am_sinkClass_t sinkClassID) const
{
return existsObjectWithKeyInMap(sinkClassID, mMappedData.mSinkClassesMap);
}
* @param sourceClassID
* @return true if it exists
*/
-bool CAmMapHandler::existSourceClass(const am_sourceClass_t sourceClassID) const
+bool CAmDatabaseHandlerMap::existSourceClass(const am_sourceClass_t sourceClassID) const
{
return existsObjectWithKeyInMap(sourceClassID, mMappedData.mSourceClassesMap);
}
-am_Error_e CAmMapHandler::changeConnectionTimingInformation(const am_connectionID_t connectionID, const am_timeSync_t delay)
+am_Error_e CAmDatabaseHandlerMap::changeConnectionTimingInformation(const am_connectionID_t connectionID, const am_timeSync_t delay)
{
assert(connectionID!=0);
if(!existConnectionID(connectionID))
return (E_OK);
}
-am_Error_e CAmMapHandler::changeConnectionFinal(const am_connectionID_t connectionID)
+am_Error_e CAmDatabaseHandlerMap::changeConnectionFinal(const am_connectionID_t connectionID)
{
assert(connectionID!=0);
am_Connection_Database_s const * connection = objectWithKeyIfExistsInMap(connectionID, mMappedData.mConnectionMap);
return (E_NON_EXISTENT);
}
-am_timeSync_t CAmMapHandler::calculateMainConnectionDelay(const am_mainConnectionID_t mainConnectionID) const
+am_timeSync_t CAmDatabaseHandlerMap::calculateMainConnectionDelay(const am_mainConnectionID_t mainConnectionID) const
{
assert(mainConnectionID!=0);
if (!existMainConnection(mainConnectionID))
* registers the Observer at the Database
* @param iObserver pointer to the observer
*/
-void CAmMapHandler::registerObserver(CAmDatabaseObserver *iObserver)
+void CAmDatabaseHandlerMap::registerObserver(CAmDatabaseObserver *iObserver)
{
assert(iObserver!=NULL);
mpDatabaseObserver = iObserver;
* @param sourceID the sourceID
* @return true if source is visible
*/
-bool CAmMapHandler::sourceVisible(const am_sourceID_t sourceID) const
+bool CAmDatabaseHandlerMap::sourceVisible(const am_sourceID_t sourceID) const
{
assert(sourceID!=0);
if (!existSource(sourceID))
* @param sinkID the sinkID
* @return true if source is visible
*/
-bool CAmMapHandler::sinkVisible(const am_sinkID_t sinkID) const
+bool CAmDatabaseHandlerMap::sinkVisible(const am_sinkID_t sinkID) const
{
am_Sink_Database_s const * source = objectWithKeyIfExistsInMap(sinkID, mMappedData.mSinkMap);
if( NULL!=source )
* @param connection the connection to be checked
* @return true if connections exists
*/
-bool CAmMapHandler::existConnection(const am_Connection_s & connection) const
+bool CAmDatabaseHandlerMap::existConnection(const am_Connection_s & connection) const
{
am_Connection_Database_s const * connectionObject = findFirstObjectMatchingCriteria(mMappedData.mConnectionMap, connection, compareConnectionObjectsWithObject);
return ( NULL!=connectionObject );
* @param connectionID
* @return true if connection exits
*/
-bool CAmMapHandler::existConnectionID(const am_connectionID_t connectionID) const
+bool CAmDatabaseHandlerMap::existConnectionID(const am_connectionID_t connectionID) const
{
am_Connection_Database_s const * connection = objectWithKeyIfExistsInMap(connectionID, mMappedData.mConnectionMap);
if( NULL!=connection )
* @param crossfaderID the ID of the crossfader to be checked
* @return true if exists
*/
-bool CAmMapHandler::existcrossFader(const am_crossfaderID_t crossfaderID) const
+bool CAmDatabaseHandlerMap::existcrossFader(const am_crossfaderID_t crossfaderID) const
{
return existsObjectWithKeyInMap(crossfaderID, mMappedData.mCrossfaderMap);
}
-am_Error_e CAmMapHandler::getSoureState(const am_sourceID_t sourceID, am_SourceState_e & sourceState) const
+am_Error_e CAmDatabaseHandlerMap::getSoureState(const am_sourceID_t sourceID, am_SourceState_e & sourceState) const
{
am_Source_Database_s const * source = objectWithKeyIfExistsInMap(sourceID, mMappedData.mSourceMap);
if( NULL!=source )
}
}
-am_Error_e CAmMapHandler::changeSourceState(const am_sourceID_t sourceID, const am_SourceState_e sourceState)
+am_Error_e CAmDatabaseHandlerMap::changeSourceState(const am_sourceID_t sourceID, const am_SourceState_e sourceState)
{
assert(sourceID!=0);
assert(sourceState>=SS_UNKNNOWN && sourceState<=SS_MAX);
return (E_NON_EXISTENT);
}
-am_Error_e CAmMapHandler::getSinkVolume(const am_sinkID_t sinkID, am_volume_t & volume) const
+am_Error_e CAmDatabaseHandlerMap::getSinkVolume(const am_sinkID_t sinkID, am_volume_t & volume) const
{
assert(sinkID!=0);
return (E_NON_EXISTENT);
}
-am_Error_e CAmMapHandler::getSourceVolume(const am_sourceID_t sourceID, am_volume_t & volume) const
+am_Error_e CAmDatabaseHandlerMap::getSourceVolume(const am_sourceID_t sourceID, am_volume_t & volume) const
{
assert(sourceID!=0);
am_Source_Database_s const * source = objectWithKeyIfExistsInMap(sourceID, mMappedData.mSourceMap);
return (E_NON_EXISTENT);
}
-am_Error_e CAmMapHandler::getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_SoundPropertyType_e propertyType, int16_t & value) const
+am_Error_e CAmDatabaseHandlerMap::getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_SoundPropertyType_e propertyType, int16_t & value) const
{
assert(sinkID!=0);
return (E_NON_EXISTENT);
}
-am_Error_e CAmMapHandler::getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_SoundPropertyType_e propertyType, int16_t & value) const
+am_Error_e CAmDatabaseHandlerMap::getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_SoundPropertyType_e propertyType, int16_t & value) const
{
assert(sourceID!=0);
return (E_NON_EXISTENT);
}
-am_Error_e CAmMapHandler::getDomainState(const am_domainID_t domainID, am_DomainState_e& state) const
+am_Error_e CAmDatabaseHandlerMap::getDomainState(const am_domainID_t domainID, am_DomainState_e& state) const
{
assert(domainID!=0);
return (E_NON_EXISTENT);
}
-am_Error_e CAmMapHandler::peekDomain(const std::string & name, am_domainID_t & domainID)
+am_Error_e CAmDatabaseHandlerMap::peekDomain(const std::string & name, am_domainID_t & domainID)
{
domainID=0;
return (E_OK);
}
-am_Error_e CAmMapHandler::peekSink(const std::string & name, am_sinkID_t & sinkID)
+am_Error_e CAmDatabaseHandlerMap::peekSink(const std::string & name, am_sinkID_t & sinkID)
{
am_Sink_Database_s const *reservedSink = findFirstObjectMatchingCriteria(mMappedData.mSinkMap, name, compareSinkObjectByName);
if( NULL!=reservedSink )
}
}
-am_Error_e CAmMapHandler::peekSource(const std::string & name, am_sourceID_t & sourceID)
+am_Error_e CAmDatabaseHandlerMap::peekSource(const std::string & name, am_sourceID_t & sourceID)
{
am_Source_Database_s const *reservedDomain = findFirstObjectMatchingCriteria(mMappedData.mSourceMap, name, compareSourceObjectByName);
if( NULL!=reservedDomain )
}
}
-am_Error_e CAmMapHandler::changeSinkVolume(const am_sinkID_t sinkID, const am_volume_t volume)
+am_Error_e CAmDatabaseHandlerMap::changeSinkVolume(const am_sinkID_t sinkID, const am_volume_t volume)
{
assert(sinkID!=0);
return (E_OK);
}
-am_Error_e CAmMapHandler::changeSourceVolume(const am_sourceID_t sourceID, const am_volume_t volume)
+am_Error_e CAmDatabaseHandlerMap::changeSourceVolume(const am_sourceID_t sourceID, const am_volume_t volume)
{
assert(sourceID!=0);
if (!existSource(sourceID))
return (E_OK);
}
-am_Error_e CAmMapHandler::changeSourceSoundPropertyDB(const am_SoundProperty_s & soundProperty, const am_sourceID_t sourceID)
+am_Error_e CAmDatabaseHandlerMap::changeSourceSoundPropertyDB(const am_SoundProperty_s & soundProperty, const am_sourceID_t sourceID)
{
assert(soundProperty.type>=SP_UNKNOWN && soundProperty.type<=SP_MAX);
assert(sourceID!=0);
return (E_NON_EXISTENT);
}
-am_Error_e CAmMapHandler::changeSinkSoundPropertyDB(const am_SoundProperty_s & soundProperty, const am_sinkID_t sinkID)
+am_Error_e CAmDatabaseHandlerMap::changeSinkSoundPropertyDB(const am_SoundProperty_s & soundProperty, const am_sinkID_t sinkID)
{
assert(soundProperty.type>=SP_UNKNOWN && soundProperty.type<=SP_MAX);
assert(sinkID!=0);
return (E_NON_EXISTENT);
}
-am_Error_e CAmMapHandler::changeCrossFaderHotSink(const am_crossfaderID_t crossfaderID, const am_HotSink_e hotsink)
+am_Error_e CAmDatabaseHandlerMap::changeCrossFaderHotSink(const am_crossfaderID_t crossfaderID, const am_HotSink_e hotsink)
{
assert(crossfaderID!=0);
assert(hotsink>=HS_UNKNOWN && hotsink>=HS_MAX);
return (E_OK);
}
-am_Error_e CAmMapHandler::getRoutingTree(bool onlyfree, CAmRoutingTree& tree, std::vector<CAmRoutingTreeItem*>& flatTree)
+am_Error_e CAmDatabaseHandlerMap::getRoutingTree(bool onlyfree, CAmRoutingTree& tree, std::vector<CAmRoutingTreeItem*>& flatTree)
{
am_domainID_t rootID = tree.returnRootDomainID();
CAmRoutingTreeItem *parent = tree.returnRootItem();
return (E_OK);
}
-am_Error_e am::CAmMapHandler::peekSinkClassID(const std::string & name, am_sinkClass_t & sinkClassID)
+am_Error_e am::CAmDatabaseHandlerMap::peekSinkClassID(const std::string & name, am_sinkClass_t & sinkClassID)
{
if (name.empty())
return (E_NON_EXISTENT);
return (E_NON_EXISTENT);
}
-am_Error_e am::CAmMapHandler::peekSourceClassID(const std::string & name, am_sourceClass_t & sourceClassID)
+am_Error_e am::CAmDatabaseHandlerMap::peekSourceClassID(const std::string & name, am_sourceClass_t & sourceClassID)
{
if (name.empty())
return (E_NON_EXISTENT);
}
-am_Error_e CAmMapHandler::changeSourceDB(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_ConnectionFormat_e>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties)
+am_Error_e CAmDatabaseHandlerMap::changeSourceDB(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_ConnectionFormat_e>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties)
{
assert(sourceID!=0);
}
-am_Error_e CAmMapHandler::changeSinkDB(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_ConnectionFormat_e>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties)
+am_Error_e CAmDatabaseHandlerMap::changeSinkDB(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_ConnectionFormat_e>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties)
{
assert(sinkID!=0);
return (E_OK);
}
-am_Error_e CAmMapHandler::getListMainSinkNotificationConfigurations(const am_sinkID_t sinkID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations)
+am_Error_e CAmDatabaseHandlerMap::getListMainSinkNotificationConfigurations(const am_sinkID_t sinkID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations)
{
assert(sinkID!=0);
if (!existSink(sinkID))
return (E_OK);
}
-am_Error_e CAmMapHandler::getListMainSourceNotificationConfigurations(const am_sourceID_t sourceID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations)
+am_Error_e CAmDatabaseHandlerMap::getListMainSourceNotificationConfigurations(const am_sourceID_t sourceID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations)
{
assert(sourceID!=0);
if (!existSource(sourceID))
return changed;
}
-am_Error_e CAmMapHandler::changeMainSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s mainNotificationConfiguration)
+am_Error_e CAmDatabaseHandlerMap::changeMainSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s mainNotificationConfiguration)
{
assert(sinkID!=0);
return (E_OK);
}
-am_Error_e CAmMapHandler::changeMainSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s mainNotificationConfiguration)
+am_Error_e CAmDatabaseHandlerMap::changeMainSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s mainNotificationConfiguration)
{
assert(sourceID!=0);
return (E_OK);
}
-am_Error_e CAmMapHandler::changeGatewayDB(const am_gatewayID_t gatewayID, const std::vector<am_ConnectionFormat_e>& listSourceConnectionFormats, const std::vector<am_ConnectionFormat_e>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix)
+am_Error_e CAmDatabaseHandlerMap::changeGatewayDB(const am_gatewayID_t gatewayID, const std::vector<am_ConnectionFormat_e>& listSourceConnectionFormats, const std::vector<am_ConnectionFormat_e>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix)
{
assert(gatewayID!=0);
return changed;
}
-am_Error_e CAmMapHandler::changeSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s notificationConfiguration)
+am_Error_e CAmDatabaseHandlerMap::changeSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s notificationConfiguration)
{
assert(sinkID!=0);
return (E_NON_EXISTENT);
}
-am_Error_e CAmMapHandler::changeSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s notificationConfiguration)
+am_Error_e CAmDatabaseHandlerMap::changeSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s notificationConfiguration)
{
assert(sourceID!=0);
*
* \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
*
- * \file CAmDatabaseHandler.cpp
+ * \file CAmDatabaseHandlerSQLite.cpp
* For further information see http://www.genivi.org/.
*
*/
-#include "CAmDatabaseHandler.h"
+#include "CAmDatabaseHandlerSQLite.h"
#include <cassert>
#include <stdexcept>
#include <vector>
return (o.str());
}
-CAmDatabaseHandler::CAmDatabaseHandler():CAmDatabaseHandlerInterface()
+CAmDatabaseHandlerSQLite::CAmDatabaseHandlerSQLite():mpDatabaseObserver(NULL), //
+ mFirstStaticSink(true), //
+ mFirstStaticSource(true), //
+ mFirstStaticGateway(true), //
+ mFirstStaticSinkClass(true), //
+ mFirstStaticSourceClass(true), //
+ mFirstStaticCrossfader(true), //
+ mListConnectionFormat(),
+ mpDatabase(NULL), //
+ mPath(std::string(""))
{
- mpDatabase = NULL;
- mPath = std::string("");
+
}
-CAmDatabaseHandler::CAmDatabaseHandler(std::string databasePath):CAmDatabaseHandlerInterface(),
- mpDatabase(NULL), //
- mPath(databasePath)
+CAmDatabaseHandlerSQLite::CAmDatabaseHandlerSQLite(std::string databasePath):mpDatabaseObserver(NULL), //
+ mFirstStaticSink(true), //
+ mFirstStaticSource(true), //
+ mFirstStaticGateway(true), //
+ mFirstStaticSinkClass(true), //
+ mFirstStaticSourceClass(true), //
+ mFirstStaticCrossfader(true), //
+ mListConnectionFormat(),
+ mpDatabase(NULL), //
+ mPath(databasePath)
{
-
std::ifstream infile(mPath.c_str());
if (infile)
createTables();
}
-CAmDatabaseHandler::~CAmDatabaseHandler()
+CAmDatabaseHandlerSQLite::~CAmDatabaseHandlerSQLite()
{
logInfo("Closed Database");
- sqlite3_close(mpDatabase);
+ mpDatabaseObserver = NULL;
+ if(mpDatabase)
+ sqlite3_close(mpDatabase);
}
-am_Error_e CAmDatabaseHandler::enterDomainDB(const am_Domain_s & domainData, am_domainID_t & domainID)
+am_Error_e CAmDatabaseHandlerSQLite::enterDomainDB(const am_Domain_s & domainData, am_domainID_t & domainID)
{
assert(domainData.domainID==0);
assert(!domainData.name.empty());
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::enterMainConnectionDB(const am_MainConnection_s & mainConnectionData, am_mainConnectionID_t & connectionID)
+am_Error_e CAmDatabaseHandlerSQLite::enterMainConnectionDB(const am_MainConnection_s & mainConnectionData, am_mainConnectionID_t & connectionID)
{
assert(mainConnectionData.mainConnectionID==0);
assert(mainConnectionData.connectionState>=CS_UNKNOWN && mainConnectionData.connectionState<=CS_MAX);
return (changeDelayMainConnection(delay, connectionID));
}
-am_Error_e CAmDatabaseHandler::enterSinkDB(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
+am_Error_e CAmDatabaseHandlerSQLite::enterSinkDB(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
{
assert(sinkData.sinkID<DYNAMIC_ID_BOUNDARY);
assert(sinkData.domainID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::enterCrossfaderDB(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
+am_Error_e CAmDatabaseHandlerSQLite::enterCrossfaderDB(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
{
assert(crossfaderData.crossfaderID<DYNAMIC_ID_BOUNDARY);
assert(crossfaderData.hotSink>=HS_UNKNOWN && crossfaderData.hotSink<=HS_MAX);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::enterGatewayDB(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
+am_Error_e CAmDatabaseHandlerSQLite::enterGatewayDB(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
{
assert(gatewayData.gatewayID<DYNAMIC_ID_BOUNDARY);
assert(gatewayData.sinkID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::enterSourceDB(const am_Source_s & sourceData, am_sourceID_t & sourceID)
+am_Error_e CAmDatabaseHandlerSQLite::enterSourceDB(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
assert(sourceData.sourceID<DYNAMIC_ID_BOUNDARY);
assert(sourceData.domainID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID)
+am_Error_e CAmDatabaseHandlerSQLite::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID)
{
assert(mainconnectionID!=0);
if (!existMainConnection(mainconnectionID))
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState)
+am_Error_e CAmDatabaseHandlerSQLite::changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState)
{
assert(mainconnectionID!=0);
assert(connectionState>=CS_UNKNOWN && connectionState<=CS_MAX);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID)
+am_Error_e CAmDatabaseHandlerSQLite::changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID)
{
assert(sinkID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeSinkAvailabilityDB(const am_Availability_s & availability, const am_sinkID_t sinkID)
+am_Error_e CAmDatabaseHandlerSQLite::changeSinkAvailabilityDB(const am_Availability_s & availability, const am_sinkID_t sinkID)
{
assert(sinkID!=0);
assert(availability.availability>=A_UNKNOWN && availability.availability<=A_MAX);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID)
+am_Error_e CAmDatabaseHandlerSQLite::changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID)
{
assert(domainID!=0);
assert(domainState>=DS_UNKNOWN && domainState<=DS_MAX);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID)
+am_Error_e CAmDatabaseHandlerSQLite::changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID)
{
assert(sinkID!=0);
assert(muteState>=MS_UNKNOWN && muteState<=MS_MAX);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sinkID_t sinkID)
+am_Error_e CAmDatabaseHandlerSQLite::changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sinkID_t sinkID)
{
assert(soundProperty.type>=MSP_UNKNOWN && soundProperty.type<=MSP_MAX);
assert(sinkID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sourceID_t sourceID)
+am_Error_e CAmDatabaseHandlerSQLite::changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sourceID_t sourceID)
{
assert(soundProperty.type>=MSP_UNKNOWN && soundProperty.type<=MSP_MAX);
assert(sourceID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeSourceAvailabilityDB(const am_Availability_s & availability, const am_sourceID_t sourceID)
+am_Error_e CAmDatabaseHandlerSQLite::changeSourceAvailabilityDB(const am_Availability_s & availability, const am_sourceID_t sourceID)
{
assert(sourceID!=0);
assert(availability.availability>=A_UNKNOWN && availability.availability<=A_MAX);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeSystemPropertyDB(const am_SystemProperty_s & property)
+am_Error_e CAmDatabaseHandlerSQLite::changeSystemPropertyDB(const am_SystemProperty_s & property)
{
assert(property.type>=SYP_UNKNOWN && property.type<=SYP_MAX);
sqlite3_stmt* query = NULL;
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID)
+am_Error_e CAmDatabaseHandlerSQLite::removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID)
{
assert(mainConnectionID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::removeSinkDB(const am_sinkID_t sinkID)
+am_Error_e CAmDatabaseHandlerSQLite::removeSinkDB(const am_sinkID_t sinkID)
{
assert(sinkID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::removeSourceDB(const am_sourceID_t sourceID)
+am_Error_e CAmDatabaseHandlerSQLite::removeSourceDB(const am_sourceID_t sourceID)
{
assert(sourceID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::removeGatewayDB(const am_gatewayID_t gatewayID)
+am_Error_e CAmDatabaseHandlerSQLite::removeGatewayDB(const am_gatewayID_t gatewayID)
{
assert(gatewayID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::removeCrossfaderDB(const am_crossfaderID_t crossfaderID)
+am_Error_e CAmDatabaseHandlerSQLite::removeCrossfaderDB(const am_crossfaderID_t crossfaderID)
{
assert(crossfaderID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::removeDomainDB(const am_domainID_t domainID)
+am_Error_e CAmDatabaseHandlerSQLite::removeDomainDB(const am_domainID_t domainID)
{
assert(domainID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::removeSinkClassDB(const am_sinkClass_t sinkClassID)
+am_Error_e CAmDatabaseHandlerSQLite::removeSinkClassDB(const am_sinkClass_t sinkClassID)
{
assert(sinkClassID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::removeSourceClassDB(const am_sourceClass_t sourceClassID)
+am_Error_e CAmDatabaseHandlerSQLite::removeSourceClassDB(const am_sourceClass_t sourceClassID)
{
assert(sourceClassID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::removeConnection(const am_connectionID_t connectionID)
+am_Error_e CAmDatabaseHandlerSQLite::removeConnection(const am_connectionID_t connectionID)
{
assert(connectionID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s & classInfo) const
+am_Error_e CAmDatabaseHandlerSQLite::getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s & classInfo) const
{
assert(sourceID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s & sinkData) const
+am_Error_e CAmDatabaseHandlerSQLite::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s & sinkData) const
{
assert(sinkID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s & sourceData) const
+am_Error_e CAmDatabaseHandlerSQLite::getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s & sourceData) const
{
assert(sourceID!=0);
return (E_OK);
}
-am_Error_e am::CAmDatabaseHandler::getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s & mainConnectionData) const
+am_Error_e am::CAmDatabaseHandlerSQLite::getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s & mainConnectionData) const
{
assert(mainConnectionID!=0);
if (!existMainConnection(mainConnectionID))
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeSinkClassInfoDB(const am_SinkClass_s& sinkClass)
+am_Error_e CAmDatabaseHandlerSQLite::changeSinkClassInfoDB(const am_SinkClass_s& sinkClass)
{
assert(sinkClass.sinkClassID!=0);
assert(!sinkClass.listClassProperties.empty());
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeSourceClassInfoDB(const am_SourceClass_s& sourceClass)
+am_Error_e CAmDatabaseHandlerSQLite::changeSourceClassInfoDB(const am_SourceClass_s& sourceClass)
{
assert(sourceClass.sourceClassID!=0);
assert(!sourceClass.listClassProperties.empty());
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s & sinkClass) const
+am_Error_e CAmDatabaseHandlerSQLite::getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s & sinkClass) const
{
assert(sinkID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s & gatewayData) const
+am_Error_e CAmDatabaseHandlerSQLite::getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s & gatewayData) const
{
assert(gatewayID!=0);
if (!existGateway(gatewayID))
}
-am_Error_e CAmDatabaseHandler::getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s & crossfaderData) const
+am_Error_e CAmDatabaseHandlerSQLite::getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s & crossfaderData) const
{
assert(crossfaderID!=0);
if (!existcrossFader(crossfaderID))
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t> & listSinkID) const
+am_Error_e CAmDatabaseHandlerSQLite::getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t> & listSinkID) const
{
assert(domainID!=0);
listSinkID.clear();
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t> & listSourceID) const
+am_Error_e CAmDatabaseHandlerSQLite::getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t> & listSourceID) const
{
assert(domainID!=0);
listSourceID.clear();
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t> & listCrossfader) const
+am_Error_e CAmDatabaseHandlerSQLite::getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t> & listCrossfader) const
{
assert(domainID!=0);
listCrossfader.clear();
}
-am_Error_e CAmDatabaseHandler::getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t> & listGatewaysID) const
+am_Error_e CAmDatabaseHandlerSQLite::getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t> & listGatewaysID) const
{
assert(domainID!=0);
listGatewaysID.clear();
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getListMainConnections(std::vector<am_MainConnection_s> & listMainConnections) const
+am_Error_e CAmDatabaseHandlerSQLite::getListMainConnections(std::vector<am_MainConnection_s> & listMainConnections) const
{
listMainConnections.clear();
sqlite3_stmt *query = NULL, *query1 = NULL;
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getListDomains(std::vector<am_Domain_s> & listDomains) const
+am_Error_e CAmDatabaseHandlerSQLite::getListDomains(std::vector<am_Domain_s> & listDomains) const
{
listDomains.clear();
sqlite3_stmt* query = NULL;
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getListConnections(std::vector<am_Connection_s> & listConnections) const
+am_Error_e CAmDatabaseHandlerSQLite::getListConnections(std::vector<am_Connection_s> & listConnections) const
{
listConnections.clear();
sqlite3_stmt* query = NULL;
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getListSinks(std::vector<am_Sink_s> & listSinks) const
+am_Error_e CAmDatabaseHandlerSQLite::getListSinks(std::vector<am_Sink_s> & listSinks) const
{
listSinks.clear();
sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qNotificationConfiguration= NULL, *qMAinSoundProperty = NULL, *qMainNotificationConfiguration= NULL;
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getListSources(std::vector<am_Source_s> & listSources) const
+am_Error_e CAmDatabaseHandlerSQLite::getListSources(std::vector<am_Source_s> & listSources) const
{
listSources.clear();
sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qMAinSoundProperty = NULL, *qNotification(NULL), *qMainNotification(NULL);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getListSourceClasses(std::vector<am_SourceClass_s> & listSourceClasses) const
+am_Error_e CAmDatabaseHandlerSQLite::getListSourceClasses(std::vector<am_SourceClass_s> & listSourceClasses) const
{
listSourceClasses.clear();
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getListCrossfaders(std::vector<am_Crossfader_s> & listCrossfaders) const
+am_Error_e CAmDatabaseHandlerSQLite::getListCrossfaders(std::vector<am_Crossfader_s> & listCrossfaders) const
{
listCrossfaders.clear();
sqlite3_stmt* query = NULL;
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getListGateways(std::vector<am_Gateway_s> & listGateways) const
+am_Error_e CAmDatabaseHandlerSQLite::getListGateways(std::vector<am_Gateway_s> & listGateways) const
{
listGateways.clear();
sqlite3_stmt* query = NULL, *qSinkConnectionFormat = NULL, *qSourceConnectionFormat = NULL;
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
+am_Error_e CAmDatabaseHandlerSQLite::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
{
listSinkClasses.clear();
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getListVisibleMainConnections(std::vector<am_MainConnectionType_s> & listConnections) const
+am_Error_e CAmDatabaseHandlerSQLite::getListVisibleMainConnections(std::vector<am_MainConnectionType_s> & listConnections) const
{
listConnections.clear();
sqlite3_stmt *query = NULL;
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getListMainSinks(std::vector<am_SinkType_s> & listMainSinks) const
+am_Error_e CAmDatabaseHandlerSQLite::getListMainSinks(std::vector<am_SinkType_s> & listMainSinks) const
{
listMainSinks.clear();
sqlite3_stmt* query = NULL;
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getListMainSources(std::vector<am_SourceType_s> & listMainSources) const
+am_Error_e CAmDatabaseHandlerSQLite::getListMainSources(std::vector<am_SourceType_s> & listMainSources) const
{
listMainSources.clear();
sqlite3_stmt* query = NULL;
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s> & listSoundProperties) const
+am_Error_e CAmDatabaseHandlerSQLite::getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s> & listSoundProperties) const
{
assert(sinkID!=0);
if (!existSink(sinkID))
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s> & listSourceProperties) const
+am_Error_e CAmDatabaseHandlerSQLite::getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s> & listSourceProperties) const
{
assert(sourceID!=0);
if (!existSource(sourceID))
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getListSystemProperties(std::vector<am_SystemProperty_s> & listSystemProperties) const
+am_Error_e CAmDatabaseHandlerSQLite::getListSystemProperties(std::vector<am_SystemProperty_s> & listSystemProperties) const
{
listSystemProperties.clear();
return (E_OK);
}
-am_Error_e am::CAmDatabaseHandler::getListSinkConnectionFormats(const am_sinkID_t sinkID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const
+am_Error_e am::CAmDatabaseHandlerSQLite::getListSinkConnectionFormats(const am_sinkID_t sinkID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const
{
listConnectionFormats.clear();
sqlite3_stmt *qConnectionFormat = NULL;
return (E_OK);
}
-am_Error_e am::CAmDatabaseHandler::getListSourceConnectionFormats(const am_sourceID_t sourceID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const
+am_Error_e am::CAmDatabaseHandlerSQLite::getListSourceConnectionFormats(const am_sourceID_t sourceID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const
{
listConnectionFormats.clear();
sqlite3_stmt* qConnectionFormat = NULL;
return (E_OK);
}
-am_Error_e am::CAmDatabaseHandler::getListGatewayConnectionFormats(const am_gatewayID_t gatewayID, std::vector<bool> & listConnectionFormat) const
+am_Error_e am::CAmDatabaseHandlerSQLite::getListGatewayConnectionFormats(const am_gatewayID_t gatewayID, std::vector<bool> & listConnectionFormat) const
{
ListConnectionFormat::const_iterator iter = mListConnectionFormat.begin();
iter = mListConnectionFormat.find(gatewayID);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t & delay) const
+am_Error_e CAmDatabaseHandlerSQLite::getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t & delay) const
{
assert(mainConnectionID!=0);
delay = -1;
return (E_OK);
}
-bool CAmDatabaseHandler::sqQuery(const std::string& query)
+bool CAmDatabaseHandlerSQLite::sqQuery(const std::string& query)
{
sqlite3_stmt* statement;
int eCode = 0;
return (true);
}
-bool CAmDatabaseHandler::openDatabase()
+bool CAmDatabaseHandlerSQLite::openDatabase()
{
if (sqlite3_open_v2(mPath.c_str(), &mpDatabase, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX, NULL) == SQLITE_OK)
{
return (false);
}
-am_Error_e CAmDatabaseHandler::changeDelayMainConnection(const am_timeSync_t & delay, const am_mainConnectionID_t & connectionID)
+am_Error_e CAmDatabaseHandlerSQLite::changeDelayMainConnection(const am_timeSync_t & delay, const am_mainConnectionID_t & connectionID)
{
assert(connectionID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::enterConnectionDB(const am_Connection_s& connection, am_connectionID_t& connectionID)
+am_Error_e CAmDatabaseHandlerSQLite::enterConnectionDB(const am_Connection_s& connection, am_connectionID_t& connectionID)
{
assert(connection.connectionID==0);
assert(connection.sinkID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::enterSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID)
+am_Error_e CAmDatabaseHandlerSQLite::enterSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID)
{
assert(sinkClass.sinkClassID<DYNAMIC_ID_BOUNDARY);
assert(!sinkClass.name.empty());
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::enterSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass)
+am_Error_e CAmDatabaseHandlerSQLite::enterSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass)
{
assert(sourceClass.sourceClassID<DYNAMIC_ID_BOUNDARY);
assert(!sourceClass.name.empty());
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::enterSystemProperties(const std::vector<am_SystemProperty_s> & listSystemProperties)
+am_Error_e CAmDatabaseHandlerSQLite::enterSystemProperties(const std::vector<am_SystemProperty_s> & listSystemProperties)
{
assert(!listSystemProperties.empty());
sqlite3_stmt* query = NULL;
* @param mainConnectionID to be checked for
* @return true if it exists
*/
-bool CAmDatabaseHandler::existMainConnection(const am_mainConnectionID_t mainConnectionID) const
+bool CAmDatabaseHandlerSQLite::existMainConnection(const am_mainConnectionID_t mainConnectionID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT mainConnectionID FROM " + std::string(MAINCONNECTION_TABLE) + " WHERE mainConnectionID=" + i2s(mainConnectionID);
* @param sourceID to be checked for
* @return true if it exists
*/
-bool CAmDatabaseHandler::existSource(const am_sourceID_t sourceID) const
+bool CAmDatabaseHandlerSQLite::existSource(const am_sourceID_t sourceID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND sourceID=" + i2s(sourceID);
* @param name the name
* @return true if it exits
*/
-bool CAmDatabaseHandler::existSourceNameOrID(const am_sourceID_t sourceID, const std::string & name) const
+bool CAmDatabaseHandlerSQLite::existSourceNameOrID(const am_sourceID_t sourceID, const std::string & name) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND (name=? OR sourceID=?)";
* @param name the name
* @return true if it exits
*/
-bool CAmDatabaseHandler::existSourceName(const std::string & name) const
+bool CAmDatabaseHandlerSQLite::existSourceName(const std::string & name) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND name=?";
* @param sinkID to be checked for
* @return true if it exists
*/
-bool CAmDatabaseHandler::existSink(const am_sinkID_t sinkID) const
+bool CAmDatabaseHandlerSQLite::existSink(const am_sinkID_t sinkID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND sinkID=" + i2s(sinkID);
* @param name the name
* @return true if it exists.
*/
-bool CAmDatabaseHandler::existSinkNameOrID(const am_sinkID_t sinkID, const std::string & name) const
+bool CAmDatabaseHandlerSQLite::existSinkNameOrID(const am_sinkID_t sinkID, const std::string & name) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND (name=? OR sinkID=?)";
* @param name the name
* @return true if it exists
*/
-bool CAmDatabaseHandler::existSinkName(const std::string & name) const
+bool CAmDatabaseHandlerSQLite::existSinkName(const std::string & name) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND name=?";
* @param domainID to be checked for
* @return true if it exists
*/
-bool CAmDatabaseHandler::existDomain(const am_domainID_t domainID) const
+bool CAmDatabaseHandlerSQLite::existDomain(const am_domainID_t domainID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT domainID FROM " + std::string(DOMAIN_TABLE) + " WHERE reserved=0 AND domainID=" + i2s(domainID);
* @param gatewayID to be checked for
* @return true if it exists
*/
-bool CAmDatabaseHandler::existGateway(const am_gatewayID_t gatewayID) const
+bool CAmDatabaseHandlerSQLite::existGateway(const am_gatewayID_t gatewayID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT gatewayID FROM " + std::string(GATEWAY_TABLE) + " WHERE gatewayID=" + i2s(gatewayID);
return (returnVal);
}
-am_Error_e CAmDatabaseHandler::getDomainOfSource(const am_sourceID_t sourceID, am_domainID_t & domainID) const
+am_Error_e CAmDatabaseHandlerSQLite::getDomainOfSource(const am_sourceID_t sourceID, am_domainID_t & domainID) const
{
assert(sourceID!=0);
return (returnVal);
}
-am_Error_e am::CAmDatabaseHandler::getDomainOfSink(const am_sinkID_t sinkID, am_domainID_t & domainID) const
+am_Error_e am::CAmDatabaseHandlerSQLite::getDomainOfSink(const am_sinkID_t sinkID, am_domainID_t & domainID) const
{
assert(sinkID!=0);
* @param sinkClassID
* @return true if it exists
*/
-bool CAmDatabaseHandler::existSinkClass(const am_sinkClass_t sinkClassID) const
+bool CAmDatabaseHandlerSQLite::existSinkClass(const am_sinkClass_t sinkClassID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sinkClassID FROM " + std::string(SINK_CLASS_TABLE) + " WHERE sinkClassID=" + i2s(sinkClassID);
* @param sourceClassID
* @return true if it exists
*/
-bool CAmDatabaseHandler::existSourceClass(const am_sourceClass_t sourceClassID) const
+bool CAmDatabaseHandlerSQLite::existSourceClass(const am_sourceClass_t sourceClassID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sourceClassID FROM " + std::string(SOURCE_CLASS_TABLE) + " WHERE sourceClassID=" + i2s(sourceClassID);
return (returnVal);
}
-am_Error_e CAmDatabaseHandler::changeConnectionTimingInformation(const am_connectionID_t connectionID, const am_timeSync_t delay)
+am_Error_e CAmDatabaseHandlerSQLite::changeConnectionTimingInformation(const am_connectionID_t connectionID, const am_timeSync_t delay)
{
assert(connectionID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeConnectionFinal(const am_connectionID_t connectionID)
+am_Error_e CAmDatabaseHandlerSQLite::changeConnectionFinal(const am_connectionID_t connectionID)
{
assert(connectionID!=0);
return (E_OK);
}
-am_timeSync_t CAmDatabaseHandler::calculateMainConnectionDelay(const am_mainConnectionID_t mainConnectionID) const
+am_timeSync_t CAmDatabaseHandlerSQLite::calculateMainConnectionDelay(const am_mainConnectionID_t mainConnectionID) const
{
assert(mainConnectionID!=0);
sqlite3_stmt* query = NULL;
* registers the Observer at the Database
* @param iObserver pointer to the observer
*/
-void CAmDatabaseHandler::registerObserver(CAmDatabaseObserver *iObserver)
+void CAmDatabaseHandlerSQLite::registerObserver(CAmDatabaseObserver *iObserver)
{
assert(iObserver!=NULL);
mpDatabaseObserver = iObserver;
* @param sourceID the sourceID
* @return true if source is visible
*/
-bool CAmDatabaseHandler::sourceVisible(const am_sourceID_t sourceID) const
+bool CAmDatabaseHandlerSQLite::sourceVisible(const am_sourceID_t sourceID) const
{
assert(sourceID!=0);
sqlite3_stmt* query = NULL;
* @param sinkID the sinkID
* @return true if source is visible
*/
-bool CAmDatabaseHandler::sinkVisible(const am_sinkID_t sinkID) const
+bool CAmDatabaseHandlerSQLite::sinkVisible(const am_sinkID_t sinkID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT visible FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND sinkID=" + i2s(sinkID);
* @param connection the connection to be checked
* @return true if connections exists
*/
-bool CAmDatabaseHandler::existConnection(const am_Connection_s & connection) const
+bool CAmDatabaseHandlerSQLite::existConnection(const am_Connection_s & connection) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT connectionID FROM " + std::string(CONNECTION_TABLE) + " WHERE sinkID=? AND sourceID=? AND connectionFormat=? AND reserved=0";
* @param connectionID
* @return true if connection exits
*/
-bool CAmDatabaseHandler::existConnectionID(const am_connectionID_t connectionID) const
+bool CAmDatabaseHandlerSQLite::existConnectionID(const am_connectionID_t connectionID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT connectionID FROM " + std::string(CONNECTION_TABLE) + " WHERE connectionID=? AND reserved=0";
* @param crossfaderID the ID of the crossfader to be checked
* @return true if exists
*/
-bool CAmDatabaseHandler::existcrossFader(const am_crossfaderID_t crossfaderID) const
+bool CAmDatabaseHandlerSQLite::existcrossFader(const am_crossfaderID_t crossfaderID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT crossfaderID FROM " + std::string(CROSSFADER_TABLE) + " WHERE crossfaderID=?";
return (returnVal);
}
-am_Error_e CAmDatabaseHandler::getSoureState(const am_sourceID_t sourceID, am_SourceState_e & sourceState) const
+am_Error_e CAmDatabaseHandlerSQLite::getSoureState(const am_sourceID_t sourceID, am_SourceState_e & sourceState) const
{
assert(sourceID!=0);
sqlite3_stmt* query = NULL;
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeSourceState(const am_sourceID_t sourceID, const am_SourceState_e sourceState)
+am_Error_e CAmDatabaseHandlerSQLite::changeSourceState(const am_sourceID_t sourceID, const am_SourceState_e sourceState)
{
assert(sourceID!=0);
assert(sourceState>=SS_UNKNNOWN && sourceState<=SS_MAX);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getSinkVolume(const am_sinkID_t sinkID, am_volume_t & volume) const
+am_Error_e CAmDatabaseHandlerSQLite::getSinkVolume(const am_sinkID_t sinkID, am_volume_t & volume) const
{
assert(sinkID!=0);
sqlite3_stmt* query = NULL;
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getSourceVolume(const am_sourceID_t sourceID, am_volume_t & volume) const
+am_Error_e CAmDatabaseHandlerSQLite::getSourceVolume(const am_sourceID_t sourceID, am_volume_t & volume) const
{
assert(sourceID!=0);
sqlite3_stmt* query = NULL;
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_SoundPropertyType_e propertyType, int16_t & value) const
+am_Error_e CAmDatabaseHandlerSQLite::getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_SoundPropertyType_e propertyType, int16_t & value) const
{
assert(sinkID!=0);
if (!existSink(sinkID))
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_SoundPropertyType_e propertyType, int16_t & value) const
+am_Error_e CAmDatabaseHandlerSQLite::getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_SoundPropertyType_e propertyType, int16_t & value) const
{
assert(sourceID!=0);
if (!existSource(sourceID))
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getDomainState(const am_domainID_t domainID, am_DomainState_e& state) const
+am_Error_e CAmDatabaseHandlerSQLite::getDomainState(const am_domainID_t domainID, am_DomainState_e& state) const
{
assert(domainID!=0);
sqlite3_stmt* query = NULL;
}
-am_Error_e CAmDatabaseHandler::peekDomain(const std::string & name, am_domainID_t & domainID)
+am_Error_e CAmDatabaseHandlerSQLite::peekDomain(const std::string & name, am_domainID_t & domainID)
{
domainID=0;
sqlite3_stmt* query = NULL, *queryInsert = NULL;
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::peekSink(const std::string & name, am_sinkID_t & sinkID)
+am_Error_e CAmDatabaseHandlerSQLite::peekSink(const std::string & name, am_sinkID_t & sinkID)
{
sqlite3_stmt* query = NULL, *queryInsert = NULL;
std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE name=?";
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::peekSource(const std::string & name, am_sourceID_t & sourceID)
+am_Error_e CAmDatabaseHandlerSQLite::peekSource(const std::string & name, am_sourceID_t & sourceID)
{
sqlite3_stmt* query = NULL, *queryInsert = NULL;
std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE name=?";
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeSinkVolume(const am_sinkID_t sinkID, const am_volume_t volume)
+am_Error_e CAmDatabaseHandlerSQLite::changeSinkVolume(const am_sinkID_t sinkID, const am_volume_t volume)
{
assert(sinkID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeSourceVolume(const am_sourceID_t sourceID, const am_volume_t volume)
+am_Error_e CAmDatabaseHandlerSQLite::changeSourceVolume(const am_sourceID_t sourceID, const am_volume_t volume)
{
assert(sourceID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeSourceSoundPropertyDB(const am_SoundProperty_s & soundProperty, const am_sourceID_t sourceID)
+am_Error_e CAmDatabaseHandlerSQLite::changeSourceSoundPropertyDB(const am_SoundProperty_s & soundProperty, const am_sourceID_t sourceID)
{
assert(soundProperty.type>=SP_UNKNOWN && soundProperty.type<=SP_MAX);
assert(sourceID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeSinkSoundPropertyDB(const am_SoundProperty_s & soundProperty, const am_sinkID_t sinkID)
+am_Error_e CAmDatabaseHandlerSQLite::changeSinkSoundPropertyDB(const am_SoundProperty_s & soundProperty, const am_sinkID_t sinkID)
{
assert(soundProperty.type>=SP_UNKNOWN && soundProperty.type<=SP_MAX);
assert(sinkID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeCrossFaderHotSink(const am_crossfaderID_t crossfaderID, const am_HotSink_e hotsink)
+am_Error_e CAmDatabaseHandlerSQLite::changeCrossFaderHotSink(const am_crossfaderID_t crossfaderID, const am_HotSink_e hotsink)
{
assert(crossfaderID!=0);
assert(hotsink>=HS_UNKNOWN && hotsink>=HS_MAX);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getRoutingTree(bool onlyfree, CAmRoutingTree& tree, std::vector<CAmRoutingTreeItem*>& flatTree)
+am_Error_e CAmDatabaseHandlerSQLite::getRoutingTree(bool onlyfree, CAmRoutingTree& tree, std::vector<CAmRoutingTreeItem*>& flatTree)
{
sqlite3_stmt* query = NULL;
int eCode = 0;
return (E_OK);
}
-am_Error_e am::CAmDatabaseHandler::peekSinkClassID(const std::string & name, am_sinkClass_t & sinkClassID)
+am_Error_e am::CAmDatabaseHandlerSQLite::peekSinkClassID(const std::string & name, am_sinkClass_t & sinkClassID)
{
if (name.empty())
return (E_NON_EXISTENT);
return (returnVal);
}
-am_Error_e am::CAmDatabaseHandler::peekSourceClassID(const std::string & name, am_sourceClass_t & sourceClassID)
+am_Error_e am::CAmDatabaseHandlerSQLite::peekSourceClassID(const std::string & name, am_sourceClass_t & sourceClassID)
{
if (name.empty())
return (E_NON_EXISTENT);
}
-am_Error_e CAmDatabaseHandler::changeSourceDB(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_ConnectionFormat_e>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties)
+am_Error_e CAmDatabaseHandlerSQLite::changeSourceDB(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_ConnectionFormat_e>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties)
{
assert(sourceID!=0);
}
-am_Error_e CAmDatabaseHandler::changeSinkDB(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_ConnectionFormat_e>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties)
+am_Error_e CAmDatabaseHandlerSQLite::changeSinkDB(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_ConnectionFormat_e>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties)
{
assert(sinkID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::getListMainSinkNotificationConfigurations(const am_sinkID_t sinkID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations)
+am_Error_e CAmDatabaseHandlerSQLite::getListMainSinkNotificationConfigurations(const am_sinkID_t sinkID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations)
{
assert(sinkID!=0);
if (!existSink(sinkID))
}
-am_Error_e CAmDatabaseHandler::getListMainSourceNotificationConfigurations(const am_sourceID_t sourceID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations)
+am_Error_e CAmDatabaseHandlerSQLite::getListMainSourceNotificationConfigurations(const am_sourceID_t sourceID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations)
{
assert(sourceID!=0);
if (!existSource(sourceID))
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeMainSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s mainNotificationConfiguration)
+am_Error_e CAmDatabaseHandlerSQLite::changeMainSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s mainNotificationConfiguration)
{
assert(sinkID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeMainSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s mainNotificationConfiguration)
+am_Error_e CAmDatabaseHandlerSQLite::changeMainSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s mainNotificationConfiguration)
{
assert(sourceID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeGatewayDB(const am_gatewayID_t gatewayID, const std::vector<am_ConnectionFormat_e>& listSourceConnectionFormats, const std::vector<am_ConnectionFormat_e>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix)
+am_Error_e CAmDatabaseHandlerSQLite::changeGatewayDB(const am_gatewayID_t gatewayID, const std::vector<am_ConnectionFormat_e>& listSourceConnectionFormats, const std::vector<am_ConnectionFormat_e>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix)
{
assert(gatewayID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s notificationConfiguration)
+am_Error_e CAmDatabaseHandlerSQLite::changeSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s notificationConfiguration)
{
assert(sinkID!=0);
return (E_OK);
}
-am_Error_e CAmDatabaseHandler::changeSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s notificationConfiguration)
+am_Error_e CAmDatabaseHandlerSQLite::changeSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s notificationConfiguration)
{
assert(sourceID!=0);
return (E_OK);
}
-void CAmDatabaseHandler::createTables()
+void CAmDatabaseHandlerSQLite::createTables()
{
for (uint16_t i = 0; i < sizeof(databaseTables) / sizeof(databaseTables[0]); i++)
{
#include <algorithm>
#include <vector>
#include <iterator>
-#include "CAmDatabaseHandlerInterface.h"
+#include "IAmDatabaseHandler.h"
#include "CAmControlSender.h"
namespace am {
-CAmRouter::CAmRouter(CAmDatabaseHandlerInterface* iDatabaseHandler, CAmControlSender* iSender) :
+CAmRouter::CAmRouter(IAmDatabaseHandler* iDatabaseHandler, CAmControlSender* iSender) :
mpDatabaseHandler(iDatabaseHandler), //
mpControlSender(iSender)
{
#include "CAmRoutingReceiver.h"
#include <cassert>
#include <algorithm>
-#include "CAmDatabaseHandlerInterface.h"
+#include "IAmDatabaseHandler.h"
#include "CAmRoutingSender.h"
#include "CAmControlSender.h"
#include "shared/CAmDltWrapper.h"
namespace am
{
-CAmRoutingReceiver::CAmRoutingReceiver(CAmDatabaseHandlerInterface *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler) :
+CAmRoutingReceiver::CAmRoutingReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler) :
mpDatabaseHandler(iDatabaseHandler), //
mpRoutingSender(iRoutingSender), //
mpControlSender(iControlSender), //
assert(mpSocketHandler!=NULL);
}
-CAmRoutingReceiver::CAmRoutingReceiver(CAmDatabaseHandlerInterface *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler, CAmDbusWrapper *iDBusWrapper) :
+CAmRoutingReceiver::CAmRoutingReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler, CAmDbusWrapper *iDBusWrapper) :
mpDatabaseHandler(iDatabaseHandler), //
mpRoutingSender(iRoutingSender), //
mpControlSender(iControlSender), //
#include "config.h"
#include "CAmRouter.h"
#include "CAmTelnetServer.h"
-#include "CAmDatabaseHandlerInterface.h"
+#include "IAmDatabaseHandler.h"
#include "CAmControlSender.h"
#include "CAmCommandSender.h"
#include "CAmRoutingSender.h"
CAmTelnetMenuHelper* CAmTelnetMenuHelper::instance = NULL;
/****************************************************************************/
-CAmTelnetMenuHelper::CAmTelnetMenuHelper(CAmSocketHandler *iSocketHandler, CAmCommandSender *iCommandSender, CAmCommandReceiver *iCommandReceiver, CAmRoutingSender *iRoutingSender, CAmRoutingReceiver *iRoutingReceiver, CAmControlSender *iControlSender, CAmControlReceiver *iControlReceiver, CAmDatabaseHandlerInterface *iDatabasehandler, CAmRouter *iRouter, CAmTelnetServer *iTelnetServer)
+CAmTelnetMenuHelper::CAmTelnetMenuHelper(CAmSocketHandler *iSocketHandler, CAmCommandSender *iCommandSender, CAmCommandReceiver *iCommandReceiver, CAmRoutingSender *iRoutingSender, CAmRoutingReceiver *iRoutingReceiver, CAmControlSender *iControlSender, CAmControlReceiver *iControlReceiver, IAmDatabaseHandler *iDatabasehandler, CAmRouter *iRouter, CAmTelnetServer *iTelnetServer)
/****************************************************************************/
:mpTelenetServer(iTelnetServer), mpSocketHandler(iSocketHandler), mpCommandSender(iCommandSender), mpCommandReceiver(iCommandReceiver), mpRoutingSender(iRoutingSender), mpRoutingReceiver(iRoutingReceiver), mpControlSender(iControlSender), mpControlReceiver(iControlReceiver), mpDatabasehandler(iDatabasehandler), mpRouter(iRouter)
{
#include <unistd.h>
#include <stdexcept>
#include <cstdlib>
-#include "CAmDatabaseHandlerInterface.h"
#include "CAmRoutingSender.h"
#include "CAmTelnetMenuHelper.h"
#include "shared/CAmDltWrapper.h"
#define PRINT_BOOL(var) var ? output+="true\t\t" : output+="false\t\t";
-CAmTelnetServer::CAmTelnetServer(CAmSocketHandler *iSocketHandler, CAmCommandSender *iCommandSender, CAmCommandReceiver *iCommandReceiver, CAmRoutingSender *iRoutingSender, CAmRoutingReceiver *iRoutingReceiver, CAmControlSender *iControlSender, CAmControlReceiver *iControlReceiver, CAmDatabaseHandlerInterface *iDatabasehandler, CAmRouter *iRouter, unsigned int servPort, unsigned int maxConnections) :
+CAmTelnetServer::CAmTelnetServer(CAmSocketHandler *iSocketHandler, CAmCommandSender *iCommandSender, CAmCommandReceiver *iCommandReceiver, CAmRoutingSender *iRoutingSender, CAmRoutingReceiver *iRoutingReceiver, CAmControlSender *iControlSender, CAmControlReceiver *iControlReceiver, IAmDatabaseHandler *iDatabasehandler, CAmRouter *iRouter, unsigned int servPort, unsigned int maxConnections) :
telnetConnectFiredCB(this, &CAmTelnetServer::connectSocket), //
telnetReceiveFiredCB(this, &CAmTelnetServer::receiveData), //
telnetDispatchCB(this, &CAmTelnetServer::dispatchData), //
#endif
#ifdef WITH_DATABASE_STORAGE
- #include "CAmDatabaseHandler.h"
+ #include "CAmDatabaseHandlerSQLite.h"
#else
- #include "CAmMapHandler.h"
+ #include "CAmDatabaseHandlerMap.h"
#endif
#ifdef WITH_SYSTEMD_WATCHDOG
#include "CAmDatabaseObserver.h"
#include "shared/CAmDltWrapper.h"
#include "shared/CAmSocketHandler.h"
-#include "CAmDatabaseHandlerInterface.h"
using namespace am;
DLT_DECLARE_CONTEXT(AudioManager)
#endif /*WITH_SYSTEMD_WATCHDOG*/
#ifdef WITH_DATABASE_STORAGE
- CAmDatabaseHandler * ptr_iDatabaseHandler = new CAmDatabaseHandler(databasePath);
+ CAmDatabaseHandler * pDatabaseHandler = new CAmDatabaseHandler(databasePath);
#else
- CAmMapHandler * ptr_iDatabaseHandler = new CAmMapHandler();
+ CAmDatabaseHandlerMap * pDatabaseHandler = new CAmDatabaseHandlerMap();
#endif /*WITH_DATABASE_STORAGE*/
- CAmDatabaseHandlerInterface & iDatabaseHandler = *ptr_iDatabaseHandler;
+ IAmDatabaseHandler & iDatabaseHandler = *pDatabaseHandler;
CAmRoutingSender iRoutingSender(listRoutingPluginDirs);
CAmCommandSender iCommandSender(listCommandPluginDirs);
CAmControlSender iControlSender(controllerPlugin,&iSocketHandler);
- CAmRouter iRouter(ptr_iDatabaseHandler, &iControlSender);
+ CAmRouter iRouter(pDatabaseHandler, &iControlSender);
#ifdef WITH_DBUS_WRAPPER
- CAmCommandReceiver iCommandReceiver(ptr_iDatabaseHandler, &iControlSender, &iSocketHandler, &iDBusWrapper);
- CAmRoutingReceiver iRoutingReceiver(ptr_iDatabaseHandler, &iRoutingSender, &iControlSender, &iSocketHandler, &iDBusWrapper);
+ CAmCommandReceiver iCommandReceiver(pDatabaseHandler, &iControlSender, &iSocketHandler, &iDBusWrapper);
+ CAmRoutingReceiver iRoutingReceiver(pDatabaseHandler, &iRoutingSender, &iControlSender, &iSocketHandler, &iDBusWrapper);
#ifdef WITH_NSM
- CAmControlReceiver iControlReceiver(ptr_iDatabaseHandler,&iRoutingSender,&iCommandSender,&iSocketHandler, &iRouter, &iNodeStateCommunicator);
+ CAmControlReceiver iControlReceiver(pDatabaseHandler,&iRoutingSender,&iCommandSender,&iSocketHandler, &iRouter, &iNodeStateCommunicator);
iNodeStateCommunicator.registerControlSender(&iControlSender);
#else /*WITH_NSM*/
- CAmControlReceiver iControlReceiver(ptr_iDatabaseHandler,&iRoutingSender,&iCommandSender,&iSocketHandler, &iRouter);
+ CAmControlReceiver iControlReceiver(pDatabaseHandler,&iRoutingSender,&iCommandSender,&iSocketHandler, &iRouter);
#endif /*WITH_NSM*/
#else /*WITH_DBUS_WRAPPER*/
- CAmCommandReceiver iCommandReceiver(ptr_iDatabaseHandler,&iControlSender,&iSocketHandler);
- CAmRoutingReceiver iRoutingReceiver(ptr_iDatabaseHandler,&iRoutingSender,&iControlSender,&iSocketHandler);
- CAmControlReceiver iControlReceiver(ptr_iDatabaseHandler,&iRoutingSender,&iCommandSender,&iSocketHandler, &iRouter);
+ CAmCommandReceiver iCommandReceiver(pDatabaseHandler,&iControlSender,&iSocketHandler);
+ CAmRoutingReceiver iRoutingReceiver(pDatabaseHandler,&iRoutingSender,&iControlSender,&iSocketHandler);
+ CAmControlReceiver iControlReceiver(pDatabaseHandler,&iRoutingSender,&iCommandSender,&iSocketHandler, &iRouter);
#endif /*WITH_DBUS_WRAPPER*/
#ifdef WITH_TELNET
- CAmTelnetServer iTelnetServer(&iSocketHandler, &iCommandSender, &iCommandReceiver, &iRoutingSender, &iRoutingReceiver, &iControlSender, &iControlReceiver, ptr_iDatabaseHandler, &iRouter, telnetport, maxConnections);
+ CAmTelnetServer iTelnetServer(&iSocketHandler, &iCommandSender, &iCommandReceiver, &iRoutingSender, &iRoutingReceiver, &iControlSender, &iControlReceiver, pDatabaseHandler, &iRouter, telnetport, maxConnections);
CAmDatabaseObserver iObserver(&iCommandSender, &iRoutingSender, &iSocketHandler, &iTelnetServer);
#else /*WITH_TELNET*/
CAmDatabaseObserver iObserver(&iCommandSender,&iRoutingSender, &iSocketHandler);
//start the mainloop here....
iSocketHandler.start_listenting();
- if(ptr_iDatabaseHandler)
+ if(pDatabaseHandler)
{
- delete ptr_iDatabaseHandler;
- ptr_iDatabaseHandler = NULL;
+ delete pDatabaseHandler;
+ pDatabaseHandler = NULL;
}
}
#include "gtest/gtest.h"
#include "gmock/gmock.h"
-#include "CAmDatabaseHandler.h"
+#include "CAmDatabaseHandlerSQLite.h"
#include "CAmControlReceiver.h"
#include "CAmRoutingReceiver.h"
#include "CAmDatabaseObserver.h"
CAmDbusWrapper* pDBusWrapper;
std::vector<std::string> plistCommandPluginDirs;
std::vector<std::string> plistRoutingPluginDirs;
- CAmDatabaseHandler pDatabaseHandler;
+ CAmDatabaseHandlerSQLite pDatabaseHandler;
CAmRoutingSender pRoutingSender;
CAmCommandSender pCommandSender;
MockIAmControlSend pMockControlInterface;
)
file(GLOB CONTROL_INTERFACE_SRCS_CXX
- "../../src/CAmDatabaseHandler.cpp"
+ "../../src/CAmDatabaseHandlerSQLite.cpp"
"../../src/CAmDatabaseObserver.cpp"
"../../src/CAmRoutingSender.cpp"
"../../src/CAmRoutingReceiver.cpp"
#include "gtest/gtest.h"
#include "gmock/gmock.h"
-#include "CAmDatabaseHandler.h"
+#include "CAmDatabaseHandlerSQLite.h"
#include "CAmControlReceiver.h"
#include "CAmControlSender.h"
#include "CAmDatabaseObserver.h"
std::vector<std::string> plistRoutingPluginDirs;
std::vector<std::string> plistCommandPluginDirs;
CAmSocketHandler pSocketHandler;
- CAmDatabaseHandler pDatabaseHandler;
+ CAmDatabaseHandlerSQLite pDatabaseHandler;
CAmRoutingSender pRoutingSender;
CAmCommandSender pCommandSender;
MockIAmCommandSend pMockInterface;
)
file(GLOB DATABASE_SRCS_CXX
- "../../src/CAmDatabaseHandler.cpp"
+ "../../src/CAmDatabaseHandlerSQLite.cpp"
"../../src/CAmDatabaseObserver.cpp"
"../../src/CAmCommandSender.cpp"
"../../src/CAmRoutingSender.cpp"
#include "gtest/gtest.h"
#include "gmock/gmock.h"
-#include "CAmMapHandler.h"
+#include "CAmDatabaseHandlerMap.h"
#include "CAmControlReceiver.h"
#include "CAmControlSender.h"
#include "CAmDatabaseObserver.h"
std::vector<std::string> plistRoutingPluginDirs;
std::vector<std::string> plistCommandPluginDirs;
CAmSocketHandler pSocketHandler;
- CAmMapHandler pDatabaseHandler;
+ CAmDatabaseHandlerMap pDatabaseHandler;
CAmRoutingSender pRoutingSender;
CAmCommandSender pCommandSender;
MockIAmCommandSend pMockInterface;
)
file(GLOB DATABASE_SRCS_CXX
- "../../src/CAmMapHandler.cpp"
- "../../src/CAmDatabaseHandler.cpp"
+ "../../src/CAmDatabaseHandlerMap.cpp"
"../../src/CAmDatabaseObserver.cpp"
"../../src/CAmCommandSender.cpp"
"../../src/CAmRoutingSender.cpp"
#include <string>
#include <vector>
#include <set>
-#include "CAmMapHandler.h"
+#include "CAmDatabaseHandlerMap.h"
#include "CAmControlReceiver.h"
#include "CAmControlSender.h"
#include "CAmDatabaseObserver.h"
std::vector<std::string> plistCommandPluginDirs;
CAmSocketHandler pSocketHandler;
CAmControlSender pControlSender;
- CAmMapHandler pDatabaseHandler;
+ CAmDatabaseHandlerMap pDatabaseHandler;
CAmRouter pRouter;
CAmRoutingSender pRoutingSender;
CAmCommandSender pCommandSender;
)
file(GLOB ROUTINGMAP_SRCS_CXX
- "../../src/CAmMapHandler.cpp"
+ "../../src/CAmDatabaseHandlerMap.cpp"
"../../src/CAmDatabaseObserver.cpp"
"../../src/CAmCommandSender.cpp"
"../../src/CAmRoutingSender.cpp"
#include <string>
#include <vector>
#include <set>
-#include "CAmDatabaseHandler.h"
+#include "CAmDatabaseHandlerSQLite.h"
#include "CAmControlReceiver.h"
#include "CAmControlSender.h"
#include "CAmDatabaseObserver.h"
std::vector<std::string> plistCommandPluginDirs;
CAmSocketHandler pSocketHandler;
CAmControlSender pControlSender;
- CAmDatabaseHandler pDatabaseHandler;
+ CAmDatabaseHandlerSQLite pDatabaseHandler;
CAmRouter pRouter;
CAmRoutingSender pRoutingSender;
CAmCommandSender pCommandSender;
)
file(GLOB ROUTING_SRCS_CXX
- "../../src/CAmMapHandler.cpp"
- "../../src/CAmDatabaseHandler.cpp"
+ "../../src/CAmDatabaseHandlerSQLite.cpp"
"../../src/CAmDatabaseObserver.cpp"
"../../src/CAmCommandSender.cpp"
"../../src/CAmRoutingSender.cpp"
#include <string>
#include <vector>
#include <set>
-#include "CAmDatabaseHandler.h"
+#include "CAmDatabaseHandlerSQLite.h"
#include "CAmControlReceiver.h"
#include "CAmControlSender.h"
#include "CAmDatabaseObserver.h"
std::vector<std::string> plistRoutingPluginDirs;
std::vector<std::string> plistCommandPluginDirs;
CAmSocketHandler pSocketHandler;
- CAmDatabaseHandler pDatabaseHandler;
+ CAmDatabaseHandlerSQLite pDatabaseHandler;
CAmRoutingSender pRoutingSender;
CAmCommandSender pCommandSender;
CAmControlSender pControlSender;
file(GLOB ROUTING_INTERFACE_SRCS_CXX
"../../src/CAmControlReceiver.cpp"
- "../../src/CAmDatabaseHandler.cpp"
+ "../../src/CAmDatabaseHandlerSQLite.cpp"
"../../src/CAmDatabaseObserver.cpp"
"../../src/CAmCommandSender.cpp"
"../../src/CAmRoutingSender.cpp"
, mlistCommandPluginDirs()
, mSocketHandler()
#ifdef WITH_DATABASE_STORAGE
-, mDatabasehandler(std::string(":memory:"))
+, mpDatabasehandler(std::string(":memory:"))
#else
, mDatabasehandler()
#endif
#include "gtest/gtest.h"
#include "CAmTelnetServer.h"
-#include "CAmDatabaseHandler.h"
-#include "CAmMapHandler.h"
#include "CAmRoutingSender.h"
#include "CAmCommandSender.h"
#include "CAmControlSender.h"
#include "CAmRouter.h"
+#include "IAmDatabaseHandler.h"
+#ifdef WITH_DATABASE_STORAGE
+ #include "CAmDatabaseHandlerSQLite.h"
+#else
+ #include "CAmDatabaseHandlerMap.h"
+#endif
namespace am
{
class CAmSocketHandler;
-class CAmDatabaseHandler;
-class CAmMapHandler;
class CAmRoutingSender;
class CAmCommandSender;
class CAmControlSender;
CAmSocketHandler mSocketHandler;
#ifdef WITH_DATABASE_STORAGE
- CAmDatabaseHandler mDatabasehandler;
+ CAmDatabaseHandlerSQLite mDatabasehandler;
#else
- CAmMapHandler mDatabasehandler;
+ CAmDatabaseHandlerMap mDatabasehandler;
#endif
CAmRoutingSender mRoutingSender;
CAmCommandSender mCommandSender;
"../../src/CAmCommandSender.cpp"
"../../src/CAmControlReceiver.cpp"
"../../src/CAmControlSender.cpp"
- "../../src/CAmMapHandler.cpp"
- "../../src/CAmDatabaseHandler.cpp"
+ "../../src/CAmDatabaseHandlerMap.cpp"
+ "../../src/CAmDatabaseHandlerSQLite.cpp"
"../../src/CAmDatabaseObserver.cpp"
"../../src/CAmRoutingReceiver.cpp"
"../../src/CAmRoutingSender.cpp"