summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Linke <Christian.Linke@bmw.de>2016-02-11 06:28:47 (GMT)
committerChristian Linke <Christian.Linke@bmw.de>2016-02-15 08:00:59 (GMT)
commit5bcd206b9270d9a79e212f91723ea1a08a4d4859 (patch)
tree55b0cd4d07fbd7ebfd15d58d02e9cae6ae61b127
parent59080ecc2c8840fd85c561adea3f85f5344534a8 (diff)
downloadaudiomanager-5bcd206b9270d9a79e212f91723ea1a08a4d4859.tar.gz
* rework of the build structure, adopt to standard cmake package structure7.4
* check versions when loading the libs * introduction of the AudioManagerCore * give control plugin as file or directory * remove SQLITE * either find and use gmock or build and install it * fixed [Bug 411] * compile flag gnu11 is now used Signed-off-by: Christian Linke <Christian.Linke@bmw.de> Signed-off-by: Christian Linke <Christian.Linke@bmw.de>
-rw-r--r--AudioManagerCore/CMakeLists.txt109
-rw-r--r--AudioManagerCore/include/CAmCommandReceiver.h (renamed from AudioManagerDaemon/include/CAmCommandReceiver.h)0
-rw-r--r--AudioManagerCore/include/CAmCommandSender.h (renamed from AudioManagerDaemon/include/CAmCommandSender.h)0
-rw-r--r--AudioManagerCore/include/CAmControlReceiver.h (renamed from AudioManagerDaemon/include/CAmControlReceiver.h)0
-rw-r--r--AudioManagerCore/include/CAmControlSender.h (renamed from AudioManagerDaemon/include/CAmControlSender.h)0
-rw-r--r--AudioManagerCore/include/CAmDatabaseHandlerMap.h (renamed from AudioManagerDaemon/include/CAmDatabaseHandlerMap.h)0
-rw-r--r--AudioManagerCore/include/CAmDatabaseObserver.h (renamed from AudioManagerDaemon/include/CAmDatabaseObserver.h)0
-rw-r--r--AudioManagerCore/include/CAmGraph.h (renamed from AudioManagerDaemon/include/CAmGraph.h)0
-rw-r--r--AudioManagerCore/include/CAmLog.h (renamed from AudioManagerDaemon/include/CAmLog.h)0
-rw-r--r--AudioManagerCore/include/CAmRouter.h (renamed from AudioManagerDaemon/include/CAmRouter.h)0
-rw-r--r--AudioManagerCore/include/CAmRoutingReceiver.h (renamed from AudioManagerDaemon/include/CAmRoutingReceiver.h)0
-rw-r--r--AudioManagerCore/include/CAmRoutingSender.h (renamed from AudioManagerDaemon/include/CAmRoutingSender.h)0
-rw-r--r--AudioManagerCore/include/CAmTelnetMenuHelper.h (renamed from AudioManagerDaemon/include/CAmTelnetMenuHelper.h)0
-rw-r--r--AudioManagerCore/include/CAmTelnetServer.h (renamed from AudioManagerDaemon/include/CAmTelnetServer.h)0
-rw-r--r--AudioManagerCore/include/IAmDatabaseHandler.h (renamed from AudioManagerDaemon/include/IAmDatabaseHandler.h)0
-rw-r--r--AudioManagerCore/include/TAmPluginTemplate.h (renamed from AudioManagerDaemon/include/TAmPluginTemplate.h)0
-rw-r--r--AudioManagerCore/src/CAmCommandReceiver.cpp (renamed from AudioManagerDaemon/src/CAmCommandReceiver.cpp)0
-rw-r--r--AudioManagerCore/src/CAmCommandSender.cpp (renamed from AudioManagerDaemon/src/CAmCommandSender.cpp)15
-rw-r--r--AudioManagerCore/src/CAmControlReceiver.cpp (renamed from AudioManagerDaemon/src/CAmControlReceiver.cpp)0
-rw-r--r--AudioManagerCore/src/CAmControlSender.cpp (renamed from AudioManagerDaemon/src/CAmControlSender.cpp)64
-rw-r--r--AudioManagerCore/src/CAmDatabaseHandlerMap.cpp (renamed from AudioManagerDaemon/src/CAmDatabaseHandlerMap.cpp)0
-rw-r--r--AudioManagerCore/src/CAmDatabaseObserver.cpp (renamed from AudioManagerDaemon/src/CAmDatabaseObserver.cpp)0
-rw-r--r--AudioManagerCore/src/CAmLog.cpp (renamed from AudioManagerDaemon/src/CAmLog.cpp)0
-rw-r--r--AudioManagerCore/src/CAmRouter.cpp (renamed from AudioManagerDaemon/src/CAmRouter.cpp)0
-rw-r--r--AudioManagerCore/src/CAmRoutingReceiver.cpp (renamed from AudioManagerDaemon/src/CAmRoutingReceiver.cpp)0
-rw-r--r--AudioManagerCore/src/CAmRoutingSender.cpp (renamed from AudioManagerDaemon/src/CAmRoutingSender.cpp)13
-rw-r--r--AudioManagerCore/src/CAmTelnetMenuHelper.cpp (renamed from AudioManagerDaemon/src/CAmTelnetMenuHelper.cpp)0
-rwxr-xr-xAudioManagerCore/src/CAmTelnetServer.cpp (renamed from AudioManagerDaemon/src/CAmTelnetServer.cpp)0
-rw-r--r--AudioManagerCore/test/AmControlInterfaceTest/CAmControlInterfaceTest.cpp (renamed from AudioManagerDaemon/test/AmControlInterfaceTest/CAmControlInterfaceTest.cpp)19
-rw-r--r--AudioManagerCore/test/AmControlInterfaceTest/CAmControlInterfaceTest.h (renamed from AudioManagerDaemon/test/AmControlInterfaceTest/CAmControlInterfaceTest.h)0
-rw-r--r--AudioManagerCore/test/AmControlInterfaceTest/CMakeLists.txt52
-rw-r--r--AudioManagerCore/test/AmControlInterfaceTest/CMakeLists.txt~50
-rw-r--r--AudioManagerCore/test/AmMapHandlerTest/CAmMapHandlerTest.cpp (renamed from AudioManagerDaemon/test/AmMapHandlerTest/CAmMapHandlerTest.cpp)13
-rw-r--r--AudioManagerCore/test/AmMapHandlerTest/CAmMapHandlerTest.h (renamed from AudioManagerDaemon/test/AmMapHandlerTest/CAmMapHandlerTest.h)0
-rw-r--r--AudioManagerCore/test/AmMapHandlerTest/CAmTestDatabaseObserver.cpp (renamed from AudioManagerDaemon/test/AmMapHandlerTest/CAmTestDatabaseObserver.cpp)0
-rw-r--r--AudioManagerCore/test/AmMapHandlerTest/CMakeLists.txt49
-rw-r--r--AudioManagerCore/test/AmMapHandlerTest/CMakeLists.txt~54
-rw-r--r--AudioManagerCore/test/AmMapHandlerTest/MockDatabaseObserver.h (renamed from AudioManagerDaemon/test/AmMapHandlerTest/MockDatabaseObserver.h)0
-rw-r--r--AudioManagerCore/test/AmRouterMapTest/CAmRouterMapTest.cpp (renamed from AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.cpp)17
-rw-r--r--AudioManagerCore/test/AmRouterMapTest/CAmRouterMapTest.h (renamed from AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.h)0
-rw-r--r--AudioManagerCore/test/AmRouterMapTest/CMakeLists.txt47
-rw-r--r--AudioManagerCore/test/AmRouterMapTest/CMakeLists.txt~47
-rw-r--r--AudioManagerCore/test/AmRouterTest/CAmRouterTest.cpp (renamed from AudioManagerDaemon/test/AmRouterTest/CAmRouterTest.cpp)17
-rw-r--r--AudioManagerCore/test/AmRouterTest/CAmRouterTest.h (renamed from AudioManagerDaemon/test/AmRouterTest/CAmRouterTest.h)0
-rw-r--r--AudioManagerCore/test/AmRouterTest/CMakeLists.txt48
-rw-r--r--AudioManagerCore/test/AmRouterTest/CMakeLists.txt~47
-rw-r--r--AudioManagerCore/test/AmRoutingInterfaceTest/CAmRoutingInterfaceTest.cpp (renamed from AudioManagerDaemon/test/AmRoutingInterfaceTest/CAmRoutingInterfaceTest.cpp)12
-rw-r--r--AudioManagerCore/test/AmRoutingInterfaceTest/CAmRoutingInterfaceTest.h (renamed from AudioManagerDaemon/test/AmRoutingInterfaceTest/CAmRoutingInterfaceTest.h)0
-rw-r--r--AudioManagerCore/test/AmRoutingInterfaceTest/CMakeLists.txt49
-rw-r--r--AudioManagerCore/test/AmRoutingInterfaceTest/CMakeLists.txt~48
-rw-r--r--AudioManagerCore/test/AmTelnetServerTest/CAmTelnetServerTest.cpp (renamed from AudioManagerDaemon/test/AmTelnetServerTest/CAmTelnetServerTest.cpp)2
-rw-r--r--AudioManagerCore/test/AmTelnetServerTest/CAmTelnetServerTest.h (renamed from AudioManagerDaemon/test/AmTelnetServerTest/CAmTelnetServerTest.h)0
-rw-r--r--AudioManagerCore/test/AmTelnetServerTest/CMakeLists.txt48
-rw-r--r--AudioManagerCore/test/AmTelnetServerTest/CMakeLists.txt~46
-rw-r--r--AudioManagerCore/test/CAmCommonFunctions.cpp (renamed from AudioManagerDaemon/test/CAmCommonFunctions.cpp)0
-rw-r--r--AudioManagerCore/test/CAmCommonFunctions.h (renamed from AudioManagerDaemon/test/CAmCommonFunctions.h)0
-rw-r--r--AudioManagerCore/test/CMakeLists.txt (renamed from AudioManagerDaemon/test/CMakeLists.txt)11
-rw-r--r--AudioManagerCore/test/IAmCommandBackdoor.h (renamed from AudioManagerDaemon/test/IAmCommandBackdoor.h)0
-rw-r--r--AudioManagerCore/test/IAmControlBackdoor.h (renamed from AudioManagerDaemon/test/IAmControlBackdoor.h)0
-rw-r--r--AudioManagerCore/test/IAmRoutingBackdoor.h (renamed from AudioManagerDaemon/test/IAmRoutingBackdoor.h)0
-rw-r--r--AudioManagerCore/test/MockIAmCommandSend.h (renamed from AudioManagerDaemon/test/MockIAmCommandSend.h)0
-rw-r--r--AudioManagerCore/test/MockIAmControlSend.h (renamed from AudioManagerDaemon/test/MockIAmControlSend.h)0
-rw-r--r--AudioManagerCore/test/MockIAmRoutingSend.h (renamed from AudioManagerDaemon/test/MockIAmRoutingSend.h)0
-rw-r--r--AudioManagerDaemon/CMakeLists.txt112
-rw-r--r--AudioManagerDaemon/docx/Doxyfile.in268
-rw-r--r--AudioManagerDaemon/include/CAmDatabaseHandlerSQLite.h208
-rw-r--r--AudioManagerDaemon/src/CAmDatabaseHandlerSQLite.cpp5651
-rwxr-xr-xAudioManagerDaemon/src/main.cpp14
-rw-r--r--AudioManagerDaemon/test/AmControlInterfaceTest/CMakeLists.txt95
-rw-r--r--AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.cpp2585
-rw-r--r--AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.h75
-rw-r--r--AudioManagerDaemon/test/AmDatabaseHandlerTest/CMakeLists.txt92
-rw-r--r--AudioManagerDaemon/test/AmMapHandlerTest/CMakeLists.txt90
-rw-r--r--AudioManagerDaemon/test/AmRouterMapTest/CMakeLists.txt81
-rw-r--r--AudioManagerDaemon/test/AmRouterTest/CMakeLists.txt81
-rw-r--r--AudioManagerDaemon/test/AmRoutingInterfaceTest/CMakeLists.txt90
-rw-r--r--AudioManagerDaemon/test/AmTelnetServerTest/CMakeLists.txt90
-rw-r--r--AudioManagerUtilities/CMakeLists.txt151
-rw-r--r--AudioManagerUtilities/include/CAmCommonAPIWrapper.h4
-rw-r--r--AudioManagerUtilities/include/CAmDltWrapper.h10
-rw-r--r--AudioManagerUtilities/include/CAmSocketHandler.h43
-rw-r--r--AudioManagerUtilities/include/sd-daemon.h286
-rw-r--r--AudioManagerUtilities/src/CAmDltWrapper.cpp108
-rw-r--r--AudioManagerUtilities/src/CAmSocketHandler.cpp3
-rwxr-xr-xAudioManagerUtilities/src/CAmWatchdog.cpp9
-rw-r--r--AudioManagerUtilities/src/sd-daemon.c534
-rw-r--r--AudioManagerUtilities/test/AmSocketHandlerTest/CAmSocketHandlerTest.cpp (renamed from AudioManagerDaemon/test/AmSocketHandlerTest/CAmSocketHandlerTest.cpp)0
-rw-r--r--AudioManagerUtilities/test/AmSocketHandlerTest/CAmSocketHandlerTest.h (renamed from AudioManagerDaemon/test/AmSocketHandlerTest/CAmSocketHandlerTest.h)0
-rw-r--r--AudioManagerUtilities/test/AmSocketHandlerTest/CMakeLists.txt (renamed from AudioManagerDaemon/test/AmSocketHandlerTest/CMakeLists.txt)50
-rw-r--r--AudioManagerUtilities/test/CMakeLists.txt4
-rwxr-xr-xCMakeLists.txt211
-rwxr-xr-xREADME138
-rw-r--r--README.html273
-rw-r--r--cmake/AudioManagerConfig.cmake.in35
-rw-r--r--cmake/AudioManagerCoreConfig.cmake.in17
-rw-r--r--cmake/AudioManagerUtilitiesConfig.cmake.in17
-rw-r--r--cmake/MacroVersionFromGit.cmake1
-rw-r--r--cmake/audiomanagerConfig.cmake.in44
-rw-r--r--cmake/audiomanagercore.pc.in10
-rw-r--r--cmake/audiomanagerutilities.pc.in4
-rw-r--r--cmake/config.cmake.in7
-rw-r--r--cmake/gmock.pc.in9
-rw-r--r--cmake/gtest.pc.in9
-rw-r--r--docx/01_mainpage.dox (renamed from AudioManagerDaemon/docx/01_mainpage.dox)0
-rw-r--r--docx/02_license.dox (renamed from AudioManagerDaemon/docx/02_license.dox)0
-rw-r--r--docx/02_x_dependecies.dox (renamed from AudioManagerDaemon/docx/02_x_dependecies.dox)0
-rw-r--r--docx/02_y_versioning.dox (renamed from AudioManagerDaemon/docx/02_y_versioning.dox)0
-rw-r--r--docx/03_architecture_overview.dox (renamed from AudioManagerDaemon/docx/03_architecture_overview.dox)0
-rw-r--r--docx/03_x_uml_model.dox (renamed from AudioManagerDaemon/docx/03_x_uml_model.dox)0
-rw-r--r--docx/04_components.dox (renamed from AudioManagerDaemon/docx/04_components.dox)0
-rw-r--r--docx/04_d_commonAPI.dox (renamed from AudioManagerDaemon/docx/04_d_commonAPI.dox)0
-rw-r--r--docx/04_x_elements.dox (renamed from AudioManagerDaemon/docx/04_x_elements.dox)0
-rw-r--r--docx/04_y_audiomanager_and_sources.dox (renamed from AudioManagerDaemon/docx/04_y_audiomanager_and_sources.dox)0
-rw-r--r--docx/05_unique.dox (renamed from AudioManagerDaemon/docx/05_unique.dox)0
-rw-r--r--docx/06_classification.dox (renamed from AudioManagerDaemon/docx/06_classification.dox)0
-rw-r--r--docx/07_interrupts.dox (renamed from AudioManagerDaemon/docx/07_interrupts.dox)0
-rw-r--r--docx/08_connections.dox (renamed from AudioManagerDaemon/docx/08_connections.dox)0
-rw-r--r--docx/09_lipsync.dox (renamed from AudioManagerDaemon/docx/09_lipsync.dox)0
-rw-r--r--docx/10_early_audio.dox (renamed from AudioManagerDaemon/docx/10_early_audio.dox)0
-rw-r--r--docx/11_views.dox (renamed from AudioManagerDaemon/docx/11_views.dox)0
-rw-r--r--docx/12_volumes.dox (renamed from AudioManagerDaemon/docx/12_volumes.dox)0
-rw-r--r--docx/13_properties.dox (renamed from AudioManagerDaemon/docx/13_properties.dox)0
-rw-r--r--docx/13_x_notifications.dox (renamed from AudioManagerDaemon/docx/13_x_notifications.dox)0
-rw-r--r--docx/14_misc.dox (renamed from AudioManagerDaemon/docx/14_misc.dox)0
-rw-r--r--docx/14_u_last_user_mode.dox (renamed from AudioManagerDaemon/docx/14_u_last_user_mode.dox)0
-rw-r--r--docx/14_x_mainloop.dox (renamed from AudioManagerDaemon/docx/14_x_mainloop.dox)0
-rw-r--r--docx/14_y_watchdog.dox (renamed from AudioManagerDaemon/docx/14_y_watchdog.dox)0
-rw-r--r--docx/14_zz_Startup_Rundown.dox (renamed from AudioManagerDaemon/docx/14_zz_Startup_Rundown.dox)0
-rw-r--r--docx/15_a_CommandLineParsing.dox (renamed from AudioManagerDaemon/docx/15_a_CommandLineParsing.dox)0
-rw-r--r--docx/15_dlt_support.dox (renamed from AudioManagerDaemon/docx/15_dlt_support.dox)0
-rw-r--r--docx/15_x_eclipse.dox (renamed from AudioManagerDaemon/docx/15_x_eclipse.dox)0
-rw-r--r--docx/16_readme.dox (renamed from AudioManagerDaemon/docx/16_readme.dox)0
-rw-r--r--docx/Doxyfile.in2326
-rw-r--r--docx/images/AudioDomains.gif (renamed from AudioManagerDaemon/docx/images/AudioDomains.gif)bin18948 -> 18948 bytes
-rwxr-xr-xdocx/images/AudioManagement.png (renamed from AudioManagerDaemon/docx/images/AudioManagement.png)bin34386 -> 34386 bytes
-rw-r--r--docx/images/AvailabilityofSinks.png (renamed from AudioManagerDaemon/docx/images/AvailabilityofSinks.png)bin37630 -> 37630 bytes
-rw-r--r--docx/images/AvailabilityofSources.png (renamed from AudioManagerDaemon/docx/images/AvailabilityofSources.png)bin37577 -> 37577 bytes
-rwxr-xr-xdocx/images/CancelRundown.png (renamed from AudioManagerDaemon/docx/images/CancelRundown.png)bin61007 -> 61007 bytes
-rwxr-xr-xdocx/images/ChangeofAudioformatduringplaytime.png (renamed from AudioManagerDaemon/docx/images/ChangeofAudioformatduringplaytime.png)bin46422 -> 46422 bytes
-rwxr-xr-xdocx/images/ClassDiagramm.png (renamed from AudioManagerDaemon/docx/images/ClassDiagramm.png)bin220221 -> 220221 bytes
-rw-r--r--docx/images/Deferred_Call_async.png (renamed from AudioManagerDaemon/docx/images/Deferred_Call_async.png)bin27008 -> 27008 bytes
-rw-r--r--docx/images/Deferred_Call_sync.png (renamed from AudioManagerDaemon/docx/images/Deferred_Call_sync.png)bin39301 -> 39301 bytes
-rw-r--r--docx/images/Gateway.gif (renamed from AudioManagerDaemon/docx/images/Gateway.gif)bin14829 -> 14829 bytes
-rw-r--r--docx/images/GatewayMatrix.png (renamed from AudioManagerDaemon/docx/images/GatewayMatrix.png)bin12269 -> 12269 bytes
-rw-r--r--docx/images/Interaction_with_sourcessinks.png (renamed from AudioManagerDaemon/docx/images/Interaction_with_sourcessinks.png)bin19385 -> 19385 bytes
-rw-r--r--docx/images/Interacton_Overview.png (renamed from AudioManagerDaemon/docx/images/Interacton_Overview.png)bin62617 -> 62617 bytes
-rwxr-xr-xdocx/images/InterruptStatusChange.png (renamed from AudioManagerDaemon/docx/images/InterruptStatusChange.png)bin22021 -> 22021 bytes
-rwxr-xr-xdocx/images/LastUserModeHandlingExample.png (renamed from AudioManagerDaemon/docx/images/LastUserModeHandlingExample.png)bin49412 -> 49412 bytes
-rw-r--r--docx/images/Levels.png (renamed from AudioManagerDaemon/docx/images/Levels.png)bin52975 -> 52975 bytes
-rwxr-xr-xdocx/images/Lifecylerequest.png (renamed from AudioManagerDaemon/docx/images/Lifecylerequest.png)bin48509 -> 48509 bytes
-rw-r--r--docx/images/Mainloop.png (renamed from AudioManagerDaemon/docx/images/Mainloop.png)bin46228 -> 46228 bytes
-rwxr-xr-xdocx/images/NodeStateManagementRelations.png (renamed from AudioManagerDaemon/docx/images/NodeStateManagementRelations.png)bin19326 -> 19326 bytes
-rwxr-xr-xdocx/images/Notifications.png (renamed from AudioManagerDaemon/docx/images/Notifications.png)bin23940 -> 23940 bytes
-rw-r--r--docx/images/PluginCommandInterfaceCAPI.png (renamed from AudioManagerDaemon/docx/images/PluginCommandInterfaceCAPI.png)bin114519 -> 114519 bytes
-rw-r--r--docx/images/PluginRoutingInterfaceCAPI.png (renamed from AudioManagerDaemon/docx/images/PluginRoutingInterfaceCAPI.png)bin167624 -> 167624 bytes
-rw-r--r--docx/images/Register_Domain.png (renamed from AudioManagerDaemon/docx/images/Register_Domain.png)bin17905 -> 17905 bytes
-rwxr-xr-xdocx/images/Registrations.png (renamed from AudioManagerDaemon/docx/images/Registrations.png)bin38991 -> 38991 bytes
-rwxr-xr-xdocx/images/Rundown.png (renamed from AudioManagerDaemon/docx/images/Rundown.png)bin75612 -> 75612 bytes
-rwxr-xr-xdocx/images/SettingConnectionFormats.png (renamed from AudioManagerDaemon/docx/images/SettingConnectionFormats.png)bin26690 -> 26690 bytes
-rw-r--r--docx/images/SoundPropertyChangeofSink.png (renamed from AudioManagerDaemon/docx/images/SoundPropertyChangeofSink.png)bin34583 -> 34583 bytes
-rw-r--r--docx/images/SoundPropertyChangeofSource.png (renamed from AudioManagerDaemon/docx/images/SoundPropertyChangeofSource.png)bin32592 -> 32592 bytes
-rwxr-xr-xdocx/images/SourceStates.png (renamed from AudioManagerDaemon/docx/images/SourceStates.png)bin32217 -> 32217 bytes
-rwxr-xr-xdocx/images/Startup.png (renamed from AudioManagerDaemon/docx/images/Startup.png)bin86887 -> 86887 bytes
-rwxr-xr-xdocx/images/StartupWithLastUserMode.png (renamed from AudioManagerDaemon/docx/images/StartupWithLastUserMode.png)bin22247 -> 22247 bytes
-rwxr-xr-xdocx/images/VolumeChangesofSinks.png (renamed from AudioManagerDaemon/docx/images/VolumeChangesofSinks.png)bin47122 -> 47122 bytes
-rw-r--r--docx/images/VolumeChangesofSources.png (renamed from AudioManagerDaemon/docx/images/VolumeChangesofSources.png)bin41243 -> 41243 bytes
-rw-r--r--docx/images/bus_topology.png (renamed from AudioManagerDaemon/docx/images/bus_topology.png)bin21535 -> 21535 bytes
-rwxr-xr-xdocx/images/daemon_insight.png (renamed from AudioManagerDaemon/docx/images/daemon_insight.png)bin64057 -> 64057 bytes
-rw-r--r--docx/images/delay.jpg (renamed from AudioManagerDaemon/docx/images/delay.jpg)bin17066 -> 17066 bytes
-rw-r--r--docx/images/dependencies.png (renamed from AudioManagerDaemon/docx/images/dependencies.png)bin38376 -> 38376 bytes
-rw-r--r--docx/images/dependencies_test.png (renamed from AudioManagerDaemon/docx/images/dependencies_test.png)bin59908 -> 59908 bytes
-rw-r--r--docx/images/dependency_created.png (renamed from AudioManagerDaemon/docx/images/dependency_created.png)bin119569 -> 119569 bytes
-rw-r--r--docx/images/early.png (renamed from AudioManagerDaemon/docx/images/early.png)bin18557 -> 18557 bytes
-rw-r--r--docx/images/example_system.png (renamed from AudioManagerDaemon/docx/images/example_system.png)bin10379 -> 10379 bytes
-rw-r--r--docx/images/genivilogo.png (renamed from AudioManagerDaemon/docx/images/genivilogo.png)bin9537 -> 9537 bytes
-rw-r--r--docx/images/late.png (renamed from AudioManagerDaemon/docx/images/late.png)bin15928 -> 15928 bytes
-rw-r--r--docx/images/routing_hierarchy.png (renamed from AudioManagerDaemon/docx/images/routing_hierarchy.png)bin11645 -> 11645 bytes
-rw-r--r--docx/images/unique.svg (renamed from AudioManagerDaemon/docx/images/unique.svg)0
-rw-r--r--docx/images/versioning.png (renamed from AudioManagerDaemon/docx/images/versioning.png)bin23647 -> 23647 bytes
-rwxr-xr-xdocx/images/versioning_new.png (renamed from AudioManagerDaemon/docx/images/versioning_new.png)bin18298 -> 18298 bytes
-rw-r--r--docx/images/views.png (renamed from AudioManagerDaemon/docx/images/views.png)bin65262 -> 65262 bytes
-rw-r--r--googleMock/CMakeLists.txt7
-rw-r--r--googleMock/gtest/CMakeLists.txt7
183 files changed, 3783 insertions, 10943 deletions
diff --git a/AudioManagerCore/CMakeLists.txt b/AudioManagerCore/CMakeLists.txt
new file mode 100644
index 0000000..2a553ba
--- /dev/null
+++ b/AudioManagerCore/CMakeLists.txt
@@ -0,0 +1,109 @@
+# 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
+#
+# For further information see http://www.genivi.org/.
+#
+
+cmake_minimum_required(VERSION 3.0)
+
+project (AudioManagerCore LANGUAGES CXX VERSION ${DAEMONVERSION})
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
+
+SET(AUDIOMANAGER_CORE_INCLUDE
+ ${AUDIOMANAGER_CORE}/include
+ ${AUDIOMANAGER_UTILITIES_INCLUDE}
+ CACHE INTERNAL "AUDIOMANAGER_CORE_INCLUDE directories" FORCE)
+
+SET(AUDIO_MANAGER_CORE_LIBS
+ ${AUDIO_MANAGER_UTILITIES_LIBS}
+ AudioManagerUtilities
+ CACHE INTERNAL "AUDIO_MANAGER_CORE_LIBS libs" FORCE)
+
+IF (WITH_SHARED_CORE)
+ SET(LIBRARY_TYPE SHARED)
+ELSE (WITH_SHARED_CORE)
+ SET(LIBRARY_TYPE STATIC)
+ENDIF (WITH_SHARED_CORE)
+
+set(AUDIOMAN_CORE_SRCS_CXX
+ src/CAmCommandReceiver.cpp
+ src/CAmCommandSender.cpp
+ src/CAmControlReceiver.cpp
+ src/CAmControlSender.cpp
+ src/CAmDatabaseObserver.cpp
+ src/CAmRoutingReceiver.cpp
+ src/CAmRoutingSender.cpp
+ src/CAmRouter.cpp
+ src/CAmLog.cpp
+ src/CAmDatabaseHandlerMap.cpp
+)
+
+if(WITH_TELNET)
+ set (AUDIOMAN_CORE_SRCS_CXX
+ ${AUDIOMAN_CORE_SRCS_CXX}
+ src/CAmTelnetServer.cpp
+ src/CAmTelnetMenuHelper.cpp)
+endif(WITH_TELNET)
+
+INCLUDE_DIRECTORIES(${AUDIOMANAGER_CORE_INCLUDE})
+
+ADD_LIBRARY(AudioManagerCore ${LIBRARY_TYPE} ${AUDIOMAN_CORE_SRCS_CXX})
+
+TARGET_LINK_LIBRARIES(AudioManagerCore ${AUDIO_MANAGER_CORE_LIBS} )
+
+ADD_DEPENDENCIES(AudioManagerCore AudioManagerUtilities)
+
+set_target_properties(AudioManagerCore PROPERTIES VERSION ${AudioManagerCore_VERSION} SOVERSION ${AudioManagerCore_VERSION_MAJOR})
+
+
+IF (WITH_SHARED_CORE)
+ INSTALL(TARGETS AudioManagerCore
+ LIBRARY DESTINATION lib
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
+ COMPONENT bin)
+ELSE (WITH_SHARED_CORE)
+ INSTALL(TARGETS AudioManagerCore
+ ARCHIVE DESTINATION lib
+ COMPONENT dev)
+ENDIF (WITH_SHARED_CORE)
+
+configure_file( ${CMAKE_SOURCE_DIR}/cmake/audiomanagercore.pc.in ${CMAKE_BINARY_DIR}/audiomanagercore.pc @ONLY )
+install(FILES ${CMAKE_BINARY_DIR}/audiomanagercore.pc DESTINATION lib/pkgconfig COMPONENT devel)
+
+configure_package_config_file (
+ ${CMAKE_SOURCE_DIR}/cmake/AudioManagerCoreConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/AudioManagerCoreConfig.cmake
+ INSTALL_DESTINATION lib/${LIB_INSTALL_SUFFIX}/cmake
+ PATH_VARS AUDIO_INCLUDE_FOLDER )
+
+write_basic_package_version_file(
+ ${CMAKE_CURRENT_BINARY_DIR}/AudioManagerCoreConfigVersion.cmake
+ VERSION ${DAEMONVERSION}
+ COMPATIBILITY SameMajorVersion )
+
+install(
+FILES ${CMAKE_CURRENT_BINARY_DIR}/AudioManagerCoreConfig.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/AudioManagerCoreConfigVersion.cmake
+DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/AudioManagerCore-${DAEMONVERSION})
+
+INSTALL(DIRECTORY "${AUDIOMANAGER_CORE}/include/"
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${LIB_INSTALL_SUFFIX}/AudioManagerCore
+ COMPONENT dev)
+
+if(WITH_TESTS)
+ add_subdirectory (test)
+endif(WITH_TESTS)
+
+
+
diff --git a/AudioManagerDaemon/include/CAmCommandReceiver.h b/AudioManagerCore/include/CAmCommandReceiver.h
index 0f30d81..0f30d81 100644
--- a/AudioManagerDaemon/include/CAmCommandReceiver.h
+++ b/AudioManagerCore/include/CAmCommandReceiver.h
diff --git a/AudioManagerDaemon/include/CAmCommandSender.h b/AudioManagerCore/include/CAmCommandSender.h
index 82363de..82363de 100644
--- a/AudioManagerDaemon/include/CAmCommandSender.h
+++ b/AudioManagerCore/include/CAmCommandSender.h
diff --git a/AudioManagerDaemon/include/CAmControlReceiver.h b/AudioManagerCore/include/CAmControlReceiver.h
index 3f39189..3f39189 100644
--- a/AudioManagerDaemon/include/CAmControlReceiver.h
+++ b/AudioManagerCore/include/CAmControlReceiver.h
diff --git a/AudioManagerDaemon/include/CAmControlSender.h b/AudioManagerCore/include/CAmControlSender.h
index 40ab379..40ab379 100644
--- a/AudioManagerDaemon/include/CAmControlSender.h
+++ b/AudioManagerCore/include/CAmControlSender.h
diff --git a/AudioManagerDaemon/include/CAmDatabaseHandlerMap.h b/AudioManagerCore/include/CAmDatabaseHandlerMap.h
index cf319f7..cf319f7 100644
--- a/AudioManagerDaemon/include/CAmDatabaseHandlerMap.h
+++ b/AudioManagerCore/include/CAmDatabaseHandlerMap.h
diff --git a/AudioManagerDaemon/include/CAmDatabaseObserver.h b/AudioManagerCore/include/CAmDatabaseObserver.h
index 7d18be4..7d18be4 100644
--- a/AudioManagerDaemon/include/CAmDatabaseObserver.h
+++ b/AudioManagerCore/include/CAmDatabaseObserver.h
diff --git a/AudioManagerDaemon/include/CAmGraph.h b/AudioManagerCore/include/CAmGraph.h
index ff4a09c..ff4a09c 100644
--- a/AudioManagerDaemon/include/CAmGraph.h
+++ b/AudioManagerCore/include/CAmGraph.h
diff --git a/AudioManagerDaemon/include/CAmLog.h b/AudioManagerCore/include/CAmLog.h
index 35c6a41..35c6a41 100644
--- a/AudioManagerDaemon/include/CAmLog.h
+++ b/AudioManagerCore/include/CAmLog.h
diff --git a/AudioManagerDaemon/include/CAmRouter.h b/AudioManagerCore/include/CAmRouter.h
index fe41049..fe41049 100644
--- a/AudioManagerDaemon/include/CAmRouter.h
+++ b/AudioManagerCore/include/CAmRouter.h
diff --git a/AudioManagerDaemon/include/CAmRoutingReceiver.h b/AudioManagerCore/include/CAmRoutingReceiver.h
index 82626c6..82626c6 100644
--- a/AudioManagerDaemon/include/CAmRoutingReceiver.h
+++ b/AudioManagerCore/include/CAmRoutingReceiver.h
diff --git a/AudioManagerDaemon/include/CAmRoutingSender.h b/AudioManagerCore/include/CAmRoutingSender.h
index 4a23428..4a23428 100644
--- a/AudioManagerDaemon/include/CAmRoutingSender.h
+++ b/AudioManagerCore/include/CAmRoutingSender.h
diff --git a/AudioManagerDaemon/include/CAmTelnetMenuHelper.h b/AudioManagerCore/include/CAmTelnetMenuHelper.h
index 7038cb3..7038cb3 100644
--- a/AudioManagerDaemon/include/CAmTelnetMenuHelper.h
+++ b/AudioManagerCore/include/CAmTelnetMenuHelper.h
diff --git a/AudioManagerDaemon/include/CAmTelnetServer.h b/AudioManagerCore/include/CAmTelnetServer.h
index 0e4c510..0e4c510 100644
--- a/AudioManagerDaemon/include/CAmTelnetServer.h
+++ b/AudioManagerCore/include/CAmTelnetServer.h
diff --git a/AudioManagerDaemon/include/IAmDatabaseHandler.h b/AudioManagerCore/include/IAmDatabaseHandler.h
index 30c1aaf..30c1aaf 100644
--- a/AudioManagerDaemon/include/IAmDatabaseHandler.h
+++ b/AudioManagerCore/include/IAmDatabaseHandler.h
diff --git a/AudioManagerDaemon/include/TAmPluginTemplate.h b/AudioManagerCore/include/TAmPluginTemplate.h
index f000fbe..f000fbe 100644
--- a/AudioManagerDaemon/include/TAmPluginTemplate.h
+++ b/AudioManagerCore/include/TAmPluginTemplate.h
diff --git a/AudioManagerDaemon/src/CAmCommandReceiver.cpp b/AudioManagerCore/src/CAmCommandReceiver.cpp
index d903384..d903384 100644
--- a/AudioManagerDaemon/src/CAmCommandReceiver.cpp
+++ b/AudioManagerCore/src/CAmCommandReceiver.cpp
diff --git a/AudioManagerDaemon/src/CAmCommandSender.cpp b/AudioManagerCore/src/CAmCommandSender.cpp
index c41c01d..da064cc 100644
--- a/AudioManagerDaemon/src/CAmCommandSender.cpp
+++ b/AudioManagerCore/src/CAmCommandSender.cpp
@@ -33,12 +33,11 @@
#include "CAmCommandReceiver.h"
#include "TAmPluginTemplate.h"
#include "CAmDltWrapper.h"
+#include "audiomanagerconfig.h"
namespace am
{
-#define REQUIRED_INTERFACE_VERSION_MAJOR 1 //!< major interface version. All versions smaller than this will be rejected
-#define REQUIRED_INTERFACE_VERSION_MINOR 0 //!< minor interface version. All versions smaller than this will be rejected
/**
* macro to call all interfaces
*/
@@ -137,15 +136,19 @@ CAmCommandSender::CAmCommandSender(const std::vector<std::string>& listOfPluginD
}
//check libversion
- std::string version;
+ std::string version, cVersion(CommandVersion);
commander->getInterfaceVersion(version);
- uint16_t minorVersion, majorVersion;
+ uint16_t minorVersion, majorVersion, cMinorVersion, cMajorVersion;
std::istringstream(version.substr(0, 1)) >> majorVersion;
std::istringstream(version.substr(2, 1)) >> minorVersion;
+ std::istringstream(cVersion.substr(0, 1)) >> cMajorVersion;
+ std::istringstream(cVersion.substr(2, 1)) >> cMinorVersion;
+
+
- if (majorVersion < REQUIRED_INTERFACE_VERSION_MAJOR || ((majorVersion == REQUIRED_INTERFACE_VERSION_MAJOR) && (minorVersion > REQUIRED_INTERFACE_VERSION_MINOR)))
+ if (majorVersion < cMajorVersion || ((majorVersion == cMajorVersion) && (minorVersion > cMinorVersion)))
{
- logInfo("CommandInterface initialization failed. Version of Interface to old");
+ logError("CommandInterface initialization failed. Version of Interface to old");
dlclose(tempLibHandle);
continue;
}
diff --git a/AudioManagerDaemon/src/CAmControlReceiver.cpp b/AudioManagerCore/src/CAmControlReceiver.cpp
index c1c161e..c1c161e 100644
--- a/AudioManagerDaemon/src/CAmControlReceiver.cpp
+++ b/AudioManagerCore/src/CAmControlReceiver.cpp
diff --git a/AudioManagerDaemon/src/CAmControlSender.cpp b/AudioManagerCore/src/CAmControlSender.cpp
index 672c2d5..10125d5 100644
--- a/AudioManagerDaemon/src/CAmControlSender.cpp
+++ b/AudioManagerCore/src/CAmControlSender.cpp
@@ -27,6 +27,9 @@
#include <iostream>
#include <sstream>
#include <stdexcept>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <dirent.h>
#include "TAmPluginTemplate.h"
#include "CAmDltWrapper.h"
@@ -48,6 +51,57 @@ CAmControlSender::CAmControlSender(std::string controlPluginFile,CAmSocketHandle
mSignal(0)
{
assert(sockethandler);
+
+ //Check if a folder is given, then select the first plugin
+ struct stat buf;
+ const char* conFile(controlPluginFile.c_str());
+ stat(conFile, &buf);
+ if (S_ISDIR(buf.st_mode))
+ {
+ std::string directoryName(controlPluginFile);
+ logInfo("Searching for ControlPlugin in", directoryName);
+ DIR *directory = opendir(directoryName.c_str());
+
+ if (!directory)
+ {
+ logError("Error opening directory ", directoryName);
+ throw std::runtime_error("Controller directory could not be openend");
+ }
+
+ // iterate content of directory
+ struct dirent *itemInDirectory = 0;
+ while ((itemInDirectory = readdir(directory)))
+ {
+ unsigned char entryType = itemInDirectory->d_type;
+ std::string entryName = itemInDirectory->d_name;
+ std::string fullName = directoryName + "/" + entryName;
+
+ bool regularFile = (entryType == DT_REG || entryType == DT_LNK);
+ bool sharedLibExtension = ("so" == entryName.substr(entryName.find_last_of(".") + 1));
+
+ // Handle cases where readdir() could not determine the file type
+ if (entryType == DT_UNKNOWN) {
+ struct stat buf;
+
+ if (stat(fullName.c_str(), &buf)) {
+ logInfo(__PRETTY_FUNCTION__,"Failed to stat file: ", entryName, errno);
+ continue;
+ }
+
+ regularFile = S_ISREG(buf.st_mode);
+ }
+
+ if (regularFile && sharedLibExtension)
+ {
+ controlPluginFile=directoryName + "/" + entryName;
+ logInfo("Found ControlPlugin:", controlPluginFile);
+ break;
+ }
+ }
+ closedir(directory);
+
+ }
+
std::ifstream isfile(controlPluginFile.c_str());
if (!isfile)
{
@@ -63,13 +117,17 @@ CAmControlSender::CAmControlSender(std::string controlPluginFile,CAmSocketHandle
mController = createFunc();
//check libversion
- std::string version;
+ std::string version, cVersion(ControlVersion);
mController->getInterfaceVersion(version);
- uint16_t minorVersion, majorVersion;
+ uint16_t minorVersion, majorVersion, cMinorVersion, cMajorVersion;
std::istringstream(version.substr(0, 1)) >> majorVersion;
std::istringstream(version.substr(2, 1)) >> minorVersion;
+ std::istringstream(cVersion.substr(0, 1)) >> cMajorVersion;
+ std::istringstream(cVersion.substr(2, 1)) >> cMinorVersion;
+
+
- if (majorVersion < REQUIRED_INTERFACE_VERSION_MAJOR || ((majorVersion == REQUIRED_INTERFACE_VERSION_MAJOR) && (minorVersion > REQUIRED_INTERFACE_VERSION_MINOR)))
+ if (majorVersion < cMajorVersion || ((majorVersion == cMajorVersion) && (minorVersion > cMinorVersion)))
{
logError("ControlSender::ControlSender: Interface Version of Controller too old, exiting now");
throw std::runtime_error("Interface Version of Controller too old");
diff --git a/AudioManagerDaemon/src/CAmDatabaseHandlerMap.cpp b/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp
index 929c8d5..929c8d5 100644
--- a/AudioManagerDaemon/src/CAmDatabaseHandlerMap.cpp
+++ b/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp
diff --git a/AudioManagerDaemon/src/CAmDatabaseObserver.cpp b/AudioManagerCore/src/CAmDatabaseObserver.cpp
index acac639..acac639 100644
--- a/AudioManagerDaemon/src/CAmDatabaseObserver.cpp
+++ b/AudioManagerCore/src/CAmDatabaseObserver.cpp
diff --git a/AudioManagerDaemon/src/CAmLog.cpp b/AudioManagerCore/src/CAmLog.cpp
index f68f660..f68f660 100644
--- a/AudioManagerDaemon/src/CAmLog.cpp
+++ b/AudioManagerCore/src/CAmLog.cpp
diff --git a/AudioManagerDaemon/src/CAmRouter.cpp b/AudioManagerCore/src/CAmRouter.cpp
index f98bf11..f98bf11 100644
--- a/AudioManagerDaemon/src/CAmRouter.cpp
+++ b/AudioManagerCore/src/CAmRouter.cpp
diff --git a/AudioManagerDaemon/src/CAmRoutingReceiver.cpp b/AudioManagerCore/src/CAmRoutingReceiver.cpp
index 4189936..4189936 100644
--- a/AudioManagerDaemon/src/CAmRoutingReceiver.cpp
+++ b/AudioManagerCore/src/CAmRoutingReceiver.cpp
diff --git a/AudioManagerDaemon/src/CAmRoutingSender.cpp b/AudioManagerCore/src/CAmRoutingSender.cpp
index efd44e1..35e35b8 100644
--- a/AudioManagerDaemon/src/CAmRoutingSender.cpp
+++ b/AudioManagerCore/src/CAmRoutingSender.cpp
@@ -146,14 +146,19 @@ CAmRoutingSender::CAmRoutingSender(const std::vector<std::string>& listOfPluginD
routerInterface.routingInterface = router;
//check libversion
- std::string version;
+ std::string version, cVersion(RoutingVersion);
router->getInterfaceVersion(version);
- uint16_t minorVersion, majorVersion;
+ uint16_t minorVersion, majorVersion, cMinorVersion, cMajorVersion;
std::istringstream(version.substr(0, 1)) >> majorVersion;
std::istringstream(version.substr(2, 1)) >> minorVersion;
- if (majorVersion < REQUIRED_INTERFACE_VERSION_MAJOR || ((majorVersion == REQUIRED_INTERFACE_VERSION_MAJOR) && (minorVersion > REQUIRED_INTERFACE_VERSION_MINOR)))
+ std::istringstream(cVersion.substr(0, 1)) >> cMajorVersion;
+ std::istringstream(cVersion.substr(2, 1)) >> cMinorVersion;
+
+
+
+ if (majorVersion < cMajorVersion || ((majorVersion == cMajorVersion) && (minorVersion > cMinorVersion)))
{
- logInfo("RoutingPlugin initialization failed. Version of Interface to old");
+ logError("Routing initialization failed. Version of Interface to old");
dlclose(tempLibHandle);
continue;
}
diff --git a/AudioManagerDaemon/src/CAmTelnetMenuHelper.cpp b/AudioManagerCore/src/CAmTelnetMenuHelper.cpp
index 2aae4f5..2aae4f5 100644
--- a/AudioManagerDaemon/src/CAmTelnetMenuHelper.cpp
+++ b/AudioManagerCore/src/CAmTelnetMenuHelper.cpp
diff --git a/AudioManagerDaemon/src/CAmTelnetServer.cpp b/AudioManagerCore/src/CAmTelnetServer.cpp
index 22f7b0e..22f7b0e 100755
--- a/AudioManagerDaemon/src/CAmTelnetServer.cpp
+++ b/AudioManagerCore/src/CAmTelnetServer.cpp
diff --git a/AudioManagerDaemon/test/AmControlInterfaceTest/CAmControlInterfaceTest.cpp b/AudioManagerCore/test/AmControlInterfaceTest/CAmControlInterfaceTest.cpp
index 9f58a5a..9008ce6 100644
--- a/AudioManagerDaemon/test/AmControlInterfaceTest/CAmControlInterfaceTest.cpp
+++ b/AudioManagerCore/test/AmControlInterfaceTest/CAmControlInterfaceTest.cpp
@@ -26,11 +26,13 @@
#include <vector>
#include <set>
#include "CAmDltWrapper.h"
+#include "CAmCommandLineSingleton.h"
using namespace am;
using namespace testing;
DLT_DECLARE_CONTEXT(AudioManager)
+TCLAP::SwitchArg enableNoDLTDebug ("V","logDlt","print DLT logs to stdout or dlt-daemon default off",false);
ACTION(returnResyncConnection)
{
@@ -61,9 +63,6 @@ CAmControlInterfaceTest::CAmControlInterfaceTest() :
pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender, &pSocketHandler, &pRouter), //
pRoutingReceiver(&pDatabaseHandler, &pRoutingSender, &pControlSender, &pSocketHandler)
{
- CAmDltWrapper::instance(0)->registerApp("AudioManagerDeamon", "AudioManagerDeamon");
- CAmDltWrapper::instance()->registerContext(AudioManager, "Main", "Main Context");
- logInfo("The Audiomanager is started");
pDatabaseHandler.registerObserver(&pDatabaseObserver);
pControlInterfaceBackdoor.replaceController(&pControlSender, &pMockControlInterface);
pRoutingInterfaceBackdoor.injectInterface(&pRoutingSender, &pMockRoutingInterface, "mock");
@@ -72,11 +71,12 @@ CAmControlInterfaceTest::CAmControlInterfaceTest() :
CAmControlInterfaceTest::~CAmControlInterfaceTest()
{
+ CAmDltWrapper::instance()->unregisterContext(AudioManager);
}
void CAmControlInterfaceTest::SetUp()
{
- logInfo("RoutingSendInterface Test started");
+
}
void CAmControlInterfaceTest::TearDown()
@@ -656,6 +656,17 @@ TEST_F(CAmControlInterfaceTest,ackConnectNotPossible)
int main(int argc, char **argv)
{
+ try
+ {
+ TCLAP::CmdLine* cmd(CAmCommandLineSingleton::instanciateOnce("The team of the AudioManager wishes you a nice day!",' ',DAEMONVERSION,true));
+ cmd->add(enableNoDLTDebug);
+ }
+ catch (TCLAP::ArgException &e) // catch any exceptions
+ { std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl; }
+ CAmCommandLineSingleton::instance()->preparse(argc,argv);
+ CAmDltWrapper::instance(enableNoDLTDebug.getValue())->registerApp("AudioManagerDeamon", "AudioManagerDeamon");
+ CAmDltWrapper::instance()->registerContext(AudioManager, "Main", "Main Context");
+ logInfo("RoutingSendInterface Test started");
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
diff --git a/AudioManagerDaemon/test/AmControlInterfaceTest/CAmControlInterfaceTest.h b/AudioManagerCore/test/AmControlInterfaceTest/CAmControlInterfaceTest.h
index b7fa27a..b7fa27a 100644
--- a/AudioManagerDaemon/test/AmControlInterfaceTest/CAmControlInterfaceTest.h
+++ b/AudioManagerCore/test/AmControlInterfaceTest/CAmControlInterfaceTest.h
diff --git a/AudioManagerCore/test/AmControlInterfaceTest/CMakeLists.txt b/AudioManagerCore/test/AmControlInterfaceTest/CMakeLists.txt
new file mode 100644
index 0000000..4f33ac5
--- /dev/null
+++ b/AudioManagerCore/test/AmControlInterfaceTest/CMakeLists.txt
@@ -0,0 +1,52 @@
+# 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
+#
+# For further information see http://www.genivi.org/.
+#
+
+cmake_minimum_required(VERSION 3.0)
+
+project(AmControlInterfaceTest LANGUAGES CXX VERSION ${DAEMONVERSION})
+
+INCLUDE_DIRECTORIES(
+ ${AUDIOMANAGER_CORE_INCLUDE}
+ ${GMOCK_INCLUDE_DIRS}
+ ${GTEST_INCLUDE_DIRS})
+
+
+ file(GLOB CONTROL_INTERFACE_SRCS_CXX
+ "../CAmCommonFunctions.cpp"
+ "*.cpp"
+)
+
+add_executable(AmControlInterfaceTest ${CONTROL_INTERFACE_SRCS_CXX})
+
+TARGET_LINK_LIBRARIES(AmControlInterfaceTest
+ ${GTEST_LIBRARIES}
+ ${GMOCK_LIBRARIES}
+ AudioManagerCore
+)
+
+add_test(AmControlInterfaceTest AmControlInterfaceTest)
+
+ADD_DEPENDENCIES(AmControlInterfaceTest AudioManagerCore)
+
+INSTALL(TARGETS AmControlInterfaceTest
+ DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
+ COMPONENT tests)
+
+
+
+
diff --git a/AudioManagerCore/test/AmControlInterfaceTest/CMakeLists.txt~ b/AudioManagerCore/test/AmControlInterfaceTest/CMakeLists.txt~
new file mode 100644
index 0000000..5b71a59
--- /dev/null
+++ b/AudioManagerCore/test/AmControlInterfaceTest/CMakeLists.txt~
@@ -0,0 +1,50 @@
+# 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
+#
+# For further information see http://www.genivi.org/.
+#
+
+cmake_minimum_required(VERSION 3.0)
+
+project(AmControlInterfaceTest LANGUAGES CXX VERSION ${DAEMONVERSION})
+
+INCLUDE_DIRECTORIES(
+ ${AUDIOMANAGER_CORE_INCLUDE}
+ ${GMOCK_INCLUDE_DIRS}
+ ${GTEST_INCLUDE_DIRS})
+
+
+ file(GLOB CONTROL_INTERFACE_SRCS_CXX
+ "../CAmCommonFunctions.cpp"
+ "*.cpp"
+)
+
+add_executable(AmControlInterfaceTest ${CONTROL_INTERFACE_SRCS_CXX})
+
+TARGET_LINK_LIBRARIES(AmControlInterfaceTest
+ ${GTEST_LIBRARIES}
+ ${GMOCK_LIBRARIES}
+ AudioManagerCore
+)
+
+ADD_DEPENDENCIES(AmControlInterfaceTest AudioManagerCore)
+
+INSTALL(TARGETS AmControlInterfaceTest
+ DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
+ COMPONENT tests)
+
+
+
+
diff --git a/AudioManagerDaemon/test/AmMapHandlerTest/CAmMapHandlerTest.cpp b/AudioManagerCore/test/AmMapHandlerTest/CAmMapHandlerTest.cpp
index 0f90704..337ecb7 100644
--- a/AudioManagerDaemon/test/AmMapHandlerTest/CAmMapHandlerTest.cpp
+++ b/AudioManagerCore/test/AmMapHandlerTest/CAmMapHandlerTest.cpp
@@ -28,6 +28,7 @@
#include <set>
#include <ios>
#include "CAmDltWrapper.h"
+#include "CAmCommandLineSingleton.h"
using namespace am;
using namespace testing;
@@ -42,6 +43,8 @@ int16_t const TEST_MAX_CONNECTION_ID = 20;
int16_t const TEST_MAX_MAINCONNECTION_ID = 20;
int16_t const TEST_MAX_SINK_ID = 40;
+TCLAP::SwitchArg enableNoDLTDebug ("V","logDlt","print DLT logs to stdout or dlt-daemon default off",false);
+
CAmMapBasicTest::CAmMapBasicTest() :
plistRoutingPluginDirs(), //
@@ -3256,7 +3259,15 @@ TEST_F(CAmMapHandlerObserverCallbacksTest, changeMainNotificationsSources)
int main(int argc, char **argv)
{
- CAmDltWrapper::instance()->registerApp("databse", "databasetest");
+ try
+ {
+ TCLAP::CmdLine* cmd(CAmCommandLineSingleton::instanciateOnce("The team of the AudioManager wishes you a nice day!",' ',DAEMONVERSION,true));
+ cmd->add(enableNoDLTDebug);
+ }
+ catch (TCLAP::ArgException &e) // catch any exceptions
+ { std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl; }
+ CAmCommandLineSingleton::instance()->preparse(argc,argv);
+ CAmDltWrapper::instance(enableNoDLTDebug.getValue())->registerApp("databse", "databasetest");
logInfo("Database Test started ");
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/AudioManagerDaemon/test/AmMapHandlerTest/CAmMapHandlerTest.h b/AudioManagerCore/test/AmMapHandlerTest/CAmMapHandlerTest.h
index e3cc0ef..e3cc0ef 100644
--- a/AudioManagerDaemon/test/AmMapHandlerTest/CAmMapHandlerTest.h
+++ b/AudioManagerCore/test/AmMapHandlerTest/CAmMapHandlerTest.h
diff --git a/AudioManagerDaemon/test/AmMapHandlerTest/CAmTestDatabaseObserver.cpp b/AudioManagerCore/test/AmMapHandlerTest/CAmTestDatabaseObserver.cpp
index a035cee..a035cee 100644
--- a/AudioManagerDaemon/test/AmMapHandlerTest/CAmTestDatabaseObserver.cpp
+++ b/AudioManagerCore/test/AmMapHandlerTest/CAmTestDatabaseObserver.cpp
diff --git a/AudioManagerCore/test/AmMapHandlerTest/CMakeLists.txt b/AudioManagerCore/test/AmMapHandlerTest/CMakeLists.txt
new file mode 100644
index 0000000..6588710
--- /dev/null
+++ b/AudioManagerCore/test/AmMapHandlerTest/CMakeLists.txt
@@ -0,0 +1,49 @@
+# 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
+#
+# For further information see http://www.genivi.org/.
+#
+
+cmake_minimum_required(VERSION 3.0)
+
+project(AmMapHandlerTest LANGUAGES CXX VERSION ${DAEMONVERSION})
+
+INCLUDE_DIRECTORIES(
+ ${AUDIOMANAGER_UTILITIES_INCLUDE}
+ ${GMOCK_INCLUDE_DIRS}
+ ${GTEST_INCLUDE_DIRS}
+)
+
+file(GLOB DATABASE_SRCS_CXX
+ "../CAmCommonFunctions.cpp"
+ "CAmTestDatabaseObserver.cpp"
+ "*.cpp"
+ )
+
+ADD_EXECUTABLE( AmMapHandlerTest ${DATABASE_SRCS_CXX})
+
+TARGET_LINK_LIBRARIES( AmMapHandlerTest
+ ${GTEST_LIBRARIES}
+ ${GMOCK_LIBRARIES}
+ AudioManagerCore
+)
+
+ADD_DEPENDENCIES(AmMapHandlerTest AudioManagerCore)
+
+INSTALL(TARGETS AmMapHandlerTest
+ DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
+ COMPONENT tests
+)
+
diff --git a/AudioManagerCore/test/AmMapHandlerTest/CMakeLists.txt~ b/AudioManagerCore/test/AmMapHandlerTest/CMakeLists.txt~
new file mode 100644
index 0000000..05d2a05
--- /dev/null
+++ b/AudioManagerCore/test/AmMapHandlerTest/CMakeLists.txt~
@@ -0,0 +1,54 @@
+# 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
+#
+# For further information see http://www.genivi.org/.
+#
+
+cmake_minimum_required(VERSION 3.0)
+
+project(AmMapHandlerTest LANGUAGES CXX VERSION ${DAEMONVERSION})
+
+INCLUDE_DIRECTORIES(
+ ${AUDIOMANAGER_UTILITIES_INCLUDE}
+ ${GMOCK_INCLUDE_DIRS}
+)
+
+if(WITH_DLT)
+ INCLUDE_DIRECTORIES(
+ ${INCLUDE_DIRECTORIES}
+ ${DLT_INCLUDE_DIRS})
+endif(WITH_DLT)
+
+file(GLOB DATABASE_SRCS_CXX
+ "../CAmCommonFunctions.cpp"
+ "CAmTestDatabaseObserver.cpp"
+ "*.cpp"
+ )
+
+ADD_EXECUTABLE( AmMapHandlerTest ${DATABASE_SRCS_CXX})
+
+TARGET_LINK_LIBRARIES( AmMapHandlerTest
+ ${GTEST_LIBRARIES}
+ ${GMOCK_LIBRARIES}
+ AudioManagerCore
+)
+
+ADD_DEPENDENCIES(AmMapHandlerTest AudioManagerCore)
+
+INSTALL(TARGETS AmMapHandlerTest
+ DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
+ COMPONENT tests
+)
+
diff --git a/AudioManagerDaemon/test/AmMapHandlerTest/MockDatabaseObserver.h b/AudioManagerCore/test/AmMapHandlerTest/MockDatabaseObserver.h
index da1b3b4..da1b3b4 100644
--- a/AudioManagerDaemon/test/AmMapHandlerTest/MockDatabaseObserver.h
+++ b/AudioManagerCore/test/AmMapHandlerTest/MockDatabaseObserver.h
diff --git a/AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.cpp b/AudioManagerCore/test/AmRouterMapTest/CAmRouterMapTest.cpp
index 647dad5..f95a24a 100644
--- a/AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.cpp
+++ b/AudioManagerCore/test/AmRouterMapTest/CAmRouterMapTest.cpp
@@ -25,8 +25,9 @@
#include "CAmRouterMapTest.h"
#include <string.h>
#include "CAmDltWrapper.h"
+#include "CAmCommandLineSingleton.h"
-
+TCLAP::SwitchArg enableNoDLTDebug ("V","logDlt","print DLT logs to stdout or dlt-daemon default off",false);
using namespace am;
@@ -3166,11 +3167,15 @@ TEST_F(CAmRouterMapTest,route3Domains1Source3Gateways3Convertres1Sink)
int main(int argc, char **argv)
{
-#ifdef WITH_DLT
- CAmDltWrapper::instance()->registerApp("routing", "CAmRouterMapTest");
-#else
- CAmDltWrapper::instance(true)->registerApp("routing", "CAmRouterMapTest");
-#endif
+ try
+ {
+ TCLAP::CmdLine* cmd(CAmCommandLineSingleton::instanciateOnce("The team of the AudioManager wishes you a nice day!",' ',DAEMONVERSION,true));
+ cmd->add(enableNoDLTDebug);
+ }
+ catch (TCLAP::ArgException &e) // catch any exceptions
+ { std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl; }
+ CAmCommandLineSingleton::instance()->preparse(argc,argv);
+ CAmDltWrapper::instance(enableNoDLTDebug.getValue())->registerApp("routing", "CAmRouterMapTest");
logInfo("Routing Test started ");
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.h b/AudioManagerCore/test/AmRouterMapTest/CAmRouterMapTest.h
index 65ff97b..65ff97b 100644
--- a/AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.h
+++ b/AudioManagerCore/test/AmRouterMapTest/CAmRouterMapTest.h
diff --git a/AudioManagerCore/test/AmRouterMapTest/CMakeLists.txt b/AudioManagerCore/test/AmRouterMapTest/CMakeLists.txt
new file mode 100644
index 0000000..17689d9
--- /dev/null
+++ b/AudioManagerCore/test/AmRouterMapTest/CMakeLists.txt
@@ -0,0 +1,47 @@
+# 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
+#
+# For further information see http://www.genivi.org/.
+#
+
+cmake_minimum_required(VERSION 3.0)
+
+project (AmRouterMapTest LANGUAGES CXX VERSION ${DAEMONVERSION})
+
+INCLUDE_DIRECTORIES(
+ ${AUDIOMANAGER_CORE_INCLUDE}
+ ${GMOCK_INCLUDE_DIRS}
+ ${GTEST_INCLUDE_DIRS})
+
+file(GLOB ROUTINGMAP_SRCS_CXX
+ "../CAmCommonFunctions.cpp"
+ "*.cpp"
+ )
+
+ADD_EXECUTABLE( AmRouterMapTest ${ROUTINGMAP_SRCS_CXX})
+
+TARGET_LINK_LIBRARIES(AmRouterMapTest
+ ${GTEST_LIBRARIES}
+ ${GMOCK_LIBRARIES}
+ AudioManagerCore
+)
+
+ADD_DEPENDENCIES(AmRouterMapTest AudioManagerCore)
+
+INSTALL(TARGETS AmRouterMapTest
+ DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
+ COMPONENT tests
+)
+
diff --git a/AudioManagerCore/test/AmRouterMapTest/CMakeLists.txt~ b/AudioManagerCore/test/AmRouterMapTest/CMakeLists.txt~
new file mode 100644
index 0000000..ec79082
--- /dev/null
+++ b/AudioManagerCore/test/AmRouterMapTest/CMakeLists.txt~
@@ -0,0 +1,47 @@
+# 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
+#
+# For further information see http://www.genivi.org/.
+#
+
+cmake_minimum_required(VERSION 3.0)
+
+project (AmRouterMapTest LANGUAGES CXX VERSION ${DAEMONVERSION})
+
+INCLUDE_DIRECTORIES(
+ ${AUDIOMANAGER_CORE_INCLUDE}
+ ${GMOCK_INCLUDE_DIR}
+ ${GTEST_INCLUDE_DIRS})
+
+file(GLOB ROUTINGMAP_SRCS_CXX
+ "../CAmCommonFunctions.cpp"
+ "*.cpp"
+ )
+
+ADD_EXECUTABLE( AmRouterMapTest ${ROUTINGMAP_SRCS_CXX})
+
+TARGET_LINK_LIBRARIES(AmRouterMapTest
+ ${GTEST_LIBRARIES}
+ ${GMOCK_LIBRARIES}
+ AudioManagerCore
+)
+
+ADD_DEPENDENCIES(AmRouterMapTest AudioManagerCore)
+
+INSTALL(TARGETS AmRouterMapTest
+ DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
+ COMPONENT tests
+)
+
diff --git a/AudioManagerDaemon/test/AmRouterTest/CAmRouterTest.cpp b/AudioManagerCore/test/AmRouterTest/CAmRouterTest.cpp
index e88d54b..a64979e 100644
--- a/AudioManagerDaemon/test/AmRouterTest/CAmRouterTest.cpp
+++ b/AudioManagerCore/test/AmRouterTest/CAmRouterTest.cpp
@@ -23,10 +23,13 @@
#include "CAmRouterTest.h"
#include <string.h>
#include "CAmDltWrapper.h"
+#include "CAmCommandLineSingleton.h"
using namespace am;
using namespace testing;
+TCLAP::SwitchArg enableNoDLTDebug ("V","logDlt","print DLT logs to stdout or dlt-daemon default off",false);
+
CAmRouterTest::CAmRouterTest() :
plistRoutingPluginDirs(), //
plistCommandPluginDirs(), //
@@ -1948,11 +1951,15 @@ TEST_F(CAmRouterTest,simpleRoute4Domains)
int main(int argc, char **argv)
{
-#ifdef WITH_DLT
- CAmDltWrapper::instance()->registerApp("routing", "CAmRouterTest");
-#else
- CAmDltWrapper::instance(true)->registerApp("routing", "CAmRouterTest");
-#endif
+ try
+ {
+ TCLAP::CmdLine* cmd(CAmCommandLineSingleton::instanciateOnce("The team of the AudioManager wishes you a nice day!",' ',DAEMONVERSION,true));
+ cmd->add(enableNoDLTDebug);
+ }
+ catch (TCLAP::ArgException &e) // catch any exceptions
+ { std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl; }
+ CAmCommandLineSingleton::instance()->preparse(argc,argv);
+ CAmDltWrapper::instance(enableNoDLTDebug.getValue())->registerApp("routing", "CAmRouterTest");
logInfo("Routing Test started ");
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/AudioManagerDaemon/test/AmRouterTest/CAmRouterTest.h b/AudioManagerCore/test/AmRouterTest/CAmRouterTest.h
index 4a4e35b..4a4e35b 100644
--- a/AudioManagerDaemon/test/AmRouterTest/CAmRouterTest.h
+++ b/AudioManagerCore/test/AmRouterTest/CAmRouterTest.h
diff --git a/AudioManagerCore/test/AmRouterTest/CMakeLists.txt b/AudioManagerCore/test/AmRouterTest/CMakeLists.txt
new file mode 100644
index 0000000..db05911
--- /dev/null
+++ b/AudioManagerCore/test/AmRouterTest/CMakeLists.txt
@@ -0,0 +1,48 @@
+# 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
+#
+# For further information see http://www.genivi.org/.
+#
+
+cmake_minimum_required(VERSION 3.0)
+
+project(AmRouterTest LANGUAGES CXX VERSION ${DAEMONVERSION})
+
+INCLUDE_DIRECTORIES(
+ ${AUDIOMANAGER_CORE_INCLUDE}
+ ${GMOCK_INCLUDE_DIRS}
+ ${GTEST_INCLUDE_DIRS})
+
+
+file(GLOB ROUTING_SRCS_CXX
+ "../CAmCommonFunctions.cpp"
+ "*.cpp"
+ )
+
+ADD_EXECUTABLE( AmRouterTest ${ROUTING_SRCS_CXX})
+
+TARGET_LINK_LIBRARIES(AmRouterTest
+ ${GTEST_LIBRARIES}
+ ${GMOCK_LIBRARIES}
+ AudioManagerCore
+)
+
+ADD_DEPENDENCIES(AmRouterTest AudioManagerCore)
+
+INSTALL(TARGETS AmRouterTest
+ DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
+ COMPONENT tests
+)
+
diff --git a/AudioManagerCore/test/AmRouterTest/CMakeLists.txt~ b/AudioManagerCore/test/AmRouterTest/CMakeLists.txt~
new file mode 100644
index 0000000..32e1206
--- /dev/null
+++ b/AudioManagerCore/test/AmRouterTest/CMakeLists.txt~
@@ -0,0 +1,47 @@
+# 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
+#
+# For further information see http://www.genivi.org/.
+#
+
+cmake_minimum_required(VERSION 3.0)
+
+project(AmRouterTest LANGUAGES CXX VERSION ${DAEMONVERSION})
+
+INCLUDE_DIRECTORIES(
+ ${AUDIOMANAGER_CORE_INCLUDE}
+ ${GMOCK_INCLUDE_DIR})
+
+
+file(GLOB ROUTING_SRCS_CXX
+ "../CAmCommonFunctions.cpp"
+ "*.cpp"
+ )
+
+ADD_EXECUTABLE( AmRouterTest ${ROUTING_SRCS_CXX})
+
+TARGET_LINK_LIBRARIES(AmRouterTest
+ ${GTEST_LIBRARIES}
+ ${GMOCK_LIBRARIES}
+ AudioManagerCore
+)
+
+ADD_DEPENDENCIES(AmRouterTest AudioManagerCore)
+
+INSTALL(TARGETS AmRouterTest
+ DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
+ COMPONENT tests
+)
+
diff --git a/AudioManagerDaemon/test/AmRoutingInterfaceTest/CAmRoutingInterfaceTest.cpp b/AudioManagerCore/test/AmRoutingInterfaceTest/CAmRoutingInterfaceTest.cpp
index 347b65a..5978b6d 100644
--- a/AudioManagerDaemon/test/AmRoutingInterfaceTest/CAmRoutingInterfaceTest.cpp
+++ b/AudioManagerCore/test/AmRoutingInterfaceTest/CAmRoutingInterfaceTest.cpp
@@ -22,10 +22,13 @@
#include "CAmRoutingInterfaceTest.h"
#include "CAmDltWrapper.h"
+#include "CAmCommandLineSingleton.h"
using namespace am;
using namespace testing;
+TCLAP::SwitchArg enableNoDLTDebug ("V","logDlt","print DLT logs to stdout or dlt-daemon default off",false);
+
CAmRoutingInterfaceTest::CAmRoutingInterfaceTest() :
plistRoutingPluginDirs(), //
plistCommandPluginDirs(), //
@@ -365,6 +368,15 @@ TEST_F(CAmRoutingInterfaceTest,nothingTodisconnect)
int main(int argc, char **argv)
{
+ try
+ {
+ TCLAP::CmdLine* cmd(CAmCommandLineSingleton::instanciateOnce("The team of the AudioManager wishes you a nice day!",' ',DAEMONVERSION,true));
+ cmd->add(enableNoDLTDebug);
+ }
+ catch (TCLAP::ArgException &e) // catch any exceptions
+ { std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl; }
+ CAmCommandLineSingleton::instance()->preparse(argc,argv);
+ CAmDltWrapper::instance(enableNoDLTDebug.getValue())->registerApp("routing", "CAmRouterTest");
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
diff --git a/AudioManagerDaemon/test/AmRoutingInterfaceTest/CAmRoutingInterfaceTest.h b/AudioManagerCore/test/AmRoutingInterfaceTest/CAmRoutingInterfaceTest.h
index 75a7511..75a7511 100644
--- a/AudioManagerDaemon/test/AmRoutingInterfaceTest/CAmRoutingInterfaceTest.h
+++ b/AudioManagerCore/test/AmRoutingInterfaceTest/CAmRoutingInterfaceTest.h
diff --git a/AudioManagerCore/test/AmRoutingInterfaceTest/CMakeLists.txt b/AudioManagerCore/test/AmRoutingInterfaceTest/CMakeLists.txt
new file mode 100644
index 0000000..dc5115d
--- /dev/null
+++ b/AudioManagerCore/test/AmRoutingInterfaceTest/CMakeLists.txt
@@ -0,0 +1,49 @@
+# 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
+#
+# For further information see http://www.genivi.org/.
+#
+
+cmake_minimum_required(VERSION 3.0)
+
+project (AmRoutingInterfaceTest LANGUAGES CXX VERSION ${DAEMONVERSION})
+
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager")
+
+INCLUDE_DIRECTORIES(
+ ${AUDIOMANAGER_CORE_INCLUDE}
+ ${GMOCK_INCLUDE_DIRS}
+ ${GTEST_INCLUDE_DIRS})
+
+file(GLOB ROUTING_INTERFACE_SRCS_CXX
+ "../CAmCommonFunctions.cpp"
+ "*.cpp"
+)
+
+ADD_EXECUTABLE(AmRoutingInterfaceTest ${ROUTING_INTERFACE_SRCS_CXX})
+
+TARGET_LINK_LIBRARIES(AmRoutingInterfaceTest
+ ${GTEST_LIBRARIES}
+ ${GMOCK_LIBRARIES}
+ AudioManagerCore
+)
+
+ADD_DEPENDENCIES(AmRoutingInterfaceTest AudioManagerCore)
+
+INSTALL(TARGETS AmRoutingInterfaceTest
+ DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
+ COMPONENT tests
+)
+
diff --git a/AudioManagerCore/test/AmRoutingInterfaceTest/CMakeLists.txt~ b/AudioManagerCore/test/AmRoutingInterfaceTest/CMakeLists.txt~
new file mode 100644
index 0000000..e8fbb29
--- /dev/null
+++ b/AudioManagerCore/test/AmRoutingInterfaceTest/CMakeLists.txt~
@@ -0,0 +1,48 @@
+# 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
+#
+# For further information see http://www.genivi.org/.
+#
+
+cmake_minimum_required(VERSION 3.0)
+
+project (AmRoutingInterfaceTest LANGUAGES CXX VERSION ${DAEMONVERSION})
+
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager")
+
+INCLUDE_DIRECTORIES(
+ ${AUDIOMANAGER_CORE_INCLUDE}
+ ${GMOCK_INCLUDE_DIR})
+
+file(GLOB ROUTING_INTERFACE_SRCS_CXX
+ "../CAmCommonFunctions.cpp"
+ "*.cpp"
+)
+
+ADD_EXECUTABLE(AmRoutingInterfaceTest ${ROUTING_INTERFACE_SRCS_CXX})
+
+TARGET_LINK_LIBRARIES(AmRoutingInterfaceTest
+ ${GTEST_LIBRARIES}
+ ${GMOCK_LIBRARIES}
+ AudioManagerCore
+)
+
+ADD_DEPENDENCIES(AmRoutingInterfaceTest AudioManagerCore)
+
+INSTALL(TARGETS AmRoutingInterfaceTest
+ DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
+ COMPONENT tests
+)
+
diff --git a/AudioManagerDaemon/test/AmTelnetServerTest/CAmTelnetServerTest.cpp b/AudioManagerCore/test/AmTelnetServerTest/CAmTelnetServerTest.cpp
index f91a2d0..d3f7a11 100644
--- a/AudioManagerDaemon/test/AmTelnetServerTest/CAmTelnetServerTest.cpp
+++ b/AudioManagerCore/test/AmTelnetServerTest/CAmTelnetServerTest.cpp
@@ -38,7 +38,7 @@ using namespace am;
using namespace std;
-static std::string controllerPlugin = std::string(CONTROLLER_PLUGIN);
+static std::string controllerPlugin = std::string(CONTROLLER_PLUGIN_DIR);
static unsigned short servPort = 6060;
static int staticSocket = -1;
static CAmSocketHandler* mpSocketHandler = NULL;
diff --git a/AudioManagerDaemon/test/AmTelnetServerTest/CAmTelnetServerTest.h b/AudioManagerCore/test/AmTelnetServerTest/CAmTelnetServerTest.h
index 02f98a3..02f98a3 100644
--- a/AudioManagerDaemon/test/AmTelnetServerTest/CAmTelnetServerTest.h
+++ b/AudioManagerCore/test/AmTelnetServerTest/CAmTelnetServerTest.h
diff --git a/AudioManagerCore/test/AmTelnetServerTest/CMakeLists.txt b/AudioManagerCore/test/AmTelnetServerTest/CMakeLists.txt
new file mode 100644
index 0000000..8dcb0a3
--- /dev/null
+++ b/AudioManagerCore/test/AmTelnetServerTest/CMakeLists.txt
@@ -0,0 +1,48 @@
+# 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
+#
+# For further information see http://www.genivi.org/.
+#
+
+cmake_minimum_required(VERSION 3.0)
+
+PROJECT(AmTelnetServerTest LANGUAGES CXX VERSION ${DAEMONVERSION})
+
+INCLUDE_DIRECTORIES(
+ ${AUDIOMANAGER_CORE_INCLUDE}
+ ${GMOCK_INCLUDE_DIRS}
+ ${GTEST_INCLUDE_DIRS})
+
+file(GLOB TELNET_SRCS_CXX
+ "*.cpp"
+)
+
+ADD_EXECUTABLE(AmTelnetServerTest ${TELNET_SRCS_CXX})
+
+TARGET_LINK_LIBRARIES(AmTelnetServerTest
+ ${GTEST_LIBRARIES}
+ ${GMOCK_LIBRARIES}
+ AudioManagerCore
+)
+add_test(AmTelnetServerTest AmTelnetServerTest)
+
+ADD_DEPENDENCIES(AmTelnetServerTest AudioManagerCore)
+
+INSTALL(TARGETS AmTelnetServerTest
+ DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
+ COMPONENT tests
+)
+
+
diff --git a/AudioManagerCore/test/AmTelnetServerTest/CMakeLists.txt~ b/AudioManagerCore/test/AmTelnetServerTest/CMakeLists.txt~
new file mode 100644
index 0000000..51e92b8
--- /dev/null
+++ b/AudioManagerCore/test/AmTelnetServerTest/CMakeLists.txt~
@@ -0,0 +1,46 @@
+# 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
+#
+# For further information see http://www.genivi.org/.
+#
+
+cmake_minimum_required(VERSION 3.0)
+
+PROJECT(AmTelnetServerTest LANGUAGES CXX VERSION ${DAEMONVERSION})
+
+INCLUDE_DIRECTORIES(
+ ${AUDIOMANAGER_CORE_INCLUDE}
+ ${GMOCK_INCLUDE_DIR})
+
+file(GLOB TELNET_SRCS_CXX
+ "*.cpp"
+)
+
+ADD_EXECUTABLE(AmTelnetServerTest ${TELNET_SRCS_CXX})
+
+TARGET_LINK_LIBRARIES(AmTelnetServerTest
+ ${GTEST_LIBRARIES}
+ ${GMOCK_LIBRARIES}
+ AudioManagerCore
+)
+
+ADD_DEPENDENCIES(AmTelnetServerTest AudioManagerCore)
+
+INSTALL(TARGETS AmTelnetServerTest
+ DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
+ COMPONENT tests
+)
+
+
diff --git a/AudioManagerDaemon/test/CAmCommonFunctions.cpp b/AudioManagerCore/test/CAmCommonFunctions.cpp
index 22331d4..22331d4 100644
--- a/AudioManagerDaemon/test/CAmCommonFunctions.cpp
+++ b/AudioManagerCore/test/CAmCommonFunctions.cpp
diff --git a/AudioManagerDaemon/test/CAmCommonFunctions.h b/AudioManagerCore/test/CAmCommonFunctions.h
index 9dbdc8f..9dbdc8f 100644
--- a/AudioManagerDaemon/test/CAmCommonFunctions.h
+++ b/AudioManagerCore/test/CAmCommonFunctions.h
diff --git a/AudioManagerDaemon/test/CMakeLists.txt b/AudioManagerCore/test/CMakeLists.txt
index a52f5ae..9dd9007 100644
--- a/AudioManagerDaemon/test/CMakeLists.txt
+++ b/AudioManagerCore/test/CMakeLists.txt
@@ -15,26 +15,19 @@
# For further information see http://www.genivi.org/.
#
-cmake_minimum_required(VERSION 2.8.8)
+cmake_minimum_required(VERSION 3.0)
set(EXECUTABLE_OUTPUT_PATH ${TEST_EXECUTABLE_OUTPUT_PATH})
-
-if(USE_BUILD_LIBS)
- execute_process(COMMAND mkdir -p "${EXECUTABLE_OUTPUT_PATH}")
-endif(USE_BUILD_LIBS)
-
#make aunt google stop complaining
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs")
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager -Wno-unused-local-typedefs -lz -ldl")
add_subdirectory (AmControlInterfaceTest)
-add_subdirectory (AmDatabaseHandlerTest)
add_subdirectory (AmMapHandlerTest)
add_subdirectory (AmRouterTest)
add_subdirectory (AmRouterMapTest)
add_subdirectory (AmRoutingInterfaceTest)
-add_subdirectory (AmSocketHandlerTest)
IF(WITH_TELNET)
add_subdirectory (AmTelnetServerTest)
diff --git a/AudioManagerDaemon/test/IAmCommandBackdoor.h b/AudioManagerCore/test/IAmCommandBackdoor.h
index b7d2b20..b7d2b20 100644
--- a/AudioManagerDaemon/test/IAmCommandBackdoor.h
+++ b/AudioManagerCore/test/IAmCommandBackdoor.h
diff --git a/AudioManagerDaemon/test/IAmControlBackdoor.h b/AudioManagerCore/test/IAmControlBackdoor.h
index b5ba3ef..b5ba3ef 100644
--- a/AudioManagerDaemon/test/IAmControlBackdoor.h
+++ b/AudioManagerCore/test/IAmControlBackdoor.h
diff --git a/AudioManagerDaemon/test/IAmRoutingBackdoor.h b/AudioManagerCore/test/IAmRoutingBackdoor.h
index cbdb070..cbdb070 100644
--- a/AudioManagerDaemon/test/IAmRoutingBackdoor.h
+++ b/AudioManagerCore/test/IAmRoutingBackdoor.h
diff --git a/AudioManagerDaemon/test/MockIAmCommandSend.h b/AudioManagerCore/test/MockIAmCommandSend.h
index 36bc1cb..36bc1cb 100644
--- a/AudioManagerDaemon/test/MockIAmCommandSend.h
+++ b/AudioManagerCore/test/MockIAmCommandSend.h
diff --git a/AudioManagerDaemon/test/MockIAmControlSend.h b/AudioManagerCore/test/MockIAmControlSend.h
index e628068..e628068 100644
--- a/AudioManagerDaemon/test/MockIAmControlSend.h
+++ b/AudioManagerCore/test/MockIAmControlSend.h
diff --git a/AudioManagerDaemon/test/MockIAmRoutingSend.h b/AudioManagerCore/test/MockIAmRoutingSend.h
index 748e64e..748e64e 100644
--- a/AudioManagerDaemon/test/MockIAmRoutingSend.h
+++ b/AudioManagerCore/test/MockIAmRoutingSend.h
diff --git a/AudioManagerDaemon/CMakeLists.txt b/AudioManagerDaemon/CMakeLists.txt
index d044ed8..acc5c2b 100644
--- a/AudioManagerDaemon/CMakeLists.txt
+++ b/AudioManagerDaemon/CMakeLists.txt
@@ -15,89 +15,12 @@
# For further information see http://www.genivi.org/.
#
-cmake_minimum_required(VERSION 2.8.8)
-
-project (AudioManagerDeamon)
-
-set(DOC_OUTPUT_PATH ${DOC_OUTPUT_PATH}/AudioManager)
-
-set(AM_MAP_CAPACITY 10
- CACHE INTEGER "Number of preallocations for datastorage")
-
-set(AM_MAX_CONNECTIONS 0x1000
- CACHE INTEGER "Number of max connections before rollover")
-
-set(AM_MAX_CONNECTIONS SHRT_MAX
- CACHE INTEGER "Number of max Mainconnections before rollover")
-
-set(INCLUDE_FOLDER "include")
-
-if (WITH_DATABASE_STORAGE)
- pkg_check_modules(SQLITE REQUIRED sqlite3)
-endif (WITH_DATABASE_STORAGE)
-
-if(WITH_DBUS_WRAPPER)
- pkg_check_modules (DBUS "dbus-1 >= 1.4")
-endif(WITH_DBUS_WRAPPER)
-
-set (AM_LINK_LIBS
- ${CMAKE_DL_LIBS}
- AudioManagerUtilities
- rt)
-
-if(WITH_CAPI_WRAPPER)
- find_package(CommonAPI 3.1.3 REQUIRED)
- string(REPLACE "." "" COMMONAPI_VERSION_NUMBER ${CommonAPI_VERSION})
- SET(COMMONAPI_VERSION_NUMBER ${COMMONAPI_VERSION_NUMBER} CACHE INTERNAL "hide this!" FORCE)
- SET(CommonAPI_VERSION ${CommonAPI_VERSION} PARENT_SCOPE)
-endif(WITH_CAPI_WRAPPER)
+cmake_minimum_required(VERSION 3.0)
+project (AudioManagerDeamon LANGUAGES CXX VERSION ${DAEMONVERSION})
set(AUDIOMAN_SRCS_CXX
- src/main.cpp
- src/CAmCommandReceiver.cpp
- src/CAmCommandSender.cpp
- src/CAmControlReceiver.cpp
- src/CAmControlSender.cpp
- src/CAmDatabaseObserver.cpp
- src/CAmRoutingReceiver.cpp
- src/CAmRoutingSender.cpp
- src/CAmRouter.cpp
- src/CAmLog.cpp
-)
-
-if(WITH_TELNET)
- set (AUDIOMAN_SRCS_CXX
- ${AUDIOMAN_SRCS_CXX}
- src/CAmTelnetServer.cpp
- src/CAmTelnetMenuHelper.cpp)
-endif(WITH_TELNET)
-
-if(WITH_DBUS_WRAPPER)
- set (AUDIOMAN_SRCS_CXX
- ${AUDIOMAN_SRCS_CXX}
- "${AUDIOMANAGER_UTILITIES_SRC}/CAmDbusWrapper.cpp")
- set (AM_LINK_LIBS ${AM_LINK_LIBS} ${DBUS_LIBRARIES})
-endif(WITH_DBUS_WRAPPER)
-
-if(WITH_CAPI_WRAPPER)
- set(LINK_LIBRARIES -Wl,--as-needed CommonAPI)
- set (AUDIOMAN_SRCS_CXX ${AUDIOMAN_SRCS_CXX} "${AUDIOMANAGER_UTILITIES_SRC}/CAmCommonAPIWrapper.cpp")
- set (AM_LINK_LIBS ${AM_LINK_LIBS} ${LINK_LIBRARIES})
-endif(WITH_CAPI_WRAPPER)
-
-if(WITH_DATABASE_STORAGE)
- set (AUDIOMAN_SRCS_CXX
- ${AUDIOMAN_SRCS_CXX}
- src/CAmDatabaseHandlerSQLite.cpp)
- set (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- ${SQLITE_LIBRARIES})
-else(WITH_DATABASE_STORAGE)
- set (AUDIOMAN_SRCS_CXX
- ${AUDIOMAN_SRCS_CXX}
- src/CAmDatabaseHandlerMap.cpp)
-endif(WITH_DATABASE_STORAGE)
+ src/main.cpp)
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}
@@ -105,34 +28,16 @@ INCLUDE_DIRECTORIES(
${AUDIO_INCLUDE_FOLDER}
${AUDIOMANAGER_INCLUDE_FOLDER}
${AUDIOMANAGER_UTILITIES_INCLUDE}
+ ${AUDIOMANAGER_CORE_INCLUDE}
${INCLUDE_FOLDER}
${TCLAP_INCLUDE_DIR}
)
-if(WITH_CAPI_WRAPPER)
- INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES}
- ${COMMONAPI_INCLUDE_DIRS}
- )
-endif(WITH_CAPI_WRAPPER)
-
-if(WITH_DLT)
- INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES}
- ${DLT_INCLUDE_DIRS})
- set (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- ${DLT_LIBRARIES})
-endif(WITH_DLT)
-
-if(WITH_DBUS_WRAPPER)
- INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES}
- ${DBUS_INCLUDE_DIRS})
-endif(WITH_DBUS_WRAPPER)
-
ADD_EXECUTABLE(AudioManager ${AUDIOMAN_SRCS_CXX})
-TARGET_LINK_LIBRARIES(AudioManager ${AM_LINK_LIBS})
+TARGET_LINK_LIBRARIES(AudioManager AudioManagerCore ${AUDIO_MANAGER_CORE_LIBS})
-ADD_DEPENDENCIES(AudioManager AudioManagerUtilities)
+ADD_DEPENDENCIES(AudioManager AudioManagerCore)
INSTALL(TARGETS AudioManager
RUNTIME DESTINATION bin
@@ -143,9 +48,4 @@ INSTALL(DIRECTORY "${AUDIO_INCLUDE_FOLDER}/"
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${LIB_INSTALL_SUFFIX}
COMPONENT dev)
-if(WITH_TESTS)
- add_subdirectory (test)
-endif(WITH_TESTS)
-
-
diff --git a/AudioManagerDaemon/docx/Doxyfile.in b/AudioManagerDaemon/docx/Doxyfile.in
deleted file mode 100644
index 8cd141f..0000000
--- a/AudioManagerDaemon/docx/Doxyfile.in
+++ /dev/null
@@ -1,268 +0,0 @@
-# Doxyfile 1.6.3
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-DOXYFILE_ENCODING = UTF-8
-PROJECT_NAME = AudioManager
-PROJECT_NUMBER = @DAEMONVERSION@
-OUTPUT_DIRECTORY = @DOC_OUTPUT_PATH@
-CREATE_SUBDIRS = NO
-OUTPUT_LANGUAGE = English
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ABBREVIATE_BRIEF =
-ALWAYS_DETAILED_SEC = NO
-INLINE_INHERITED_MEMB = NO
-FULL_PATH_NAMES = NO
-STRIP_FROM_PATH =
-STRIP_FROM_INC_PATH =
-SHORT_NAMES = YES
-JAVADOC_AUTOBRIEF = YES
-QT_AUTOBRIEF = YES
-MULTILINE_CPP_IS_BRIEF = YES
-INHERIT_DOCS = YES
-SEPARATE_MEMBER_PAGES = NO
-TAB_SIZE = 8
-ALIASES =
-OPTIMIZE_OUTPUT_FOR_C = NO
-OPTIMIZE_OUTPUT_JAVA = NO
-OPTIMIZE_FOR_FORTRAN = NO
-OPTIMIZE_OUTPUT_VHDL = NO
-EXTENSION_MAPPING =
-BUILTIN_STL_SUPPORT = YES
-CPP_CLI_SUPPORT = YES
-SIP_SUPPORT = NO
-IDL_PROPERTY_SUPPORT = YES
-DISTRIBUTE_GROUP_DOC = NO
-SUBGROUPING = YES
-TYPEDEF_HIDES_STRUCT = NO
-SYMBOL_CACHE_SIZE = 0
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL = YES
-EXTRACT_PRIVATE = NO
-EXTRACT_STATIC = YES
-EXTRACT_LOCAL_CLASSES = YES
-EXTRACT_LOCAL_METHODS = YES
-EXTRACT_ANON_NSPACES = NO
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
-HIDE_FRIEND_COMPOUNDS = NO
-HIDE_IN_BODY_DOCS = NO
-INTERNAL_DOCS = NO
-CASE_SENSE_NAMES = NO
-HIDE_SCOPE_NAMES = NO
-SHOW_INCLUDE_FILES = YES
-FORCE_LOCAL_INCLUDES = NO
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = YES
-SORT_BRIEF_DOCS = NO
-SORT_MEMBERS_CTORS_1ST = YES
-SORT_GROUP_NAMES = YES
-SORT_BY_SCOPE_NAME = NO
-GENERATE_TODOLIST = NO
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS =
-MAX_INITIALIZER_LINES = 30
-SHOW_USED_FILES = YES
-SHOW_DIRECTORIES = YES
-SHOW_FILES = YES
-SHOW_NAMESPACES = YES
-FILE_VERSION_FILTER =
-LAYOUT_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = YES
-WARNINGS = NO
-WARN_IF_UNDOCUMENTED = NO
-WARN_IF_DOC_ERROR = NO
-WARN_NO_PARAMDOC = NO
-WARN_FORMAT = "$file:$line: $text "
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = @CMAKE_CURRENT_SOURCE_DIR@
-INPUT_ENCODING = UTF-8
-FILE_PATTERNS = *.h *.cpp *.dox
-RECURSIVE = YES
-EXCLUDE =
-EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS = */test/* */build*/* */cmake/* */googleMock/* */tclap*/*
-EXCLUDE_SYMBOLS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH = @CMAKE_SOURCE_DIR@/AudioManagerDaemon/docx/images
-INPUT_FILTER =
-FILTER_PATTERNS =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = YES
-INLINE_SOURCES = NO
-STRIP_CODE_COMMENTS = YES
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION = YES
-REFERENCES_LINK_SOURCE = YES
-USE_HTAGS = NO
-VERBATIM_HEADERS = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = YES
-COLS_IN_ALPHA_INDEX = 5
-IGNORE_PREFIX = YES
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = YES
-HTML_OUTPUT =
-HTML_FILE_EXTENSION = .html
-HTML_HEADER =
-HTML_FOOTER =
-HTML_STYLESHEET =
-HTML_COLORSTYLE_HUE = 220
-HTML_COLORSTYLE_SAT = 100
-HTML_COLORSTYLE_GAMMA = 80
-HTML_TIMESTAMP = YES
-HTML_ALIGN_MEMBERS = YES
-HTML_DYNAMIC_SECTIONS = YES
-GENERATE_DOCSET = YES
-DOCSET_FEEDNAME = "AudioManager docs"
-DOCSET_BUNDLE_ID = org.genivi.AudioManager.Doxygen
-DOCSET_PUBLISHER_ID = org.genivi.AudioManager.Publisher
-DOCSET_PUBLISHER_NAME = genivi
-GENERATE_HTMLHELP = NO
-CHM_FILE =
-HHC_LOCATION =
-GENERATE_CHI = NO
-CHM_INDEX_ENCODING =
-BINARY_TOC = NO
-TOC_EXPAND = NO
-GENERATE_QHP = NO
-QCH_FILE =
-QHP_NAMESPACE = org.doxygen.Project
-QHP_VIRTUAL_FOLDER = doc
-QHP_CUST_FILTER_NAME =
-QHP_CUST_FILTER_ATTRS =
-QHP_SECT_FILTER_ATTRS =
-QHG_LOCATION =
-GENERATE_ECLIPSEHELP = NO
-ECLIPSE_DOC_ID = org.genivi.AudioManager
-DISABLE_INDEX = NO
-ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = YES
-USE_INLINE_TREES = YES
-TREEVIEW_WIDTH = 250
-EXT_LINKS_IN_WINDOW = YES
-FORMULA_FONTSIZE = 10
-SEARCHENGINE = YES
-SERVER_BASED_SEARCH = NO
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = NO
-LATEX_OUTPUT =
-LATEX_CMD_NAME = latex
-MAKEINDEX_CMD_NAME = makeindex
-COMPACT_LATEX = NO
-PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = YES
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = NO
-LATEX_HIDE_INDICES = NO
-LATEX_SOURCE_CODE = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = NO
-RTF_OUTPUT =
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = NO
-MAN_OUTPUT = @CMAKE_SOURCE_DIR@/man
-MAN_EXTENSION = .3
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = NO
-XML_OUTPUT = xml
-XML_SCHEMA =
-XML_DTD =
-XML_PROGRAMLISTING = YES
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = YES
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD = NO
-PERLMOD_LATEX = NO
-PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = YES
-EXPAND_ONLY_PREDEF = YES
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-TAGFILES =
-GENERATE_TAGFILE = NO
-ALLEXTERNALS = NO
-EXTERNAL_GROUPS = YES
-PERL_PATH = /usr/bin/perl
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = YES
-MSCGEN_PATH =
-HIDE_UNDOC_RELATIONS = YES
-HAVE_DOT = YES
-DOT_FONTNAME = FreeSans.ttf
-DOT_FONTSIZE = 10
-DOT_FONTPATH =
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
-GROUP_GRAPHS = YES
-UML_LOOK = NO
-TEMPLATE_RELATIONS = YES
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = YES
-CALL_GRAPH = YES
-CALLER_GRAPH = YES
-GRAPHICAL_HIERARCHY = YES
-DIRECTORY_GRAPH = YES
-DOT_IMAGE_FORMAT = png
-DOT_PATH =
-DOTFILE_DIRS =
-DOT_GRAPH_MAX_NODES = 50
-MAX_DOT_GRAPH_DEPTH = 0
-DOT_TRANSPARENT = NO
-DOT_MULTI_TARGETS = YES
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
diff --git a/AudioManagerDaemon/include/CAmDatabaseHandlerSQLite.h b/AudioManagerDaemon/include/CAmDatabaseHandlerSQLite.h
deleted file mode 100644
index c9005e3..0000000
--- a/AudioManagerDaemon/include/CAmDatabaseHandlerSQLite.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/**
- * SPDX license identifier: MPL-2.0
- *
- * 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
- *
- * \file CAmDatabaseHandlerSQLite.h
- * For further information see http://www.genivi.org/.
- *
- */
-
-#ifndef DATABASEHANDLER_H_
-#define DATABASEHANDLER_H_
-
-#include "IAmDatabaseHandler.h"
-#include <map>
-#include <sqlite3.h>
-
-namespace am
-{
-
-class CAmDatabaseObserver;
-class CAmRoutingTree;
-class CAmRoutingTreeItem;
-
-//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 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 mFirstStaticConverter; //!< 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
-public:
- 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);
- 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 enterConverterDB(const am_Converter_s & converteData, am_converterID_t & converterID);
- 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 removeConverterDB(const am_converterID_t converterID);
- 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 getConverterInfoDB(const am_converterID_t converterID, am_Converter_s& converterData) 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 getSinkMainVolume(const am_sinkID_t sinkID, am_mainVolume_t& mainVolume) 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 getMainSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomMainSoundPropertyType_t propertyType, int16_t& value) const;
- am_Error_e getMainSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomMainSoundPropertyType_t propertyType, int16_t& value) const;
- am_Error_e getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomSoundPropertyType_t propertyType, int16_t& value) const;
- am_Error_e getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomSoundPropertyType_t propertyType, int16_t& value) const;
- am_Error_e getListSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_SoundProperty_s>& listSoundproperties) const;
- am_Error_e getListSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_SoundProperty_s>& listSoundproperties) 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 getListConvertersOfDomain(const am_domainID_t domainID, std::vector<am_converterID_t>& listConvertersID) 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 getListConverters(std::vector<am_Converter_s> & listConverters) 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_CustomAvailabilityReason_t> & listConnectionFormats) const;
- am_Error_e getListSourceConnectionFormats(const am_sourceID_t sourceID, std::vector<am_CustomAvailabilityReason_t> & listConnectionFormats) const;
- am_Error_e getListGatewayConnectionFormats(const am_gatewayID_t gatewayID, std::vector<bool> & listConnectionFormat) const;
- am_Error_e getListConverterConnectionFormats(const am_converterID_t converterID, 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 getDomainOfCrossfader(const am_crossfaderID_t crossfader, 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 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_CustomAvailabilityReason_t>& 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_CustomAvailabilityReason_t>& 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_CustomAvailabilityReason_t>& listSourceConnectionFormats, const std::vector<am_CustomAvailabilityReason_t>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix);
- am_Error_e changeConverterDB(const am_converterID_t converterID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& 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 existConverter(const am_converterID_t converterID) 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;
- bool isComponentConnected(const am_Gateway_s & gateway) const;
- bool isComponentConnected(const am_Converter_s & converter) const;
- //todo: Implement dump for SQLite database handler
- void dump( std::ostream & output) const { output << __FUNCTION__ << " not implemented!"; };
- am_Error_e enumerateSources(std::function<void(const am_Source_s & element)> cb) const;
- am_Error_e enumerateSinks(std::function<void(const am_Sink_s & element)> cb) const;
- am_Error_e enumerateGateways(std::function<void(const am_Gateway_s & element)> cb) const;
- am_Error_e enumerateConverters(std::function<void(const am_Converter_s & element)> cb) const;
-};
-
-}
-
-#endif /* DATABASEHANDLER_H_ */
diff --git a/AudioManagerDaemon/src/CAmDatabaseHandlerSQLite.cpp b/AudioManagerDaemon/src/CAmDatabaseHandlerSQLite.cpp
deleted file mode 100644
index 5e95c6c..0000000
--- a/AudioManagerDaemon/src/CAmDatabaseHandlerSQLite.cpp
+++ /dev/null
@@ -1,5651 +0,0 @@
-/**
- * SPDX license identifier: MPL-2.0
- *
- * 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
- *
- * \file CAmDatabaseHandlerSQLite.cpp
- * For further information see http://www.genivi.org/.
- *
- */
-
-#include "CAmDatabaseHandlerSQLite.h"
-#include <cassert>
-#include <stdexcept>
-#include <vector>
-#include <fstream>
-#include <sstream>
-#include <string>
-#include "CAmDatabaseObserver.h"
-#include "CAmRouter.h"
-#include "CAmDltWrapper.h"
-#include <sqlite3.h>
-
-namespace am
-{
-
-/**
- * Macro to handle SQLITE errors on prepare
- */
-#define MY_SQLITE_PREPARE_V2(db,zSql,nByte,ppStmt,pzTail) \
- if ((eCode = sqlite3_prepare_v2(db, zSql, nByte, ppStmt, pzTail))) \
- { \
- logError("CAmDatabaseHandler::my_sqlite_prepare_v2 on Command",zSql,"failed with errorCode:", eCode); \
- return (E_DATABASE_ERROR); \
- }
-
-#define MY_SQLITE_PREPARE_V2_BOOL(db,zSql,nByte,ppStmt,pzTail) \
- if ((eCode = sqlite3_prepare_v2(db, zSql, nByte, ppStmt, pzTail))) \
- { \
- logError("CAmDatabaseHandler::my_sqlite_prepare_v2_bool on Command",zSql,"failed with errorCode:", eCode); \
- return (false); \
- }
-
-/**
- * Macro to handle SQLITE errors bind text
- */
-#define MY_SQLITE_BIND_TEXT(query,index,text,size,static_) \
- if ((eCode = sqlite3_bind_text(query, index, text, size, static_))) \
- { \
- logError("CAmDatabaseHandler::sqlite3_bind_text failed with errorCode:", eCode); \
- return (E_DATABASE_ERROR); \
- }
-
-/**
- * Macro to handle SQLITE errors on bind int
- */
-#define MY_SQLITE_BIND_INT(query, index, data) \
- if((eCode = sqlite3_bind_int(query, index, data))) \
- { \
- logError("CAmDatabaseHandler::sqlite3_bind_int failed with errorCode:", eCode); \
- return (E_DATABASE_ERROR); \
- }
-
-/**
- * Macro to handle SQLITE errors on reset
- */
-#define MY_SQLITE_RESET(query) \
- if((eCode = sqlite3_reset(query))) \
- { \
- logError("CAmDatabaseHandler::sqlite3_reset failed with errorCode:", eCode); \
- return (E_DATABASE_ERROR); \
- }
-
-/**
- * Macro to handle SQLITE finalize
- */
-#define MY_SQLITE_FINALIZE(query) \
- if((eCode = sqlite3_finalize(query))) \
- { \
- logError("CAmDatabaseHandler::sqlite3_finalize failed with errorCode:", eCode); \
- return (E_DATABASE_ERROR); \
- }
-
-#define MY_SQLITE_FINALIZE_BOOL(query) \
- if((eCode = sqlite3_finalize(query))) \
- { \
- logError("CAmDatabaseHandler::sqlite3_finalize failed with errorCode:", eCode); \
- return (true); \
- }
-
-#define DOMAIN_TABLE "Domains" //!< domain table
-#define SOURCE_CLASS_TABLE "SourceClasses" //!< source class table
-#define SINK_CLASS_TABLE "SinkClasses" //!< sink class table
-#define SOURCE_TABLE "Sources" //!< source table
-#define SINK_TABLE "Sinks" //!< sink table
-#define GATEWAY_TABLE "Gateways" //!< gateway table
-#define CONVERTER_TABLE "Converters" //!< converter table
-#define CROSSFADER_TABLE "Crossfaders" //!< crossfader table
-#define CONNECTION_TABLE "Connections" //!< connection table
-#define MAINCONNECTION_TABLE "MainConnections" //!< main connection table
-#define SYSTEM_TABLE "SystemProperties" //!< system properties table
-/**
- * table that holds table informations
- */
-const std::string databaseTables[] =
-{ " Domains (domainID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50), busname VARCHAR(50), nodename VARCHAR(50), early BOOL, complete BOOL, state INTEGER, reserved BOOL);", //
- " SourceClasses (sourceClassID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50));", //
- " SinkClasses (sinkClassID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50));", //
- " Sources (sourceID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, domainID INTEGER, name VARCHAR(50), sourceClassID INTEGER, sourceState INTEGER, volume INTEGER, visible BOOL, availability INTEGER, availabilityReason INTEGER, interruptState INTEGER, reserved BOOL);", //
- " Sinks (sinkID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50), domainID INTEGER, sinkClassID INTEGER, volume INTEGER, visible BOOL, availability INTEGER, availabilityReason INTEGER, muteState INTEGER, mainVolume INTEGER, reserved BOOL);", //
- " Gateways (gatewayID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50), sinkID INTEGER, sourceID INTEGER, domainSinkID INTEGER, domainSourceID INTEGER, controlDomainID INTEGER);", //
- " Converters (converterID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50), sinkID INTEGER, sourceID INTEGER, domainID INTEGER);", //
- " Crossfaders (crossfaderID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50), sinkID_A INTEGER, sinkID_B INTEGER, sourceID INTEGER, hotSink INTEGER);", //
- " Connections (connectionID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, sourceID INTEGER, sinkID INTEGER, delay INTEGER, connectionFormat INTEGER, reserved BOOL);", //
- " MainConnections (mainConnectionID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, sourceID INTEGER, sinkID INTEGER, connectionState INTEGER, delay INTEGER);", //
- " SystemProperties (type INTEGER PRIMARY KEY, value INTEGER);" };
-
-/**
- * template to converts T to std::string
- * @param x T
- * @return string
- */
-template<typename T>
-inline std::string i2s(T const& x)
-{
- std::ostringstream o;
- o << x;
- return (o.str());
-}
-
-CAmDatabaseHandlerSQLite::CAmDatabaseHandlerSQLite():mpDatabaseObserver(NULL), //
- mFirstStaticSink(true), //
- mFirstStaticSource(true), //
- mFirstStaticGateway(true), //
- mFirstStaticConverter(true),
- mFirstStaticSinkClass(true), //
- mFirstStaticSourceClass(true), //
- mFirstStaticCrossfader(true), //
- mListConnectionFormat(),
- mpDatabase(NULL), //
- mPath(std::string(""))
-{
-
-}
-
-CAmDatabaseHandlerSQLite::CAmDatabaseHandlerSQLite(std::string databasePath):mpDatabaseObserver(NULL), //
- mFirstStaticSink(true), //
- mFirstStaticSource(true), //
- mFirstStaticGateway(true), //
- mFirstStaticConverter(true),
- mFirstStaticSinkClass(true), //
- mFirstStaticSourceClass(true), //
- mFirstStaticCrossfader(true), //
- mListConnectionFormat(),
- mpDatabase(NULL), //
- mPath(databasePath)
-{
- std::ifstream infile(mPath.c_str());
-
- if (infile)
- {
- if(remove(mPath.c_str())==0)
- {
- logError("DatabaseHandler::DatabaseHandler Knocked down database failed !");
- }
- logInfo("DatabaseHandler::DatabaseHandler Knocked down database");
- }
-
- bool dbOpen = openDatabase();
- if (!dbOpen)
- {
- logInfo("DatabaseHandler::DatabaseHandler problems opening the database!");
- }
-
- createTables();
-}
-
-CAmDatabaseHandlerSQLite::~CAmDatabaseHandlerSQLite()
-{
- logInfo("Closed Database");
- mpDatabaseObserver = NULL;
- if(mpDatabase)
- sqlite3_close(mpDatabase);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::enterDomainDB(const am_Domain_s & domainData, am_domainID_t & domainID)
-{
- assert(domainData.domainID==0);
- assert(!domainData.name.empty());
- assert(!domainData.busname.empty());
- assert(domainData.state>=DS_UNKNOWN && domainData.state<=DS_MAX);
-
- //first check for a reserved domain
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- domainID=0;
- std::string command = "SELECT domainID FROM " + std::string(DOMAIN_TABLE) + " WHERE name=?";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_TEXT(query, 1, domainData.name.c_str(), domainData.name.size(), SQLITE_STATIC)
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- domainID = sqlite3_column_int(query, 0);
- command = "UPDATE " + std::string(DOMAIN_TABLE) + " SET name=?, busname=?, nodename=?, early=?, complete=?, state=?, reserved=? WHERE domainID=" + i2s(sqlite3_column_int(query, 0));
- }
- else if (eCode == SQLITE_DONE)
- {
-
- command = "INSERT INTO " + std::string(DOMAIN_TABLE) + " (name, busname, nodename, early, complete, state, reserved) VALUES (?,?,?,?,?,?,?)";
- }
- else
- {
- logError("DatabaseHandler::enterDomainDB SQLITE Step error code:", eCode);
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_TEXT(query, 1, domainData.name.c_str(), domainData.name.size(), SQLITE_STATIC)
- MY_SQLITE_BIND_TEXT(query, 2, domainData.busname.c_str(), domainData.busname.size(), SQLITE_STATIC)
- MY_SQLITE_BIND_TEXT(query, 3, domainData.nodename.c_str(), domainData.nodename.size(), SQLITE_STATIC)
- MY_SQLITE_BIND_INT(query, 4, domainData.early)
- MY_SQLITE_BIND_INT(query, 5, domainData.complete)
- MY_SQLITE_BIND_INT(query, 6, domainData.state)
- MY_SQLITE_BIND_INT(query, 7, 0)
-
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterDomainDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_FINALIZE(query)
-
- if (domainID==0)
- domainID = sqlite3_last_insert_rowid(mpDatabase);
- logInfo("DatabaseHandler::enterDomainDB entered new domain with name=", domainData.name, "busname=", domainData.busname, "nodename=", domainData.nodename, "assigned ID:", domainID);
-
- am_Domain_s domain = domainData;
- domain.domainID = domainID;
- if (mpDatabaseObserver)
- mpDatabaseObserver->newDomain(domain);
-
- return (E_OK);
-}
-
-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);
- assert(mainConnectionData.sinkID!=0);
- assert(mainConnectionData.sourceID!=0);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- int16_t delay = 0;
- std::string command = "INSERT INTO " + std::string(MAINCONNECTION_TABLE) + "(sourceID, sinkID, connectionState, delay) VALUES (?,?,?,-1)";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, mainConnectionData.sourceID)
- MY_SQLITE_BIND_INT(query, 2, mainConnectionData.sinkID)
- MY_SQLITE_BIND_INT(query, 3, mainConnectionData.connectionState)
-
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterMainConnectionDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- connectionID = sqlite3_last_insert_rowid(mpDatabase);
-
- //now check the connectionTable for all connections in the route. IF connectionID exist
- command = "SELECT delay FROM " + std::string(CONNECTION_TABLE) + (" WHERE connectionID=?");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_connectionID_t>::const_iterator elementIterator = mainConnectionData.listConnectionID.begin();
- for (; elementIterator < mainConnectionData.listConnectionID.end(); ++elementIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, *elementIterator)
-
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- int16_t temp_delay = sqlite3_column_int(query, 1);
- if (temp_delay != -1 && delay != -1)
- delay += temp_delay;
- else
- delay = -1;
- }
- else
- {
- logError("DatabaseHandler::enterMainConnectionDB did not find route for MainConnection: ", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
- MY_SQLITE_FINALIZE(query)
-
- //now we create a table with references to the connections;
- command = "CREATE TABLE MainConnectionRoute" + i2s(connectionID) + std::string("(connectionID INTEGER)");
- if (!this->sqQuery(command))
- return (E_DATABASE_ERROR);
-
- command = "INSERT INTO MainConnectionRoute" + i2s(connectionID) + "(connectionID) VALUES (?)";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_connectionID_t>::const_iterator listConnectionIterator(mainConnectionData.listConnectionID.begin());
- for (; listConnectionIterator < mainConnectionData.listConnectionID.end(); ++listConnectionIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, *listConnectionIterator)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterMainConnectionDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
-
- MY_SQLITE_FINALIZE(query)
- logInfo("DatabaseHandler::enterMainConnectionDB entered new mainConnection with sourceID", mainConnectionData.sourceID, "sinkID:", mainConnectionData.sinkID, "delay:", delay, "assigned ID:", connectionID);
-
- if (mpDatabaseObserver)
- {
- am_MainConnectionType_s mainConnection;
- mainConnection.mainConnectionID = connectionID;
- mainConnection.connectionState = mainConnectionData.connectionState;
- mainConnection.delay = delay;
- mainConnection.sinkID = mainConnectionData.sinkID;
- mainConnection.sourceID = mainConnectionData.sourceID;
- mpDatabaseObserver->newMainConnection(mainConnection);
- mpDatabaseObserver->mainConnectionStateChanged(connectionID, mainConnectionData.connectionState);
- }
-
- //finally, we update the delay value for the maintable
- if (delay == 0)
- delay = -1;
- return (changeDelayMainConnection(delay, connectionID));
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::enterSinkDB(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
-{
- assert(sinkData.sinkID<DYNAMIC_ID_BOUNDARY);
- assert(sinkData.domainID!=0);
- assert(!sinkData.name.empty());
- assert(sinkData.sinkClassID!=0);
- //todo: need to check if class exists?
- assert(!sinkData.listConnectionFormats.empty());
- assert(sinkData.muteState>=MS_UNKNOWN && sinkData.muteState<=MS_MAX);
-
- sqlite3_stmt *query = NULL;
- int eCode = 0;
- std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE name=? AND reserved=1";
-
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_TEXT(query, 1, sinkData.name.c_str(), sinkData.name.size(), SQLITE_STATIC)
-
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- command = "UPDATE " + std::string(SINK_TABLE) + " SET name=?, domainID=?, sinkClassID=?, volume=?, visible=?, availability=?, availabilityReason=?, muteState=?, mainVolume=?, reserved=? WHERE sinkID=" + i2s(sqlite3_column_int(query, 0));
- }
- else if (eCode == SQLITE_DONE)
- {
- //if sinkID is zero and the first Static Sink was already entered, the ID is created
- if (sinkData.sinkID == 0 && !mFirstStaticSink && !existSinkName(sinkData.name))
- {
- command = "INSERT INTO " + std::string(SINK_TABLE) + "(name, domainID, sinkClassID, volume, visible, availability, availabilityReason, muteState, mainVolume, reserved) VALUES (?,?,?,?,?,?,?,?,?,?)";
- }
- else
- {
- //check if the ID already exists
- if (existSinkNameOrID(sinkData.sinkID, sinkData.name))
- {
- MY_SQLITE_FINALIZE(query)
- return (E_ALREADY_EXISTS);
- }
- command = "INSERT INTO " + std::string(SINK_TABLE) + "(name, domainID, sinkClassID, volume, visible, availability, availabilityReason, muteState, mainVolume, reserved, sinkID) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
- }
- }
- else
- {
- logError("DatabaseHandler::enterSinkDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_TEXT(query, 1, sinkData.name.c_str(), sinkData.name.size(), SQLITE_STATIC)
- MY_SQLITE_BIND_INT(query, 2, sinkData.domainID)
- MY_SQLITE_BIND_INT(query, 3, sinkData.sinkClassID)
- MY_SQLITE_BIND_INT(query, 4, sinkData.volume)
- MY_SQLITE_BIND_INT(query, 5, sinkData.visible)
- MY_SQLITE_BIND_INT(query, 6, sinkData.available.availability)
- MY_SQLITE_BIND_INT(query, 7, sinkData.available.availabilityReason)
- MY_SQLITE_BIND_INT(query, 8, sinkData.muteState)
- MY_SQLITE_BIND_INT(query, 9, sinkData.mainVolume)
- MY_SQLITE_BIND_INT(query, 10, 0)
-
- //if the ID is not created, we add it to the query
- if (sinkData.sinkID != 0)
- {
- MY_SQLITE_BIND_INT(query, 11, sinkData.sinkID)
- }
-
- //if the first static sink is entered, we need to set it onto the boundary
- else if (mFirstStaticSink)
- {
- MY_SQLITE_BIND_INT(query, 11, DYNAMIC_ID_BOUNDARY)
- mFirstStaticSink = false;
- }
-
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterSinkDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- //now read back the sinkID
- command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE name=?";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_TEXT(query, 1, sinkData.name.c_str(), sinkData.name.size(), SQLITE_STATIC)
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- sinkID = sqlite3_column_int(query, 0);
- }
- else
- {
- sinkID = 0;
- logError("DatabaseHandler::existSink database error!:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_FINALIZE(query)
-
- //now we need to create the additional tables:
- command = "CREATE TABLE SinkConnectionFormat" + i2s(sinkID) + std::string("(soundFormat INTEGER)");
- if (!this->sqQuery(command))
- return (E_DATABASE_ERROR);
- command = "CREATE TABLE SinkSoundProperty" + i2s(sinkID) + std::string("(soundPropertyType INTEGER, value INTEGER)");
- if (!this->sqQuery(command))
- return (E_DATABASE_ERROR);
- command = "CREATE TABLE SinkNotificationConfiguration" + i2s(sinkID) + std::string("(type INTEGER, status INTEGER, parameter INTEGER)");
- if (!this->sqQuery(command))
- return (E_DATABASE_ERROR);
-
- //fill ConnectionFormats
- command = "INSERT INTO SinkConnectionFormat" + i2s(sinkID) + std::string("(soundFormat) VALUES (?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_CustomConnectionFormat_t>::const_iterator connectionFormatIterator = sinkData.listConnectionFormats.begin();
- for (; connectionFormatIterator < sinkData.listConnectionFormats.end(); ++connectionFormatIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, *connectionFormatIterator)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterSinkDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
-
- //Fill SinkSoundProperties
- command = "INSERT INTO SinkSoundProperty" + i2s(sinkID) + std::string("(soundPropertyType,value) VALUES (?,?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_SoundProperty_s>::const_iterator SoundPropertyIterator = sinkData.listSoundProperties.begin();
- for (; SoundPropertyIterator < sinkData.listSoundProperties.end(); ++SoundPropertyIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, SoundPropertyIterator->type)
- MY_SQLITE_BIND_INT(query, 2, SoundPropertyIterator->value)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterSinkDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
-
- //Fill NotificationConfigurations
- command = "INSERT INTO SinkNotificationConfiguration" + i2s(sinkID) + std::string("(type,status,parameter) VALUES (?,?,?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_NotificationConfiguration_s>::const_iterator NotificationConfigurationIterator(sinkData.listNotificationConfigurations.begin());
- for (; NotificationConfigurationIterator < sinkData.listNotificationConfigurations.end(); ++NotificationConfigurationIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, NotificationConfigurationIterator->type)
- MY_SQLITE_BIND_INT(query, 2, NotificationConfigurationIterator->status)
- MY_SQLITE_BIND_INT(query, 3, NotificationConfigurationIterator->parameter)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterSinkDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
-
- if (sinkData.visible == true)
- {
- command = "CREATE TABLE SinkMainSoundProperty" + i2s(sinkID) + std::string("(soundPropertyType INTEGER, value INTEGER)");
- if (!this->sqQuery(command))
- return (E_DATABASE_ERROR);
-
- //Fill MainSinkSoundProperties
- command = "INSERT INTO SinkMainSoundProperty" + i2s(sinkID) + std::string("(soundPropertyType,value) VALUES (?,?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_MainSoundProperty_s>::const_iterator mainSoundPropertyIterator = sinkData.listMainSoundProperties.begin();
- for (; mainSoundPropertyIterator < sinkData.listMainSoundProperties.end(); ++mainSoundPropertyIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, mainSoundPropertyIterator->type)
- MY_SQLITE_BIND_INT(query, 2, mainSoundPropertyIterator->value)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterSinkDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
- MY_SQLITE_FINALIZE(query)
-
- //now we got MainNotificationConfigurations as well
- command = "CREATE TABLE SinkMainNotificationConfiguration" + i2s(sinkID) + std::string("(type INTEGER, status INTEGER, parameter INTEGER)");
- if (!this->sqQuery(command))
- return (E_DATABASE_ERROR);
-
- command = "INSERT INTO SinkMainNotificationConfiguration" + i2s(sinkID) + std::string("(type,status,parameter) VALUES (?,?,?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_NotificationConfiguration_s>::const_iterator mainNotificationConfigurationIterator(sinkData.listMainNotificationConfigurations.begin());
- for (; mainNotificationConfigurationIterator < sinkData.listMainNotificationConfigurations.end(); ++mainNotificationConfigurationIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, mainNotificationConfigurationIterator->type)
- MY_SQLITE_BIND_INT(query, 2, mainNotificationConfigurationIterator->status)
- MY_SQLITE_BIND_INT(query, 3, mainNotificationConfigurationIterator->parameter)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterSinkDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
- MY_SQLITE_FINALIZE(query)
- }
-
- logInfo("DatabaseHandler::enterSinkDB entered new sink with name", sinkData.name, "domainID:", sinkData.domainID, "classID:", sinkData.sinkClassID, "volume:", sinkData.volume, "assigned ID:", sinkID);
- am_Sink_s sink = sinkData;
- sink.sinkID = sinkID;
- if (mpDatabaseObserver != NULL)
- mpDatabaseObserver->newSink(sink);
- return (E_OK);
-}
-
-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);
- assert(!crossfaderData.name.empty());
- assert(existSink(crossfaderData.sinkID_A));
- assert(existSink(crossfaderData.sinkID_B));
- assert(existSource(crossfaderData.sourceID));
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- //if gatewayData is zero and the first Static Sink was already entered, the ID is created
- if (crossfaderData.crossfaderID == 0 && !mFirstStaticCrossfader)
- {
- command = "INSERT INTO " + std::string(CROSSFADER_TABLE) + "(name, sinkID_A, sinkID_B, sourceID, hotSink) VALUES (?,?,?,?,?)";
- }
- else
- {
- //check if the ID already exists
- if (existCrossFader(crossfaderData.crossfaderID))
- return (E_ALREADY_EXISTS);
- command = "INSERT INTO " + std::string(CROSSFADER_TABLE) + "(name, sinkID_A, sinkID_B, sourceID, hotSink, crossfaderID) VALUES (?,?,?,?,?,?)";
- }
-
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- MY_SQLITE_BIND_TEXT(query, 1, crossfaderData.name.c_str(), crossfaderData.name.size(), SQLITE_STATIC)
- MY_SQLITE_BIND_INT(query, 2, crossfaderData.sinkID_A)
- MY_SQLITE_BIND_INT(query, 3, crossfaderData.sinkID_B)
- MY_SQLITE_BIND_INT(query, 4, crossfaderData.sourceID)
- MY_SQLITE_BIND_INT(query, 5, crossfaderData.hotSink)
-
- //if the ID is not created, we add it to the query
- if (crossfaderData.crossfaderID != 0)
- {
- MY_SQLITE_BIND_INT(query, 6, crossfaderData.crossfaderID)
- }
-
- //if the first static sink is entered, we need to set it onto the boundary
- else if (mFirstStaticCrossfader)
- {
- MY_SQLITE_BIND_INT(query, 6, DYNAMIC_ID_BOUNDARY)
- mFirstStaticCrossfader = false;
- }
-
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterCrossfaderDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- //now read back the crossfaderID
- command = "SELECT crossfaderID FROM " + std::string(CROSSFADER_TABLE) + " WHERE name=?";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_TEXT(query, 1, crossfaderData.name.c_str(), crossfaderData.name.size(), SQLITE_STATIC)
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- crossfaderID = sqlite3_column_int(query, 0);
- }
- else
- {
- crossfaderID = 0;
- logError("DatabaseHandler::enterCrossfaderDB database error!:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_FINALIZE(query)
-
- logInfo("DatabaseHandler::enterCrossfaderDB entered new crossfader with name=", crossfaderData.name, "sinkA= ", crossfaderData.sinkID_A, "sinkB=", crossfaderData.sinkID_B, "source=", crossfaderData.sourceID, "assigned ID:", crossfaderID);
-
- am_Crossfader_s crossfader(crossfaderData);
- crossfader.crossfaderID = crossfaderID;
- if (mpDatabaseObserver)
- mpDatabaseObserver->newCrossfader(crossfader);
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::enterGatewayDB(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
-{
- assert(gatewayData.gatewayID<DYNAMIC_ID_BOUNDARY);
- assert(gatewayData.sinkID!=0);
- assert(gatewayData.sourceID!=0);
- assert(gatewayData.controlDomainID!=0);
- assert(gatewayData.domainSinkID!=0);
- assert(gatewayData.domainSourceID!=0);
- assert(!gatewayData.name.empty());
- assert(!gatewayData.convertionMatrix.empty());
- assert(!gatewayData.listSinkFormats.empty());
- assert(!gatewayData.listSourceFormats.empty());
-
- //might be that the sinks and sources are not there during registration time
- //assert(existSink(gatewayData.sinkID));
- //assert(existSource(gatewayData.sourceID));
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- //if gatewayData is zero and the first Static Sink was already entered, the ID is created
- if (gatewayData.gatewayID == 0 && !mFirstStaticGateway)
- {
- command = "INSERT INTO " + std::string(GATEWAY_TABLE) + "(name, sinkID, sourceID, domainSinkID, domainSourceID, controlDomainID) VALUES (?,?,?,?,?,?)";
- }
- else
- {
- //check if the ID already exists
- if (existGateway(gatewayData.gatewayID))
- return (E_ALREADY_EXISTS);
- command = "INSERT INTO " + std::string(GATEWAY_TABLE) + "(name, sinkID, sourceID, domainSinkID, domainSourceID, controlDomainID, gatewayID) VALUES (?,?,?,?,?,?,?)";
- }
-
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_TEXT(query, 1, gatewayData.name.c_str(), gatewayData.name.size(), SQLITE_STATIC)
- MY_SQLITE_BIND_INT(query, 2, gatewayData.sinkID)
- MY_SQLITE_BIND_INT(query, 3, gatewayData.sourceID)
- MY_SQLITE_BIND_INT(query, 4, gatewayData.domainSinkID)
- MY_SQLITE_BIND_INT(query, 5, gatewayData.domainSourceID)
- MY_SQLITE_BIND_INT(query, 6, gatewayData.controlDomainID)
-
- //if the ID is not created, we add it to the query
- if (gatewayData.gatewayID != 0)
- {
- MY_SQLITE_BIND_INT(query, 7, gatewayData.gatewayID)
- }
-
- //if the first static sink is entered, we need to set it onto the boundary
- else if (mFirstStaticGateway)
- {
- MY_SQLITE_BIND_INT(query, 7, DYNAMIC_ID_BOUNDARY)
- mFirstStaticGateway = false;
- }
-
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterGatewayDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- gatewayID = sqlite3_last_insert_rowid(mpDatabase);
-
- //now the convertion matrix todo: change the map implementation sometimes to blob in sqlite
- mListConnectionFormat.insert(std::make_pair(gatewayID, gatewayData.convertionMatrix));
-
- command = "CREATE TABLE GatewaySourceFormat" + i2s(gatewayID) + std::string("(soundFormat INTEGER)");
- if (!this->sqQuery(command))
- return (E_DATABASE_ERROR);
- command = "CREATE TABLE GatewaySinkFormat" + i2s(gatewayID) + std::string("(soundFormat INTEGER)");
- if (!this->sqQuery(command))
- return (E_DATABASE_ERROR);
-
- //fill ConnectionFormats
- command = "INSERT INTO GatewaySourceFormat" + i2s(gatewayID) + std::string("(soundFormat) VALUES (?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_CustomConnectionFormat_t>::const_iterator connectionFormatIterator = gatewayData.listSourceFormats.begin();
- for (; connectionFormatIterator < gatewayData.listSourceFormats.end(); ++connectionFormatIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, *connectionFormatIterator)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterGatewayDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
- MY_SQLITE_FINALIZE(query)
-
- command = "INSERT INTO GatewaySinkFormat" + i2s(gatewayID) + std::string("(soundFormat) VALUES (?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- connectionFormatIterator = gatewayData.listSinkFormats.begin();
- for (; connectionFormatIterator < gatewayData.listSinkFormats.end(); ++connectionFormatIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, *connectionFormatIterator)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterGatewayDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
- MY_SQLITE_FINALIZE(query)
-
- logInfo("DatabaseHandler::enterGatewayDB entered new gateway with name", gatewayData.name, "sourceID:", gatewayData.sourceID, "sinkID:", gatewayData.sinkID, "assigned ID:", gatewayID);
- am_Gateway_s gateway = gatewayData;
- gateway.gatewayID = gatewayID;
- if (mpDatabaseObserver)
- mpDatabaseObserver->newGateway(gateway);
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::enterConverterDB(const am_Converter_s & converterData, am_converterID_t & converterID)
-{
- assert(converterData.converterID<DYNAMIC_ID_BOUNDARY);
- assert(converterData.sinkID!=0);
- assert(converterData.sourceID!=0);
- assert(converterData.domainID!=0);
- assert(!converterData.name.empty());
- assert(!converterData.convertionMatrix.empty());
- assert(!converterData.listSinkFormats.empty());
- assert(!converterData.listSourceFormats.empty());
-
- //might be that the sinks and sources are not there during registration time
- //assert(existSink(gatewayData.sinkID));
- //assert(existSource(gatewayData.sourceID));
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- //if gatewayData is zero and the first Static Sink was already entered, the ID is created
- if (converterData.converterID == 0 && !mFirstStaticConverter)
- {
- command = "INSERT INTO " + std::string(CONVERTER_TABLE) + "(name, sinkID, sourceID, domainID) VALUES (?,?,?,?)";
- }
- else
- {
- //check if the ID already exists
- if (existConverter(converterData.converterID))
- return (E_ALREADY_EXISTS);
- command = "INSERT INTO " + std::string(CONVERTER_TABLE) + "(name, sinkID, sourceID, domainID, converterID) VALUES (?,?,?,?,?)";
- }
-
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_TEXT(query, 1, converterData.name.c_str(), converterData.name.size(), SQLITE_STATIC)
- MY_SQLITE_BIND_INT(query, 2, converterData.sinkID)
- MY_SQLITE_BIND_INT(query, 3, converterData.sourceID)
- MY_SQLITE_BIND_INT(query, 4, converterData.domainID)
-
- //if the ID is not created, we add it to the query
- if (converterData.converterID != 0)
- {
- MY_SQLITE_BIND_INT(query, 5, converterData.converterID)
- }
-
- //if the first static sink is entered, we need to set it onto the boundary
- else if (mFirstStaticConverter)
- {
- MY_SQLITE_BIND_INT(query, 5, DYNAMIC_ID_BOUNDARY)
- mFirstStaticConverter = false;
- }
-
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterConverterDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- converterID = sqlite3_last_insert_rowid(mpDatabase);
-
- //now the convertion matrix todo: change the map implementation sometimes to blob in sqlite
- mListConnectionFormat.insert(std::make_pair(converterID, converterData.convertionMatrix));
-
- command = "CREATE TABLE ConverterSourceFormat" + i2s(converterID) + std::string("(soundFormat INTEGER)");
- if (!this->sqQuery(command))
- return (E_DATABASE_ERROR);
- command = "CREATE TABLE ConverterSinkFormat" + i2s(converterID) + std::string("(soundFormat INTEGER)");
- if (!this->sqQuery(command))
- return (E_DATABASE_ERROR);
-
- //fill ConnectionFormats
- command = "INSERT INTO ConverterSourceFormat" + i2s(converterID) + std::string("(soundFormat) VALUES (?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_CustomConnectionFormat_t>::const_iterator connectionFormatIterator = converterData.listSourceFormats.begin();
- for (; connectionFormatIterator < converterData.listSourceFormats.end(); ++connectionFormatIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, *connectionFormatIterator)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterConverterDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
- MY_SQLITE_FINALIZE(query)
-
- command = "INSERT INTO ConverterSinkFormat" + i2s(converterID) + std::string("(soundFormat) VALUES (?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- connectionFormatIterator = converterData.listSinkFormats.begin();
- for (; connectionFormatIterator < converterData.listSinkFormats.end(); ++connectionFormatIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, *connectionFormatIterator)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterConverterDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
- MY_SQLITE_FINALIZE(query)
-
- logInfo("DatabaseHandler::enterConverterDB entered new gateway with name", converterData.name, "sourceID:", converterData.sourceID, "sinkID:", converterData.sinkID, "assigned ID:", converterID);
- am_Converter_s converter = converterData;
- converter.converterID = converterID;
- if (mpDatabaseObserver)
- mpDatabaseObserver->newConverter(converter);
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::enterSourceDB(const am_Source_s & sourceData, am_sourceID_t & sourceID)
-{
- assert(sourceData.sourceID<DYNAMIC_ID_BOUNDARY);
- assert(sourceData.domainID!=0);
- assert(!sourceData.name.empty());
- assert(sourceData.sourceClassID!=0);
- // \todo: need to check if class exists?
- assert(!sourceData.listConnectionFormats.empty());
- assert(sourceData.sourceState>=SS_UNKNNOWN && sourceData.sourceState<=SS_MAX);
-
- sqlite3_stmt* query = NULL;
- ;
- int eCode = 0;
- std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE name=? AND reserved=1";
-
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_TEXT(query, 1, sourceData.name.c_str(), sourceData.name.size(), SQLITE_STATIC)
-
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- command = "UPDATE " + std::string(SOURCE_TABLE) + " SET name=?, domainID=?, sourceClassID=?, sourceState=?, volume=?, visible=?, availability=?, availabilityReason=?, interruptState=?, reserved=? WHERE sourceID=" + i2s(sqlite3_column_int(query, 0));
- }
- else if (eCode == SQLITE_DONE)
- {
- //if sinkID is zero and the first Static Sink was already entered, the ID is created
- if (sourceData.sourceID == 0 && !mFirstStaticSource && !existSourceName(sourceData.name))
- {
- command = "INSERT INTO " + std::string(SOURCE_TABLE) + "(name, domainID, sourceClassID, sourceState, volume, visible, availability, availabilityReason, interruptState, reserved) VALUES (?,?,?,?,?,?,?,?,?,?)";
- }
- else
- {
- //check if the ID already exists
- if (existSourceNameOrID(sourceData.sourceID, sourceData.name))
- {
- MY_SQLITE_FINALIZE(query)
- return (E_ALREADY_EXISTS);
- }
- command = "INSERT INTO " + std::string(SOURCE_TABLE) + "(name, domainID, sourceClassID, sourceState, volume, visible, availability, availabilityReason, interruptState, reserved, sourceID) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
- }
- }
- else
- {
- logError("DatabaseHandler::enterSourceDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_TEXT(query, 1, sourceData.name.c_str(), sourceData.name.size(), SQLITE_STATIC)
- MY_SQLITE_BIND_INT(query, 2, sourceData.domainID)
- MY_SQLITE_BIND_INT(query, 3, sourceData.sourceClassID)
- MY_SQLITE_BIND_INT(query, 4, sourceData.sourceState)
- MY_SQLITE_BIND_INT(query, 5, sourceData.volume)
- MY_SQLITE_BIND_INT(query, 6, sourceData.visible)
- MY_SQLITE_BIND_INT(query, 7, sourceData.available.availability)
- MY_SQLITE_BIND_INT(query, 8, sourceData.available.availabilityReason)
- MY_SQLITE_BIND_INT(query, 9, sourceData.interruptState)
- MY_SQLITE_BIND_INT(query, 10, 0)
-
- //if the ID is not created, we add it to the query
- if (sourceData.sourceID != 0)
- {
- MY_SQLITE_BIND_INT(query, 11, sourceData.sourceID)
- }
-
- //if the first static sink is entered, we need to set it onto the boundary
- else if (mFirstStaticSource)
- {
- MY_SQLITE_BIND_INT(query, 11, DYNAMIC_ID_BOUNDARY)
- mFirstStaticSource = false;
- }
-
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterSourceDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- //now read back the sinkID
- command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE name=?";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_TEXT(query, 1, sourceData.name.c_str(), sourceData.name.size(), SQLITE_STATIC)
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- sourceID = sqlite3_column_int(query, 0);
- }
- else
- {
- sourceID = 0;
- logError("DatabaseHandler::existSink database error!:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_FINALIZE(query)
-
- //now we need to create the additional tables:
- command = "CREATE TABLE SourceConnectionFormat" + i2s(sourceID) + std::string("(soundFormat INTEGER)");
- if (!this->sqQuery(command))
- return (E_DATABASE_ERROR);
- command = "CREATE TABLE SourceSoundProperty" + i2s(sourceID) + std::string("(soundPropertyType INTEGER, value INTEGER)");
- if (!this->sqQuery(command))
- return (E_DATABASE_ERROR);
- command = "CREATE TABLE SourceNotificationConfiguration" + i2s(sourceID) + std::string("(type INTEGER, status INTEGER, parameter INTEGER)");
- if (!this->sqQuery(command))
- return (E_DATABASE_ERROR);
-
- //fill ConnectionFormats
- command = "INSERT INTO SourceConnectionFormat" + i2s(sourceID) + std::string("(soundFormat) VALUES (?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_CustomConnectionFormat_t>::const_iterator connectionFormatIterator = sourceData.listConnectionFormats.begin();
- for (; connectionFormatIterator != sourceData.listConnectionFormats.end(); ++connectionFormatIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, *connectionFormatIterator)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterSourceDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
- MY_SQLITE_FINALIZE(query)
-
- //Fill SinkSoundProperties
- command = "INSERT INTO SourceSoundProperty" + i2s(sourceID) + std::string("(soundPropertyType,value) VALUES (?,?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_SoundProperty_s>::const_iterator SoundPropertyIterator = sourceData.listSoundProperties.begin();
- for (; SoundPropertyIterator != sourceData.listSoundProperties.end(); ++SoundPropertyIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, SoundPropertyIterator->type)
- MY_SQLITE_BIND_INT(query, 2, SoundPropertyIterator->value)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterSinkDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
-
- //Fill NotificationConfigurations
- command = "INSERT INTO SourceNotificationConfiguration" + i2s(sourceID) + std::string("(type,status,parameter) VALUES (?,?,?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_NotificationConfiguration_s>::const_iterator NotificationConfigurationIterator(sourceData.listNotificationConfigurations.begin());
- for (; NotificationConfigurationIterator < sourceData.listNotificationConfigurations.end(); ++NotificationConfigurationIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, NotificationConfigurationIterator->type)
- MY_SQLITE_BIND_INT(query, 2, NotificationConfigurationIterator->status)
- MY_SQLITE_BIND_INT(query, 3, NotificationConfigurationIterator->parameter)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterSinkDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
-
- if (sourceData.visible == true)
- {
- command = "CREATE TABLE SourceMainSoundProperty" + i2s(sourceID) + std::string("(soundPropertyType INTEGER, value INTEGER)");
- if (!this->sqQuery(command))
- return (E_DATABASE_ERROR);
-
- //Fill MainSinkSoundProperties
- command = "INSERT INTO SourceMainSoundProperty" + i2s(sourceID) + std::string("(soundPropertyType,value) VALUES (?,?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_MainSoundProperty_s>::const_iterator mainSoundPropertyIterator = sourceData.listMainSoundProperties.begin();
- for (; mainSoundPropertyIterator != sourceData.listMainSoundProperties.end(); ++mainSoundPropertyIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, mainSoundPropertyIterator->type)
- MY_SQLITE_BIND_INT(query, 2, mainSoundPropertyIterator->value)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterSourceDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
- MY_SQLITE_FINALIZE(query)
-
- //now we got MainNotificationConfigurations as well
- command = "CREATE TABLE SourceMainNotificationConfiguration" + i2s(sourceID) + std::string("(type INTEGER, status INTEGER, parameter INTEGER)");
- if (!this->sqQuery(command))
- return (E_DATABASE_ERROR);
-
- command = "INSERT INTO SourceMainNotificationConfiguration" + i2s(sourceID) + std::string("(type,status,parameter) VALUES (?,?,?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_NotificationConfiguration_s>::const_iterator mainNotificationConfigurationIterator(sourceData.listMainNotificationConfigurations.begin());
- for (; mainNotificationConfigurationIterator != sourceData.listMainNotificationConfigurations.end(); ++mainNotificationConfigurationIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, mainNotificationConfigurationIterator->type)
- MY_SQLITE_BIND_INT(query, 2, mainNotificationConfigurationIterator->status)
- MY_SQLITE_BIND_INT(query, 3, mainNotificationConfigurationIterator->parameter)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterSinkDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
- MY_SQLITE_FINALIZE(query)
- }
-
- logInfo("DatabaseHandler::enterSourceDB entered new source with name", sourceData.name, "domainID:", sourceData.domainID, "classID:", sourceData.sourceClassID, "visible:", sourceData.visible, "assigned ID:", sourceID);
-
- am_Source_s source = sourceData;
- source.sourceID = sourceID;
- if (mpDatabaseObserver)
- mpDatabaseObserver->newSource(source);
- return (E_OK);
-}
-
-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_NON_EXISTENT);
- }
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- int16_t delay = 0;
- command = "SELECT delay FROM " + std::string(CONNECTION_TABLE) + (" WHERE connectionID=?");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_connectionID_t>::const_iterator elementIterator = listConnectionID.begin();
- for (; elementIterator < listConnectionID.end(); ++elementIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, *elementIterator)
-
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- int16_t temp_delay = sqlite3_column_int(query, 1);
- if (temp_delay != -1 && delay != -1)
- delay += temp_delay;
- else
- delay = -1;
- }
- else
- {
- logError("DatabaseHandler::changeMainConnectionRouteDB did not find route for MainConnection: ", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
-
- MY_SQLITE_FINALIZE(query)
-
- //now we delete the data in the table
- command = "DELETE from MainConnectionRoute" + i2s(mainconnectionID);
- if (!this->sqQuery(command))
- return (E_DATABASE_ERROR);
-
- command = "INSERT INTO MainConnectionRoute" + i2s(mainconnectionID) + "(connectionID) VALUES (?)";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_connectionID_t>::const_iterator listConnectionIterator(listConnectionID.begin());
- for (; listConnectionIterator != listConnectionID.end(); ++listConnectionIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, *listConnectionIterator)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeMainConnectionRouteDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
-
- if (changeDelayMainConnection(delay,mainconnectionID)!=E_OK)
- logError("DatabaseHandler::changeMainConnectionRouteDB error while changing mainConnectionDelay to ", delay);
-
- MY_SQLITE_FINALIZE(query)
- logInfo("DatabaseHandler::changeMainConnectionRouteDB entered new route:", mainconnectionID);
- return (E_OK);
-}
-
-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);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- if (!existMainConnection(mainconnectionID))
- {
- return (E_NON_EXISTENT);
- }
- command = "UPDATE " + std::string(MAINCONNECTION_TABLE) + " SET connectionState=? WHERE mainConnectionID=" + i2s(mainconnectionID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, connectionState)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeMainConnectionStateDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_FINALIZE(query)
- logInfo("DatabaseHandler::changeMainConnectionStateDB changed mainConnectionState of MainConnection:", mainconnectionID, "to:", connectionState);
-
- if (mpDatabaseObserver)
- mpDatabaseObserver->mainConnectionStateChanged(mainconnectionID, connectionState);
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID)
-{
- assert(sinkID!=0);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- if (!existSink(sinkID))
- {
- return (E_NON_EXISTENT);
- }
- command = "UPDATE " + std::string(SINK_TABLE) + " SET mainVolume=? WHERE sinkID=" + i2s(sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, mainVolume)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeSinkMainVolumeDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
- logInfo("DatabaseHandler::changeSinkMainVolumeDB changed mainVolume of sink:", sinkID, "to:", mainVolume);
-
- if (mpDatabaseObserver)
- mpDatabaseObserver->volumeChanged(sinkID, mainVolume);
-
- return (E_OK);
-}
-
-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);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- if (!existSink(sinkID))
- {
- return (E_NON_EXISTENT);
- }
- command = "UPDATE " + std::string(SINK_TABLE) + " SET availability=?, availabilityReason=? WHERE sinkID=" + i2s(sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, availability.availability)
- MY_SQLITE_BIND_INT(query, 2, availability.availabilityReason)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeSinkAvailabilityDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- assert(sinkID!=0);
- MY_SQLITE_FINALIZE(query)
- logInfo("DatabaseHandler::changeSinkAvailabilityDB changed sinkAvailability of sink:", sinkID, "to:", availability.availability, "Reason:", availability.availabilityReason);
-
- if (mpDatabaseObserver && sourceVisible(sinkID))
- mpDatabaseObserver->sinkAvailabilityChanged(sinkID, availability);
- return (E_OK);
-}
-
-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);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- if (!existDomain(domainID))
- {
- return (E_NON_EXISTENT);
- }
- command = "UPDATE " + std::string(DOMAIN_TABLE) + " SET state=? WHERE domainID=" + i2s(domainID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, domainState)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changDomainStateDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- logInfo("DatabaseHandler::changDomainStateDB changed domainState of domain:", domainID, "to:", domainState);
- return (E_OK);
-}
-
-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);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- if (!existSink(sinkID))
- {
- return (E_NON_EXISTENT);
- }
- command = "UPDATE " + std::string(SINK_TABLE) + " SET muteState=? WHERE sinkID=" + i2s(sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, muteState)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeSinkMuteStateDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- assert(sinkID!=0);
- MY_SQLITE_FINALIZE(query)
- logInfo("DatabaseHandler::changeSinkMuteStateDB changed sinkMuteState of sink:", sinkID, "to:", muteState);
-
- if (mpDatabaseObserver)
- mpDatabaseObserver->sinkMuteStateChanged(sinkID, muteState);
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sinkID_t sinkID)
-{
- assert(sinkID!=0);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- if (!existSink(sinkID))
- {
- return (E_NON_EXISTENT);
- }
- command = "UPDATE SinkMainSoundProperty" + i2s(sinkID) + " SET value=? WHERE soundPropertyType=" + i2s(soundProperty.type);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, soundProperty.value)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeMainSinkSoundPropertyDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- assert(sinkID!=0);
- MY_SQLITE_FINALIZE(query)
- logInfo("DatabaseHandler::changeMainSinkSoundPropertyDB changed MainSinkSoundProperty of sink:", sinkID, "type:", soundProperty.type, "to:", soundProperty.value);
- if (mpDatabaseObserver)
- mpDatabaseObserver->mainSinkSoundPropertyChanged(sinkID, soundProperty);
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sourceID_t sourceID)
-{
- assert(sourceID!=0);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- if (!existSource(sourceID))
- {
- return (E_NON_EXISTENT);
- }
- command = "UPDATE SourceMainSoundProperty" + i2s(sourceID) + " SET value=? WHERE soundPropertyType=" + i2s(soundProperty.type);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, soundProperty.value)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeMainSourceSoundPropertyDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_FINALIZE(query)
-
- logInfo("DatabaseHandler::changeMainSourceSoundPropertyDB changed MainSinkSoundProperty of source:", sourceID, "type:", soundProperty.type, "to:", soundProperty.value);
-
- if (mpDatabaseObserver)
- mpDatabaseObserver->mainSourceSoundPropertyChanged(sourceID, soundProperty);
- return (E_OK);
-}
-
-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);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- if (!existSource(sourceID))
- {
- return (E_NON_EXISTENT);
- }
- command = "UPDATE " + std::string(SOURCE_TABLE) + " SET availability=?, availabilityReason=? WHERE sourceID=" + i2s(sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, availability.availability)
- MY_SQLITE_BIND_INT(query, 2, availability.availabilityReason)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeSourceAvailabilityDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- logInfo("DatabaseHandler::changeSourceAvailabilityDB changed changeSourceAvailabilityDB of source:", sourceID, "to:", availability.availability, "Reason:", availability.availabilityReason);
-
- if (mpDatabaseObserver && sourceVisible(sourceID))
- mpDatabaseObserver->sourceAvailabilityChanged(sourceID, availability);
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::changeSystemPropertyDB(const am_SystemProperty_s & property)
-{
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command = "UPDATE " + std::string(SYSTEM_TABLE) + " set value=? WHERE type=?";
-
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, property.value)
- MY_SQLITE_BIND_INT(query, 2, property.type)
-
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeSystemPropertyDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- logInfo("DatabaseHandler::changeSystemPropertyDB changed system property");
-
- if (mpDatabaseObserver)
- mpDatabaseObserver->systemPropertyChanged(property);
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID)
-{
- assert(mainConnectionID!=0);
-
- if (!existMainConnection(mainConnectionID))
- {
- return (E_NON_EXISTENT);
- }
- std::string command = "DELETE from " + std::string(MAINCONNECTION_TABLE) + " WHERE mainConnectionID=" + i2s(mainConnectionID);
- std::string command1 = "DROP table MainConnectionRoute" + i2s(mainConnectionID);
- if (!sqQuery(command))
- return (E_DATABASE_ERROR);
- if (!sqQuery(command1))
- return (E_DATABASE_ERROR);
- logInfo("DatabaseHandler::removeMainConnectionDB removed:", mainConnectionID);
- if (mpDatabaseObserver)
- {
- mpDatabaseObserver->mainConnectionStateChanged(mainConnectionID, CS_DISCONNECTED);
- mpDatabaseObserver->removedMainConnection(mainConnectionID);
- }
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::removeSinkDB(const am_sinkID_t sinkID)
-{
- assert(sinkID!=0);
-
- if (!existSink(sinkID))
- {
- return (E_NON_EXISTENT);
- }
-
- bool visible = sinkVisible(sinkID);
-
- std::string command = "DELETE from " + std::string(SINK_TABLE) + " WHERE sinkID=" + i2s(sinkID);
- std::string command1 = "DROP table SinkConnectionFormat" + i2s(sinkID);
- std::string command2 = "DROP table SinkSoundProperty" + i2s(sinkID);
- std::string command3 = "DROP table SinkMainSoundProperty" + i2s(sinkID);
- std::string command4 = "DROP table SinkNotificationConfiguration" + i2s(sinkID);
- std::string command5 = "DROP table SinkMainNotificationConfiguration" + i2s(sinkID);
- if (!sqQuery(command))
- return (E_DATABASE_ERROR);
- if (!sqQuery(command1))
- return (E_DATABASE_ERROR);
- if (!sqQuery(command2))
- return (E_DATABASE_ERROR);
- if (!sqQuery(command4))
- return (E_DATABASE_ERROR);
- if (visible) //only drop table if it ever existed
- {
- if (!sqQuery(command3))
- return (E_DATABASE_ERROR);
- if (!sqQuery(command5))
- return (E_DATABASE_ERROR);
- }
- logInfo("DatabaseHandler::removeSinkDB removed:", sinkID);
-
- if (mpDatabaseObserver != NULL)
- mpDatabaseObserver->removedSink(sinkID, visible);
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::removeSourceDB(const am_sourceID_t sourceID)
-{
- assert(sourceID!=0);
-
- if (!existSource(sourceID))
- {
- return (E_NON_EXISTENT);
- }
-
- bool visible = sourceVisible(sourceID);
-
- std::string command = "DELETE from " + std::string(SOURCE_TABLE) + " WHERE sourceID=" + i2s(sourceID);
- std::string command1 = "DROP table SourceConnectionFormat" + i2s(sourceID);
- std::string command2 = "DROP table SourceMainSoundProperty" + i2s(sourceID);
- std::string command3 = "DROP table SourceSoundProperty" + i2s(sourceID);
- std::string command4 = "DROP table SourceNotificationConfiguration" + i2s(sourceID);
- std::string command5 = "DROP table SourceMainNotificationConfiguration" + i2s(sourceID);
- if (!sqQuery(command))
- return (E_DATABASE_ERROR);
- if (!sqQuery(command1))
- return (E_DATABASE_ERROR);
- if (!sqQuery(command3))
- return (E_DATABASE_ERROR);
- if (!sqQuery(command4))
- return (E_DATABASE_ERROR);
-
- if(visible)
- {
- if (!sqQuery(command2))
- return (E_DATABASE_ERROR);
- if (!sqQuery(command5))
- return (E_DATABASE_ERROR);
- }
- logInfo("DatabaseHandler::removeSourceDB removed:", sourceID);
- if (mpDatabaseObserver)
- mpDatabaseObserver->removedSource(sourceID, visible);
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::removeGatewayDB(const am_gatewayID_t gatewayID)
-{
- assert(gatewayID!=0);
-
- if (!existGateway(gatewayID))
- {
- return (E_NON_EXISTENT);
- }
- std::string command = "DELETE from " + std::string(GATEWAY_TABLE) + " WHERE gatewayID=" + i2s(gatewayID);
- if (!sqQuery(command))
- return (E_DATABASE_ERROR);
- logInfo("DatabaseHandler::removeGatewayDB removed:", gatewayID);
- if (mpDatabaseObserver)
- mpDatabaseObserver->removeGateway(gatewayID);
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::removeConverterDB(const am_converterID_t converterID)
-{
- assert(converterID!=0);
-
- if (!existConverter(converterID))
- {
- return (E_NON_EXISTENT);
- }
- std::string command = "DELETE from " + std::string(CONVERTER_TABLE) + " WHERE converterID=" + i2s(converterID);
- if (!sqQuery(command))
- return (E_DATABASE_ERROR);
- logInfo("DatabaseHandler::removeConverterDB removed:", converterID);
- if (mpDatabaseObserver)
- mpDatabaseObserver->removeConverter(converterID);
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::removeCrossfaderDB(const am_crossfaderID_t crossfaderID)
-{
- assert(crossfaderID!=0);
-
- if (!existCrossFader(crossfaderID))
- {
- return (E_NON_EXISTENT);
- }
- std::string command = "DELETE from " + std::string(CROSSFADER_TABLE) + " WHERE crossfaderID=" + i2s(crossfaderID);
- if (!sqQuery(command))
- return (E_DATABASE_ERROR);
- logInfo("DatabaseHandler::removeCrossfaderDB removed:", crossfaderID);
- if (mpDatabaseObserver)
- mpDatabaseObserver->removeCrossfader(crossfaderID);
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::removeDomainDB(const am_domainID_t domainID)
-{
- assert(domainID!=0);
-
- if (!existDomain(domainID))
- {
- return (E_NON_EXISTENT);
- }
- std::string command = "DELETE from " + std::string(DOMAIN_TABLE) + " WHERE domainID=" + i2s(domainID);
- if (!sqQuery(command))
- return (E_DATABASE_ERROR);
- logInfo("DatabaseHandler::removeDomainDB removed:", domainID);
- if (mpDatabaseObserver)
- mpDatabaseObserver->removeDomain(domainID);
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::removeSinkClassDB(const am_sinkClass_t sinkClassID)
-{
- assert(sinkClassID!=0);
-
- if (!existSinkClass(sinkClassID))
- {
- return (E_NON_EXISTENT);
- }
- std::string command = "DELETE from " + std::string(SINK_CLASS_TABLE) + " WHERE sinkClassID=" + i2s(sinkClassID);
- std::string command1 = "DROP table SinkClassProperties" + i2s(sinkClassID);
- if (!sqQuery(command))
- return (E_DATABASE_ERROR);
- if (!sqQuery(command1))
- return (E_DATABASE_ERROR);
-
- logInfo("DatabaseHandler::removeSinkClassDB removed:", sinkClassID);
- if (mpDatabaseObserver)
- mpDatabaseObserver->numberOfSinkClassesChanged();
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::removeSourceClassDB(const am_sourceClass_t sourceClassID)
-{
- assert(sourceClassID!=0);
-
- if (!existSourceClass(sourceClassID))
- {
- return (E_NON_EXISTENT);
- }
- std::string command = "DELETE from " + std::string(SOURCE_CLASS_TABLE) + " WHERE sourceClassID=" + i2s(sourceClassID);
- std::string command1 = "DROP table SourceClassProperties" + i2s(sourceClassID);
- if (!sqQuery(command))
- return (E_DATABASE_ERROR);
- if (!sqQuery(command1))
- return (E_DATABASE_ERROR);
- logInfo("DatabaseHandler::removeSourceClassDB removed:", sourceClassID);
- if (mpDatabaseObserver)
- mpDatabaseObserver->numberOfSourceClassesChanged();
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::removeConnection(const am_connectionID_t connectionID)
-{
- assert(connectionID!=0);
-
- std::string command = "DELETE from " + std::string(CONNECTION_TABLE) + " WHERE connectionID=" + i2s(connectionID);
- if (!sqQuery(command))
- return (E_DATABASE_ERROR);
- logInfo("DatabaseHandler::removeConnection removed:", connectionID);
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s & classInfo) const
-{
- assert(sourceID!=0);
-
- if (!existSource(sourceID))
- {
- return (E_NON_EXISTENT);
- }
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- am_ClassProperty_s propertyTemp;
- std::string command = "SELECT sourceClassID FROM " + std::string(SOURCE_TABLE) + " WHERE sourceID=" + (i2s(sourceID));
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- classInfo.sourceClassID = sqlite3_column_int(query, 0);
- }
-
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::getSourceClassInfoDB SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- command = "SELECT name FROM " + std::string(SOURCE_CLASS_TABLE) + " WHERE sourceClassID=" + (i2s(classInfo.sourceClassID));
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- classInfo.name = std::string((const char*) sqlite3_column_text(query, 0));
- }
-
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::getSourceClassInfoDB SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- //read out Properties
- command = "SELECT classProperty, value FROM SourceClassProperties" + i2s(classInfo.sourceClassID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- propertyTemp.classProperty = (am_CustomClassProperty_t) sqlite3_column_int(query, 0);
- propertyTemp.value = sqlite3_column_int(query, 1);
- classInfo.listClassProperties.push_back(propertyTemp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getSourceClassInfoDB SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s & sinkData) const
-{
-
- assert(sinkID!=0);
-
- if (!existSink(sinkID))
- {
- return (E_NON_EXISTENT);
- }
-
- sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qMAinSoundProperty = NULL, *qMainNotification = NULL, *qNotification = NULL;
- int eCode = 0;
- am_CustomConnectionFormat_t tempConnectionFormat;
- am_SoundProperty_s tempSoundProperty;
- am_MainSoundProperty_s tempMainSoundProperty;
- am_NotificationConfiguration_s tempNotificationConfiguration,tempMainNotification;
- std::string command = "SELECT name, domainID, sinkClassID, volume, visible, availability, availabilityReason, muteState, mainVolume, sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 and sinkID=" + i2s(sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- sinkData.name = std::string((const char*) sqlite3_column_text(query, 0));
- sinkData.domainID = sqlite3_column_int(query, 1);
- sinkData.sinkClassID = sqlite3_column_int(query, 2);
- sinkData.volume = sqlite3_column_int(query, 3);
- sinkData.visible = sqlite3_column_int(query, 4);
- sinkData.available.availability = (am_Availability_e) sqlite3_column_int(query, 5);
- sinkData.available.availabilityReason = (am_CustomAvailabilityReason_t) sqlite3_column_int(query, 6);
- sinkData.muteState = (am_MuteState_e) sqlite3_column_int(query, 7);
- sinkData.mainVolume = sqlite3_column_int(query, 8);
- sinkData.sinkID = sqlite3_column_int(query, 9);
-
- //read out the connectionFormats
- std::string commandConnectionFormat = "SELECT soundFormat FROM SinkConnectionFormat" + i2s(sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL)
- while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
- {
- tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qConnectionFormat, 0);
- sinkData.listConnectionFormats.push_back(tempConnectionFormat);
- }
-
- MY_SQLITE_FINALIZE(qConnectionFormat)
-
- //read out sound properties
- std::string commandSoundProperty = "SELECT soundPropertyType, value FROM SinkSoundProperty" + i2s(sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandSoundProperty.c_str(), -1, &qSoundProperty, NULL)
- while ((eCode = sqlite3_step(qSoundProperty)) == SQLITE_ROW)
- {
- tempSoundProperty.type = (am_CustomSoundPropertyType_t) sqlite3_column_int(qSoundProperty, 0);
- tempSoundProperty.value = sqlite3_column_int(qSoundProperty, 1);
- sinkData.listSoundProperties.push_back(tempSoundProperty);
- }
-
- MY_SQLITE_FINALIZE(qSoundProperty)
-
- std::string notificationCommand = "SELECT type, status, parameter FROM SinkNotificationConfiguration" + i2s(sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, notificationCommand.c_str(), -1, &qNotification, NULL)
-
- while ((eCode = sqlite3_step(qNotification)) == SQLITE_ROW)
- {
- tempNotificationConfiguration.type = static_cast<am_CustomNotificationType_t>(sqlite3_column_int(qNotification, 0));
- tempNotificationConfiguration.status = static_cast<am_NotificationStatus_e>(sqlite3_column_int(qNotification, 1));
- tempNotificationConfiguration.parameter= static_cast<int16_t>(sqlite3_column_int(qNotification, 2));
- sinkData.listNotificationConfigurations.push_back(tempNotificationConfiguration);
- }
- MY_SQLITE_FINALIZE(qNotification)
-
- if (sinkData.visible)
- {
-
- //read out MainSoundProperties
- std::string commandMainSoundProperty = "SELECT soundPropertyType, value FROM SinkMainSoundProperty" + i2s(sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandMainSoundProperty.c_str(), -1, &qMAinSoundProperty, NULL)
- while ((eCode = sqlite3_step(qMAinSoundProperty)) == SQLITE_ROW)
- {
- tempMainSoundProperty.type = (am_CustomMainSoundPropertyType_t) sqlite3_column_int(qMAinSoundProperty, 0);
- tempMainSoundProperty.value = sqlite3_column_int(qMAinSoundProperty, 1);
- sinkData.listMainSoundProperties.push_back(tempMainSoundProperty);
- }
-
- MY_SQLITE_FINALIZE(qMAinSoundProperty)
-
- std::string mainNotificationCommand = "SELECT type, status, parameter FROM SinkMainNotificationConfiguration" + i2s(sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, mainNotificationCommand.c_str(), -1, &qMainNotification, NULL)
-
- while ((eCode = sqlite3_step(qMainNotification)) == SQLITE_ROW)
- {
- tempMainNotification.type = static_cast<am_CustomNotificationType_t>(sqlite3_column_int(qMainNotification, 0));
- tempMainNotification.status = static_cast<am_NotificationStatus_e>(sqlite3_column_int(qMainNotification, 1));
- tempMainNotification.parameter= static_cast<int16_t>(sqlite3_column_int(qMainNotification, 2));
- sinkData.listMainNotificationConfigurations.push_back(tempMainNotification);
- }
- MY_SQLITE_FINALIZE(qMainNotification)
- }
- }
-
- else if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getSinkInfoDB SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s & sourceData) const
-{
- assert(sourceID!=0);
-
- if (!existSource(sourceID))
- {
- return (E_NON_EXISTENT);
- }
-
- sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qMAinSoundProperty = NULL, *qMainNotification = NULL, *qNotification = NULL;
- int eCode = 0;
- am_CustomConnectionFormat_t tempConnectionFormat;
- am_SoundProperty_s tempSoundProperty;
- am_MainSoundProperty_s tempMainSoundProperty;
- am_NotificationConfiguration_s tempNotificationConfiguration,tempMainNotification;
- std::string command = "SELECT name, domainID, sourceClassID, sourceState, volume, visible, availability, availabilityReason, interruptState, sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND sourceID=" + i2s(sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- sourceData.name = std::string((const char*) sqlite3_column_text(query, 0));
- sourceData.domainID = sqlite3_column_int(query, 1);
- sourceData.sourceClassID = sqlite3_column_int(query, 2);
- sourceData.sourceState = (am_SourceState_e) sqlite3_column_int(query, 3);
- sourceData.volume = sqlite3_column_int(query, 4);
- sourceData.visible = sqlite3_column_int(query, 5);
- sourceData.available.availability = (am_Availability_e) sqlite3_column_int(query, 6);
- sourceData.available.availabilityReason = (am_CustomAvailabilityReason_t) sqlite3_column_int(query, 7);
- sourceData.interruptState = (am_InterruptState_e) sqlite3_column_int(query, 8);
- sourceData.sourceID = sqlite3_column_int(query, 9);
-
- //read out the connectionFormats
- std::string commandConnectionFormat = "SELECT soundFormat FROM SourceConnectionFormat" + i2s(sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL)
- while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
- {
- tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qConnectionFormat, 0);
- sourceData.listConnectionFormats.push_back(tempConnectionFormat);
- }
-
- MY_SQLITE_FINALIZE(qConnectionFormat)
-
- //read out sound properties
- std::string commandSoundProperty = "SELECT soundPropertyType, value FROM SourceSoundProperty" + i2s(sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandSoundProperty.c_str(), -1, &qSoundProperty, NULL);
- while ((eCode = sqlite3_step(qSoundProperty)) == SQLITE_ROW)
- {
- tempSoundProperty.type = (am_CustomSoundPropertyType_t) sqlite3_column_int(qSoundProperty, 0);
- tempSoundProperty.value = sqlite3_column_int(qSoundProperty, 1);
- sourceData.listSoundProperties.push_back(tempSoundProperty);
- }
-
- MY_SQLITE_FINALIZE(qSoundProperty)
-
- std::string notificationCommand = "SELECT type, status, parameter FROM SourceNotificationConfiguration" + i2s(sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, notificationCommand.c_str(), -1, &qNotification, NULL)
-
- while ((eCode = sqlite3_step(qNotification)) == SQLITE_ROW)
- {
- tempNotificationConfiguration.type = static_cast<am_CustomNotificationType_t>(sqlite3_column_int(qNotification, 0));
- tempNotificationConfiguration.status = static_cast<am_NotificationStatus_e>(sqlite3_column_int(qNotification, 1));
- tempNotificationConfiguration.parameter= static_cast<int16_t>(sqlite3_column_int(qNotification, 2));
- sourceData.listNotificationConfigurations.push_back(tempNotificationConfiguration);
- }
- MY_SQLITE_FINALIZE(qNotification)
-
- if (sourceData.visible)
- {
-
- //read out MainSoundProperties
- std::string commandMainSoundProperty = "SELECT soundPropertyType, value FROM SourceMainSoundProperty" + i2s(sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandMainSoundProperty.c_str(), -1, &qMAinSoundProperty, NULL)
- while ((eCode = sqlite3_step(qMAinSoundProperty)) == SQLITE_ROW)
- {
- tempMainSoundProperty.type = (am_CustomMainSoundPropertyType_t) sqlite3_column_int(qMAinSoundProperty, 0);
- tempMainSoundProperty.value = sqlite3_column_int(qMAinSoundProperty, 1);
- sourceData.listMainSoundProperties.push_back(tempMainSoundProperty);
- }
-
- MY_SQLITE_FINALIZE(qMAinSoundProperty)
-
- std::string mainNotificationCommand = "SELECT type, status, parameter FROM SourceMainNotificationConfiguration" + i2s(sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, mainNotificationCommand.c_str(), -1, &qMainNotification, NULL)
-
- while ((eCode = sqlite3_step(qMainNotification)) == SQLITE_ROW)
- {
- tempMainNotification.type = static_cast<am_CustomNotificationType_t>(sqlite3_column_int(qMainNotification, 0));
- tempMainNotification.status = static_cast<am_NotificationStatus_e>(sqlite3_column_int(qMainNotification, 1));
- tempMainNotification.parameter= static_cast<int16_t>(sqlite3_column_int(qMainNotification, 2));
- sourceData.listMainNotificationConfigurations.push_back(tempMainNotification);
- }
- MY_SQLITE_FINALIZE(qMainNotification)
-
- }
- }
- else if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getSourceInfoDB SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e am::CAmDatabaseHandlerSQLite::getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s & mainConnectionData) const
-{
- assert(mainConnectionID!=0);
- if (!existMainConnection(mainConnectionID))
- {
- return (E_NON_EXISTENT);
- }
- sqlite3_stmt *query = NULL, *query1 = NULL;
- int eCode = 0;
- am_MainConnection_s temp;
- std::string command = "SELECT mainConnectionID, sourceID, sinkID, connectionState, delay FROM " + std::string(MAINCONNECTION_TABLE) + " WHERE mainConnectionID=" + i2s(mainConnectionID);
- std::string command1 = "SELECT connectionID FROM MainConnectionRoute";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- mainConnectionData.mainConnectionID = sqlite3_column_int(query, 0);
- mainConnectionData.sourceID = sqlite3_column_int(query, 1);
- mainConnectionData.sinkID = sqlite3_column_int(query, 2);
- mainConnectionData.connectionState = (am_ConnectionState_e) sqlite3_column_int(query, 3);
- mainConnectionData.delay = sqlite3_column_int(query, 4);
- std::string statement = command1 + i2s(mainConnectionID);
- MY_SQLITE_PREPARE_V2(mpDatabase, statement.c_str(), -1, &query1, NULL)
- while ((eCode = sqlite3_step(query1)) == SQLITE_ROW)
- {
- mainConnectionData.listConnectionID.push_back(sqlite3_column_int(query1, 0));
- }
- MY_SQLITE_FINALIZE(query1)
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getMainConnectionInfoDB SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::changeSinkClassInfoDB(const am_SinkClass_s& sinkClass)
-{
- assert(sinkClass.sinkClassID!=0);
- assert(!sinkClass.listClassProperties.empty());
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
-
- //check if the ID already exists
- if (!existSinkClass(sinkClass.sinkClassID))
- return (E_NON_EXISTENT);
-
- //fill ConnectionFormats
- std::string command = "UPDATE SinkClassProperties" + i2s(sinkClass.sinkClassID) + " set value=? WHERE classProperty=?;";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_ClassProperty_s>::const_iterator Iterator = sinkClass.listClassProperties.begin();
- for (; Iterator < sinkClass.listClassProperties.end(); ++Iterator)
- {
- MY_SQLITE_BIND_INT(query, 1, Iterator->value)
- MY_SQLITE_BIND_INT(query, 2, Iterator->classProperty)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::setSinkClassInfoDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR); if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeMainSourceNotificationConfigurationDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_FINALIZE(query)
- }
- MY_SQLITE_RESET(query)
- }
-
- MY_SQLITE_FINALIZE(query)
-
- logInfo("DatabaseHandler::setSinkClassInfoDB set setSinkClassInfo");
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::changeSourceClassInfoDB(const am_SourceClass_s& sourceClass)
-{
- assert(sourceClass.sourceClassID!=0);
- assert(!sourceClass.listClassProperties.empty());
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
-
- //check if the ID already exists
- if (!existSourceClass(sourceClass.sourceClassID))
- return (E_NON_EXISTENT);
-
- //fill ConnectionFormats
- std::string command = "UPDATE SourceClassProperties" + i2s(sourceClass.sourceClassID) + " set value=? WHERE classProperty=?;";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_ClassProperty_s>::const_iterator Iterator = sourceClass.listClassProperties.begin();
- for (; Iterator < sourceClass.listClassProperties.end(); ++Iterator)
- {
- MY_SQLITE_BIND_INT(query, 1, Iterator->value)
- MY_SQLITE_BIND_INT(query, 2, Iterator->classProperty)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::setSinkClassInfoDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
-
- MY_SQLITE_FINALIZE(query)
-
- logInfo("DatabaseHandler::setSinkClassInfoDB set setSinkClassInfo");
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s & sinkClass) const
-{
- assert(sinkID!=0);
-
- if (!existSink(sinkID))
- {
- return (E_NON_EXISTENT);
- }
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- am_ClassProperty_s propertyTemp;
- std::string command = "SELECT sinkClassID FROM " + std::string(SINK_TABLE) + " WHERE sinkID=" + (i2s(sinkID));
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- sinkClass.sinkClassID = sqlite3_column_int(query, 0);
- }
-
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::getSinkClassInfoDB SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- command = "SELECT name FROM " + std::string(SINK_CLASS_TABLE) + " WHERE sinkClassID=" + (i2s(sinkClass.sinkClassID));
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- sinkClass.name = std::string((const char*) sqlite3_column_text(query, 0));
- }
-
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::getSinkClassInfoDB SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- //read out Properties
- command = "SELECT classProperty, value FROM SinkClassProperties" + i2s(sinkClass.sinkClassID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- propertyTemp.classProperty = (am_CustomClassProperty_t) sqlite3_column_int(query, 0);
- propertyTemp.value = sqlite3_column_int(query, 1);
- sinkClass.listClassProperties.push_back(propertyTemp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getSinkClassInfoDB SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s & gatewayData) const
-{
- assert(gatewayID!=0);
- if (!existGateway(gatewayID))
- {
- return (E_NON_EXISTENT);
- }
- sqlite3_stmt* query = NULL, *qSinkConnectionFormat = NULL, *qSourceConnectionFormat = NULL;
- int eCode = 0;
- am_CustomConnectionFormat_t tempConnectionFormat;
- std::string command = "SELECT name, sinkID, sourceID, domainSinkID, domainSourceID, controlDomainID, gatewayID FROM " + std::string(GATEWAY_TABLE) + " WHERE gatewayID=" + i2s(gatewayID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- gatewayData.name = std::string((const char*) sqlite3_column_text(query, 0));
- gatewayData.sinkID = sqlite3_column_int(query, 1);
- gatewayData.sourceID = sqlite3_column_int(query, 2);
- gatewayData.domainSinkID = sqlite3_column_int(query, 3);
- gatewayData.domainSourceID = sqlite3_column_int(query, 4);
- gatewayData.controlDomainID = sqlite3_column_int(query, 5);
- gatewayData.gatewayID = sqlite3_column_int(query, 6);
-
- //convertionMatrix:
- ListConnectionFormat::const_iterator iter = mListConnectionFormat.begin();
- iter = mListConnectionFormat.find(gatewayData.gatewayID);
- if (iter == mListConnectionFormat.end())
- {
- logError("DatabaseHandler::getGatewayInfoDB database error with convertionFormat");
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- gatewayData.convertionMatrix = iter->second;
-
- //read out the connectionFormats
- std::string commandConnectionFormat = "SELECT soundFormat FROM GatewaySourceFormat" + i2s(gatewayData.gatewayID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qSourceConnectionFormat, NULL)
- while ((eCode = sqlite3_step(qSourceConnectionFormat)) == SQLITE_ROW)
- {
- tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qSourceConnectionFormat, 0);
- gatewayData.listSourceFormats.push_back(tempConnectionFormat);
- }
-
- MY_SQLITE_FINALIZE(qSourceConnectionFormat)
-
- //read out sound properties
- commandConnectionFormat = "SELECT soundFormat FROM GatewaySinkFormat" + i2s(gatewayData.gatewayID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qSinkConnectionFormat, NULL)
- while ((eCode = sqlite3_step(qSinkConnectionFormat)) == SQLITE_ROW)
- {
- tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qSinkConnectionFormat, 0);
- gatewayData.listSinkFormats.push_back(tempConnectionFormat);
- }
-
- MY_SQLITE_FINALIZE(qSinkConnectionFormat)
-
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getGatewayInfoDB SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getConverterInfoDB(const am_converterID_t converterID, am_Converter_s& converterData) const
-{
- assert(converterID!=0);
- if (!existConverter(converterID))
- {
- return (E_NON_EXISTENT);
- }
- sqlite3_stmt* query = NULL, *qSinkConnectionFormat = NULL, *qSourceConnectionFormat = NULL;
- int eCode = 0;
- am_CustomConnectionFormat_t tempConnectionFormat;
- std::string command = "SELECT name, sinkID, sourceID, domainID, converterID FROM " + std::string(CONVERTER_TABLE) + " WHERE converterID=" + i2s(converterID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- converterData.name = std::string((const char*) sqlite3_column_text(query, 0));
- converterData.sinkID = sqlite3_column_int(query, 1);
- converterData.sourceID = sqlite3_column_int(query, 2);
- converterData.domainID = sqlite3_column_int(query, 3);
- converterData.converterID = sqlite3_column_int(query, 4);
-
- //convertionMatrix:
- ListConnectionFormat::const_iterator iter = mListConnectionFormat.begin();
- iter = mListConnectionFormat.find(converterData.converterID);
- if (iter == mListConnectionFormat.end())
- {
- logError("DatabaseHandler::getConverterInfoDB database error with convertionFormat");
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- converterData.convertionMatrix = iter->second;
-
- //read out the connectionFormats
- std::string commandConnectionFormat = "SELECT soundFormat FROM ConverterSourceFormat" + i2s(converterData.converterID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qSourceConnectionFormat, NULL)
- while ((eCode = sqlite3_step(qSourceConnectionFormat)) == SQLITE_ROW)
- {
- tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qSourceConnectionFormat, 0);
- converterData.listSourceFormats.push_back(tempConnectionFormat);
- }
-
- MY_SQLITE_FINALIZE(qSourceConnectionFormat)
-
- //read out sound properties
- commandConnectionFormat = "SELECT soundFormat FROM ConverterSinkFormat" + i2s(converterData.converterID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qSinkConnectionFormat, NULL)
- while ((eCode = sqlite3_step(qSinkConnectionFormat)) == SQLITE_ROW)
- {
- tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qSinkConnectionFormat, 0);
- converterData.listSinkFormats.push_back(tempConnectionFormat);
- }
-
- MY_SQLITE_FINALIZE(qSinkConnectionFormat)
-
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getConverterInfoDB SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s & crossfaderData) const
-{
- assert(crossfaderID!=0);
- if (!existCrossFader(crossfaderID))
- {
- return (E_NON_EXISTENT);
- }
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command = "SELECT name, sinkID_A, sinkID_B, sourceID, hotSink,crossfaderID FROM " + std::string(CROSSFADER_TABLE) + " WHERE crossfaderID=" + i2s(crossfaderID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- crossfaderData.name = std::string((const char*) sqlite3_column_text(query, 0));
- crossfaderData.sinkID_A = sqlite3_column_int(query, 1);
- crossfaderData.sinkID_B = sqlite3_column_int(query, 2);
- crossfaderData.sourceID = sqlite3_column_int(query, 3);
- crossfaderData.hotSink = static_cast<am_HotSink_e>(sqlite3_column_int(query, 4));
- crossfaderData.crossfaderID = sqlite3_column_int(query, 5);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getCrossfaderInfoDB SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t> & listSinkID) const
-{
- assert(domainID!=0);
- listSinkID.clear();
- if (!existDomain(domainID))
- {
- return (E_NON_EXISTENT);
- }
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- am_sinkID_t temp;
- std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND domainID=" + (i2s(domainID));
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp = sqlite3_column_int(query, 0);
- listSinkID.push_back(temp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListSinksOfDomain SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t> & listSourceID) const
-{
- assert(domainID!=0);
- listSourceID.clear();
- if (!existDomain(domainID))
- {
- return (E_NON_EXISTENT);
- }
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- am_sourceID_t temp;
- std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND domainID=" + i2s(domainID);
-
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp = sqlite3_column_int(query, 0);
- listSourceID.push_back(temp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListSourcesOfDomain SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t> & listCrossfader) const
-{
- assert(domainID!=0);
- listCrossfader.clear();
- if (!existDomain(domainID))
- {
- return (E_NON_EXISTENT);
- }
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- am_crossfaderID_t temp;
-
- std::string command = "SELECT c.crossfaderID FROM " + std::string(CROSSFADER_TABLE) + " c," + std::string(SOURCE_TABLE) + " s WHERE c.sourceID=s.sourceID AND s.domainID=" + i2s(domainID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp = sqlite3_column_int(query, 0);
- listCrossfader.push_back(temp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListCrossfadersOfDomain SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t> & listGatewaysID) const
-{
- assert(domainID!=0);
- listGatewaysID.clear();
- if (!existDomain(domainID))
- {
- return (E_NON_EXISTENT);
- }
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- am_gatewayID_t temp;
-
- std::string command = "SELECT gatewayID FROM " + std::string(GATEWAY_TABLE) + " WHERE controlDomainID=" + i2s(domainID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp = sqlite3_column_int(query, 0);
- listGatewaysID.push_back(temp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListGatewaysOfDomain SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListConvertersOfDomain(const am_domainID_t domainID, std::vector<am_converterID_t>& listConvertersID) const
-{
- assert(domainID!=0);
- listConvertersID.clear();
- if (!existDomain(domainID))
- {
- return (E_NON_EXISTENT);
- }
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- am_gatewayID_t temp;
-
- std::string command = "SELECT converterID FROM " + std::string(CONVERTER_TABLE) + " WHERE domainID=" + i2s(domainID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp = sqlite3_column_int(query, 0);
- listConvertersID.push_back(temp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListConvertersOfDomain SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListMainConnections(std::vector<am_MainConnection_s> & listMainConnections) const
-{
- listMainConnections.clear();
- sqlite3_stmt *query = NULL, *query1 = NULL;
- int eCode = 0;
- am_MainConnection_s temp;
- std::string command = "SELECT mainConnectionID, sourceID, sinkID, connectionState, delay FROM " + std::string(MAINCONNECTION_TABLE);
- std::string command1 = "SELECT connectionID FROM MainConnectionRoute";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp.mainConnectionID = sqlite3_column_int(query, 0);
- temp.sourceID = sqlite3_column_int(query, 1);
- temp.sinkID = sqlite3_column_int(query, 2);
- temp.connectionState = (am_ConnectionState_e) sqlite3_column_int(query, 3);
- temp.delay = sqlite3_column_int(query, 4);
- std::string statement = command1 + i2s(temp.mainConnectionID);
- MY_SQLITE_PREPARE_V2(mpDatabase, statement.c_str(), -1, &query1, NULL)
- while ((eCode = sqlite3_step(query1)) == SQLITE_ROW)
- {
- temp.listConnectionID.push_back(sqlite3_column_int(query1, 0));
- }
- listMainConnections.push_back(temp);
- MY_SQLITE_FINALIZE(query1)
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListMainConnections SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListDomains(std::vector<am_Domain_s> & listDomains) const
-{
- listDomains.clear();
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- am_Domain_s temp;
- std::string command = "SELECT domainID, name, busname, nodename, early, complete, state FROM " + std::string(DOMAIN_TABLE) + " WHERE reserved=0";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp.domainID = sqlite3_column_int(query, 0);
- temp.name = std::string((const char*) sqlite3_column_text(query, 1));
- temp.busname = std::string((const char*) sqlite3_column_text(query, 2));
- temp.nodename = std::string((const char*) sqlite3_column_text(query, 3));
- temp.early = sqlite3_column_int(query, 4);
- temp.complete = sqlite3_column_int(query, 5);
- temp.state = (am_DomainState_e) sqlite3_column_int(query, 6);
- listDomains.push_back(temp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListDomains SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListConnections(std::vector<am_Connection_s> & listConnections) const
-{
- listConnections.clear();
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- am_Connection_s temp;
- std::string command = "SELECT connectionID, sourceID, sinkID, delay, connectionFormat FROM " + std::string(CONNECTION_TABLE) + " WHERE reserved=0";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp.connectionID = sqlite3_column_int(query, 0);
- temp.sourceID = sqlite3_column_int(query, 1);
- temp.sinkID = sqlite3_column_int(query, 2);
- temp.delay = sqlite3_column_int(query, 3);
- temp.connectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(query, 4);
- listConnections.push_back(temp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListConnections SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListSinks(std::vector<am_Sink_s> & listSinks) const
-{
- listSinks.clear();
- return enumerateSinks([&](const am_Sink_s & sink){ listSinks.push_back(sink);});
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListSources(std::vector<am_Source_s> & listSources) const
-{
- listSources.clear();
- return enumerateSources([&](const am_Source_s & source){ listSources.push_back(source);});
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListSourceClasses(std::vector<am_SourceClass_s> & listSourceClasses) const
-{
- listSourceClasses.clear();
-
- sqlite3_stmt* query = NULL, *subQuery = NULL;
- int eCode = 0, eCode1;
- am_SourceClass_s classTemp;
- am_ClassProperty_s propertyTemp;
-
- std::string command = "SELECT sourceClassID, name FROM " + std::string(SOURCE_CLASS_TABLE);
- std::string command2;
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- classTemp.sourceClassID = sqlite3_column_int(query, 0);
- classTemp.name = std::string((const char*) sqlite3_column_text(query, 1));
-
- //read out Properties
- command2 = "SELECT classProperty, value FROM SourceClassProperties" + i2s(classTemp.sourceClassID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command2.c_str(), -1, &subQuery, NULL)
-
- while ((eCode1 = sqlite3_step(subQuery)) == SQLITE_ROW)
- {
- propertyTemp.classProperty = (am_CustomClassProperty_t) sqlite3_column_int(subQuery, 0);
- propertyTemp.value = sqlite3_column_int(subQuery, 1);
- classTemp.listClassProperties.push_back(propertyTemp);
- }
-
- if (eCode1 != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListSourceClasses SQLITE error code:", eCode1);
- MY_SQLITE_FINALIZE(query)
- MY_SQLITE_FINALIZE(subQuery)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(subQuery)
-
- listSourceClasses.push_back(classTemp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListSourceClasses SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(subQuery)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListCrossfaders(std::vector<am_Crossfader_s> & listCrossfaders) const
-{
- listCrossfaders.clear();
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- am_Crossfader_s tempData;
- std::string command = "SELECT name, sinkID_A, sinkID_B, sourceID, hotSink,crossfaderID FROM " + std::string(CROSSFADER_TABLE);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- tempData.name = std::string((const char*) sqlite3_column_text(query, 0));
- tempData.sinkID_A = sqlite3_column_int(query, 1);
- tempData.sinkID_B = sqlite3_column_int(query, 2);
- tempData.sourceID = sqlite3_column_int(query, 3);
- tempData.hotSink = static_cast<am_HotSink_e>(sqlite3_column_int(query, 4));
- tempData.crossfaderID = sqlite3_column_int(query, 5);
- listCrossfaders.push_back(tempData);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListCrossfaders SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListGateways(std::vector<am_Gateway_s> & listGateways) const
-{
- listGateways.clear();
- return enumerateGateways([&](const am_Gateway_s & gateway){ listGateways.push_back(gateway);});
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListConverters(std::vector<am_Converter_s> & listConverters) const
-{
- listConverters.clear();
- return enumerateConverters([&](const am_Converter_s & converter){ listConverters.push_back(converter);});
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
-{
- listSinkClasses.clear();
-
- sqlite3_stmt* query = NULL, *subQuery = NULL;
- int eCode = 0;
- am_SinkClass_s classTemp;
- am_ClassProperty_s propertyTemp;
-
- std::string command = "SELECT sinkClassID, name FROM " + std::string(SINK_CLASS_TABLE);
- std::string command2;
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- classTemp.sinkClassID = sqlite3_column_int(query, 0);
- classTemp.name = std::string((const char*) sqlite3_column_text(query, 1));
-
- //read out Properties
- command2 = "SELECT classProperty, value FROM SinkClassProperties" + i2s(classTemp.sinkClassID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command2.c_str(), -1, &subQuery, NULL)
-
- while ((eCode = sqlite3_step(subQuery)) == SQLITE_ROW)
- {
- propertyTemp.classProperty = (am_CustomClassProperty_t) sqlite3_column_int(subQuery, 0);
- propertyTemp.value = sqlite3_column_int(subQuery, 1);
- classTemp.listClassProperties.push_back(propertyTemp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListSourceClasses SQLITE error code:", eCode);
-
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(subQuery)
-
- listSinkClasses.push_back(classTemp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListSourceClasses SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListVisibleMainConnections(std::vector<am_MainConnectionType_s> & listConnections) const
-{
- listConnections.clear();
- sqlite3_stmt *query = NULL;
- int eCode = 0;
- am_MainConnectionType_s temp;
-
- std::string command = "SELECT mainConnectionID, sourceID, sinkID, connectionState, delay FROM " + std::string(MAINCONNECTION_TABLE);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp.mainConnectionID = sqlite3_column_int(query, 0);
- temp.sourceID = sqlite3_column_int(query, 1);
- temp.sinkID = sqlite3_column_int(query, 2);
- temp.connectionState = (am_ConnectionState_e) sqlite3_column_int(query, 3);
- temp.delay = sqlite3_column_int(query, 4);
- listConnections.push_back(temp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListVisibleMainConnections SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListMainSinks(std::vector<am_SinkType_s> & listMainSinks) const
-{
- listMainSinks.clear();
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- am_SinkType_s temp;
-
- std::string command = "SELECT name, sinkID, availability, availabilityReason, muteState, mainVolume, sinkClassID FROM " + std::string(SINK_TABLE) + " WHERE visible=1 AND reserved=0";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp.name = std::string((const char*) sqlite3_column_text(query, 0));
- temp.sinkID = sqlite3_column_int(query, 1);
- temp.availability.availability = (am_Availability_e) sqlite3_column_int(query, 2);
- temp.availability.availabilityReason = (am_CustomAvailabilityReason_t) sqlite3_column_int(query, 3);
- temp.muteState = (am_MuteState_e) sqlite3_column_int(query, 4);
- temp.volume = sqlite3_column_int(query, 5);
- temp.sinkClassID = sqlite3_column_int(query, 6);
- listMainSinks.push_back(temp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListSinks SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListMainSources(std::vector<am_SourceType_s> & listMainSources) const
-{
- listMainSources.clear();
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- am_SourceType_s temp;
- std::string command = "SELECT name, sourceClassID, availability, availabilityReason, sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE visible=1 AND reserved=0";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp.name = std::string((const char*) sqlite3_column_text(query, 0));
- temp.sourceClassID = sqlite3_column_int(query, 1);
- temp.availability.availability = (am_Availability_e) sqlite3_column_int(query, 2);
- temp.availability.availabilityReason = (am_CustomAvailabilityReason_t) sqlite3_column_int(query, 3);
- temp.sourceID = sqlite3_column_int(query, 4);
-
- listMainSources.push_back(temp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListSources SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-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_DATABASE_ERROR); // todo: here we could change to non existen, but not shown in sequences
- listSoundProperties.clear();
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- am_MainSoundProperty_s temp;
- std::string command = "SELECT soundPropertyType, value FROM SinkMainSoundProperty" + i2s(sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp.type = (am_CustomMainSoundPropertyType_t) sqlite3_column_int(query, 0);
- temp.value = sqlite3_column_int(query, 1);
- listSoundProperties.push_back(temp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListMainSinkSoundProperties SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-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_DATABASE_ERROR); // todo: here we could change to non existen, but not shown in sequences
- listSourceProperties.clear();
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- am_MainSoundProperty_s temp;
- std::string command = "SELECT soundPropertyType, value FROM SourceMainSoundProperty" + i2s(sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp.type = (am_CustomMainSoundPropertyType_t) sqlite3_column_int(query, 0);
- temp.value = sqlite3_column_int(query, 1);
- listSourceProperties.push_back(temp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListMainSourceSoundProperties SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_SoundProperty_s>& listSoundproperties) const
-{
- assert(sinkID!=0);
- if (!existSink(sinkID))
- return (E_DATABASE_ERROR); // todo: here we could change to non existen, but not shown in sequences
- listSoundproperties.clear();
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- am_SoundProperty_s temp;
- std::string command = "SELECT soundPropertyType, value FROM SinkSoundProperty" + i2s(sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp.type = (am_CustomMainSoundPropertyType_t) sqlite3_column_int(query, 0);
- temp.value = sqlite3_column_int(query, 1);
- listSoundproperties.push_back(temp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListSinkSoundProperties SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_SoundProperty_s>& listSoundproperties) const
-{
- assert(sourceID!=0);
- if (!existSource(sourceID))
- return (E_DATABASE_ERROR); // todo: here we could change to non existen, but not shown in sequences
- listSoundproperties.clear();
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- am_SoundProperty_s temp;
- std::string command = "SELECT soundPropertyType, value FROM SourceSoundProperty" + i2s(sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp.type = (am_CustomMainSoundPropertyType_t) sqlite3_column_int(query, 0);
- temp.value = sqlite3_column_int(query, 1);
- listSoundproperties.push_back(temp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListSourceSoundProperties SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListSystemProperties(std::vector<am_SystemProperty_s> & listSystemProperties) const
-{
- listSystemProperties.clear();
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- am_SystemProperty_s temp;
- std::string command = "SELECT type, value FROM " + std::string(SYSTEM_TABLE);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp.type = (am_CustomSystemPropertyType_t) sqlite3_column_int(query, 0);
- temp.value = sqlite3_column_int(query, 1);
- listSystemProperties.push_back(temp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListSystemProperties SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e am::CAmDatabaseHandlerSQLite::getListSinkConnectionFormats(const am_sinkID_t sinkID, std::vector<am_CustomConnectionFormat_t> & listConnectionFormats) const
-{
- listConnectionFormats.clear();
- sqlite3_stmt *qConnectionFormat = NULL;
- int eCode = 0;
- am_CustomConnectionFormat_t tempConnectionFormat;
- std::string commandConnectionFormat = "SELECT soundFormat FROM SinkConnectionFormat" + i2s(sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL)
- while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
- {
- tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qConnectionFormat, 0);
- listConnectionFormats.push_back(tempConnectionFormat);
- }
-
- MY_SQLITE_FINALIZE(qConnectionFormat)
-
- return (E_OK);
-}
-
-am_Error_e am::CAmDatabaseHandlerSQLite::getListSourceConnectionFormats(const am_sourceID_t sourceID, std::vector<am_CustomConnectionFormat_t> & listConnectionFormats) const
-{
- listConnectionFormats.clear();
- sqlite3_stmt* qConnectionFormat = NULL;
- int eCode = 0;
- am_CustomConnectionFormat_t tempConnectionFormat;
-
- //read out the connectionFormats
- std::string commandConnectionFormat = "SELECT soundFormat FROM SourceConnectionFormat" + i2s(sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL)
- while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
- {
- tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qConnectionFormat, 0);
- listConnectionFormats.push_back(tempConnectionFormat);
- }
-
- MY_SQLITE_FINALIZE(qConnectionFormat)
-
- return (E_OK);
-}
-
-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);
- if (iter == mListConnectionFormat.end())
- {
- logError("DatabaseHandler::getListGatewayConnectionFormats database error with convertionFormat");
-
- return (E_DATABASE_ERROR);
- }
- listConnectionFormat = iter->second;
-
- return (E_OK);
-}
-
-am_Error_e am::CAmDatabaseHandlerSQLite::getListConverterConnectionFormats(const am_converterID_t converterID, std::vector<bool> & listConnectionFormat) const
-{
- ListConnectionFormat::const_iterator iter = mListConnectionFormat.begin();
- iter = mListConnectionFormat.find(converterID);
- if (iter == mListConnectionFormat.end())
- {
- logError("DatabaseHandler::getListConverterConnectionFormats database error with convertionFormat");
-
- return (E_DATABASE_ERROR);
- }
- listConnectionFormat = iter->second;
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t & delay) const
-{
- assert(mainConnectionID!=0);
- delay = -1;
- sqlite3_stmt *query = NULL;
- int eCode = 0;
-
- std::string command = "SELECT delay FROM " + std::string(MAINCONNECTION_TABLE) + " WHERE mainConnectionID=" + i2s(mainConnectionID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- delay = sqlite3_column_int(query, 0);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getTimingInformation SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- if (delay == -1)
- return (E_NOT_POSSIBLE);
-
- return (E_OK);
-}
-
-bool CAmDatabaseHandlerSQLite::sqQuery(const std::string& query)
-{
- sqlite3_stmt* statement;
- int eCode = 0;
- if ((eCode = sqlite3_exec(mpDatabase, query.c_str(), NULL, &statement, NULL)) != SQLITE_OK)
- {
- logError("DatabaseHandler::sqQuery SQL Query failed:", query.c_str(), "error code:", eCode);
- return (false);
- }
- return (true);
-}
-
-bool CAmDatabaseHandlerSQLite::openDatabase()
-{
- if (sqlite3_open_v2(mPath.c_str(), &mpDatabase, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX, NULL) == SQLITE_OK)
- {
- logInfo("DatabaseHandler::openDatabase opened database");
- return (true);
- }
- logError("DatabaseHandler::openDatabase failed to open database");
- return (false);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::changeDelayMainConnection(const am_timeSync_t & delay, const am_mainConnectionID_t & connectionID)
-{
- assert(connectionID!=0);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command = "SELECT mainConnectionID FROM " + std::string(MAINCONNECTION_TABLE) + " WHERE delay=? AND mainConnectionID=?";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, delay)
- MY_SQLITE_BIND_INT(query, 2, connectionID)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- MY_SQLITE_FINALIZE(query)
- return (E_OK);
- }
- command = "UPDATE " + std::string(MAINCONNECTION_TABLE) + " SET delay=? WHERE mainConnectionID=?;";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, delay)
- MY_SQLITE_BIND_INT(query, 2, connectionID)
-
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeDelayMainConnection SQLITE Step error code:", eCode);
-
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- if (mpDatabaseObserver)
- mpDatabaseObserver->timingInformationChanged(connectionID, delay);
-
- MY_SQLITE_FINALIZE(query)
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::enterConnectionDB(const am_Connection_s& connection, am_connectionID_t& connectionID)
-{
- assert(connection.connectionID==0);
- assert(connection.sinkID!=0);
- assert(connection.sourceID!=0);
- //connection format is not checked, because it's project specific
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command = "INSERT INTO " + std::string(CONNECTION_TABLE) + "(sinkID, sourceID, delay, connectionFormat, reserved) VALUES (?,?,?,?,?)";
-
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, connection.sinkID)
- MY_SQLITE_BIND_INT(query, 2, connection.sourceID)
- MY_SQLITE_BIND_INT(query, 3, connection.delay)
- MY_SQLITE_BIND_INT(query, 4, connection.connectionFormat)
- MY_SQLITE_BIND_INT(query, 5, true)
-
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterConnectionDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- connectionID = sqlite3_last_insert_rowid(mpDatabase);
-
- logInfo("DatabaseHandler::enterConnectionDB entered new connection sourceID=", connection.sourceID, "sinkID=", connection.sinkID, "sourceID=", connection.sourceID, "connectionFormat=", connection.connectionFormat, "assigned ID=", connectionID);
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::enterSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID)
-{
- assert(sinkClass.sinkClassID<DYNAMIC_ID_BOUNDARY);
- assert(!sinkClass.name.empty());
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- //if sinkID is zero and the first Static Sink was already entered, the ID is created
- if (sinkClass.sinkClassID == 0 && !mFirstStaticSinkClass)
- {
- command = "INSERT INTO " + std::string(SINK_CLASS_TABLE) + "(name) VALUES (?)";
- }
- else
- {
- //check if the ID already exists
- if (existSinkClass(sinkClass.sinkClassID))
- return (E_ALREADY_EXISTS);
- command = "INSERT INTO " + std::string(SINK_CLASS_TABLE) + "(name, sinkClassID) VALUES (?,?)";
- }
-
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_TEXT(query, 1, sinkClass.name.c_str(), sinkClass.name.size(), SQLITE_STATIC)
-
- //if the ID is not created, we add it to the query
- if (sinkClass.sinkClassID != 0)
- {
- MY_SQLITE_BIND_INT(query, 2, sinkClass.sinkClassID)
- }
-
- //if the first static sink is entered, we need to set it onto the boundary
- else if (mFirstStaticSinkClass)
- {
- MY_SQLITE_BIND_INT(query, 2, DYNAMIC_ID_BOUNDARY)
- mFirstStaticSinkClass = false;
- }
-
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterSinkClassDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- sinkClassID = sqlite3_last_insert_rowid(mpDatabase); //todo:change last_insert implementations for mulithread usage...
-
- //now we need to create the additional tables:
- command = "CREATE TABLE SinkClassProperties" + i2s(sinkClassID) + std::string("(classProperty INTEGER, value INTEGER)");
- if (!this->sqQuery(command))
- return (E_DATABASE_ERROR);
-
- //fill ConnectionFormats
- command = "INSERT INTO SinkClassProperties" + i2s(sinkClassID) + std::string("(classProperty,value) VALUES (?,?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_ClassProperty_s>::const_iterator Iterator = sinkClass.listClassProperties.begin();
- for (; Iterator < sinkClass.listClassProperties.end(); ++Iterator)
- {
- MY_SQLITE_BIND_INT(query, 1, Iterator->classProperty)
- MY_SQLITE_BIND_INT(query, 2, Iterator->value)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterSinkClassDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
-
- MY_SQLITE_FINALIZE(query)
-
- logInfo("DatabaseHandler::enterSinkClassDB entered new sinkClass");
- if (mpDatabaseObserver)
- mpDatabaseObserver->numberOfSinkClassesChanged();
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::enterSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass)
-{
- assert(sourceClass.sourceClassID<DYNAMIC_ID_BOUNDARY);
- assert(!sourceClass.name.empty());
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- //if sinkID is zero and the first Static Sink was already entered, the ID is created
- if (sourceClass.sourceClassID == 0 && !mFirstStaticSourceClass)
- {
- command = "INSERT INTO " + std::string(SOURCE_CLASS_TABLE) + "(name) VALUES (?)";
- }
- else
- {
- //check if the ID already exists
- if (existSourceClass(sourceClass.sourceClassID))
- return (E_ALREADY_EXISTS);
- command = "INSERT INTO " + std::string(SOURCE_CLASS_TABLE) + "(name, sourceClassID) VALUES (?,?)";
- }
-
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_TEXT(query, 1, sourceClass.name.c_str(), sourceClass.name.size(), SQLITE_STATIC)
-
- //if the ID is not created, we add it to the query
- if (sourceClass.sourceClassID != 0)
- {
- MY_SQLITE_BIND_INT(query, 2, sourceClass.sourceClassID)
- }
-
- //if the first static sink is entered, we need to set it onto the boundary
- else if (mFirstStaticSourceClass)
- {
- MY_SQLITE_BIND_INT(query, 2, DYNAMIC_ID_BOUNDARY)
- mFirstStaticSourceClass = false;
- }
-
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterSourceClassDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- sourceClassID = sqlite3_last_insert_rowid(mpDatabase); //todo:change last_insert implementations for mulithread usage...
-
- //now we need to create the additional tables:
- command = "CREATE TABLE SourceClassProperties" + i2s(sourceClassID) + std::string("(classProperty INTEGER, value INTEGER)");
- if (!this->sqQuery(command))
- return (E_DATABASE_ERROR);
-
- //fill ConnectionFormats
- command = "INSERT INTO SourceClassProperties" + i2s(sourceClassID) + std::string("(classProperty,value) VALUES (?,?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_ClassProperty_s>::const_iterator Iterator = sourceClass.listClassProperties.begin();
- for (; Iterator < sourceClass.listClassProperties.end(); ++Iterator)
- {
- MY_SQLITE_BIND_INT(query, 1, Iterator->classProperty)
- MY_SQLITE_BIND_INT(query, 2, Iterator->value)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterSourceClassDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
-
- MY_SQLITE_FINALIZE(query)
-
- logInfo("DatabaseHandler::enterSourceClassDB entered new sourceClass");
-
- if (mpDatabaseObserver)
- mpDatabaseObserver->numberOfSourceClassesChanged();
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::enterSystemProperties(const std::vector<am_SystemProperty_s> & listSystemProperties)
-{
- assert(!listSystemProperties.empty());
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::vector<am_SystemProperty_s>::const_iterator listIterator = listSystemProperties.begin();
- std::string command = "DELETE FROM " + std::string(SYSTEM_TABLE);
- if (!this->sqQuery(command))
- return (E_DATABASE_ERROR);
-
- command = "INSERT INTO " + std::string(SYSTEM_TABLE) + " (type, value) VALUES (?,?)";
-
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- for (; listIterator < listSystemProperties.end(); ++listIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, listIterator->type)
- MY_SQLITE_BIND_INT(query, 2, listIterator->value)
-
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterSystemProperties SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_RESET(query)
- }
-
- MY_SQLITE_FINALIZE(query)
-
- logInfo("DatabaseHandler::enterSystemProperties entered system properties");
- return (E_OK);
-}
-
-/**
- * checks for a certain mainConnection
- * @param mainConnectionID to be checked for
- * @return true if it exists
- */
-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);
- int eCode = 0;
- bool returnVal = true;
- MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
- if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- returnVal = false;
- else if (eCode != SQLITE_ROW)
- {
- returnVal = false;
- logError("DatabaseHandler::existMainConnection database error!:", eCode);
- }
-
- MY_SQLITE_FINALIZE_BOOL(query)
- return (returnVal);
-}
-
-/**
- * checks for a certain Source
- * @param sourceID to be checked for
- * @return true if it exists
- */
-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);
- int eCode = 0;
- bool returnVal = true;
- MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
- if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- returnVal = false;
- else if (eCode != SQLITE_ROW)
- {
- returnVal = false;
- logError("DatabaseHandler::existSource database error!:", eCode);
- }
- MY_SQLITE_FINALIZE_BOOL(query)
- return (returnVal);
-}
-
-/**
- * checks if a source name or ID exists
- * @param sourceID the sourceID
- * @param name the name
- * @return true if it exits
- */
-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=?)";
- int eCode = 0;
- bool returnVal = true;
- MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_bind_text(query, 1, name.c_str(), name.size(), SQLITE_STATIC)))
- {
- logError("CAmDatabaseHandler::sqlite3_bind_text failed with errorCode:", eCode);
- return (false);
- }
-
- if ((eCode = sqlite3_bind_int(query, 2, sourceID)))
- {
- logError("CAmDatabaseHandler::sqlite3_bind_int failed with errorCode:", eCode);
- return (false);
- }
-
- if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- returnVal = false;
- else if (eCode != SQLITE_ROW)
- {
- returnVal = false;
- logError("DatabaseHandler::existSource database error!:", eCode);
- }
- MY_SQLITE_FINALIZE_BOOL(query)
- return (returnVal);
-}
-
-/**
- * checks if a name exits
- * @param name the name
- * @return true if it exits
- */
-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=?";
- int eCode = 0;
- bool returnVal = true;
- MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_bind_text(query, 1, name.c_str(), name.size(), SQLITE_STATIC)))
- {
- logError("CAmDatabaseHandler::sqlite3_bind_text failed with errorCode:", eCode);
- return (false);
- }
-
- if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- returnVal = false;
- else if (eCode != SQLITE_ROW)
- {
- returnVal = false;
- logError("DatabaseHandler::existSource database error!:", eCode);
- }
-
- MY_SQLITE_FINALIZE_BOOL(query)
- return (returnVal);
-}
-
-/**
- * checks for a certain Sink
- * @param sinkID to be checked for
- * @return true if it exists
- */
-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);
- int eCode = 0;
- bool returnVal = true;
- MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- returnVal = false;
- else if (eCode != SQLITE_ROW)
- {
- returnVal = false;
- logError("DatabaseHandler::existSink database error!:", eCode);
- }
- MY_SQLITE_FINALIZE_BOOL(query)
- return (returnVal);
-}
-
-/**
- * checks if a sink with the ID or the name exists
- * @param sinkID the ID
- * @param name the name
- * @return true if it exists.
- */
-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=?)";
- int eCode = 0;
- bool returnVal = true;
- MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_bind_text(query, 1, name.c_str(), name.size(), SQLITE_STATIC)))
- {
- logError("CAmDatabaseHandler::sqlite3_bind_text failed with errorCode:", eCode);
- return (false);
- }
-
- if ((eCode = sqlite3_bind_int(query, 2, sinkID)))
- {
- logError("CAmDatabaseHandler::sqlite3_bind_int failed with errorCode:", eCode);
- return (false);
- }
-
- if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- returnVal = false;
- else if (eCode != SQLITE_ROW)
- {
- returnVal = false;
- logError("DatabaseHandler::existSink database error!:", eCode);
- }
-
- MY_SQLITE_FINALIZE_BOOL(query)
- return (returnVal);
-}
-
-/**
- * checks if a sink with the name exists
- * @param name the name
- * @return true if it exists
- */
-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=?";
- int eCode = 0;
- bool returnVal = true;
- MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_bind_text(query, 1, name.c_str(), name.size(), SQLITE_STATIC)))
- {
- logError("CAmDatabaseHandler::sqlite3_bind_text failed with errorCode:", eCode);
- return (false);
- }
-
- if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- returnVal = false;
- else if (eCode != SQLITE_ROW)
- {
- returnVal = false;
- logError("DatabaseHandler::existSink database error!:", eCode);
- }
-
- MY_SQLITE_FINALIZE_BOOL(query)
- return (returnVal);
-}
-
-/**
- * checks for a certain domain
- * @param domainID to be checked for
- * @return true if it exists
- */
-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);
- int eCode = 0;
- bool returnVal = true;
- MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- returnVal = false;
- else if (eCode != SQLITE_ROW)
- {
- returnVal = false;
- logError("DatabaseHandler::existDomain database error!:", eCode);
- }
-
- MY_SQLITE_FINALIZE_BOOL(query)
- return (returnVal);
-}
-
-/**
- * checks for certain gateway
- * @param gatewayID to be checked for
- * @return true if it exists
- */
-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);
- int eCode = 0;
- bool returnVal = true;
- MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- returnVal = false;
- else if (eCode != SQLITE_ROW)
- {
- returnVal = false;
- logError("DatabaseHandler::existGateway database error!:", eCode);
- }
-
- MY_SQLITE_FINALIZE_BOOL(query)
- return (returnVal);
-}
-
-bool CAmDatabaseHandlerSQLite::existConverter(const am_converterID_t converterID) const
-{
- sqlite3_stmt* query = NULL;
- std::string command = "SELECT converterID FROM " + std::string(CONVERTER_TABLE) + " WHERE converterID=" + i2s(converterID);
- int eCode = 0;
- bool returnVal = true;
- MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- returnVal = false;
- else if (eCode != SQLITE_ROW)
- {
- returnVal = false;
- logError("DatabaseHandler::existConverter database error!:", eCode);
- }
-
- MY_SQLITE_FINALIZE_BOOL(query)
- return (returnVal);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getDomainOfSource(const am_sourceID_t sourceID, am_domainID_t & domainID) const
-{
- assert(sourceID!=0);
-
- sqlite3_stmt* query = NULL;
- std::string command = "SELECT domainID FROM " + std::string(SOURCE_TABLE) + " WHERE sourceID=" + i2s(sourceID);
- int eCode = 0;
- am_Error_e returnVal = E_DATABASE_ERROR;
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- domainID = sqlite3_column_int(query, 0);
- returnVal = E_OK;
- }
- else
- {
- logError("DatabaseHandler::getDomainOfSource database error!:", eCode);
- }
-
- MY_SQLITE_FINALIZE(query)
- return (returnVal);
-}
-
-am_Error_e am::CAmDatabaseHandlerSQLite::getDomainOfSink(const am_sinkID_t sinkID, am_domainID_t & domainID) const
-{
- assert(sinkID!=0);
-
- sqlite3_stmt* query = NULL;
- std::string command = "SELECT domainID FROM " + std::string(SINK_TABLE) + " WHERE sinkID=" + i2s(sinkID);
- int eCode = 0;
- am_Error_e returnVal = E_DATABASE_ERROR;
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- domainID = sqlite3_column_int(query, 0);
- returnVal = E_OK;
- }
- else
- {
- logError("DatabaseHandler::getDomainOfSink database error!:", eCode);
- }
-
- MY_SQLITE_FINALIZE(query)
- return (returnVal);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getDomainOfCrossfader(const am_crossfaderID_t crossfader, am_domainID_t& domainID) const
-{
- assert(crossfader!=0);
-
- am_sourceID_t sourceID = 0;
- sqlite3_stmt* query = NULL;
- std::string command = "SELECT sourceID FROM " + std::string(CROSSFADER_TABLE) + " WHERE crossfaderID=" + i2s(crossfader);
- int eCode = 0;
- am_Error_e returnVal = E_DATABASE_ERROR;
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- sourceID = sqlite3_column_int(query, 0);
- MY_SQLITE_FINALIZE(query);
-
- sqlite3_stmt* querySrc = NULL;
- command = "SELECT domainID FROM " + std::string(SOURCE_TABLE) + " WHERE sourceID=" + i2s(sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &querySrc, NULL)
- if ((eCode = sqlite3_step(querySrc)) == SQLITE_ROW)
- {
- domainID = sqlite3_column_int(query, 0);
- returnVal = E_OK;
- }
- else
- {
- logError("DatabaseHandler::getDomainOfCrossfader database error!:", eCode);
- }
- MY_SQLITE_FINALIZE(querySrc)
- }
- else
- {
- logError("DatabaseHandler::getDomainOfCrossfader database error!:", eCode);
- }
- MY_SQLITE_FINALIZE(query)
- return (returnVal);
-}
-
-/**
- * checks for certain SinkClass
- * @param sinkClassID
- * @return true if it exists
- */
-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);
- int eCode = 0;
- bool returnVal = true;
- MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
- if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- returnVal = false;
- else if (eCode != SQLITE_ROW)
- {
- returnVal = false;
- logError("DatabaseHandler::existSinkClass database error!:", eCode);
- }
-
- MY_SQLITE_FINALIZE_BOOL(query)
- return (returnVal);
-}
-
-/**
- * checks for certain sourceClass
- * @param sourceClassID
- * @return true if it exists
- */
-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);
- int eCode = 0;
- bool returnVal = true;
- MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- returnVal = false;
- else if (eCode != SQLITE_ROW)
- {
- returnVal = false;
- logError("DatabaseHandler::existSinkClass database error!:", eCode);
- }
-
- MY_SQLITE_FINALIZE_BOOL(query)
- return (returnVal);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::changeConnectionTimingInformation(const am_connectionID_t connectionID, const am_timeSync_t delay)
-{
- assert(connectionID!=0);
-
- sqlite3_stmt *query = NULL, *queryMainConnectionSubIDs = NULL;
- int eCode = 0, eCode1 = 0;
- std::string command = "UPDATE " + std::string(CONNECTION_TABLE) + " set delay=? WHERE connectionID=?";
-
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, delay)
- MY_SQLITE_BIND_INT(query, 2, connectionID)
-
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeConnectionTimingInformation SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- //now we need to find all mainConnections that use the changed connection and update their timing
-
- int tempMainConnectionID;
- //first get all route tables for all mainconnections
- command = "SELECT name FROM sqlite_master WHERE type ='table' and name LIKE 'MainConnectionRoute%'";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- //now check if the connection ID is in this table
- std::string tablename = std::string((const char*) sqlite3_column_text(query, 0));
- std::string command2 = "SELECT connectionID FROM " + tablename + " WHERE connectionID=" + i2s(connectionID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command2.c_str(), -1, &queryMainConnectionSubIDs, NULL)
- if ((eCode1 = sqlite3_step(queryMainConnectionSubIDs)) == SQLITE_ROW)
- {
- //if the connection ID is in, recalculate the mainconnection delay
- std::stringstream(tablename.substr(tablename.find_first_not_of("MainConnectionRoute"))) >> tempMainConnectionID;
- changeDelayMainConnection(calculateMainConnectionDelay(tempMainConnectionID), tempMainConnectionID);
- }
- else if (eCode1 != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeConnectionTimingInformation SQLITE error code:", eCode1);
-
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_FINALIZE(queryMainConnectionSubIDs)
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeConnectionTimingInformation SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::changeConnectionFinal(const am_connectionID_t connectionID)
-{
- assert(connectionID!=0);
-
- sqlite3_stmt *query = NULL;
- int eCode = 0;
- std::string command = "UPDATE " + std::string(CONNECTION_TABLE) + " set reserved=0 WHERE connectionID=?";
-
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, connectionID)
-
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeConnectionFinal SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
- return (E_OK);
-}
-
-am_timeSync_t CAmDatabaseHandlerSQLite::calculateMainConnectionDelay(const am_mainConnectionID_t mainConnectionID) const
-{
- assert(mainConnectionID!=0);
- sqlite3_stmt* query = NULL;
- std::string command = "SELECT sum(Connections.delay),min(Connections.delay) FROM " + std::string(CONNECTION_TABLE) + ",MainConnectionRoute" + i2s(mainConnectionID) + " WHERE MainConnectionRoute" + i2s(mainConnectionID) + ".connectionID = Connections.connectionID";
- int eCode = 0;
- am_timeSync_t delay = 0;
- am_timeSync_t min = 0;
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- delay = sqlite3_column_int(query, 0);
- min = sqlite3_column_int(query, 1);
- }
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::calculateMainConnectionDelay SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
- {
- logError("DatabaseHandler::calculateMainConnectionDelay SQLITE Finalize error code:", eCode);
- return (E_DATABASE_ERROR);
- }
- if (min < 0)
- delay = -1;
- return (delay);
-
-}
-
-/**
- * registers the Observer at the Database
- * @param iObserver pointer to the observer
- */
-void CAmDatabaseHandlerSQLite::registerObserver(CAmDatabaseObserver *iObserver)
-{
- assert(iObserver!=NULL);
- mpDatabaseObserver = iObserver;
-}
-
-/**
- * gives information about the visibility of a source
- * @param sourceID the sourceID
- * @return true if source is visible
- */
-bool CAmDatabaseHandlerSQLite::sourceVisible(const am_sourceID_t sourceID) const
-{
- assert(sourceID!=0);
- sqlite3_stmt* query = NULL;
- std::string command = "SELECT visible FROM " + std::string(SOURCE_TABLE) + " WHERE sourceID=" + i2s(sourceID);
- int eCode = 0;
- bool returnVal = false;
- MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- returnVal = (bool) sqlite3_column_int(query, 0);
- }
- else if (eCode != SQLITE_DONE)
- {
- returnVal = false;
- logError("DatabaseHandler::sourceVisible database error!:", eCode);
- }
-
- MY_SQLITE_FINALIZE_BOOL(query)
- return (returnVal);
-}
-
-/**
- * gives information about the visibility of a sink
- * @param sinkID the sinkID
- * @return true if source is visible
- */
-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);
- int eCode = 0;
- bool returnVal = false;
- MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- returnVal = sqlite3_column_int(query, 0);
- }
- else if (eCode != SQLITE_DONE)
- {
- returnVal = false;
- logError("DatabaseHandler::sinkVisible database error!:", eCode);
- }
-
- MY_SQLITE_FINALIZE_BOOL(query)
- return (returnVal);
-}
-
-/**
- * checks if a connection already exists.
- * Only takes sink, source and format information for search!
- * @param connection the connection to be checked
- * @return true if connections exists
- */
-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";
- int eCode = 0;
- bool returnVal = true;
- MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_bind_int(query, 1, connection.sinkID)))
- {
- logError("CAmDatabaseHandler::sqlite3_bind_int failed with errorCode:", eCode);
- return (false);
- }
-
- if ((eCode = sqlite3_bind_int(query, 2, connection.sourceID)))
- {
- logError("CAmDatabaseHandler::sqlite3_bind_int failed with errorCode:", eCode);
- return (false);
- }
-
- if ((eCode = sqlite3_bind_int(query, 3, connection.connectionFormat)))
- {
- logError("CAmDatabaseHandler::sqlite3_bind_int failed with errorCode:", eCode);
- return (false);
- }
-
- if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- returnVal = false;
- else if (eCode != SQLITE_ROW)
- {
- returnVal = false;
- logError("DatabaseHandler::existMainConnection database error!:", eCode);
- }
-
- MY_SQLITE_FINALIZE_BOOL(query)
- return (returnVal);
-}
-
-/**
- * checks if a connection with the given ID exists
- * @param connectionID
- * @return true if connection exits
- */
-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";
- int eCode = 0;
- bool returnVal = true;
- MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_bind_int(query, 1, connectionID)))
- {
- logError("CAmDatabaseHandler::sqlite3_bind_int failed with errorCode:", eCode);
- return (false);
- }
-
- if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- returnVal = false;
- else if (eCode != SQLITE_ROW)
- {
- returnVal = false;
- logError("DatabaseHandler::existMainConnection database error!:", eCode);
- }
-
- MY_SQLITE_FINALIZE_BOOL(query)
- return (returnVal);
-}
-
-/**
- * checks if a CrossFader exists
- * @param crossfaderID the ID of the crossfader to be checked
- * @return true if exists
- */
-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=?";
- int eCode = 0;
- bool returnVal = true;
- MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_bind_int(query, 1, crossfaderID)))
- {
- logError("CAmDatabaseHandler::sqlite3_bind_int failed with errorCode:", eCode);
- return (false);
- }
-
- if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- returnVal = false;
- else if (eCode != SQLITE_ROW)
- {
- returnVal = false;
- logError("DatabaseHandler::existMainConnection database error!:", eCode);
- }
-
- MY_SQLITE_FINALIZE_BOOL(query)
- return (returnVal);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getSoureState(const am_sourceID_t sourceID, am_SourceState_e & sourceState) const
-{
- assert(sourceID!=0);
- sqlite3_stmt* query = NULL;
- sourceState = SS_UNKNNOWN;
- std::string command = "SELECT sourceState FROM " + std::string(SOURCE_TABLE) + " WHERE sourceID=" + i2s(sourceID);
- int eCode = 0;
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- sourceState = (am_SourceState_e) sqlite3_column_int(query, 0);
- }
- else if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- {
- logError("DatabaseHandler::getSoureState database error!:", eCode);
- }
- MY_SQLITE_FINALIZE(query)
- return (E_OK);
-}
-
-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);
- sqlite3_stmt* query = NULL;
- std::string command = "UPDATE " + std::string(SOURCE_TABLE) + " SET sourceState=? WHERE sourceID=" + i2s(sourceID);
- int eCode = 0;
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, sourceState)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeSourceState SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getSinkMainVolume(const am_sinkID_t sinkID, am_mainVolume_t& mainVolume) const {
- assert(sinkID!=0);
- sqlite3_stmt* query = NULL;
- mainVolume = -1;
- std::string command = "SELECT mainVolume FROM " + std::string(SINK_TABLE) + " WHERE sinkID=" + i2s(sinkID);
- int eCode = 0;
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- mainVolume = sqlite3_column_int(query, 0);
- }
- else if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- {
- logError("DatabaseHandler::getSinkVolume database error!:", eCode);
- }
- MY_SQLITE_FINALIZE(query)
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getSinkVolume(const am_sinkID_t sinkID, am_volume_t & volume) const
-{
- assert(sinkID!=0);
- sqlite3_stmt* query = NULL;
- volume = -1;
- std::string command = "SELECT volume FROM " + std::string(SINK_TABLE) + " WHERE sinkID=" + i2s(sinkID);
- int eCode = 0;
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- volume = sqlite3_column_int(query, 0);
- }
- else if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- {
- logError("DatabaseHandler::getSinkVolume database error!:", eCode);
- }
- MY_SQLITE_FINALIZE(query)
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getSourceVolume(const am_sourceID_t sourceID, am_volume_t & volume) const
-{
- assert(sourceID!=0);
- sqlite3_stmt* query = NULL;
- volume = -1;
- std::string command = "SELECT volume FROM " + std::string(SOURCE_TABLE) + " WHERE sourceID=" + i2s(sourceID);
- int eCode = 0;
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- volume = sqlite3_column_int(query, 0);
- }
- else if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- {
- logError("DatabaseHandler::getSourceVolume database error!:", eCode);
- }
- MY_SQLITE_FINALIZE(query)
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getMainSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomMainSoundPropertyType_t propertyType, int16_t& value) const
-{
- assert(sinkID!=0);
- if (!existSink(sinkID))
- return (E_DATABASE_ERROR); // todo: here we could change to non existent, but not shown in sequences
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command = "SELECT value FROM SinkMainSoundProperty" + i2s(sinkID) + " WHERE soundPropertyType=" + i2s(propertyType);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- value = sqlite3_column_int(query, 0);
- }
- else
- {
- logError("DatabaseHandler::getDomainState database error!:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getMainSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomMainSoundPropertyType_t propertyType, int16_t& value) const
-{
- assert(sourceID!=0);
- if (!existSource(sourceID))
- return (E_DATABASE_ERROR); // todo: here we could change to non existent, but not shown in sequences
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command = "SELECT value FROM SourceMainSoundProperty" + i2s(sourceID) + " WHERE soundPropertyType=" + i2s(propertyType);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- value = sqlite3_column_int(query, 0);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getSinkSoundPropertyValue SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomSoundPropertyType_t propertyType, int16_t & value) const
-{
- assert(sinkID!=0);
- if (!existSink(sinkID))
- return (E_DATABASE_ERROR); // todo: here we could change to non existent, but not shown in sequences
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command = "SELECT value FROM SinkSoundProperty" + i2s(sinkID) + " WHERE soundPropertyType=" + i2s(propertyType);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- value = sqlite3_column_int(query, 0);
- }
- else
- {
- logError("DatabaseHandler::getDomainState database error!:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomSoundPropertyType_t propertyType, int16_t & value) const
-{
- assert(sourceID!=0);
- if (!existSource(sourceID))
- return (E_DATABASE_ERROR); // todo: here we could change to non existent, but not shown in sequences
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command = "SELECT value FROM SourceSoundProperty" + i2s(sourceID) + " WHERE soundPropertyType=" + i2s(propertyType);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- value = sqlite3_column_int(query, 0);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getSinkSoundPropertyValue SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getDomainState(const am_domainID_t domainID, am_DomainState_e& state) const
-{
- assert(domainID!=0);
- sqlite3_stmt* query = NULL;
- state = DS_UNKNOWN;
- std::string command = "SELECT domainState FROM " + std::string(DOMAIN_TABLE) + " WHERE domainID=" + i2s(domainID);
- int eCode = 0;
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- state = (am_DomainState_e) sqlite3_column_int(query, 0);
- }
- else if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- {
- logError("DatabaseHandler::getDomainState database error!:", eCode);
- }
- MY_SQLITE_FINALIZE(query)
- return (E_OK);
-
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::peekDomain(const std::string & name, am_domainID_t & domainID)
-{
- domainID=0;
- sqlite3_stmt* query = NULL, *queryInsert = NULL;
- std::string command = "SELECT domainID FROM " + std::string(DOMAIN_TABLE) + " WHERE name=?";
- int eCode = 0, eCode1 = 0;
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_TEXT(query, 1, name.c_str(), name.size(), SQLITE_STATIC)
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- domainID = sqlite3_column_int(query, 0);
- }
- else if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::peekDomain database error!:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- else
- {
- command = "INSERT INTO " + std::string(DOMAIN_TABLE) + " (name,reserved) VALUES (?,?)";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &queryInsert, NULL)
- MY_SQLITE_BIND_TEXT(queryInsert, 1, name.c_str(), name.size(), SQLITE_STATIC)
- MY_SQLITE_BIND_INT(queryInsert, 2, 1)
- //reservation flag
- if ((eCode1 = sqlite3_step(queryInsert)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::peekDomain SQLITE Step error code:", eCode1);
- MY_SQLITE_FINALIZE(queryInsert)
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(queryInsert)
-
- domainID = sqlite3_last_insert_rowid(mpDatabase);
- }
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-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=?";
- int eCode = 0, eCode1 = 0;
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_TEXT(query, 1, name.c_str(), name.size(), SQLITE_STATIC)
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- sinkID = sqlite3_column_int(query, 0);
- }
- else if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::peekSink database error!:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- else
- {
- if (mFirstStaticSink)
- {
- command = "INSERT INTO " + std::string(SINK_TABLE) + " (name,reserved,sinkID) VALUES (?,?," + i2s(DYNAMIC_ID_BOUNDARY) + ")";
- mFirstStaticSink = false;
- }
- else
- {
- command = "INSERT INTO " + std::string(SINK_TABLE) + " (name,reserved) VALUES (?,?)";
- }
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &queryInsert, NULL)
- MY_SQLITE_BIND_TEXT(queryInsert, 1, name.c_str(), name.size(), SQLITE_STATIC)
- MY_SQLITE_BIND_INT(queryInsert, 2, 1)
- //reservation flag
- if ((eCode1 = sqlite3_step(queryInsert)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::peekSink SQLITE Step error code:", eCode1);
- MY_SQLITE_FINALIZE(queryInsert)
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(queryInsert)
-
- sinkID = sqlite3_last_insert_rowid(mpDatabase);
- }
- MY_SQLITE_FINALIZE(query)
- return (E_OK);
-}
-
-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=?";
- int eCode = 0, eCode1 = 0;
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_TEXT(query, 1, name.c_str(), name.size(), SQLITE_STATIC)
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- sourceID = sqlite3_column_int(query, 0);
- }
- else if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::peekSink database error!:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- else
- {
- if (mFirstStaticSource)
- {
- command = "INSERT INTO " + std::string(SOURCE_TABLE) + " (name,reserved,sourceID) VALUES (?,?," + i2s(DYNAMIC_ID_BOUNDARY) + ")";
- mFirstStaticSource = false;
- }
- else
- {
- command = "INSERT INTO " + std::string(SOURCE_TABLE) + " (name,reserved) VALUES (?,?)";
- }
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &queryInsert, NULL)
- MY_SQLITE_BIND_TEXT(queryInsert, 1, name.c_str(), name.size(), SQLITE_STATIC)
- MY_SQLITE_BIND_INT(queryInsert, 2, 1)
- //reservation flag
- if ((eCode1 = sqlite3_step(queryInsert)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::peekSink SQLITE Step error code:", eCode1);
- MY_SQLITE_FINALIZE(queryInsert)
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(queryInsert)
- sourceID = sqlite3_last_insert_rowid(mpDatabase);
- }
-
- MY_SQLITE_FINALIZE(query)
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::changeSinkVolume(const am_sinkID_t sinkID, const am_volume_t volume)
-{
- assert(sinkID!=0);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- if (!existSink(sinkID))
- {
- return (E_NON_EXISTENT);
- }
- command = "UPDATE " + std::string(SINK_TABLE) + " SET volume=? WHERE sinkID=" + i2s(sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, volume)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeSinkVolume SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
- logInfo("DatabaseHandler::changeSinkVolume changed volume of sink:", sinkID, "to:", volume);
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::changeSourceVolume(const am_sourceID_t sourceID, const am_volume_t volume)
-{
- assert(sourceID!=0);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- if (!existSource(sourceID))
- {
- return (E_NON_EXISTENT);
- }
- command = "UPDATE " + std::string(SOURCE_TABLE) + " SET volume=? WHERE sourceID=" + i2s(sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, volume)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeSourceVolume SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
- logInfo("DatabaseHandler::changeSourceVolume changed volume of source=:", sourceID, "to:", volume);
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::changeSourceSoundPropertyDB(const am_SoundProperty_s & soundProperty, const am_sourceID_t sourceID)
-{
- assert(sourceID!=0);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- if (!existSource(sourceID))
- {
- return (E_NON_EXISTENT);
- }
- command = "UPDATE SourceSoundProperty" + i2s(sourceID) + " SET value=? WHERE soundPropertyType=" + i2s(soundProperty.type);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, soundProperty.value)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeSourceSoundPropertyDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
- logInfo("DatabaseHandler::changeSourceSoundPropertyDB changed SourceSoundProperty of source:", sourceID, "type:", soundProperty.type, "to:", soundProperty.value);
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::changeSinkSoundPropertyDB(const am_SoundProperty_s & soundProperty, const am_sinkID_t sinkID)
-{
- assert(sinkID!=0);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- if (!existSink(sinkID))
- {
- return (E_NON_EXISTENT);
- }
- command = "UPDATE SinkSoundProperty" + i2s(sinkID) + " SET value=? WHERE soundPropertyType=" + i2s(soundProperty.type);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, soundProperty.value)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeSinkSoundPropertyDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- assert(sinkID!=0);
-
- MY_SQLITE_FINALIZE(query)
- logInfo("DatabaseHandler::changeSinkSoundPropertyDB changed SinkSoundProperty of sink:", sinkID, "type:", soundProperty.type, "to:", soundProperty.value);
- return (E_OK);
-}
-
-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);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- if (!existCrossFader(crossfaderID))
- {
- return (E_NON_EXISTENT);
- }
- command = "UPDATE " + std::string(CROSSFADER_TABLE) + " SET hotsink=? WHERE crossfaderID=" + i2s(crossfaderID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, hotsink)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeCrossFaderHotSink SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_FINALIZE(query)
- logInfo("DatabaseHandler::changeCrossFaderHotSink changed hotsink of crossfader=", crossfaderID, "to:", hotsink);
- return (E_OK);
-}
-
-bool CAmDatabaseHandlerSQLite::isComponentConnected(const am_Gateway_s & gateway) const
-{
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
- bool returnVal = true;
- command = "SELECT 1 FROM " + std::string(CONNECTION_TABLE) + " c WHERE c.sinkID = ? OR c.sourceID = ?";
-
- MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, gateway.sinkID)
- MY_SQLITE_BIND_INT(query, 2, gateway.sourceID)
- if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- {
- returnVal = false;
- }
- else if (eCode != SQLITE_ROW)
- {
- returnVal = false;
- logError("DatabaseHandler::isComponentConnected database error!:", eCode);
- }
- MY_SQLITE_FINALIZE(query)
- return returnVal;
-}
-
-bool CAmDatabaseHandlerSQLite::isComponentConnected(const am_Converter_s & converter) const
-{
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
- bool returnVal = true;
- command = "SELECT 1 FROM " + std::string(CONNECTION_TABLE) + " c WHERE c.sinkID = ? OR c.sourceID = ?";
-
- MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, converter.sinkID)
- MY_SQLITE_BIND_INT(query, 2, converter.sourceID)
- if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
- {
- returnVal = false;
- }
- else if (eCode != SQLITE_ROW)
- {
- returnVal = false;
- logError("DatabaseHandler::isComponentConnected database error!:", eCode);
- }
- MY_SQLITE_FINALIZE(query)
-
- return returnVal;
-}
-
-am_Error_e am::CAmDatabaseHandlerSQLite::peekSinkClassID(const std::string & name, am_sinkClass_t & sinkClassID)
-{
- if (name.empty())
- return (E_NON_EXISTENT);
-
- am_Error_e returnVal = E_NON_EXISTENT;
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command = "SELECT sinkClassID FROM " + std::string(SINK_CLASS_TABLE) + " WHERE name=?";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_TEXT(query, 1, name.c_str(), name.size(), SQLITE_STATIC)
-
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- sinkClassID = sqlite3_column_int(query, 0);
- returnVal = E_OK;
- }
- else if (eCode != SQLITE_DONE)
- {
- sinkClassID = 0;
- logError("DatabaseHandler::peekSinkClassID SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- returnVal = E_DATABASE_ERROR;
- }
-
- MY_SQLITE_FINALIZE(query)
- return (returnVal);
-}
-
-am_Error_e am::CAmDatabaseHandlerSQLite::peekSourceClassID(const std::string & name, am_sourceClass_t & sourceClassID)
-{
- if (name.empty())
- return (E_NON_EXISTENT);
-
- am_Error_e returnVal = E_NON_EXISTENT;
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command = "SELECT sourceClassID FROM " + std::string(SOURCE_CLASS_TABLE) + " WHERE name=?";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_TEXT(query, 1, name.c_str(), name.size(), SQLITE_STATIC)
-
- if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- sourceClassID = sqlite3_column_int(query, 0);
- returnVal = E_OK;
- }
- else if (eCode != SQLITE_DONE)
- {
- sourceClassID = 0;
- logError("DatabaseHandler::peekSourceClassID SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- returnVal = E_DATABASE_ERROR;
- }
-
- MY_SQLITE_FINALIZE(query)
- return (returnVal);
-}
-
-
-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_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties)
-{
- assert(sourceID!=0);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
- am_sourceClass_t sourceClassOut(sourceClassID);
- std::vector<am_MainSoundProperty_s> listMainSoundPropertiesOut(listMainSoundProperties);
-
- if (!existSource(sourceID))
- {
- return (E_NON_EXISTENT);
- }
-
- //check if sinkClass needs to be changed
- if (sourceClassID!=0)
- {
- command = "UPDATE"+ std::string(SOURCE_TABLE)+ " SET sourceClassID=? WHERE sourceID=" + i2s(sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, sourceClassID)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeSource SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_FINALIZE(query);
- }
-
- else //we need to read out the active one
- {
- command = "SELECT sourceClassID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 and sourceID=" + i2s(sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- sourceClassOut = sqlite3_column_int(query, 0);
- }
- MY_SQLITE_FINALIZE(query)
- }
-
- //check if soundProperties need to be updated
- if (!listSoundProperties.empty())
- {
- //first we drop the table
- command = "DELETE from SourceSoundProperty" + i2s(sourceID);
- if (!sqQuery(command))
- return (E_DATABASE_ERROR);
-
- //then we'll have a new one
- //Fill SinkSoundProperties
- command = "INSERT INTO SourceSoundProperty" + i2s(sourceID) + std::string("(soundPropertyType,value) VALUES (?,?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_SoundProperty_s>::const_iterator SoundPropertyIterator = listSoundProperties.begin();
- for (; SoundPropertyIterator < listSoundProperties.end(); ++SoundPropertyIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, SoundPropertyIterator->type)
- MY_SQLITE_BIND_INT(query, 2, SoundPropertyIterator->value)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeSource SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
- MY_SQLITE_FINALIZE(query)
- }
-
- //check if we have to update the list of connectionformats
- if (!listConnectionFormats.empty())
- {
- //first clear the table
- command = "DELETE from SourceConnectionFormat" + i2s(sourceID);
- if (!sqQuery(command))
- return (E_DATABASE_ERROR);
-
- //fill ConnectionFormats
- command = "INSERT INTO SourceConnectionFormat" + i2s(sourceID) + std::string("(soundFormat) VALUES (?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_CustomConnectionFormat_t>::const_iterator connectionFormatIterator = listConnectionFormats.begin();
- for (; connectionFormatIterator < listConnectionFormats.end(); ++connectionFormatIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, *connectionFormatIterator)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeSink SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
- MY_SQLITE_FINALIZE(query)
- }
-
- //then we need to check if we need to update the listMainSoundProperties
- if (!listMainSoundProperties.empty() && sourceVisible(sourceID))
- {
- command = "DELETE from SourceMainSoundProperty" + i2s(sourceID);
- if (!sqQuery(command))
- return (E_DATABASE_ERROR);
-
- //Fill MainSinkSoundProperties
- command = "INSERT INTO SourceMainSoundProperty" + i2s(sourceID) + std::string("(soundPropertyType,value) VALUES (?,?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_MainSoundProperty_s>::const_iterator mainSoundPropertyIterator = listMainSoundProperties.begin();
- for (; mainSoundPropertyIterator < listMainSoundProperties.end(); ++mainSoundPropertyIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, mainSoundPropertyIterator->type)
- MY_SQLITE_BIND_INT(query, 2, mainSoundPropertyIterator->value)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeSink SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
- MY_SQLITE_FINALIZE(query)
- }
- else //read out the properties
- {
- getListMainSourceSoundProperties(sourceID,listMainSoundPropertiesOut);
- }
-
- logInfo("DatabaseHandler::changeSource changed changeSink of source:", sourceID);
-
- if (mpDatabaseObserver != NULL)
- {
- mpDatabaseObserver->sourceUpdated(sourceID,sourceClassOut,listMainSoundPropertiesOut,sourceVisible(sourceID));
- }
-
- return (E_OK);
-
-}
-
-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_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties)
-{
- assert(sinkID!=0);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
- am_sinkClass_t sinkClassOut(sinkClassID);
- std::vector<am_MainSoundProperty_s> listMainSoundPropertiesOut(listMainSoundProperties);
-
- if (!existSink(sinkID))
- {
- return (E_NON_EXISTENT);
- }
-
- //check if sinkClass needs to be changed
- if (sinkClassID!=0)
- {
- command = "UPDATE"+ std::string(SINK_TABLE)+ " SET sinkClassID=? WHERE sinkID=" + i2s(sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, sinkClassID)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeSink SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_FINALIZE(query);
- }
-
- else //we need to read out the active one
- {
- command = "SELECT sinkClassID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 and sinkID=" + i2s(sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- sinkClassOut = sqlite3_column_int(query, 0);
- }
- MY_SQLITE_FINALIZE(query)
- }
-
- //check if soundProperties need to be updated
- if (!listSoundProperties.empty())
- {
- //first we drop the table
- command = "DELETE from SinkSoundProperty" + i2s(sinkID);
- if (!sqQuery(command))
- return (E_DATABASE_ERROR);
-
- //then we'll have a new one
- //Fill SinkSoundProperties
- command = "INSERT INTO SinkSoundProperty" + i2s(sinkID) + std::string("(soundPropertyType,value) VALUES (?,?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_SoundProperty_s>::const_iterator SoundPropertyIterator = listSoundProperties.begin();
- for (; SoundPropertyIterator < listSoundProperties.end(); ++SoundPropertyIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, SoundPropertyIterator->type)
- MY_SQLITE_BIND_INT(query, 2, SoundPropertyIterator->value)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeSink SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
- MY_SQLITE_FINALIZE(query)
- }
-
- //check if we have to update the list of connectionformats
- if (!listConnectionFormats.empty())
- {
- //first clear the table
- command = "DELETE from SinkConnectionFormat" + i2s(sinkID);
- if (!sqQuery(command))
- return (E_DATABASE_ERROR);
-
- //fill ConnectionFormats
- command = "INSERT INTO SinkConnectionFormat" + i2s(sinkID) + std::string("(soundFormat) VALUES (?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_CustomConnectionFormat_t>::const_iterator connectionFormatIterator = listConnectionFormats.begin();
- for (; connectionFormatIterator < listConnectionFormats.end(); ++connectionFormatIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, *connectionFormatIterator)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeSink SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
- MY_SQLITE_FINALIZE(query)
- }
-
- //then we need to check if we need to update the listMainSoundProperties
- if (!listMainSoundProperties.empty() && sinkVisible(sinkID))
- {
- command = "DELETE from SinkMainSoundProperty" + i2s(sinkID);
- if (!sqQuery(command))
- return (E_DATABASE_ERROR);
-
- //Fill MainSinkSoundProperties
- command = "INSERT INTO SinkMainSoundProperty" + i2s(sinkID) + std::string("(soundPropertyType,value) VALUES (?,?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_MainSoundProperty_s>::const_iterator mainSoundPropertyIterator = listMainSoundProperties.begin();
- for (; mainSoundPropertyIterator < listMainSoundProperties.end(); ++mainSoundPropertyIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, mainSoundPropertyIterator->type)
- MY_SQLITE_BIND_INT(query, 2, mainSoundPropertyIterator->value)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeSink SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
- MY_SQLITE_FINALIZE(query)
- }
- else //read out the properties
- {
- getListMainSinkSoundProperties(sinkID,listMainSoundPropertiesOut);
- }
-
- logInfo("DatabaseHandler::changeSink changed changeSink of sink:", sinkID);
-
- if (mpDatabaseObserver != NULL)
- {
- mpDatabaseObserver->sinkUpdated(sinkID,sinkClassOut,listMainSoundPropertiesOut,sinkVisible(sinkID));
- }
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListMainSinkNotificationConfigurations(const am_sinkID_t sinkID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations)
-{
- assert(sinkID!=0);
- if (!existSink(sinkID))
- return (E_DATABASE_ERROR); // todo: here we could change to non existen, but not shown in sequences
- listMainNotificationConfigurations.clear();
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- am_NotificationConfiguration_s temp;
- std::string command = "SELECT type, status, parameter FROM SinkMainNotificationConfiguration" + i2s(sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp.type = static_cast<am_CustomNotificationType_t>(sqlite3_column_int(query, 0));
- temp.status = static_cast<am_NotificationStatus_e>(sqlite3_column_int(query, 1));
- temp.parameter= static_cast<int16_t>(sqlite3_column_int(query, 2));
- listMainNotificationConfigurations.push_back(temp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListSinkMainNotificationConfigurations SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::getListMainSourceNotificationConfigurations(const am_sourceID_t sourceID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations)
-{
- assert(sourceID!=0);
- if (!existSource(sourceID))
- return (E_DATABASE_ERROR); // todo: here we could change to non existen, but not shown in sequences
- listMainNotificationConfigurations.clear();
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- am_NotificationConfiguration_s temp;
- std::string command = "SELECT type, status, parameter FROM SourceMainNotificationConfiguration" + i2s(sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp.type = static_cast<am_CustomNotificationType_t>(sqlite3_column_int(query, 0));
- temp.status = static_cast<am_NotificationStatus_e>(sqlite3_column_int(query, 1));
- temp.parameter= static_cast<int16_t>(sqlite3_column_int(query, 2));
- listMainNotificationConfigurations.push_back(temp);
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListSourceMainNotificationConfigurations SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::changeMainSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s mainNotificationConfiguration)
-{
- assert(sinkID!=0);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- if (!existSink(sinkID))
- {
- return (E_NON_EXISTENT);
- }
- command = "UPDATE SinkMainNotificationConfiguration" + i2s(sinkID) + " SET status=?, parameter=? WHERE type=" + i2s(mainNotificationConfiguration.type);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, mainNotificationConfiguration.status)
- MY_SQLITE_BIND_INT(query, 2, mainNotificationConfiguration.parameter)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeMainSinkNotificationConfigurationDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_FINALIZE(query)
-
- logInfo("DatabaseHandler::changeMainSinkNotificationConfigurationDB changed MainNotificationConfiguration of source:", sinkID, "type:", mainNotificationConfiguration.type, "to status=", mainNotificationConfiguration.status, "and parameter=",mainNotificationConfiguration.parameter);
-
- if (mpDatabaseObserver)
- mpDatabaseObserver->sinkMainNotificationConfigurationChanged(sinkID, mainNotificationConfiguration);
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::changeMainSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s mainNotificationConfiguration)
-{
- assert(sourceID!=0);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- if (!existSource(sourceID))
- {
- return (E_NON_EXISTENT);
- }
- command = "UPDATE SourceMainNotificationConfiguration" + i2s(sourceID) + " SET status=?, parameter=? WHERE type=" + i2s(mainNotificationConfiguration.type);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, mainNotificationConfiguration.status)
- MY_SQLITE_BIND_INT(query, 2, mainNotificationConfiguration.parameter)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeMainSourceNotificationConfigurationDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_FINALIZE(query)
-
- logInfo("DatabaseHandler::changeMainSourceNotificationConfigurationDB changed MainNotificationConfiguration of source:", sourceID, "type:", mainNotificationConfiguration.type, "to status=", mainNotificationConfiguration.status, "and parameter=",mainNotificationConfiguration.parameter);
-
- if (mpDatabaseObserver)
- mpDatabaseObserver->sourceMainNotificationConfigurationChanged(sourceID, mainNotificationConfiguration);
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::changeGatewayDB(const am_gatewayID_t gatewayID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix)
-{
- assert(gatewayID!=0);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- if (!existGateway(gatewayID))
- {
- return (E_NON_EXISTENT);
- }
-
- if (!listSourceConnectionFormats.empty())
- {
- //clear Database
- command = "DELETE from GatewaySourceFormat" + i2s(gatewayID);
- if (!sqQuery(command))
- return (E_DATABASE_ERROR);
-
- //fill ConnectionFormats
- command = "INSERT INTO GatewaySourceFormat" + i2s(gatewayID) + std::string("(soundFormat) VALUES (?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_CustomConnectionFormat_t>::const_iterator connectionFormatIterator = listSourceConnectionFormats.begin();
- for (; connectionFormatIterator < listSourceConnectionFormats.end(); ++connectionFormatIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, *connectionFormatIterator)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterGatewayDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
- MY_SQLITE_FINALIZE(query)
- }
-
- if (!listSinkConnectionFormats.empty())
- {
- //clear Database
- command = "DELETE from GatewaySinkFormat" + i2s(gatewayID);
- if (!sqQuery(command))
- return (E_DATABASE_ERROR);
-
- command = "INSERT INTO GatewaySinkFormat" + i2s(gatewayID) + std::string("(soundFormat) VALUES (?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_CustomConnectionFormat_t>::const_iterator connectionFormatIterator = listSinkConnectionFormats.begin();
- for (; connectionFormatIterator < listSinkConnectionFormats.end(); ++connectionFormatIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, *connectionFormatIterator)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterGatewayDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
- MY_SQLITE_FINALIZE(query)
- }
-
- if (!convertionMatrix.empty())
- {
- mListConnectionFormat.clear();
- mListConnectionFormat.insert(std::make_pair(gatewayID, convertionMatrix));
- }
-
- logInfo("DatabaseHandler::changeGatewayDB changed Gateway with ID", gatewayID);
-
- //todo: check if observer needs to be adopted.
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::changeConverterDB(const am_converterID_t converterID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix)
-{
- assert(converterID!=0);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- if (!existConverter(converterID))
- {
- return (E_NON_EXISTENT);
- }
-
- if (!listSourceConnectionFormats.empty())
- {
- //clear Database
- command = "DELETE from ConverterSourceFormat" + i2s(converterID);
- if (!sqQuery(command))
- return (E_DATABASE_ERROR);
-
- //fill ConnectionFormats
- command = "INSERT INTO ConverterSourceFormat" + i2s(converterID) + std::string("(soundFormat) VALUES (?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_CustomConnectionFormat_t>::const_iterator connectionFormatIterator = listSourceConnectionFormats.begin();
- for (; connectionFormatIterator < listSourceConnectionFormats.end(); ++connectionFormatIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, *connectionFormatIterator)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterConverterDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
- MY_SQLITE_FINALIZE(query)
- }
-
- if (!listSinkConnectionFormats.empty())
- {
- //clear Database
- command = "DELETE from ConverterSinkFormat" + i2s(converterID);
- if (!sqQuery(command))
- return (E_DATABASE_ERROR);
-
- command = "INSERT INTO ConverterSinkFormat" + i2s(converterID) + std::string("(soundFormat) VALUES (?)");
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- std::vector<am_CustomConnectionFormat_t>::const_iterator connectionFormatIterator = listSinkConnectionFormats.begin();
- for (; connectionFormatIterator < listSinkConnectionFormats.end(); ++connectionFormatIterator)
- {
- MY_SQLITE_BIND_INT(query, 1, *connectionFormatIterator)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::enterConverterDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_RESET(query)
- }
- MY_SQLITE_FINALIZE(query)
- }
-
- if (!convertionMatrix.empty())
- {
- mListConnectionFormat.clear();
- mListConnectionFormat.insert(std::make_pair(converterID, convertionMatrix));
- }
-
- logInfo("DatabaseHandler::changeConverterDB changed Gateway with ID", converterID);
-
- //todo: check if observer needs to be adopted.
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::changeSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s notificationConfiguration)
-{
- assert(sinkID!=0);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- if (!existSink(sinkID))
- {
- return (E_NON_EXISTENT);
- }
- command = "UPDATE SinkNotificationConfiguration" + i2s(sinkID) + " SET status=?, parameter=? WHERE type=" + i2s(notificationConfiguration.type);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, notificationConfiguration.status)
- MY_SQLITE_BIND_INT(query, 2, notificationConfiguration.parameter)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeMainSinkNotificationConfigurationDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_FINALIZE(query)
-
- logInfo("DatabaseHandler::changeMainSinkNotificationConfigurationDB changed MainNotificationConfiguration of source:", sinkID, "type:", notificationConfiguration.type, "to status=", notificationConfiguration.status, "and parameter=",notificationConfiguration.parameter);
-
- //todo:: inform obsever here...
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::changeSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s notificationConfiguration)
-{
- assert(sourceID!=0);
-
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- std::string command;
-
- if (!existSource(sourceID))
- {
- return (E_NON_EXISTENT);
- }
- command = "UPDATE SourceNotificationConfiguration" + i2s(sourceID) + " SET status=?, parameter=? WHERE type=" + i2s(notificationConfiguration.type);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, notificationConfiguration.status)
- MY_SQLITE_BIND_INT(query, 2, notificationConfiguration.parameter)
- if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
- {
- logError("DatabaseHandler::changeMainSourceNotificationConfigurationDB SQLITE Step error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
- MY_SQLITE_FINALIZE(query)
-
- logInfo("DatabaseHandler::changeSourceNotificationConfigurationDB changed MainNotificationConfiguration of source:", sourceID, "type:", notificationConfiguration.type, "to status=", notificationConfiguration.status, "and parameter=",notificationConfiguration.parameter);
-
- //todo:: implement observer function
- return (E_OK);
-}
-
-void CAmDatabaseHandlerSQLite::createTables()
-{
- for (uint16_t i = 0; i < sizeof(databaseTables) / sizeof(databaseTables[0]); i++)
- {
- if (!sqQuery("CREATE TABLE " + databaseTables[i]))
- throw std::runtime_error("CAmDatabaseHandler Could not create tables!");
- }
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::enumerateSources(std::function<void(const am_Source_s & element)> cb) const
-{
- sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qMAinSoundProperty = NULL, *qNotification(NULL), *qMainNotification(NULL);
- int eCode = 0;
- am_Source_s temp;
- am_CustomConnectionFormat_t tempConnectionFormat;
- am_SoundProperty_s tempSoundProperty;
- am_MainSoundProperty_s tempMainSoundProperty;
- am_NotificationConfiguration_s tempNotificationConfiguration;
- std::string command = "SELECT name, domainID, sourceClassID, sourceState, volume, visible, availability, availabilityReason, interruptState, sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp.name = std::string((const char*) sqlite3_column_text(query, 0));
- temp.domainID = sqlite3_column_int(query, 1);
- temp.sourceClassID = sqlite3_column_int(query, 2);
- temp.sourceState = (am_SourceState_e) sqlite3_column_int(query, 3);
- temp.volume = sqlite3_column_int(query, 4);
- temp.visible = sqlite3_column_int(query, 5);
- temp.available.availability = (am_Availability_e) sqlite3_column_int(query, 6);
- temp.available.availabilityReason = (am_CustomAvailabilityReason_t) sqlite3_column_int(query, 7);
- temp.interruptState = (am_InterruptState_e) sqlite3_column_int(query, 8);
- temp.sourceID = sqlite3_column_int(query, 9);
-
- //read out the connectionFormats
- std::string commandConnectionFormat = "SELECT soundFormat FROM SourceConnectionFormat" + i2s(temp.sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL)
- while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
- {
- tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qConnectionFormat, 0);
- temp.listConnectionFormats.push_back(tempConnectionFormat);
- }
-
- MY_SQLITE_FINALIZE(qConnectionFormat)
-
- //read out sound properties
- std::string commandSoundProperty = "SELECT soundPropertyType, value FROM SourceSoundProperty" + i2s(temp.sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandSoundProperty.c_str(), -1, &qSoundProperty, NULL)
- while ((eCode = sqlite3_step(qSoundProperty)) == SQLITE_ROW)
- {
- tempSoundProperty.type = (am_CustomSoundPropertyType_t) sqlite3_column_int(qSoundProperty, 0);
- tempSoundProperty.value = sqlite3_column_int(qSoundProperty, 1);
- temp.listSoundProperties.push_back(tempSoundProperty);
- }
-
- MY_SQLITE_FINALIZE(qSoundProperty)
-
- std::string notificationCommand = "SELECT type, status, parameter FROM SourceNotificationConfiguration" + i2s(temp.sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, notificationCommand.c_str(), -1, &qNotification, NULL)
-
- while ((eCode = sqlite3_step(qNotification)) == SQLITE_ROW)
- {
- tempNotificationConfiguration.type = static_cast<am_CustomNotificationType_t>(sqlite3_column_int(qNotification, 0));
- tempNotificationConfiguration.status = static_cast<am_NotificationStatus_e>(sqlite3_column_int(qNotification, 1));
- tempNotificationConfiguration.parameter= static_cast<int16_t>(sqlite3_column_int(qNotification, 2));
- temp.listNotificationConfigurations.push_back(tempNotificationConfiguration);
- }
- MY_SQLITE_FINALIZE(qNotification)
-
- //read out MainSoundProperties if source is visible
- if(temp.visible)
- {
- std::string commandMainSoundProperty = "SELECT soundPropertyType, value FROM SourceMainSoundProperty" + i2s(temp.sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandMainSoundProperty.c_str(), -1, &qMAinSoundProperty, NULL)
- while ((eCode = sqlite3_step(qMAinSoundProperty)) == SQLITE_ROW)
- {
- tempMainSoundProperty.type = (am_CustomMainSoundPropertyType_t) sqlite3_column_int(qMAinSoundProperty, 0);
- tempMainSoundProperty.value = sqlite3_column_int(qMAinSoundProperty, 1);
- temp.listMainSoundProperties.push_back(tempMainSoundProperty);
- }
-
- MY_SQLITE_FINALIZE(qMAinSoundProperty)
-
- std::string mainNotificationCommand = "SELECT type, status, parameter FROM SourceMainNotificationConfiguration" + i2s(temp.sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, mainNotificationCommand.c_str(), -1, &qMainNotification, NULL)
-
- while ((eCode = sqlite3_step(qMainNotification)) == SQLITE_ROW)
- {
- tempNotificationConfiguration.type = static_cast<am_CustomNotificationType_t>(sqlite3_column_int(qMainNotification, 0));
- tempNotificationConfiguration.status = static_cast<am_NotificationStatus_e>(sqlite3_column_int(qMainNotification, 1));
- tempNotificationConfiguration.parameter= static_cast<int16_t>(sqlite3_column_int(qMainNotification, 2));
- temp.listMainNotificationConfigurations.push_back(tempNotificationConfiguration);
- }
- MY_SQLITE_FINALIZE(qMainNotification)
- }
-
-
- cb(temp);
- temp.listConnectionFormats.clear();
- temp.listMainSoundProperties.clear();
- temp.listSoundProperties.clear();
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListSources SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::enumerateSinks(std::function<void(const am_Sink_s & element)> cb) const
-{
- sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qNotificationConfiguration= NULL, *qMAinSoundProperty = NULL, *qMainNotificationConfiguration= NULL;
- int eCode = 0;
- am_Sink_s temp;
- am_CustomConnectionFormat_t tempConnectionFormat;
- am_SoundProperty_s tempSoundProperty;
- am_MainSoundProperty_s tempMainSoundProperty;
- am_NotificationConfiguration_s tempNotificationConfiguration;
- am_NotificationConfiguration_s tempMainNotificationConfiguration;
- std::string command = "SELECT name, domainID, sinkClassID, volume, visible, availability, availabilityReason, muteState, mainVolume, sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp.name = std::string((const char*) sqlite3_column_text(query, 0));
- temp.domainID = sqlite3_column_int(query, 1);
- temp.sinkClassID = sqlite3_column_int(query, 2);
- temp.volume = sqlite3_column_int(query, 3);
- temp.visible = sqlite3_column_int(query, 4);
- temp.available.availability = (am_Availability_e) sqlite3_column_int(query, 5);
- temp.available.availabilityReason = (am_CustomAvailabilityReason_t) sqlite3_column_int(query, 6);
- temp.muteState = (am_MuteState_e) sqlite3_column_int(query, 7);
- temp.mainVolume = sqlite3_column_int(query, 8);
- temp.sinkID = sqlite3_column_int(query, 9);
-
- //read out the connectionFormats
- std::string commandConnectionFormat = "SELECT soundFormat FROM SinkConnectionFormat" + i2s(temp.sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL)
- while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
- {
- tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qConnectionFormat, 0);
- temp.listConnectionFormats.push_back(tempConnectionFormat);
- }
-
- MY_SQLITE_FINALIZE(qConnectionFormat)
-
- //read out sound properties
- std::string commandSoundProperty = "SELECT soundPropertyType, value FROM SinkSoundProperty" + i2s(temp.sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandSoundProperty.c_str(), -1, &qSoundProperty, NULL)
- while ((eCode = sqlite3_step(qSoundProperty)) == SQLITE_ROW)
- {
- tempSoundProperty.type = (am_CustomSoundPropertyType_t) sqlite3_column_int(qSoundProperty, 0);
- tempSoundProperty.value = sqlite3_column_int(qSoundProperty, 1);
- temp.listSoundProperties.push_back(tempSoundProperty);
- }
-
- MY_SQLITE_FINALIZE(qSoundProperty)
-
- //read out notifications
- std::string commandNotificationConfiguration = "SELECT type, status, parameter FROM SinkNotificationConfiguration" + i2s(temp.sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandNotificationConfiguration.c_str(), -1, &qNotificationConfiguration, NULL)
- while ((eCode = sqlite3_step(qNotificationConfiguration)) == SQLITE_ROW)
- {
- tempNotificationConfiguration.type = static_cast<am_CustomNotificationType_t> (sqlite3_column_int(qNotificationConfiguration, 0));
- tempNotificationConfiguration.status = static_cast<am_NotificationStatus_e> (sqlite3_column_int(qNotificationConfiguration, 1));
- tempNotificationConfiguration.parameter = static_cast<int16_t> (sqlite3_column_int(qNotificationConfiguration, 2));
- temp.listNotificationConfigurations.push_back(tempNotificationConfiguration);
- }
-
- MY_SQLITE_FINALIZE(qNotificationConfiguration)
-
- //read out MainSoundProperties if sink is visible
- if(temp.visible)
- {
- std::string commandMainSoundProperty = "SELECT soundPropertyType, value FROM SinkMainSoundProperty" + i2s(temp.sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandMainSoundProperty.c_str(), -1, &qMAinSoundProperty, NULL)
- while ((eCode = sqlite3_step(qMAinSoundProperty)) == SQLITE_ROW)
- {
- tempMainSoundProperty.type = (am_CustomMainSoundPropertyType_t) sqlite3_column_int(qMAinSoundProperty, 0);
- tempMainSoundProperty.value = sqlite3_column_int(qMAinSoundProperty, 1);
- temp.listMainSoundProperties.push_back(tempMainSoundProperty);
- }
-
- MY_SQLITE_FINALIZE(qMAinSoundProperty)
-
- //and mainNotificationConfigurations
- std::string commandMainNotificationConfiguration = "SELECT type, status, parameter FROM SinkMainNotificationConfiguration" + i2s(temp.sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandMainNotificationConfiguration.c_str(), -1, &qMainNotificationConfiguration, NULL)
- while ((eCode = sqlite3_step(qMainNotificationConfiguration)) == SQLITE_ROW)
- {
- tempMainNotificationConfiguration.type = static_cast <am_CustomNotificationType_t> (sqlite3_column_int(qMainNotificationConfiguration, 0));
- tempMainNotificationConfiguration.status = static_cast <am_NotificationStatus_e> (sqlite3_column_int(qMainNotificationConfiguration, 1));
- tempMainNotificationConfiguration.parameter = static_cast <uint16_t>(sqlite3_column_int(qMainNotificationConfiguration, 2));
- temp.listMainNotificationConfigurations.push_back(tempMainNotificationConfiguration);
- }
-
- MY_SQLITE_FINALIZE(qMainNotificationConfiguration)
- }
-
- cb(temp);
- temp.listConnectionFormats.clear();
- temp.listMainSoundProperties.clear();
- temp.listSoundProperties.clear();
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListSinks SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::enumerateGateways(std::function<void(const am_Gateway_s & element)> cb) const
-{
- sqlite3_stmt* query = NULL, *qSinkConnectionFormat = NULL, *qSourceConnectionFormat = NULL;
- int eCode = 0;
- am_Gateway_s temp;
- am_CustomConnectionFormat_t tempConnectionFormat;
-
- std::string command = "SELECT name, sinkID, sourceID, domainSinkID, domainSourceID, controlDomainID, gatewayID FROM " + std::string(GATEWAY_TABLE);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp.name = std::string((const char*) sqlite3_column_text(query, 0));
- temp.sinkID = sqlite3_column_int(query, 1);
- temp.sourceID = sqlite3_column_int(query, 2);
- temp.domainSinkID = sqlite3_column_int(query, 3);
- temp.domainSourceID = sqlite3_column_int(query, 4);
- temp.controlDomainID = sqlite3_column_int(query, 5);
- temp.gatewayID = sqlite3_column_int(query, 6);
-
- //convertionMatrix:
- ListConnectionFormat::const_iterator iter = mListConnectionFormat.begin();
- iter = mListConnectionFormat.find(temp.gatewayID);
- if (iter == mListConnectionFormat.end())
- {
- logError("DatabaseHandler::getListGateways database error with convertionFormat");
-
- return (E_DATABASE_ERROR);
- }
- temp.convertionMatrix = iter->second;
-
- //read out the connectionFormats
- std::string commandConnectionFormat = "SELECT soundFormat FROM GatewaySourceFormat" + i2s(temp.gatewayID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qSourceConnectionFormat, NULL)
- while ((eCode = sqlite3_step(qSourceConnectionFormat)) == SQLITE_ROW)
- {
- tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qSourceConnectionFormat, 0);
- temp.listSourceFormats.push_back(tempConnectionFormat);
- }
-
- MY_SQLITE_FINALIZE(qSourceConnectionFormat)
-
- //read out sound properties
- commandConnectionFormat = "SELECT soundFormat FROM GatewaySinkFormat" + i2s(temp.gatewayID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qSinkConnectionFormat, NULL)
- while ((eCode = sqlite3_step(qSinkConnectionFormat)) == SQLITE_ROW)
- {
- tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qSinkConnectionFormat, 0);
- temp.listSinkFormats.push_back(tempConnectionFormat);
- }
-
- MY_SQLITE_FINALIZE(qSinkConnectionFormat)
-
- cb(temp);
- temp.listSinkFormats.clear();
- temp.listSourceFormats.clear();
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListGateways SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-am_Error_e CAmDatabaseHandlerSQLite::enumerateConverters(std::function<void(const am_Converter_s & element)> cb) const
-{
- sqlite3_stmt* query = NULL, *qSinkConnectionFormat = NULL, *qSourceConnectionFormat = NULL;
- int eCode = 0;
- am_Converter_s temp;
- am_CustomConnectionFormat_t tempConnectionFormat;
-
- std::string command = "SELECT name, sinkID, sourceID, domainID, converterID FROM " + std::string(CONVERTER_TABLE);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp.name = std::string((const char*) sqlite3_column_text(query, 0));
- temp.sinkID = sqlite3_column_int(query, 1);
- temp.sourceID = sqlite3_column_int(query, 2);
- temp.domainID = sqlite3_column_int(query, 3);
- temp.converterID = sqlite3_column_int(query, 4);
-
- //convertionMatrix:
- ListConnectionFormat::const_iterator iter = mListConnectionFormat.begin();
- iter = mListConnectionFormat.find(temp.converterID);
- if (iter == mListConnectionFormat.end())
- {
- logError("DatabaseHandler::getListConverters database error with convertionFormat");
-
- return (E_DATABASE_ERROR);
- }
- temp.convertionMatrix = iter->second;
-
- //read out the connectionFormats
- std::string commandConnectionFormat = "SELECT soundFormat FROM ConverterSourceFormat" + i2s(temp.converterID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qSourceConnectionFormat, NULL)
- while ((eCode = sqlite3_step(qSourceConnectionFormat)) == SQLITE_ROW)
- {
- tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qSourceConnectionFormat, 0);
- temp.listSourceFormats.push_back(tempConnectionFormat);
- }
-
- MY_SQLITE_FINALIZE(qSourceConnectionFormat)
-
- //read out sound properties
- commandConnectionFormat = "SELECT soundFormat FROM ConverterSinkFormat" + i2s(temp.converterID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qSinkConnectionFormat, NULL)
- while ((eCode = sqlite3_step(qSinkConnectionFormat)) == SQLITE_ROW)
- {
- tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qSinkConnectionFormat, 0);
- temp.listSinkFormats.push_back(tempConnectionFormat);
- }
-
- MY_SQLITE_FINALIZE(qSinkConnectionFormat)
-
- cb(temp);
- temp.listSinkFormats.clear();
- temp.listSourceFormats.clear();
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListConverters SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
-}
-
-}
diff --git a/AudioManagerDaemon/src/main.cpp b/AudioManagerDaemon/src/main.cpp
index 795795d..d71c02b 100755
--- a/AudioManagerDaemon/src/main.cpp
+++ b/AudioManagerDaemon/src/main.cpp
@@ -79,7 +79,7 @@ std::vector<std::string> listCommandPluginDirs;
std::vector<std::string> listRoutingPluginDirs;
//commandline options used by the Audiomanager itself
-TCLAP::ValueArg<std::string> controllerPlugin("c","controllerPlugin","use controllerPlugin full path with .so ending",false,CONTROLLER_PLUGIN,"string");
+TCLAP::ValueArg<std::string> controllerPlugin("c","controllerPlugin","use controllerPlugin full path with .so ending",false,CONTROLLER_PLUGIN_DIR,"string");
TCLAP::ValueArg<std::string> additionalCommandPluginDirs("L","additionalCommandPluginDirs","additional path for looking for command plugins, can be used after -l option",false," ","string");
TCLAP::ValueArg<std::string> additionalRoutingPluginDirs("R","additionalRoutingPluginDirs","additional path for looking for routing plugins, can be used after -r option ",false," ","string");
TCLAP::ValueArg<std::string> routingPluginDir("r","RoutingPluginDir","path for looking for routing plugins",false," ","string");
@@ -87,8 +87,8 @@ TCLAP::ValueArg<std::string> commandPluginDir("l","CommandPluginDir","path for l
TCLAP::ValueArg<std::string> databasePath ("p","databasePath","path for sqlite database (default is in memory)",false,":memory:","string");
TCLAP::ValueArg<unsigned int> telnetPort ("t","telnetport","The port that is used for telnet",false,DEFAULT_TELNETPORT,"int");
TCLAP::ValueArg<unsigned int> maxConnections ("m","maxConnections","Maximal number of connections for telnet",false,MAX_TELNETCONNECTIONS,"int");
-TCLAP::SwitchArg dbusWrapperTypeBool ("t","dbusType","DbusType to be used by CAmDbusWrapper: if option is selected, DBUS_SYSTEM is used otherwise DBUS_SESSION",false);
-TCLAP::SwitchArg enableNoDLTDebug ("V","logDlt","print DLT logs to stdout",false);
+TCLAP::SwitchArg dbusWrapperTypeBool ("T","dbusType","DbusType to be used by CAmDbusWrapper: if option is selected, DBUS_SYSTEM is used otherwise DBUS_SESSION",false);
+TCLAP::SwitchArg enableNoDLTDebug ("V","logDlt","print DLT logs to stdout or dlt-daemon, default on",true);
TCLAP::SwitchArg currentSettings("i","currentSettings","print current settings and exit",false);
TCLAP::SwitchArg daemonizeAM("d","daemonize","daemonize Audiomanager. Better use systemd...",false);
@@ -104,8 +104,7 @@ int fd0, fd1, fd2;
void OutOfMemoryHandler()
{
logError("No more memory - bye");
- //todo: add gracefull dead here. Do what can be done persistence wise
- exit(1);
+ throw std::runtime_error(std::string("SocketHandler::start_listenting ppoll returned with error."));
}
/**
@@ -169,9 +168,6 @@ void printCmdInformation()
printf("\tTelnet portNumber:\t\t\t%i\n", telnetPort.getValue());
printf("\tTelnet maxConnections:\t\t\t%i\n", maxConnections.getValue());
#endif
-#ifdef WITH_DATABASE_STORAGE
- printf("\tSqlite Database path:\t\t\t%s\n", databasePath.getValue().c_str());
-#endif
#ifndef WITH_DLT
printf("\tDlt Command Line Output: \t\t%s\n", enableNoDLTDebug.getValue()?"enabled":"not enabled");
#endif
@@ -248,9 +244,7 @@ void mainProgram(int argc, char *argv[])
cmd->add(routingPluginDir);
cmd->add(currentSettings);
cmd->add(daemonizeAM);
-#ifndef WITH_DLT
cmd->add(enableNoDLTDebug);
-#endif
#ifdef WITH_DBUS_WRAPPER
cmd->add(dbusWrapperTypeBool);
#endif
diff --git a/AudioManagerDaemon/test/AmControlInterfaceTest/CMakeLists.txt b/AudioManagerDaemon/test/AmControlInterfaceTest/CMakeLists.txt
deleted file mode 100644
index b21ca91..0000000
--- a/AudioManagerDaemon/test/AmControlInterfaceTest/CMakeLists.txt
+++ /dev/null
@@ -1,95 +0,0 @@
-# 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
-#
-# For further information see http://www.genivi.org/.
-#
-
-cmake_minimum_required(VERSION 2.8.8)
-
-project(AmControlInterfaceTest)
-
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager")
-
-set (AM_LINK_LIBS
- ${CMAKE_DL_LIBS}
- AudioManagerUtilities
- rt)
-
-IF (WITH_CAPI_WRAPPER)
- set (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- -Wl,--as-needed CommonAPI
- )
-ENDIF (WITH_CAPI_WRAPPER)
-
-if(WITH_DATABASE_STORAGE)
- pkg_check_modules(SQLITE REQUIRED sqlite3)
- set (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- ${SQLITE_LIBRARIES})
-endif(WITH_DATABASE_STORAGE)
-
-if(WITH_DLT)
- pkg_check_modules(DLT REQUIRED automotive-dlt>=2.2.0)
- set (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- ${DLT_LIBRARIES})
-endif(WITH_DLT)
-
-INCLUDE_DIRECTORIES(
- ${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDE_FOLDER}
- ${STD_INCLUDE_DIRS}
- ${INCLUDE_FOLDER}
- ${GOOGLE_TEST_INCLUDE_DIR}
- ${GMOCK_INCLUDE_DIR})
-
-if(WITH_DLT)
- INCLUDE_DIRECTORIES(
- ${INCLUDE_DIRECTORIES}
- ${DLT_INCLUDE_DIRS})
-endif(WITH_DLT)
-
-
-file(GLOB CONTROL_INTERFACE_SRCS_CXX
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmDatabaseHandlerMap.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmDatabaseObserver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRoutingSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRoutingReceiver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmCommandSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmCommandReceiver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmControlReceiver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmControlSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRouter.cpp"
- "../CAmCommonFunctions.cpp"
- "*.cpp"
-)
-
-add_executable(AmControlInterfaceTest ${CONTROL_INTERFACE_SRCS_CXX})
-
-TARGET_LINK_LIBRARIES(AmControlInterfaceTest
- ${AM_LINK_LIBS}
- gtest
- gmock)
-
-ADD_DEPENDENCIES(AmControlInterfaceTest gtest gmock AudioManagerUtilities)
-
-INSTALL(TARGETS AmControlInterfaceTest
- DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
- PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
- COMPONENT tests)
-
-
-
-
diff --git a/AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.cpp b/AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.cpp
deleted file mode 100644
index ac7bd03..0000000
--- a/AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.cpp
+++ /dev/null
@@ -1,2585 +0,0 @@
-/**
- * SPDX license identifier: MPL-2.0
- *
- * 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
- *
- * For further information see http://www.genivi.org/.
- *
- */
-
-#include "CAmDatabaseHandlerTest.h"
-#include <algorithm>
-#include <string>
-#include <vector>
-#include <set>
-#include "CAmDltWrapper.h"
-
-using namespace am;
-using namespace testing;
-
-//extern int GetRandomNumber(int nLow, int nHigh);
-//extern bool equalSoundProperty (const am_SoundProperty_s a, const am_SoundProperty_s b);
-extern bool equalMainSoundProperty(const am_MainSoundProperty_s a, const am_MainSoundProperty_s b);
-extern bool equalNotificationConfiguration(const am_NotificationConfiguration_s a, const am_NotificationConfiguration_s b);
-//extern bool equalRoutingElement(const am_RoutingElement_s a, const am_RoutingElement_s b);
-extern bool equalClassProperties(const am_ClassProperty_s a, const am_ClassProperty_s b);
-extern std::string int2string(int i);
-
-
-CAmDatabaseHandlerTest::CAmDatabaseHandlerTest() :
- plistRoutingPluginDirs(), //
- plistCommandPluginDirs(), //
- pSocketHandler(),//
- pDatabaseHandler(std::string(":memory:")), //
- pRoutingSender(plistRoutingPluginDirs), //
- pCommandSender(plistCommandPluginDirs), //
- pMockInterface(), //
- pRoutingInterfaceBackdoor(), //
- pCommandInterfaceBackdoor(), //
- pControlSender(), //
- pRouter(&pDatabaseHandler, &pControlSender), //
- pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender, &pSocketHandler, &pRouter), //
- pObserver(&pCommandSender,&pRoutingSender, &pSocketHandler)
-{
- pDatabaseHandler.registerObserver(&pObserver);
- pCommandInterfaceBackdoor.injectInterface(&pCommandSender, &pMockInterface);
-}
-
-CAmDatabaseHandlerTest::~CAmDatabaseHandlerTest()
-{
-}
-
-void CAmDatabaseHandlerTest::createMainConnectionSetup()
-{
- //fill the connection database
- am_Connection_s connection;
- am_Source_s source;
- am_Sink_s sink;
- std::vector<am_connectionID_t> connectionList;
-
- //we create 9 sources and sinks:
-
-
-
- for (uint16_t i = 1; i < 10; i++)
- {
- am_sinkID_t forgetSink;
- am_sourceID_t forgetSource;
- am_connectionID_t connectionID;
-
- pCF.createSink(sink);
- sink.sinkID = i;
- sink.name = "sink" + int2string(i);
- sink.domainID = 4;
- pCF.createSource(source);
- source.sourceID = i;
- source.name = "source" + int2string(i);
- source.domainID = 4;
-
- connection.sinkID = i;
- connection.sourceID = i;
- connection.delay = -1;
- connection.connectionFormat = CF_GENIVI_ANALOG;
- connection.connectionID = 0;
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,forgetSink));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,forgetSource));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterConnectionDB(connection,connectionID));
- ASSERT_EQ(E_OK, pDatabaseHandler.changeConnectionFinal(connectionID));
- connectionList.push_back(connectionID);
-
- }
-
- //create a mainConnection
- am_MainConnection_s mainConnection;
- am_mainConnectionID_t mainConnectionID;
- std::vector<am_MainConnection_s> mainConnectionList;
- mainConnection.listConnectionID = connectionList;
- mainConnection.mainConnectionID = 0;
- mainConnection.sinkID = 1;
- mainConnection.sourceID = 1;
- mainConnection.connectionState = CS_CONNECTED;
- mainConnection.delay = -1;
-
- //enter mainconnection in database
-
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterMainConnectionDB(mainConnection,mainConnectionID));
- ASSERT_NE(0, mainConnectionID);
-
- //read out the mainconnections and check if they are equal to the data written.
- ASSERT_EQ(E_OK, pDatabaseHandler.getListMainConnections(mainConnectionList));
- bool equal = true;
- std::vector<am_MainConnection_s>::iterator listIterator = mainConnectionList.begin();
- for (; listIterator < mainConnectionList.end(); ++listIterator)
- {
- if (listIterator->mainConnectionID == mainConnectionID)
- {
- equal = equal && (listIterator->connectionState == mainConnection.connectionState) && (listIterator->sinkID == mainConnection.sinkID) && (listIterator->sourceID == mainConnection.sourceID) && (listIterator->delay == mainConnection.delay) && (std::equal(listIterator->listConnectionID.begin(), listIterator->listConnectionID.end(), connectionList.begin()));
- }
- }
- ASSERT_EQ(true, equal);
-}
-
-void CAmDatabaseHandlerTest::SetUp()
-{
-}
-
-void CAmDatabaseHandlerTest::TearDown()
-{
-}
-
-TEST_F(CAmDatabaseHandlerTest,getMainConnectionInfo)
-{
- //fill the connection database
- am_Connection_s connection;
- am_Source_s source;
- am_Sink_s sink;
- std::vector<am_connectionID_t> connectionList;
-
- //we create 9 sources and sinks:
-
-
-
- for (uint16_t i = 1; i < 10; i++)
- {
- am_sinkID_t forgetSink;
- am_sourceID_t forgetSource;
- am_connectionID_t connectionID;
-
- pCF.createSink(sink);
- sink.sinkID = i;
- sink.name = "sink" + int2string(i);
- sink.domainID = 4;
- pCF.createSource(source);
- source.sourceID = i;
- source.name = "source" + int2string(i);
- source.domainID = 4;
-
- connection.sinkID = i;
- connection.sourceID = i;
- connection.delay = -1;
- connection.connectionFormat = CF_GENIVI_ANALOG;
- connection.connectionID = 0;
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,forgetSink));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,forgetSource));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterConnectionDB(connection,connectionID));
- ASSERT_EQ(E_OK, pDatabaseHandler.changeConnectionFinal(connectionID));
- connectionList.push_back(connectionID);
-
- }
-
- //create a mainConnection
- am_MainConnection_s mainConnection;
- am_mainConnectionID_t mainConnectionID;
- std::vector<am_MainConnection_s> mainConnectionList;
- mainConnection.listConnectionID = connectionList;
- mainConnection.mainConnectionID = 0;
- mainConnection.sinkID = 1;
- mainConnection.sourceID = 1;
- mainConnection.connectionState = CS_CONNECTED;
- mainConnection.delay = -1;
-
- //enter mainconnection in database
-
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterMainConnectionDB(mainConnection,mainConnectionID));
- ASSERT_NE(0, mainConnectionID);
-
- //read out the mainconnections and check if they are equal to the data written.
- ASSERT_EQ(E_OK, pDatabaseHandler.getListMainConnections(mainConnectionList));
- bool equal = true;
- std::vector<am_MainConnection_s>::iterator listIterator = mainConnectionList.begin();
- for (; listIterator < mainConnectionList.end(); ++listIterator)
- {
- if (listIterator->mainConnectionID == mainConnectionID)
- {
- equal = equal && (listIterator->connectionState == mainConnection.connectionState) && (listIterator->sinkID == mainConnection.sinkID) && (listIterator->sourceID == mainConnection.sourceID) && (listIterator->delay == mainConnection.delay) && (std::equal(listIterator->listConnectionID.begin(), listIterator->listConnectionID.end(), connectionList.begin()));
- }
- }ASSERT_EQ(true, equal);
-
- am_MainConnection_s mainConnectionT;
- ASSERT_EQ(E_OK, pDatabaseHandler.getMainConnectionInfoDB(mainConnectionID,mainConnectionT));
- ASSERT_TRUE( (mainConnection.connectionState==mainConnectionT.connectionState) && (mainConnection.delay==mainConnectionT.delay) && (std::equal(mainConnection.listConnectionID.begin(),mainConnection.listConnectionID.end(),mainConnectionT.listConnectionID.begin())) && (mainConnection.sinkID==mainConnectionT.sinkID) && (mainConnection.sourceID==mainConnectionT.sourceID) && (mainConnectionID==mainConnectionT.mainConnectionID));
-
-}
-
-TEST_F(CAmDatabaseHandlerTest,getSinkInfo)
-{
- //fill the connection database
- am_Sink_s staticSink, firstDynamicSink, secondDynamicSink;
- am_sinkID_t staticSinkID, firstDynamicSinkID, secondDynamicSinkID;
- std::vector<am_Sink_s> sinkList;
-
- pCF.createSink(staticSink);
- staticSink.sinkID = 4;
-
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(staticSink,staticSinkID))
- << "ERROR: database error";
- ASSERT_EQ(staticSink.sinkID,staticSinkID)
- << "ERROR: ID not the one given in staticSink";
-
- pCF.createSink(firstDynamicSink);
- firstDynamicSink.name = "firstdynamic";
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(firstDynamicSink,firstDynamicSinkID))
- << "ERROR: database error";
- ASSERT_EQ(firstDynamicSinkID,DYNAMIC_ID_BOUNDARY)
- << "ERROR: ID not the one given in firstDynamicSink";
-
- pCF.createSink(secondDynamicSink);
- secondDynamicSink.name = "seconddynamic";
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(secondDynamicSink,secondDynamicSinkID))
- << "ERROR: database error";
- ASSERT_NEAR(secondDynamicSinkID,DYNAMIC_ID_BOUNDARY,10)
- << "ERROR: ID not the one given in secondDynamicSink";
-
- //now read back and check the returns agains the given values
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(sinkList))
- << "ERROR: database error";
- bool equal = true;
-
- std::vector<am_Sink_s>::iterator listIterator = sinkList.begin();
- for (; listIterator < sinkList.end(); ++listIterator)
- {
- if (listIterator->sinkID == staticSinkID)
- {
- equal = equal && pCF.compareSink(listIterator, staticSink);
- }
-
- if (listIterator->sinkID == firstDynamicSinkID)
- {
- equal = equal && pCF.compareSink(listIterator, firstDynamicSink);
- }
-
- if (listIterator->sinkID == secondDynamicSinkID)
- {
- equal = equal && pCF.compareSink(listIterator, secondDynamicSink);
- }
- }ASSERT_EQ(true, equal);
-
- am_Sink_s sinkData;
- ASSERT_EQ(E_OK, pDatabaseHandler.getSinkInfoDB(secondDynamicSinkID,sinkData));
- ASSERT_TRUE( (secondDynamicSink.available.availability == sinkData.available.availability) && //
- (secondDynamicSink.available.availabilityReason == sinkData.available.availabilityReason) && //
- (secondDynamicSink.sinkClassID == sinkData.sinkClassID) && //
- (secondDynamicSink.domainID == sinkData.domainID) && //
- (secondDynamicSink.visible == sinkData.visible) && //
- (secondDynamicSink.name.compare(sinkData.name) == 0) && //
- (secondDynamicSink.volume == sinkData.volume) && //
- std::equal(secondDynamicSink.listConnectionFormats.begin(), secondDynamicSink.listConnectionFormats.end(), sinkData.listConnectionFormats.begin()) && //
- std::equal(secondDynamicSink.listMainSoundProperties.begin(), secondDynamicSink.listMainSoundProperties.end(), sinkData.listMainSoundProperties.begin(), equalMainSoundProperty) && //
- std::equal(secondDynamicSink.listNotificationConfigurations.begin(), secondDynamicSink.listNotificationConfigurations.end(), sinkData.listNotificationConfigurations.begin(), equalNotificationConfiguration) && //
- std::equal(secondDynamicSink.listMainNotificationConfigurations.begin(), secondDynamicSink.listMainNotificationConfigurations.end(), sinkData.listMainNotificationConfigurations.begin(), equalNotificationConfiguration) //
- );
-
-}
-
-TEST_F(CAmDatabaseHandlerTest,getSourceInfo)
-{
- //fill the connection database
- am_Source_s staticSource, firstDynamicSource, secondDynamicSource;
- am_sourceID_t staticSourceID, firstDynamicSourceID, secondDynamicSourceID;
- std::vector<am_Source_s> sourceList;
-
- pCF.createSource(staticSource);
- staticSource.sourceID = 4;
- staticSource.name = "Static";
-
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(staticSource,staticSourceID))
- << "ERROR: database error";
- ASSERT_EQ(staticSource.sourceID,staticSourceID)
- << "ERROR: ID not the one given in staticSource";
-
- pCF.createSource(firstDynamicSource);
- firstDynamicSource.name = "firstDynamicSource";
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(firstDynamicSource,firstDynamicSourceID))
- << "ERROR: database error";
- ASSERT_EQ(firstDynamicSourceID,DYNAMIC_ID_BOUNDARY)
- << "ERROR: ID not the one given in firstDynamicSink";
-
- pCF.createSource(secondDynamicSource);
- secondDynamicSource.name = "secondDynamicSource";
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(secondDynamicSource,secondDynamicSourceID))
- << "ERROR: database error";
- ASSERT_NEAR(secondDynamicSourceID,DYNAMIC_ID_BOUNDARY,10)
- << "ERROR: ID not the one given in secondDynamicSink";
-
- //now read back and check the returns agains the given values
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(sourceList))
- << "ERROR: database error";
- bool equal = true;
-
- std::vector<am_Source_s>::iterator listIterator = sourceList.begin();
- for (; listIterator < sourceList.end(); ++listIterator)
- {
- if (listIterator->sourceID == staticSourceID)
- {
- equal = equal && pCF.compareSource(listIterator, staticSource);
- }
-
- if (listIterator->sourceID == firstDynamicSourceID)
- {
- equal = equal && pCF.compareSource(listIterator, firstDynamicSource);
- }
-
- if (listIterator->sourceID == secondDynamicSourceID)
- {
- equal = equal && pCF.compareSource(listIterator, secondDynamicSource);
- }
-
- }ASSERT_EQ(true, equal);
-
- am_Source_s sourceData;
- ASSERT_EQ(E_OK, pDatabaseHandler.getSourceInfoDB(secondDynamicSourceID,sourceData));
- ASSERT_TRUE((secondDynamicSource.available.availability == sourceData.available.availability) && //
- (secondDynamicSource.available.availabilityReason == sourceData.available.availabilityReason) && //
- (secondDynamicSource.sourceClassID == sourceData.sourceClassID) && (secondDynamicSource.domainID == sourceData.domainID) && //
- (secondDynamicSource.interruptState == sourceData.interruptState) && (secondDynamicSource.visible == sourceData.visible) && //
- (secondDynamicSource.name.compare(sourceData.name) == 0) && (secondDynamicSource.volume == sourceData.volume) && //
- std::equal(secondDynamicSource.listConnectionFormats.begin(), secondDynamicSource.listConnectionFormats.end(), sourceData.listConnectionFormats.begin()) && //
- std::equal(secondDynamicSource.listMainSoundProperties.begin(), secondDynamicSource.listMainSoundProperties.end(), sourceData.listMainSoundProperties.begin(), equalMainSoundProperty) && //
- std::equal(secondDynamicSource.listMainNotificationConfigurations.begin(), secondDynamicSource.listMainNotificationConfigurations.end(), sourceData.listMainNotificationConfigurations.begin(), equalNotificationConfiguration) && //
- std::equal(secondDynamicSource.listNotificationConfigurations.begin(), secondDynamicSource.listNotificationConfigurations.end(), sourceData.listNotificationConfigurations.begin(), equalNotificationConfiguration) //
- );
-
-}
-
-TEST_F(CAmDatabaseHandlerTest, peekSourceID)
-{
-
- std::string sourceName("myClassID");
- am_sourceClass_t sourceClassID, peekID;
- am_SourceClass_s sourceClass;
- am_ClassProperty_s classProperty;
- classProperty.classProperty = CP_GENIVI_SOURCE_TYPE;
- classProperty.value = 13;
- sourceClass.name = sourceName;
- sourceClass.sourceClassID = 0;
- sourceClass.listClassProperties.push_back(classProperty);
-
- //first we peek without an existing class
- ASSERT_EQ(E_NON_EXISTENT, pDatabaseHandler.peekSourceClassID(sourceName,sourceClassID));
-
- //now we enter the class into the database
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
-
- //first we peek without an existing class
- ASSERT_EQ(E_OK, pDatabaseHandler.peekSourceClassID(sourceName,peekID));
- ASSERT_EQ(sourceClassID, peekID);
-}
-
-TEST_F(CAmDatabaseHandlerTest, peekSinkID)
-{
-
- std::string sinkName("myClassID");
- am_sinkClass_t sinkClassID, peekID;
- am_SinkClass_s sinkClass;
- am_ClassProperty_s classProperty;
- classProperty.classProperty = CP_GENIVI_SOURCE_TYPE;
- classProperty.value = 13;
- sinkClass.name = sinkName;
- sinkClass.sinkClassID = 0;
- sinkClass.listClassProperties.push_back(classProperty);
-
- //first we peek without an existing class
- ASSERT_EQ(E_NON_EXISTENT, pDatabaseHandler.peekSinkClassID(sinkName,sinkClassID));
-
- //now we enter the class into the database
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
-
- //first we peek without an existing class
- ASSERT_EQ(E_OK, pDatabaseHandler.peekSinkClassID(sinkName,peekID));
- ASSERT_EQ(sinkClassID, peekID);
-}
-
-TEST_F(CAmDatabaseHandlerTest,crossfaders)
-{
-
-
-
- am_Crossfader_s crossfader;
- am_crossfaderID_t crossfaderID;
- am_Sink_s sinkA, sinkB;
- am_Source_s source;
- am_sourceID_t sourceID;
- am_sinkID_t sinkAID, sinkBID;
- pCF.createSink(sinkA);
- pCF.createSink(sinkB);
- sinkB.name = "sinkB";
- pCF.createSource(source);
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sinkA,sinkAID));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sinkB,sinkBID));
-
- crossfader.crossfaderID = 0;
- crossfader.hotSink = HS_SINKA;
- crossfader.sinkID_A = sinkAID;
- crossfader.sinkID_B = sinkBID;
- crossfader.sourceID = sourceID;
- crossfader.name = "Crossfader";
- crossfader.hotSink = HS_UNKNOWN;
-
- std::vector<am_Crossfader_s> listCrossfaders;
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterCrossfaderDB(crossfader,crossfaderID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListCrossfaders(listCrossfaders));
- ASSERT_EQ(crossfader.sinkID_A, listCrossfaders[0].sinkID_A);
- ASSERT_EQ(crossfader.sinkID_B, listCrossfaders[0].sinkID_B);
- ASSERT_EQ(crossfader.sourceID, listCrossfaders[0].sourceID);
- ASSERT_EQ(crossfader.hotSink, listCrossfaders[0].hotSink);
- ASSERT_EQ(DYNAMIC_ID_BOUNDARY, listCrossfaders[0].crossfaderID);
- ASSERT_EQ(crossfader.name.compare(listCrossfaders[0].name), 0);
-}
-
-TEST_F(CAmDatabaseHandlerTest,crossfadersGetFromDomain)
-{
-
-
-
- am_Crossfader_s crossfader;
- am_crossfaderID_t crossfaderID;
- am_Sink_s sinkA, sinkB;
- am_Source_s source;
- am_sourceID_t sourceID;
- am_sinkID_t sinkAID, sinkBID;
- am_domainID_t domainID;
- am_Domain_s domain;
- pCF.createSink(sinkA);
- pCF.createSink(sinkB);
- pCF.createDomain(domain);
- sinkB.name = "sinkB";
- pCF.createSource(source);
- ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
- source.domainID = domainID;
- sinkA.domainID = domainID;
- sinkB.domainID = domainID;
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sinkA,sinkAID));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sinkB,sinkBID));
-
- crossfader.crossfaderID = 0;
- crossfader.hotSink = HS_SINKA;
- crossfader.sinkID_A = sinkAID;
- crossfader.sinkID_B = sinkBID;
- crossfader.sourceID = sourceID;
- crossfader.name = "Crossfader";
- crossfader.hotSink = HS_UNKNOWN;
-
- std::vector<am_crossfaderID_t> listCrossfaders;
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterCrossfaderDB(crossfader,crossfaderID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListCrossfadersOfDomain(source.domainID,listCrossfaders));
- ASSERT_EQ(DYNAMIC_ID_BOUNDARY, listCrossfaders[0]);
-
-}
-
-TEST_F(CAmDatabaseHandlerTest,sourceState)
-{
- am_Source_s source;
- am_sourceID_t sourceID;
- std::vector<am_Source_s> listSources;
- pCF.createSource(source);
- source.sourceState = SS_OFF;
-
- //prepare the test
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
-
- //change the source state
- ASSERT_EQ(E_OK, pDatabaseHandler.changeSourceState(sourceID,SS_ON));
-
- //read out the changed values
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
- ASSERT_EQ(listSources[0].sourceState, SS_ON);
-}
-
-TEST_F(CAmDatabaseHandlerTest,sinkVolumeChange)
-{
- am_Sink_s sink;
- am_sinkID_t sinkID;
- std::vector<am_Sink_s> listSinks;
- pCF.createSink(sink);
- sink.volume = 23;
-
- //prepare the test
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
-
- //change the volume and check the read out
- ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkVolume(sinkID,34));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
- ASSERT_EQ(listSinks[0].volume, 34);
-}
-
-TEST_F(CAmDatabaseHandlerTest,sourceVolumeChange)
-{
- am_Source_s source;
- am_sourceID_t sourceID;
- std::vector<am_Source_s> listSources;
- pCF.createSource(source);
- source.volume = 23;
-
- //prepare test
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
-
- //change the volume and check the read out
- ASSERT_EQ(E_OK, pDatabaseHandler.changeSourceVolume(sourceID,34));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
- ASSERT_EQ(listSources[0].volume, 34);
-}
-
-TEST_F(CAmDatabaseHandlerTest, peekSource)
-{
- std::vector<am_SourceType_s> listSourceTypes;
- std::vector<am_Source_s> listSources;
- am_sourceID_t sourceID, source2ID, source3ID;
- am_Source_s source;
- pCF.createSource(source);
-
- //peek a source that does not exits
-
- ASSERT_EQ(E_OK, pDatabaseHandler.peekSource(std::string("newsource"),sourceID));
-
- //make sure it is not in the list
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
- ASSERT_TRUE(listSources.empty());
- ASSERT_EQ(E_OK, pDatabaseHandler.getListMainSources(listSourceTypes));
- ASSERT_TRUE(listSourceTypes.empty());
- ASSERT_EQ(sourceID, DYNAMIC_ID_BOUNDARY);
-
- //now enter the source with the same name and make sure it does not get a new ID
- source.name = "newsource";
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,source2ID));
-
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
- ASSERT_EQ(sourceID, source2ID);
- ASSERT_FALSE(listSources.empty());
- ASSERT_TRUE(listSources.at(0).sourceID==sourceID);
-
- ASSERT_EQ(E_OK, pDatabaseHandler.getListMainSources(listSourceTypes));
- ASSERT_FALSE(listSourceTypes.empty());
- ASSERT_TRUE(listSourceTypes.at(0).sourceID==sourceID);
-
- //now we peek again. This time, the source exists
- ASSERT_EQ(E_OK, pDatabaseHandler.peekSource(source.name,source3ID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
- ASSERT_TRUE(listSources.size()==1);
-
- ASSERT_EQ(E_OK, pDatabaseHandler.getListMainSources(listSourceTypes));
- ASSERT_TRUE(listSourceTypes.size()==1);
- ASSERT_TRUE(listSourceTypes.at(0).sourceID==source3ID);
- ASSERT_EQ(source3ID, source2ID);
-}
-
-
-TEST_F(CAmDatabaseHandlerTest, peekSourceDouble)
-{
- std::vector<am_SourceType_s> listSourceTypes;
- std::vector<am_Source_s> listSources;
- am_sourceID_t sourceID;
- am_sourceID_t source2ID;
- am_sourceID_t source3ID;
- am_Source_s source;
- pCF.createSource(source);
-
- //peek a source that does not exits
-
- ASSERT_EQ(E_OK, pDatabaseHandler.peekSource(std::string("newsource"),sourceID));
-
- //peek a second source that does not exits
-
- ASSERT_EQ(E_OK, pDatabaseHandler.peekSource(std::string("newsource2"),source2ID));
-
- //make sure they are is not in the list
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
- ASSERT_TRUE(listSources.empty());
- ASSERT_EQ(sourceID, DYNAMIC_ID_BOUNDARY);
- source.name = "newsource";
-
- //now enter the source with the same name than the first peek and make sure it does not get a new ID
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,source3ID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
- ASSERT_EQ(sourceID, source3ID);
- ASSERT_TRUE(listSources.size()==1);
- ASSERT_TRUE(listSources[0].sourceID==sourceID);
-
- ASSERT_EQ(E_OK, pDatabaseHandler.getListMainSources(listSourceTypes));
- ASSERT_TRUE(listSourceTypes.size()==1);
- ASSERT_TRUE(listSourceTypes[0].sourceID==source3ID);
-}
-
-TEST_F(CAmDatabaseHandlerTest, peekSink)
-{
- std::vector<am_SinkType_s> listSinkTypes;
- std::vector<am_Sink_s> listSinks;
- am_sinkID_t sinkID, sink2ID, sink3ID;
- am_Sink_s sink;
- pCF.createSink(sink);
-
- //peek a sink that does not exits
-
- ASSERT_EQ(E_OK, pDatabaseHandler.peekSink(std::string("newsink"),sinkID));
-
- //make sure it is not in the list
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
- ASSERT_TRUE(listSinks.empty());
- ASSERT_EQ(sinkID, DYNAMIC_ID_BOUNDARY);
- sink.name = "newsink";
-
- //now enter the source with the same name and make sure it does not get a new ID
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sink2ID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
- ASSERT_EQ(sinkID, sink2ID);
- ASSERT_TRUE(listSinks[0].sinkID==sinkID);
-
- ASSERT_EQ(E_OK, pDatabaseHandler.getListMainSinks(listSinkTypes));
- ASSERT_FALSE(listSinkTypes.empty());
- ASSERT_TRUE(listSinkTypes.at(0).sinkID==sinkID);
-
- //now we peek again, this time, the sink exists
- ASSERT_EQ(E_OK, pDatabaseHandler.peekSink(sink.name,sink3ID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
- ASSERT_TRUE(listSinks.size()==1);
- ASSERT_EQ(sink3ID, sink2ID);
-
- ASSERT_EQ(E_OK, pDatabaseHandler.getListMainSinks(listSinkTypes));
- ASSERT_TRUE(listSinkTypes.size()==1);
- ASSERT_TRUE(listSinkTypes.at(0).sinkID==sink3ID);
-}
-
-TEST_F(CAmDatabaseHandlerTest, peekSinkDouble)
-{
- std::vector<am_SinkType_s> listSinkTypes;
- std::vector<am_Sink_s> listSinks;
- am_sinkID_t sinkID;
- am_sinkID_t sink2ID;
- am_sinkID_t sink3ID;
- am_Sink_s sink;
- pCF.createSink(sink);
-
- //peek a sink that does not exits
-
- ASSERT_EQ(E_OK, pDatabaseHandler.peekSink(std::string("newsink"),sinkID));
-
- //peek again
-
- ASSERT_EQ(E_OK, pDatabaseHandler.peekSink(std::string("nextsink"),sink2ID));
-
- //make sure they are is not in the list
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
- ASSERT_TRUE(listSinks.empty());
- ASSERT_EQ(sinkID, DYNAMIC_ID_BOUNDARY);
- sink.name = "newsink";
-
- //now enter the sink with the same name than the first peek and make sure it does not get a new ID
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sink3ID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
- ASSERT_EQ(sinkID, sink3ID);
- ASSERT_TRUE(listSinks[0].sinkID==sinkID);
-
- ASSERT_EQ(E_OK, pDatabaseHandler.getListMainSinks(listSinkTypes));
- ASSERT_TRUE(listSinkTypes.size()==1);
- ASSERT_TRUE(listSinkTypes[0].sinkID==sink3ID);
-}
-
-TEST_F(CAmDatabaseHandlerTest,changeConnectionTimingInformationCheckMainConnection)
-{
- std::vector<am_Connection_s> connectionList;
- std::vector<am_MainConnectionType_s> mainList;
-
- //prepare the test, it is one mainconnection, so we expect one callback
- createMainConnectionSetup();
-
- //first get all visible mainconnections and make sure, the delay is set to -1 for the first entry
- ASSERT_EQ(E_OK, pDatabaseHandler.getListVisibleMainConnections(mainList));
- ASSERT_EQ(mainList[0].delay, -1);
-
- //no go through all connections and set the delay time to 24 for each connection
- ASSERT_EQ(E_OK, pDatabaseHandler.getListConnections(connectionList));
- std::vector<am_Connection_s>::iterator iteratorConnectionList = connectionList.begin();
- for (; iteratorConnectionList < connectionList.end(); ++iteratorConnectionList)
- {
- ASSERT_EQ(E_OK, pDatabaseHandler.changeConnectionTimingInformation(iteratorConnectionList->sinkID,24));
- }
-
- //we read the result again and expect that the value is now different from -1
- ASSERT_EQ(E_OK, pDatabaseHandler.getListVisibleMainConnections(mainList));
- ASSERT_EQ(mainList[0].delay, 216);
-}
-
-TEST_F(CAmDatabaseHandlerTest,changeConnectionTimingInformation)
-{
- am_Connection_s connection;
- am_connectionID_t connectionID;
- std::vector<am_Connection_s> connectionList;
- pCF.createConnection(connection);
-
- //enter a connection
- ASSERT_EQ(E_OK, pDatabaseHandler.enterConnectionDB(connection,connectionID));
- ASSERT_EQ(E_OK, pDatabaseHandler.changeConnectionFinal(connectionID));
-
- //change the timing and check it
- ASSERT_EQ(E_OK, pDatabaseHandler.changeConnectionTimingInformation(connectionID,24));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListConnections(connectionList));
- ASSERT_TRUE(connectionList[0].delay==24);
-}
-
-TEST_F(CAmDatabaseHandlerTest,getSinkClassOfSink)
-{
- std::vector<am_SinkClass_s> sinkClassList;
- std::vector<am_ClassProperty_s> classPropertyList;
- am_SinkClass_s sinkClass, returnClass;
- am_ClassProperty_s classProperty;
- am_sinkClass_t sinkClassID;
- am_Sink_s sink;
- am_sinkID_t sinkID;
- classProperty.classProperty = CP_GENIVI_SINK_TYPE;
- classProperty.value = 1;
- classPropertyList.push_back(classProperty);
- classProperty.classProperty = CP_GENIVI_SOURCE_TYPE;
- classProperty.value = 4;
- classPropertyList.push_back(classProperty);
- sinkClass.name = "test";
- sinkClass.sinkClassID = 4;
- sinkClass.listClassProperties = classPropertyList;
- pCF.createSink(sink);
- sink.sinkClassID = 4;
-
- //prepare test
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
-
- //enter a new sinkclass, read out again and check
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
- ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
- ASSERT_EQ(sinkClassList[0].sinkClassID, 4);
- ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
- ASSERT_EQ(E_OK, pDatabaseHandler.getSinkClassInfoDB(sinkID,returnClass));
- ASSERT_EQ(sinkClassList[0].name, returnClass.name);
- ASSERT_EQ(sinkClassList[0].sinkClassID, returnClass.sinkClassID);
- ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),returnClass.listClassProperties.begin(),equalClassProperties));
-}
-
-TEST_F(CAmDatabaseHandlerTest,getSourceClassOfSource)
-{
- std::vector<am_SourceClass_s> sourceClassList;
- std::vector<am_ClassProperty_s> classPropertyList;
- am_SourceClass_s sourceClass, sinkSourceClass;
- am_ClassProperty_s classProperty;
- am_sourceClass_t sourceClassID;
- am_Source_s source;
- am_sourceID_t sourceID;
- classProperty.classProperty = CP_GENIVI_SINK_TYPE;
- classProperty.value = 1;
- classPropertyList.push_back(classProperty);
- classProperty.classProperty = CP_GENIVI_SOURCE_TYPE;
- classProperty.value = 4;
- classPropertyList.push_back(classProperty);
- sourceClass.name = "test";
- sourceClass.sourceClassID = 1;
- sourceClass.listClassProperties = classPropertyList;
- pCF.createSource(source);
-
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
- ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
- ASSERT_EQ(sourceClassList[0].sourceClassID, 1);
- ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
- ASSERT_EQ(E_OK, pDatabaseHandler.getSourceClassInfoDB(sourceID,sinkSourceClass));
- ASSERT_EQ(sourceClassList[0].name, sinkSourceClass.name);
- ASSERT_EQ(sourceClassList[0].sourceClassID, sinkSourceClass.sourceClassID);
- ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),sinkSourceClass.listClassProperties.begin(),equalClassProperties));
-}
-
-TEST_F(CAmDatabaseHandlerTest,removeSourceClass)
-{
- std::vector<am_SourceClass_s> sourceClassList;
- std::vector<am_ClassProperty_s> classPropertyList;
- am_SourceClass_s sourceClass;
- am_ClassProperty_s classProperty;
- am_sourceClass_t sourceClassID;
- classProperty.classProperty = CP_GENIVI_SINK_TYPE;
- classProperty.value = 1;
- classPropertyList.push_back(classProperty);
- classProperty.classProperty = CP_GENIVI_SOURCE_TYPE;
- classProperty.value = 4;
- classPropertyList.push_back(classProperty);
- sourceClass.name = "test";
- sourceClass.sourceClassID = 3;
- sourceClass.listClassProperties = classPropertyList;
-
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
- ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
- ASSERT_EQ(sourceClassList[0].sourceClassID, 3);
- ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
- ASSERT_EQ(E_OK, pDatabaseHandler.removeSourceClassDB(3));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
- ASSERT_TRUE(sourceClassList.empty());
-}
-
-TEST_F(CAmDatabaseHandlerTest,updateSourceClass)
-{
- std::vector<am_SourceClass_s> sourceClassList;
- std::vector<am_ClassProperty_s> classPropertyList, changedPropertyList;
- am_SourceClass_s sourceClass, changedClass;
- am_ClassProperty_s classProperty;
- am_sourceClass_t sourceClassID;
- classProperty.classProperty = CP_GENIVI_SINK_TYPE;
- classProperty.value = 1;
- classPropertyList.push_back(classProperty);
- classProperty.classProperty = CP_GENIVI_SOURCE_TYPE;
- classProperty.value = 4;
- classPropertyList.push_back(classProperty);
- sourceClass.name = "test";
- sourceClass.sourceClassID = 0;
- sourceClass.listClassProperties = classPropertyList;
- changedClass = sourceClass;
- changedClass.listClassProperties[1].value = 6;
- changedPropertyList = changedClass.listClassProperties;
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
- changedClass.sourceClassID = sourceClassID;
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
- ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
- ASSERT_EQ(sourceClassList[0].sourceClassID, DYNAMIC_ID_BOUNDARY);
- ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
- ASSERT_EQ(E_OK, pDatabaseHandler.changeSourceClassInfoDB(changedClass));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
- ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
- ASSERT_EQ(sourceClassList[0].sourceClassID, DYNAMIC_ID_BOUNDARY);
- ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),changedPropertyList.begin(),equalClassProperties));
-}
-
-TEST_F(CAmDatabaseHandlerTest,enterSourceClass)
-{
- std::vector<am_SourceClass_s> sourceClassList;
- std::vector<am_ClassProperty_s> classPropertyList;
- am_SourceClass_s sourceClass;
- am_ClassProperty_s classProperty;
- am_sourceClass_t sourceClassID;
- classProperty.classProperty = CP_GENIVI_SINK_TYPE;
- classProperty.value = 1;
- classPropertyList.push_back(classProperty);
- classProperty.classProperty = CP_GENIVI_SOURCE_TYPE;
- classProperty.value = 4;
- classPropertyList.push_back(classProperty);
- sourceClass.name = "test";
- sourceClass.sourceClassID = 0;
- sourceClass.listClassProperties = classPropertyList;
-
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
- ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
- ASSERT_EQ(sourceClassList[0].sourceClassID, DYNAMIC_ID_BOUNDARY);
- ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
-}
-
-TEST_F(CAmDatabaseHandlerTest,enterSourceClassStatic)
-{
- std::vector<am_SourceClass_s> sourceClassList;
- std::vector<am_ClassProperty_s> classPropertyList;
- am_SourceClass_s sourceClass;
- am_ClassProperty_s classProperty;
- am_sourceClass_t sourceClassID;
- classProperty.classProperty = CP_GENIVI_SINK_TYPE;
- classProperty.value = 1;
- classPropertyList.push_back(classProperty);
- classProperty.classProperty = CP_GENIVI_SOURCE_TYPE;
- classProperty.value = 4;
- classPropertyList.push_back(classProperty);
- sourceClass.name = "test";
- sourceClass.sourceClassID = 3;
- sourceClass.listClassProperties = classPropertyList;
-
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
- ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
- ASSERT_EQ(sourceClassList[0].sourceClassID, 3);
- ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
-}
-
-TEST_F(CAmDatabaseHandlerTest,removeSinkClass)
-{
- std::vector<am_SinkClass_s> sinkClassList;
- std::vector<am_ClassProperty_s> classPropertyList;
- am_SinkClass_s sinkClass;
- am_ClassProperty_s classProperty;
- am_sinkClass_t sinkClassID;
- classProperty.classProperty = CP_GENIVI_SINK_TYPE;
- classProperty.value = 1;
- classPropertyList.push_back(classProperty);
- classProperty.classProperty = CP_GENIVI_SOURCE_TYPE;
- classProperty.value = 4;
- classPropertyList.push_back(classProperty);
- sinkClass.name = "test";
- sinkClass.sinkClassID = 0;
- sinkClass.listClassProperties = classPropertyList;
-
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
- ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
- ASSERT_EQ(sinkClassList[0].sinkClassID, DYNAMIC_ID_BOUNDARY);
- ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
- ASSERT_EQ(E_OK, pDatabaseHandler.removeSinkClassDB(sinkClassID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
- ASSERT_TRUE(sinkClassList.empty());
-}
-
-TEST_F(CAmDatabaseHandlerTest,updateSinkClass)
-{
- std::vector<am_SinkClass_s> sinkClassList;
- std::vector<am_ClassProperty_s> classPropertyList, changedPropertyList;
- am_SinkClass_s sinkClass, changedClass;
- am_ClassProperty_s classProperty;
- am_sinkClass_t sinkClassID;
- classProperty.classProperty = CP_GENIVI_SINK_TYPE;
- classProperty.value = 1;
- classPropertyList.push_back(classProperty);
- classProperty.classProperty = CP_GENIVI_SOURCE_TYPE;
- classProperty.value = 4;
- classPropertyList.push_back(classProperty);
- sinkClass.name = "test";
- sinkClass.sinkClassID = 0;
- sinkClass.listClassProperties = classPropertyList;
- changedClass = sinkClass;
- changedClass.listClassProperties[1].value = 6;
- changedPropertyList = changedClass.listClassProperties;
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
- changedClass.sinkClassID = sinkClassID;
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
- ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
- ASSERT_EQ(sinkClassList[0].sinkClassID, DYNAMIC_ID_BOUNDARY);
- ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
- ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkClassInfoDB(changedClass));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
- ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
- ASSERT_EQ(sinkClassList[0].sinkClassID, DYNAMIC_ID_BOUNDARY);
- ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),changedPropertyList.begin(),equalClassProperties));
-}
-
-TEST_F(CAmDatabaseHandlerTest,enterSinkClass)
-{
- std::vector<am_SinkClass_s> sinkClassList;
- std::vector<am_ClassProperty_s> classPropertyList;
- am_SinkClass_s sinkClass;
- am_ClassProperty_s classProperty;
- am_sinkClass_t sinkClassID;
- classProperty.classProperty = CP_GENIVI_SINK_TYPE;
- classProperty.value = 1;
- classPropertyList.push_back(classProperty);
- classProperty.classProperty = CP_GENIVI_SOURCE_TYPE;
- classProperty.value = 4;
- classPropertyList.push_back(classProperty);
- sinkClass.name = "test";
- sinkClass.sinkClassID = 0;
- sinkClass.listClassProperties = classPropertyList;
-
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
- ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
- ASSERT_EQ(sinkClassList[0].sinkClassID, DYNAMIC_ID_BOUNDARY);
- ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
-}
-
-TEST_F(CAmDatabaseHandlerTest,enterSinkClassStatic)
-{
- std::vector<am_SinkClass_s> sinkClassList;
- std::vector<am_ClassProperty_s> classPropertyList;
- am_SinkClass_s sinkClass;
- am_ClassProperty_s classProperty;
- am_sinkClass_t sinkClassID;
- classProperty.classProperty = CP_GENIVI_SINK_TYPE;
- classProperty.value = 1;
- classPropertyList.push_back(classProperty);
- classProperty.classProperty = CP_GENIVI_SOURCE_TYPE;
- classProperty.value = 4;
- classPropertyList.push_back(classProperty);
- sinkClass.name = "test";
- sinkClass.sinkClassID = 4;
- sinkClass.listClassProperties = classPropertyList;
-
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
- ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
- ASSERT_EQ(sinkClassList[0].sinkClassID, 4);
- ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
-}
-
-TEST_F(CAmDatabaseHandlerTest, changeSystemProperty)
-{
- std::vector<am_SystemProperty_s> listSystemProperties, listReturn;
- am_SystemProperty_s systemProperty;
-
- systemProperty.type = SYP_UNKNOWN;
- systemProperty.value = 33;
- listSystemProperties.push_back(systemProperty);
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSystemProperties(listSystemProperties));
- systemProperty.value = 444;
- ASSERT_EQ(E_OK, pDatabaseHandler.changeSystemPropertyDB(systemProperty));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSystemProperties(listReturn));
- ASSERT_EQ(listReturn[0].type, systemProperty.type);
- ASSERT_EQ(listReturn[0].value, systemProperty.value);
-}
-
-TEST_F(CAmDatabaseHandlerTest, systemProperties)
-{
- std::vector<am_SystemProperty_s> listSystemProperties, listReturn;
- am_SystemProperty_s systemProperty;
-
- systemProperty.type = SYP_UNKNOWN;
- systemProperty.value = 33;
- listSystemProperties.push_back(systemProperty);
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSystemProperties(listSystemProperties));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSystemProperties(listReturn));
- ASSERT_EQ(listReturn[0].type, systemProperty.type);
- ASSERT_EQ(listReturn[0].value, systemProperty.value);
-}
-
-TEST_F(CAmDatabaseHandlerTest,enterSourcesCorrect)
-{
- //fill the connection database
- am_Source_s staticSource, firstDynamicSource, secondDynamicSource;
- am_sourceID_t staticSourceID, firstDynamicSourceID, secondDynamicSourceID;
- std::vector<am_Source_s> sourceList;
-
- pCF.createSource(staticSource);
- staticSource.sourceID = 4;
- staticSource.name = "Static";
-
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(staticSource,staticSourceID))
- << "ERROR: database error";
- ASSERT_EQ(staticSource.sourceID,staticSourceID)
- << "ERROR: ID not the one given in staticSource";
-
- pCF.createSource(firstDynamicSource);
- firstDynamicSource.name = "firstDynamicSource";
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(firstDynamicSource,firstDynamicSourceID))
- << "ERROR: database error";
- ASSERT_EQ(firstDynamicSourceID,DYNAMIC_ID_BOUNDARY)
- << "ERROR: ID not the one given in firstDynamicSink";
-
- pCF.createSource(secondDynamicSource);
- secondDynamicSource.name = "secondDynamicSource";
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(secondDynamicSource,secondDynamicSourceID))
- << "ERROR: database error";
- ASSERT_NEAR(secondDynamicSourceID,DYNAMIC_ID_BOUNDARY,10)
- << "ERROR: ID not the one given in secondDynamicSink";
-
- //now read back and check the returns agains the given values
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(sourceList))
- << "ERROR: database error";
- bool equal = true;
-
- std::vector<am_Source_s>::iterator listIterator = sourceList.begin();
- for (; listIterator < sourceList.end(); ++listIterator)
- {
- if (listIterator->sourceID == staticSourceID)
- {
- equal = equal && pCF.compareSource(listIterator, staticSource);
- }
-
- if (listIterator->sourceID == firstDynamicSourceID)
- {
- equal = equal && pCF.compareSource(listIterator, firstDynamicSource);
- }
-
- if (listIterator->sourceID == secondDynamicSourceID)
- {
- equal = equal && pCF.compareSource(listIterator, secondDynamicSource);
- }
-
- }
- ASSERT_EQ(true, equal);
-}
-
-TEST_F(CAmDatabaseHandlerTest, changeSourceMainSoundProperty)
-{
- std::vector<am_Source_s> listSources;
- am_Source_s source;
- am_sourceID_t sourceID;
- pCF.createSource(source);
- am_MainSoundProperty_s property;
- property.type = MSP_UNKNOWN;
- property.value = 33;
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
-
- ASSERT_EQ(E_OK, pDatabaseHandler.changeMainSourceSoundPropertyDB(property,sourceID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
- std::vector<am_MainSoundProperty_s>::iterator listIterator = listSources[0].listMainSoundProperties.begin();
- for (; listIterator < listSources[0].listMainSoundProperties.end(); ++listIterator)
- {
- if (listIterator->type == property.type)
- {
- ASSERT_EQ(listIterator->value, property.value);
- }
- }
- int16_t value;
- ASSERT_EQ(E_OK, pDatabaseHandler.getMainSourceSoundPropertyValue(sourceID, property.type, value));
- ASSERT_EQ(value, property.value);
-
- ASSERT_EQ(E_OK, pDatabaseHandler.changeMainSourceSoundPropertyDB({property.type, 34},sourceID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getMainSourceSoundPropertyValue(sourceID, property.type, value));
- ASSERT_EQ(value, 34);
-}
-
-TEST_F(CAmDatabaseHandlerTest, changeSinkMuteState)
-{
- std::vector<am_Sink_s> listSinks;
- am_Sink_s sink;
- am_sinkID_t sinkID;
- pCF.createSink(sink);
- am_MuteState_e muteState = MS_MUTED;
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
-
- ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkMuteStateDB(muteState,sinkID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
- ASSERT_EQ(muteState, listSinks[0].muteState);
-}
-
-TEST_F(CAmDatabaseHandlerTest, changeSinkMainSoundProperty)
-{
- std::vector<am_Sink_s> listSinks;
- am_Sink_s sink;
- am_sinkID_t sinkID;
- pCF.createSink(sink);
- am_MainSoundProperty_s property;
- property.type = MSP_UNKNOWN;
- property.value = 33;
-
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
-
- ASSERT_EQ(E_OK, pDatabaseHandler.changeMainSinkSoundPropertyDB(property,sinkID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
- std::vector<am_MainSoundProperty_s>::iterator listIterator = listSinks[0].listMainSoundProperties.begin();
- for (; listIterator < listSinks[0].listMainSoundProperties.end(); ++listIterator)
- {
- if (listIterator->type == property.type)
- {
- ASSERT_EQ(listIterator->value, property.value);
- }
- }
-
- int16_t value;
- ASSERT_EQ(E_OK, pDatabaseHandler.getMainSinkSoundPropertyValue(sinkID, property.type, value));
- ASSERT_EQ(value, property.value);
-
- ASSERT_EQ(E_OK, pDatabaseHandler.changeMainSinkSoundPropertyDB({property.type, 34},sinkID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getMainSinkSoundPropertyValue(sinkID, property.type, value));
- ASSERT_EQ(value, 34);
-}
-
-TEST_F(CAmDatabaseHandlerTest, changeSourceSoundProperty)
-{
- std::vector<am_Source_s> listSources;
- am_Source_s source;
- am_sourceID_t sourceID;
- pCF.createSource(source);
- am_SoundProperty_s property;
- property.type = SP_GENIVI_MID;
- property.value = 33;
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
-
- ASSERT_EQ(E_OK, pDatabaseHandler.changeSourceSoundPropertyDB(property,sourceID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
-
- std::vector<am_SoundProperty_s>::iterator listIterator = listSources[0].listSoundProperties.begin();
- for (; listIterator < listSources[0].listSoundProperties.end(); ++listIterator)
- {
- if (listIterator->type == property.type)
- ASSERT_EQ(listIterator->value, property.value);
- }
- int16_t value;
- ASSERT_EQ(E_OK, pDatabaseHandler.getSourceSoundPropertyValue(sourceID, property.type, value));
- ASSERT_EQ(value, property.value);
-
- ASSERT_EQ(E_OK, pDatabaseHandler.changeSourceSoundPropertyDB({property.type, 34},sourceID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getSourceSoundPropertyValue(sourceID, property.type, value));
- ASSERT_EQ(value, 34);
-}
-
-TEST_F(CAmDatabaseHandlerTest, changeSinkSoundProperty)
-{
- std::vector<am_Sink_s> listSinks;
- am_Sink_s sink;
- am_sinkID_t sinkID;
- pCF.createSink(sink);
- am_SoundProperty_s property;
- property.type = SP_GENIVI_MID;
- property.value = 33;
-
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
-
- ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkSoundPropertyDB(property,sinkID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
- std::vector<am_SoundProperty_s>::iterator listIterator = listSinks[0].listSoundProperties.begin();
- for (; listIterator < listSinks[0].listSoundProperties.end(); ++listIterator)
- {
- if (listIterator->type == property.type)
- ASSERT_EQ(listIterator->value, property.value);
- }
-
- int16_t value;
- ASSERT_EQ(E_OK, pDatabaseHandler.getSinkSoundPropertyValue(sinkID, property.type, value));
- ASSERT_EQ(value, property.value);
-
- ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkSoundPropertyDB({property.type, 34},sinkID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getSinkSoundPropertyValue(sinkID, property.type, value));
- ASSERT_EQ(value, 34);
-}
-
-TEST_F(CAmDatabaseHandlerTest, peekDomain)
-{
- std::vector<am_Domain_s> listDomains;
- am_Domain_s domain;
- am_domainID_t domainID;
- am_domainID_t domain2ID;
- pCF.createDomain(domain);
- ASSERT_EQ(E_OK, pDatabaseHandler.peekDomain(std::string("newdomain"),domainID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(listDomains));
- ASSERT_TRUE(listDomains.empty());
- ASSERT_EQ(domainID, 1);
- domain.name = "newdomain";
- ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domain2ID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(listDomains));
- ASSERT_EQ(domainID, domain2ID);
- ASSERT_TRUE(listDomains[0].domainID==domainID);
-}
-
-TEST_F(CAmDatabaseHandlerTest, peekDomainFirstEntered)
-{
- std::vector<am_Domain_s> listDomains;
- am_Domain_s domain;
- am_domainID_t domainID;
- am_domainID_t domain2ID;
- pCF.createDomain(domain);
- domain.name = "newdomain";
- ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK, pDatabaseHandler.peekDomain(std::string("newdomain"),domain2ID));
- ASSERT_EQ(domainID, domain2ID);
- ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(listDomains));
- ASSERT_TRUE(listDomains.size()==1);
-}
-
-TEST_F(CAmDatabaseHandlerTest, changeDomainState)
-{
- std::vector<am_Domain_s> listDomains;
- am_Domain_s domain;
- am_domainID_t domainID;
- pCF.createDomain(domain);
- am_DomainState_e newState = DS_INDEPENDENT_STARTUP;
- ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK, pDatabaseHandler.changDomainStateDB(newState,domainID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(listDomains));
- ASSERT_EQ(newState, listDomains[0].state);
-}
-
-TEST_F(CAmDatabaseHandlerTest, changeMainConnectionState)
-{
- std::vector<am_MainConnection_s> listMainConnections;
- createMainConnectionSetup();
-
- ASSERT_EQ(E_OK, pDatabaseHandler.changeMainConnectionStateDB(1,CS_DISCONNECTING));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListMainConnections(listMainConnections));
- ASSERT_EQ(CS_DISCONNECTING, listMainConnections[0].connectionState);
-}
-
-TEST_F(CAmDatabaseHandlerTest, changeSinkAvailability)
-{
- std::vector<am_Sink_s> listSinks;
- am_Sink_s sink;
- am_sinkID_t sinkID;
- pCF.createSink(sink);
- am_Availability_s availability;
- availability.availability = A_UNKNOWN;
- availability.availabilityReason = AR_GENIVI_TEMPERATURE;
-
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
- ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkAvailabilityDB(availability,sinkID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
- ASSERT_EQ(availability.availability, listSinks[0].available.availability);
- ASSERT_EQ(availability.availabilityReason, listSinks[0].available.availabilityReason);
-}
-
-TEST_F(CAmDatabaseHandlerTest, changeSourceAvailability)
-{
- std::vector<am_Source_s> listSources;
- am_Source_s source;
- am_sourceID_t sourceID;
- pCF.createSource(source);
- am_Availability_s availability;
- availability.availability = A_UNKNOWN;
- availability.availabilityReason = AR_GENIVI_TEMPERATURE;
- source.visible = true;
-
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
- ASSERT_EQ(E_OK, pDatabaseHandler.changeSourceAvailabilityDB(availability,sourceID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
- ASSERT_EQ(availability.availability, listSources[0].available.availability);
- ASSERT_EQ(availability.availabilityReason, listSources[0].available.availabilityReason);
-}
-
-TEST_F(CAmDatabaseHandlerTest,changeMainConnectionRoute)
-{
- std::vector<am_MainConnection_s> originalList;
- std::vector<am_MainConnection_s> newList;
- createMainConnectionSetup();
- //fill the connection database
- am_Connection_s connection;
- am_Source_s source;
- am_Sink_s sink;
- std::vector<am_connectionID_t> listConnectionID;
-
-
-
- for (uint16_t i = 1; i < 10; i++)
- {
- am_sinkID_t forgetSink;
- am_sourceID_t forgetSource;
- am_connectionID_t connectionID;
-
- connection.sinkID = i + 20;
- connection.sourceID = i + 20;
- connection.delay = -1;
- connection.connectionFormat = CF_GENIVI_ANALOG;
- connection.connectionID = 0;
-
- pCF.createSink(sink);
- sink.sinkID = i + 20;
- sink.name = "sink" + int2string(i + 20);
- sink.domainID = 4;
- pCF.createSource(source);
- source.sourceID = i + 20;
- source.name = "source" + int2string(i + 30);
- source.domainID = 4;
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,forgetSink));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,forgetSource));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterConnectionDB(connection,connectionID));
- listConnectionID.push_back(connectionID);
- ASSERT_EQ(E_OK, pDatabaseHandler.getListMainConnections(originalList));
-
- }
-
- ASSERT_EQ(E_OK, pDatabaseHandler.changeMainConnectionRouteDB(1,listConnectionID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListMainConnections(newList));
- ASSERT_FALSE(std::equal(newList[0].listConnectionID.begin(),newList[0].listConnectionID.end(),originalList[0].listConnectionID.begin()));
-}
-
-TEST_F(CAmDatabaseHandlerTest,changeMainSinkVolume)
-{
- am_Sink_s sink;
- am_sinkID_t sinkID;
- am_mainVolume_t newVol = 20;
- std::vector<am_Sink_s> listSinks;
- pCF.createSink(sink);
-
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
-
- ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkMainVolumeDB(newVol,sinkID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
- ASSERT_EQ(listSinks[0].mainVolume, newVol);
-}
-
-TEST_F(CAmDatabaseHandlerTest,getMainSourceSoundProperties)
-{
- am_Source_s source;
- am_sourceID_t sourceID;
- pCF.createSource(source);
- std::vector<am_MainSoundProperty_s> mainSoundProperties = source.listMainSoundProperties;
- std::vector<am_MainSoundProperty_s> listMainSoundProperties;
-
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListMainSourceSoundProperties(sourceID,listMainSoundProperties));
- ASSERT_TRUE(std::equal(mainSoundProperties.begin(),mainSoundProperties.end(),listMainSoundProperties.begin(),equalMainSoundProperty));
-}
-
-TEST_F(CAmDatabaseHandlerTest,getMainSinkSoundProperties)
-{
- am_Sink_s sink;
- am_sinkID_t sinkID;
- pCF.createSink(sink);
- std::vector<am_MainSoundProperty_s> mainSoundProperties = sink.listMainSoundProperties;
- std::vector<am_MainSoundProperty_s> listMainSoundProperties;
-
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListMainSinkSoundProperties(sinkID,listMainSoundProperties));
- ASSERT_TRUE(std::equal(mainSoundProperties.begin(),mainSoundProperties.end(),listMainSoundProperties.begin(),equalMainSoundProperty));
-}
-
-TEST_F(CAmDatabaseHandlerTest,getMainSources)
-{
- am_Source_s source, source1, source2;
- am_sourceID_t sourceID;
- pCF.createSource(source);
- pCF.createSource(source1);
- pCF.createSource(source2);
- source1.name = "source1";
- source2.name = "source2";
- bool equal = true;
- source1.visible = false;
- std::vector<am_SourceType_s> listMainSources;
- std::vector<am_Source_s> listSources;
-
-
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
- source.sourceID = sourceID;
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source1,sourceID));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source2,sourceID));
- source2.sourceID = sourceID;
- ASSERT_EQ(E_OK, pDatabaseHandler.getListMainSources(listMainSources));
- listSources.push_back(source);
- listSources.push_back(source2);
- std::vector<am_SourceType_s>::iterator listIterator = listMainSources.begin();
- for (; listIterator < listMainSources.end(); ++listIterator)
- {
- equal = equal && pCF.compareSinkMainSource(listIterator, listSources);
- }
- ASSERT_TRUE(equal);
-}
-
-TEST_F(CAmDatabaseHandlerTest,getMainSinks)
-{
- am_Sink_s sink, sink1, sink2;
- am_sinkID_t sinkID;
- pCF.createSink(sink);
- pCF.createSink(sink1);
- pCF.createSink(sink2);
- sink1.name = "sink1";
- sink2.name = "sink2";
- bool equal = true;
- sink1.visible = false;
- std::vector<am_SinkType_s> listMainSinks;
- std::vector<am_Sink_s> listSinks;
-
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
- sink.sinkID = sinkID;
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink1,sinkID));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink2,sinkID));
- sink2.sinkID = sinkID;
- ASSERT_EQ(E_OK, pDatabaseHandler.getListMainSinks(listMainSinks));
- listSinks.push_back(sink);
- listSinks.push_back(sink2);
- std::vector<am_SinkType_s>::iterator listIterator = listMainSinks.begin();
- for (; listIterator < listMainSinks.end(); ++listIterator)
- {
- equal = equal && pCF.compareSinkMainSink(listIterator, listSinks);
- }
- ASSERT_TRUE(equal);
-}
-
-TEST_F(CAmDatabaseHandlerTest,getVisibleMainConnections)
-{
- createMainConnectionSetup();
- std::vector<am_MainConnectionType_s> listVisibleMainConnections;
- std::vector<am_MainConnection_s> listMainConnections;
- ASSERT_EQ(E_OK, pDatabaseHandler.getListVisibleMainConnections(listVisibleMainConnections));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListMainConnections(listMainConnections));
- ASSERT_EQ(listMainConnections[0].mainConnectionID, listVisibleMainConnections[0].mainConnectionID);
- ASSERT_EQ(listMainConnections[0].connectionState, listVisibleMainConnections[0].connectionState);
- ASSERT_EQ(listMainConnections[0].delay, listVisibleMainConnections[0].delay);
- ASSERT_EQ(listMainConnections[0].sinkID, listVisibleMainConnections[0].sinkID);
- ASSERT_EQ(listMainConnections[0].sourceID, listVisibleMainConnections[0].sourceID);
-}
-
-TEST_F(CAmDatabaseHandlerTest,getListSourcesOfDomain)
-{
- am_Source_s source, source2;
- am_Domain_s domain;
- am_domainID_t domainID;
- am_sourceID_t sourceID;
- std::vector<am_sourceID_t> sourceList, sourceCheckList;
- pCF.createSource(source);
- source.sourceID = 1;
- source.name = "testSource";
- source.domainID = 1;
- pCF.createSource(source2);
- source2.sourceID = 0;
- source2.name = "testSource2";
- source2.domainID = 5;
- pCF.createDomain(domain);
- sourceCheckList.push_back(1); //sink.sinkID);
-
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID))
- << "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source2,sourceID))
- << "ERROR: database error";
- ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.getListSourcesOfDomain(2,sourceList))
- << "ERROR: database error";ASSERT_TRUE(sourceList.empty());
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSourcesOfDomain(1,sourceList))
- << "ERROR: database error";
- ASSERT_TRUE(std::equal(sourceList.begin(),sourceList.end(),sourceCheckList.begin()) && !sourceList.empty());
-}
-
-TEST_F(CAmDatabaseHandlerTest,getListSinksOfDomain)
-{
- am_Sink_s sink, sink2;
- am_Domain_s domain;
- am_domainID_t domainID;
- am_sinkID_t sinkID;
- std::vector<am_sinkID_t> sinkList, sinkCheckList;
- pCF.createSink(sink);
- sink.sinkID = 1;
- sink.domainID = 1;
- pCF.createSink(sink2);
- sink2.domainID = 5;
- sink2.name = "sink2";
- pCF.createDomain(domain);
- sinkCheckList.push_back(1); //sink.sinkID);
-
-
- ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID))
- << "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink2,sinkID))
- << "ERROR: database error";
- ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.getListSinksOfDomain(2,sinkList))
- << "ERROR: database error";ASSERT_TRUE(sinkList.empty());
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinksOfDomain(1,sinkList))
- << "ERROR: database error";
- ASSERT_TRUE(std::equal(sinkList.begin(),sinkList.end(),sinkCheckList.begin()) && !sinkList.empty());
-}
-
-TEST_F(CAmDatabaseHandlerTest,getListGatewaysOfDomain)
-{
- am_Gateway_s gateway, gateway2;
- am_gatewayID_t gatewayID;
- am_domainID_t domainID;
- am_Domain_s domain;
- std::vector<am_gatewayID_t> gatewayList, gatewayCheckList;
- pCF.createGateway(gateway);
- gateway.gatewayID = 1;
- gateway.name = "testGateway";
- gateway.controlDomainID = 1;
- gateway.sourceID = 1;
- gateway.sinkID = 1;
- gateway.domainSinkID = 1;
- gateway.domainSourceID = 1;
- pCF.createGateway(gateway2);
- gateway2.gatewayID = 2;
- gateway2.name = "testGateway2";
- gateway2.controlDomainID = 4;
- gateway2.sourceID = 1;
- gateway2.sinkID = 1;
- gateway2.domainSinkID = 1;
- gateway2.domainSourceID = 1;
- pCF.createDomain(domain);
- gatewayCheckList.push_back(gateway.gatewayID);
- am_Sink_s sink;
- am_Source_s source;
- am_sinkID_t sinkID;
- am_sourceID_t sourceID;
- pCF.createSink(sink);
- pCF.createSource(source);
- sink.sinkID = 1;
- source.sourceID = 1;
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway,gatewayID))
- << "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway2,gatewayID))
- << "ERROR: database error";
- ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.getListGatewaysOfDomain(2,gatewayList))
- << "ERROR: database error";ASSERT_TRUE(gatewayList.empty());
- ASSERT_EQ(E_OK,pDatabaseHandler.getListGatewaysOfDomain(1,gatewayList))
- << "ERROR: database error";
- ASSERT_TRUE(std::equal(gatewayList.begin(),gatewayList.end(),gatewayCheckList.begin()) && !gatewayList.empty());
-}
-
-TEST_F(CAmDatabaseHandlerTest,getListConvertersOfDomain)
-{
- am_Converter_s gateway, gateway2;
- am_converterID_t gatewayID;
- am_domainID_t domainID;
- am_Domain_s domain;
- std::vector<am_converterID_t> gatewayList, gatewayCheckList;
- pCF.createConverter(gateway);
- gateway.converterID = 1;
- gateway.name = "testGateway";
- gateway.sourceID = 1;
- gateway.sinkID = 1;
- gateway.domainID = 1;
- pCF.createConverter(gateway2);
- gateway2.converterID = 2;
- gateway2.name = "testGateway2";
- gateway2.sourceID = 1;
- gateway2.sinkID = 1;
- gateway2.domainID = 1;
- pCF.createDomain(domain);
- gatewayCheckList.push_back(gateway.converterID);
- gatewayCheckList.push_back(gateway2.converterID);
- am_Sink_s sink;
- am_Source_s source;
- am_sinkID_t sinkID;
- am_sourceID_t sourceID;
- pCF.createSink(sink);
- pCF.createSource(source);
- sink.sinkID = 1;
- source.sourceID = 1;
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway,gatewayID))
- << "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway2,gatewayID))
- << "ERROR: database error";
- ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.getListConvertersOfDomain(2,gatewayList))
- << "ERROR: database error";ASSERT_TRUE(gatewayList.empty());
- ASSERT_EQ(E_OK,pDatabaseHandler.getListConvertersOfDomain(1,gatewayList))
- << "ERROR: database error";
- ASSERT_TRUE(!gatewayList.empty());
- ASSERT_TRUE(std::equal(gatewayList.begin(),gatewayList.end(),gatewayCheckList.begin()));
-}
-
-TEST_F(CAmDatabaseHandlerTest,removeDomain)
-{
- am_Domain_s domain;
- am_domainID_t domainID;
- std::vector<am_Domain_s> listDomains;
- pCF.createDomain(domain);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID))
- << "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.removeDomainDB(domainID))
- << "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.getListDomains(listDomains))
- << "ERROR: database error";
- ASSERT_TRUE(listDomains.empty());
-}
-
-TEST_F(CAmDatabaseHandlerTest,removeGateway)
-{
-
-
- am_Gateway_s gateway;
- am_gatewayID_t gatewayID;
- std::vector<am_Gateway_s> listGateways;
- pCF.createGateway(gateway);
- am_Sink_s sink;
- am_Source_s source;
- am_sinkID_t sinkID;
- am_sourceID_t sourceID;
- pCF.createSink(sink);
- pCF.createSource(source);
- sink.sinkID = 1;
- source.sourceID = 2;
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway,gatewayID))
- << "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.removeGatewayDB(gatewayID))
- << "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.getListGateways(listGateways))
- << "ERROR: database error";
- ASSERT_TRUE(listGateways.empty());
-}
-
-TEST_F(CAmDatabaseHandlerTest,removeConverter)
-{
- am_Converter_s gateway;
- am_converterID_t gatewayID;
- std::vector<am_Converter_s> listGateways;
- pCF.createConverter(gateway);
- am_Sink_s sink;
- am_Source_s source;
- am_sinkID_t sinkID;
- am_sourceID_t sourceID;
- pCF.createSink(sink);
- pCF.createSource(source);
- sink.sinkID = 1;
- source.sourceID = 2;
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway,gatewayID))
- << "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.removeConverterDB(gatewayID))
- << "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.getListConverters(listGateways))
- << "ERROR: database error";
- ASSERT_TRUE(listGateways.empty());
-}
-
-TEST_F(CAmDatabaseHandlerTest,removeSink)
-{
- am_Sink_s sink;
- am_sinkID_t sinkID;
- std::vector<am_Sink_s> listSinks;
- pCF.createSink(sink);
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID))
- << "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.removeSinkDB(sinkID))
- << "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks))
- << "ERROR: database error";
- ASSERT_TRUE(listSinks.empty());
-}
-
-TEST_F(CAmDatabaseHandlerTest,removeSource)
-{
- //fill the connection database
- am_Source_s source;
- am_sourceID_t sourceID;
- std::vector<am_Source_s> listSources;
- pCF.createSource(source);
-
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID))
- << "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.removeSourceDB(sourceID))
- << "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources))
- << "ERROR: database error";
- ASSERT_TRUE(listSources.empty());
-}
-
-TEST_F(CAmDatabaseHandlerTest, removeMainConnection)
-{
- createMainConnectionSetup();
-
-
- ASSERT_EQ(E_OK,pDatabaseHandler.removeMainConnectionDB(1))
- << "ERROR: database error";
-}
-
-TEST_F(CAmDatabaseHandlerTest,removeNonexistentMainConnectionFail)
-{
- ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeMainConnectionDB(34))
- << "ERROR: database error";
-}
-
-TEST_F(CAmDatabaseHandlerTest,removeNonexistentSource)
-{
- ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeSourceDB(3))
- << "ERROR: database error";
-}
-
-TEST_F(CAmDatabaseHandlerTest,removeNonexistentSink)
-{
- ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeSinkDB(2))
- << "ERROR: database error";
-}
-
-TEST_F(CAmDatabaseHandlerTest,removeNonexistentGateway)
-{
- ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeGatewayDB(12))
- << "ERROR: database error";
-}
-
-TEST_F(CAmDatabaseHandlerTest,removeNonexistentConverter)
-{
- ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeConverterDB(12))
- << "ERROR: database error";
-}
-
-TEST_F(CAmDatabaseHandlerTest,registerGatewayCorrect)
-{
- //initialize gateway
- std::vector<am_Gateway_s> returnList;
- am_Gateway_s gateway, gateway1, gateway2;
- am_gatewayID_t gatewayID = 0, gatewayID1 = 0, gatewayID2 = 0;
-
- pCF.createGateway(gateway);
- pCF.createGateway(gateway1);
- gateway1.gatewayID = 20;
- pCF.createGateway(gateway2);
- am_Sink_s sink;
- am_Source_s source;
- am_sinkID_t sinkID;
- am_sourceID_t sourceID;
- pCF.createSink(sink);
- pCF.createSource(source);
- sink.sinkID = 1;
- source.sourceID = 2;
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway,gatewayID))
- << "ERROR: database error";
- ASSERT_EQ(DYNAMIC_ID_BOUNDARY,gatewayID)
- << "ERROR: domainID zero";
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway1,gatewayID1))
- << "ERROR: database error";
- ASSERT_EQ(gateway1.gatewayID,gatewayID1)
- << "ERROR: domainID zero";
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway2,gatewayID2))
- << "ERROR: database error";
- ASSERT_EQ(DYNAMIC_ID_BOUNDARY+1,gatewayID2)
- << "ERROR: domainID zero";
-
- //now check if we read out the correct values
- ASSERT_EQ(E_OK, pDatabaseHandler.getListGateways(returnList));
- bool equal = true;
- std::vector<am_Gateway_s>::iterator listIterator = returnList.begin();
-
- for (; listIterator < returnList.end(); ++listIterator)
- {
- if (listIterator->gatewayID == gatewayID)
- {
- equal = equal && pCF.compareGateway(listIterator, gateway);
- }
-
- if (listIterator->gatewayID == gatewayID1)
- {
- equal = equal && pCF.compareGateway(listIterator, gateway1);
- }
-
- if (listIterator->gatewayID == gatewayID2)
- {
- equal = equal && pCF.compareGateway(listIterator, gateway2);
- }
- }
-
- ASSERT_EQ(true, equal);
-}
-
-TEST_F(CAmDatabaseHandlerTest,registerConverterCorrect)
-{
- //initialize gateway
- std::vector<am_Converter_s> returnList;
- am_Converter_s gateway, gateway1, gateway2;
- am_converterID_t converterID = 0, converterID1 = 0, converterID2 = 0;
-
- pCF.createConverter(gateway);
- pCF.createConverter(gateway1);
- gateway1.converterID = 20;
- pCF.createConverter(gateway2);
- am_Sink_s sink;
- am_Source_s source;
- am_sinkID_t sinkID;
- am_sourceID_t sourceID;
- pCF.createSink(sink);
- pCF.createSource(source);
- sink.sinkID = 1;
- source.sourceID = 2;
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway,converterID))
- << "ERROR: database error";
- ASSERT_EQ(DYNAMIC_ID_BOUNDARY,converterID)
- << "ERROR: domainID zero";
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway1,converterID1))
- << "ERROR: database error";
- ASSERT_EQ(gateway1.converterID,converterID1)
- << "ERROR: domainID zero";
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway2,converterID2))
- << "ERROR: database error";
- ASSERT_EQ(DYNAMIC_ID_BOUNDARY+1,converterID2)
- << "ERROR: domainID zero";
-
- //now check if we read out the correct values
- ASSERT_EQ(E_OK, pDatabaseHandler.getListConverters(returnList));
- bool equal = true;
- std::vector<am_Converter_s>::iterator listIterator = returnList.begin();
-
- for (; listIterator < returnList.end(); ++listIterator)
- {
- if (listIterator->converterID == converterID)
- {
- equal = equal && pCF.compareConverter(listIterator, gateway);
- }
-
- if (listIterator->converterID == converterID1)
- {
- equal = equal && pCF.compareConverter(listIterator, gateway1);
- }
-
- if (listIterator->converterID == converterID2)
- {
- equal = equal && pCF.compareConverter(listIterator, gateway2);
- }
- }
-
- ASSERT_EQ(true, equal);
-}
-
-TEST_F(CAmDatabaseHandlerTest,getGatewayInfo)
-{
- //initialize gateway
- std::vector<am_Gateway_s> returnList;
- am_Gateway_s gateway, gateway1, gateway2;
- am_gatewayID_t gatewayID = 0, gatewayID1 = 0, gatewayID2 = 0;
-
- pCF.createGateway(gateway);
- pCF.createGateway(gateway1);
- gateway1.gatewayID = 20;
- pCF.createGateway(gateway2);
- am_Sink_s sink;
- am_Source_s source;
- am_sinkID_t sinkID;
- am_sourceID_t sourceID;
- pCF.createSink(sink);
- pCF.createSource(source);
- sink.sinkID = 1;
- source.sourceID = 2;
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway,gatewayID))
- << "ERROR: database error";
- ASSERT_EQ(DYNAMIC_ID_BOUNDARY,gatewayID)
- << "ERROR: domainID zero";
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway1,gatewayID1))
- << "ERROR: database error";
- ASSERT_EQ(gateway1.gatewayID,gatewayID1)
- << "ERROR: domainID zero";
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway2,gatewayID2))
- << "ERROR: database error";
- ASSERT_EQ(DYNAMIC_ID_BOUNDARY+1,gatewayID2)
- << "ERROR: domainID zero";
-
- //now check if we read out the correct values
- ASSERT_EQ(E_OK, pDatabaseHandler.getListGateways(returnList));
- bool equal = true;
- std::vector<am_Gateway_s>::iterator listIterator = returnList.begin();
-
- for (; listIterator < returnList.end(); ++listIterator)
- {
- if (listIterator->gatewayID == gatewayID)
- {
- equal = equal && pCF.compareGateway(listIterator, gateway);
- }
-
- if (listIterator->gatewayID == gatewayID1)
- {
- equal = equal && pCF.compareGateway(listIterator, gateway1);
- }
-
- if (listIterator->gatewayID == gatewayID2)
- {
- equal = equal && pCF.compareGateway(listIterator, gateway2);
- }
- }
-
- ASSERT_EQ(true, equal);
-
- am_Gateway_s gatewayInfo;
- ASSERT_EQ(E_OK, pDatabaseHandler.getGatewayInfoDB(20,gatewayInfo));
- ASSERT_TRUE(pCF.compareGateway1(gateway1,gatewayInfo));
-
-}
-
-TEST_F(CAmDatabaseHandlerTest,getConverterInfo)
-{
- //initialize gateway
- std::vector<am_Converter_s> returnList;
- am_Converter_s gateway, gateway1, gateway2;
- am_converterID_t converterID = 0, converterID1 = 0, converterID2 = 0;
-
- pCF.createConverter(gateway);
- pCF.createConverter(gateway1);
- gateway1.converterID = 20;
- pCF.createConverter(gateway2);
- am_Sink_s sink;
- am_Source_s source;
- am_sinkID_t sinkID;
- am_sourceID_t sourceID;
- pCF.createSink(sink);
- pCF.createSource(source);
- sink.sinkID = 1;
- source.sourceID = 2;
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway,converterID))
- << "ERROR: database error";
- ASSERT_EQ(DYNAMIC_ID_BOUNDARY,converterID)
- << "ERROR: domainID zero";
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway1,converterID1))
- << "ERROR: database error";
- ASSERT_EQ(gateway1.converterID,converterID1)
- << "ERROR: domainID zero";
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway2,converterID2))
- << "ERROR: database error";
- ASSERT_EQ(DYNAMIC_ID_BOUNDARY+1,converterID2)
- << "ERROR: domainID zero";
-
- //now check if we read out the correct values
- ASSERT_EQ(E_OK, pDatabaseHandler.getListConverters(returnList));
- bool equal = true;
- std::vector<am_Converter_s>::iterator listIterator = returnList.begin();
-
- for (; listIterator < returnList.end(); ++listIterator)
- {
- if (listIterator->converterID == converterID)
- {
- equal = equal && pCF.compareConverter(listIterator, gateway);
- }
-
- if (listIterator->converterID == converterID1)
- {
- equal = equal && pCF.compareConverter(listIterator, gateway1);
- }
-
- if (listIterator->converterID == converterID2)
- {
- equal = equal && pCF.compareConverter(listIterator, gateway2);
- }
- }
-
- ASSERT_EQ(true, equal);
-
- am_Converter_s gatewayInfo;
- ASSERT_EQ(E_OK, pDatabaseHandler.getConverterInfoDB(20,gatewayInfo));
- ASSERT_TRUE(pCF.compareConverter1(gateway1,gatewayInfo));
-
-}
-
-TEST_F(CAmDatabaseHandlerTest,enterSinkThatAlreadyExistFail)
-{
- //fill the connection database
- am_Sink_s staticSink, SecondSink;
- am_sinkID_t staticSinkID, SecondSinkID;
-
- pCF.createSink(staticSink);
- staticSink.sinkID = 43;
- staticSink.name = "Static";
-
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(staticSink,staticSinkID))
- << "ERROR: database error";
- ASSERT_EQ(staticSink.sinkID,staticSinkID)
- << "ERROR: ID not the one given in staticSink";
-
- pCF.createSink(SecondSink);
- SecondSink.sinkID = 43;
- SecondSink.name = "SecondSink";
-
- ASSERT_EQ(E_ALREADY_EXISTS,pDatabaseHandler.enterSinkDB(SecondSink,SecondSinkID))
- << "ERROR: database error";
-}
-
-TEST_F(CAmDatabaseHandlerTest,enterSourcesThatAlreadyExistFail)
-{
- //fill the connection database
- am_Source_s staticSource, SecondSource;
- am_sourceID_t staticSourceID, SecondSourceID;
- pCF.createSource(staticSource);
- staticSource.sourceID = 4;
-
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(staticSource,staticSourceID))
- << "ERROR: database error";
- ASSERT_EQ(staticSource.sourceID,staticSourceID)
- << "ERROR: ID not the one given in staticSource";
-
- pCF.createSource(SecondSource);
- SecondSource.sourceID = 4;
-
- ASSERT_EQ(E_ALREADY_EXISTS,pDatabaseHandler.enterSourceDB(SecondSource,SecondSourceID))
- << "ERROR: database error";
-}
-
-TEST_F(CAmDatabaseHandlerTest,registerDomainCorrect)
-{
- //initialize domain
- std::vector<am_Domain_s> returnList;
- am_Domain_s domain;
- am_domainID_t domainID = 0;
- pCF.createDomain(domain);
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID))
- << "ERROR: database error";
- ASSERT_NE(0,domainID)
- << "ERROR: domainID zero";
-
- //now check if we read out the correct values
- ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(returnList));
- bool equal = true;
- std::vector<am_Domain_s>::iterator listIterator = returnList.begin();
- for (; listIterator < returnList.end(); ++listIterator)
- {
- if (listIterator->domainID == domainID)
- {
- equal = equal && (listIterator->name.compare(domain.name) == 0) && (listIterator->busname.compare(domain.busname) == 0) && (listIterator->complete == domain.complete) && (listIterator->early == domain.early) && (listIterator->state == domain.state);
- }
- }
- ASSERT_EQ(true, equal);
-}
-
-TEST_F(CAmDatabaseHandlerTest,registerConnectionCorrect)
-{
- am_Connection_s connection;
- am_connectionID_t connectionID;
- std::vector<am_Connection_s> returnList;
- pCF.createConnection(connection);
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterConnectionDB(connection,connectionID))
- << "ERROR: database error";;
- ASSERT_NE(0,connectionID)
- << "ERROR: connectionID zero";
-
- //now check if we read out the correct values
- ASSERT_EQ(E_OK, pDatabaseHandler.changeConnectionFinal(connectionID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListConnections(returnList));
- bool equal = false;
- std::vector<am_Connection_s>::iterator listIterator = returnList.begin();
- for (; listIterator < returnList.end(); ++listIterator)
- {
- if (listIterator->connectionID == connectionID)
- {
- equal = (listIterator->sourceID == connection.sourceID) && (listIterator->sinkID == connection.sinkID) && (listIterator->delay == connection.delay) && (listIterator->connectionFormat = connection.connectionFormat);
- }
- }
- ASSERT_EQ(true, equal);
-}
-
-TEST_F(CAmDatabaseHandlerTest,enterMainConnectionCorrect)
-{
- createMainConnectionSetup();
-}
-
-TEST_F(CAmDatabaseHandlerTest,enterSinksCorrect)
-{
- //fill the connection database
- am_Sink_s staticSink, firstDynamicSink, secondDynamicSink;
- am_sinkID_t staticSinkID, firstDynamicSinkID, secondDynamicSinkID;
- std::vector<am_Sink_s> sinkList;
-
- pCF.createSink(staticSink);
- staticSink.sinkID = 4;
-
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(staticSink,staticSinkID))
- << "ERROR: database error";
- ASSERT_EQ(staticSink.sinkID,staticSinkID)
- << "ERROR: ID not the one given in staticSink";
-
- pCF.createSink(firstDynamicSink);
- firstDynamicSink.name = "firstdynamic";
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(firstDynamicSink,firstDynamicSinkID))
- << "ERROR: database error";
- ASSERT_EQ(firstDynamicSinkID,DYNAMIC_ID_BOUNDARY)
- << "ERROR: ID not the one given in firstDynamicSink";
-
- pCF.createSink(secondDynamicSink);
- secondDynamicSink.name = "seconddynamic";
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(secondDynamicSink,secondDynamicSinkID))
- << "ERROR: database error";
- ASSERT_NEAR(secondDynamicSinkID,DYNAMIC_ID_BOUNDARY,10)
- << "ERROR: ID not the one given in secondDynamicSink";
-
- //now read back and check the returns agains the given values
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(sinkList))
- << "ERROR: database error";
- bool equal = true;
-
- std::vector<am_Sink_s>::iterator listIterator = sinkList.begin();
- for (; listIterator < sinkList.end(); ++listIterator)
- {
- if (listIterator->sinkID == staticSinkID)
- {
- equal = equal && pCF.compareSink(listIterator, staticSink);
- }
-
- if (listIterator->sinkID == firstDynamicSinkID)
- {
- equal = equal && pCF.compareSink(listIterator, firstDynamicSink);
- }
-
- if (listIterator->sinkID == secondDynamicSinkID)
- {
- equal = equal && pCF.compareSink(listIterator, secondDynamicSink);
- }
- }
- ASSERT_EQ(true, equal);
-}
-
-TEST_F(CAmDatabaseHandlerTest,enterNotificationConfigurationCorrect)
-{
- am_Sink_s testSinkData, readoutData;
- pCF.createSink(testSinkData);
- testSinkData.sinkID = 4;
- am_sinkID_t sinkID;
- std::vector<am_Sink_s> listSinks;
-
- am_NotificationConfiguration_s notify;
- notify.type=NT_UNKNOWN;
- notify.status=NS_CHANGE;
- notify.parameter=25;
- testSinkData.listNotificationConfigurations.push_back(notify);
-
- //enter the sink in the database
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(testSinkData,sinkID))
- << "ERROR: database error";
-
- //read it again
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks))
- << "ERROR: database error";
-
- ASSERT_EQ(listSinks.begin()->listNotificationConfigurations[2].parameter,notify.parameter);
- ASSERT_EQ(listSinks.begin()->listNotificationConfigurations[2].status,notify.status);
- ASSERT_EQ(listSinks.begin()->listNotificationConfigurations[2].type,notify.type);
-
- ASSERT_EQ(E_OK,pDatabaseHandler.getSinkInfoDB(testSinkData.sinkID,readoutData))
- << "ERROR: database error";
-
- ASSERT_EQ(readoutData.listNotificationConfigurations[2].parameter,notify.parameter);
- ASSERT_EQ(readoutData.listNotificationConfigurations[2].status,notify.status);
- ASSERT_EQ(readoutData.listNotificationConfigurations[2].type,notify.type);
-
-}
-
-TEST_F(CAmDatabaseHandlerTest,enterMainNotificationConfigurationCorrect)
-{
- am_Sink_s testSinkData;
- pCF.createSink(testSinkData);
- testSinkData.sinkID = 4;
- am_sinkID_t sinkID;
- std::vector<am_Sink_s> listSinks;
-
- am_NotificationConfiguration_s notify;
- notify.type=NT_UNKNOWN;
- notify.status=NS_CHANGE;
- notify.parameter=25;
-
- testSinkData.listMainNotificationConfigurations.push_back(notify);
-
- //enter the sink in the database
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(testSinkData,sinkID))
- << "ERROR: database error";
-
- //read it again
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks))
- << "ERROR: database error";
-
- ASSERT_EQ(listSinks.begin()->listMainNotificationConfigurations[2].parameter,notify.parameter);
- ASSERT_EQ(listSinks.begin()->listMainNotificationConfigurations[2].status,notify.status);
- ASSERT_EQ(listSinks.begin()->listMainNotificationConfigurations[2].type,notify.type);
-}
-
-TEST_F(CAmDatabaseHandlerTest,removeNotificationsSink)
-{
- am_Sink_s testSinkData;
- pCF.createSink(testSinkData);
- testSinkData.sinkID = 4;
- am_sinkID_t sinkID;
- std::vector<am_Sink_s> listSinks;
-
- am_NotificationConfiguration_s notify;
- notify.type=NT_UNKNOWN;
- notify.status=NS_CHANGE;
- notify.parameter=25;
-
- testSinkData.listMainNotificationConfigurations.push_back(notify);
-
- //enter the sink in the database
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(testSinkData,sinkID))
- << "ERROR: database error";
-
- //read it again
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks))
- << "ERROR: database error";
-
- ASSERT_EQ(listSinks.begin()->listMainNotificationConfigurations[2].parameter,notify.parameter);
- ASSERT_EQ(listSinks.begin()->listMainNotificationConfigurations[2].status,notify.status);
- ASSERT_EQ(listSinks.begin()->listMainNotificationConfigurations[2].type,notify.type);
-
- //now we remove the sink
- ASSERT_EQ(E_OK,pDatabaseHandler.removeSinkDB(sinkID));
-}
-
-TEST_F(CAmDatabaseHandlerTest,removeNotificationsSource)
-{
- am_Source_s testSourceData;
- pCF.createSource(testSourceData);
- testSourceData.sourceID = 4;
- am_sourceID_t sourceID;
- std::vector<am_Source_s> listSources;
-
- am_NotificationConfiguration_s notify;
- notify.type=NT_UNKNOWN;
- notify.status=NS_CHANGE;
- notify.parameter=25;
-
- testSourceData.listMainNotificationConfigurations.push_back(notify);
-
- //enter the sink in the database
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(testSourceData,sourceID))
- << "ERROR: database error";
-
- //read it again
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources))
- << "ERROR: database error";
-
- ASSERT_EQ(listSources.begin()->listMainNotificationConfigurations[2].parameter,notify.parameter);
- ASSERT_EQ(listSources.begin()->listMainNotificationConfigurations[2].status,notify.status);
- ASSERT_EQ(listSources.begin()->listMainNotificationConfigurations[2].type,notify.type);
-
- //now we remove the sink
- ASSERT_EQ(E_OK,pDatabaseHandler.removeSourceDB(sourceID));
-}
-
-TEST_F(CAmDatabaseHandlerTest,getMainNotificationsSink)
-{
- am_Sink_s testSinkData;
- pCF.createSink(testSinkData);
- testSinkData.sinkID = 4;
- am_sinkID_t sinkID;
- std::vector<am_Sink_s> listSinks;
- std::vector<am_NotificationConfiguration_s>returnList;
-
- am_NotificationConfiguration_s notify;
- notify.type=NT_UNKNOWN;
- notify.status=NS_CHANGE;
- notify.parameter=25;
-
- testSinkData.listMainNotificationConfigurations.push_back(notify);
-
- am_NotificationConfiguration_s notify1;
- notify1.type=NT_UNKNOWN;
- notify1.status=NS_PERIODIC;
- notify1.parameter=5;
-
- testSinkData.listMainNotificationConfigurations.push_back(notify1);
-
- //enter the sink in the database
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(testSinkData,sinkID))
- << "ERROR: database error";
-
- //read it again
- ASSERT_EQ(E_OK,pDatabaseHandler.getListMainSinkNotificationConfigurations(sinkID,returnList))
- << "ERROR: database error";
-
- std::equal(testSinkData.listMainNotificationConfigurations.begin(),testSinkData.listMainNotificationConfigurations.end(),returnList.begin(),equalNotificationConfiguration);
-
-}
-
-TEST_F(CAmDatabaseHandlerTest,getMainNotificationsSources)
-{
- am_Source_s testSourceData;
- pCF.createSource(testSourceData);
- testSourceData.sourceID = 4;
- am_sourceID_t sourceID;
- std::vector<am_Source_s> listSources;
- std::vector<am_NotificationConfiguration_s>returnList;
-
- am_NotificationConfiguration_s notify;
- notify.type=NT_UNKNOWN;
- notify.status=NS_CHANGE;
- notify.parameter=25;
-
- testSourceData.listMainNotificationConfigurations.push_back(notify);
-
- am_NotificationConfiguration_s notify1;
- notify1.type=NT_UNKNOWN;
- notify1.status=NS_PERIODIC;
- notify1.parameter=5;
-
- testSourceData.listMainNotificationConfigurations.push_back(notify1);
-
- //enter the sink in the database
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(testSourceData,sourceID))
- << "ERROR: database error";
-
- //read it again
- ASSERT_EQ(E_OK,pDatabaseHandler.getListMainSourceNotificationConfigurations(sourceID,returnList))
- << "ERROR: database error";
-
- std::equal(testSourceData.listMainNotificationConfigurations.begin(),testSourceData.listMainNotificationConfigurations.end(),returnList.begin(),equalNotificationConfiguration);
-
-}
-
-TEST_F(CAmDatabaseHandlerTest,changeMainNotificationsSources)
-{
- am_Source_s testSourceData;
- pCF.createSource(testSourceData);
- testSourceData.sourceID = 4;
- am_sourceID_t sourceID;
- std::vector<am_Source_s> listSources;
- std::vector<am_NotificationConfiguration_s>returnList,returnList1;
-
- am_NotificationConfiguration_s notify;
- notify.type=NT_UNKNOWN;
- notify.status=NS_CHANGE;
- notify.parameter=25;
-
- testSourceData.listMainNotificationConfigurations.push_back(notify);
-
- am_NotificationConfiguration_s notify1;
- notify1.type=NT_UNKNOWN;
- notify1.status=NS_PERIODIC;
- notify1.parameter=5;
-
- am_NotificationConfiguration_s notify2;
- notify2.type=NT_UNKNOWN;
- notify2.status=NS_CHANGE;
- notify2.parameter=10;
-
- testSourceData.listMainNotificationConfigurations.push_back(notify1);
-
- //enter the sink in the database
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(testSourceData,sourceID))
- << "ERROR: database error";
-
- //read it again
- ASSERT_EQ(E_OK,pDatabaseHandler.getListMainSourceNotificationConfigurations(sourceID,returnList))
- << "ERROR: database error";
-
- std::equal(testSourceData.listMainNotificationConfigurations.begin(),testSourceData.listMainNotificationConfigurations.end(),returnList.begin(),equalNotificationConfiguration);
-
- //change a setting
- ASSERT_EQ(E_OK,pDatabaseHandler.changeMainSourceNotificationConfigurationDB(sourceID,notify2));
-
- ASSERT_EQ(E_OK,pDatabaseHandler.getListMainSourceNotificationConfigurations(sourceID,returnList1))
- << "ERROR: database error";
-
- ASSERT_EQ(returnList1[3].parameter,notify2.parameter);
- ASSERT_EQ(returnList1[3].status,notify2.status);
- ASSERT_EQ(returnList1[3].type,notify2.type);
-
-}
-
-TEST_F(CAmDatabaseHandlerTest,changeMainNotificationsSink)
-{
- am_Sink_s testSinkData;
- pCF.createSink(testSinkData);
- testSinkData.sinkID = 4;
- am_sinkID_t sinkID;
- std::vector<am_Sink_s> listSinks;
- std::vector<am_NotificationConfiguration_s>returnList,returnList1;
-
- am_NotificationConfiguration_s notify;
- notify.type=NT_UNKNOWN;
- notify.status=NS_CHANGE;
- notify.parameter=25;
-
- testSinkData.listMainNotificationConfigurations.push_back(notify);
-
- am_NotificationConfiguration_s notify1;
- notify1.type=NT_UNKNOWN;
- notify1.status=NS_PERIODIC;
- notify1.parameter=5;
-
- am_NotificationConfiguration_s notify2;
- notify2.type=NT_UNKNOWN;
- notify2.status=NS_CHANGE;
- notify2.parameter=27;
-
- testSinkData.listMainNotificationConfigurations.push_back(notify1);
-
- //enter the sink in the database
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(testSinkData,sinkID))
- << "ERROR: database error";
-
- //read it again
- ASSERT_EQ(E_OK,pDatabaseHandler.getListMainSinkNotificationConfigurations(sinkID,returnList))
- << "ERROR: database error";
-
- std::equal(testSinkData.listMainNotificationConfigurations.begin(),testSinkData.listMainNotificationConfigurations.end(),returnList.begin(),equalNotificationConfiguration);
-
- ASSERT_EQ(E_OK,pDatabaseHandler.changeMainSinkNotificationConfigurationDB(sinkID,notify2))
- << "ERROR: database error";
-
- ASSERT_EQ(E_OK,pDatabaseHandler.getListMainSinkNotificationConfigurations(sinkID,returnList1))
- << "ERROR: database error";
-
- ASSERT_EQ(returnList1[3].parameter,notify2.parameter);
- ASSERT_EQ(returnList1[3].status,notify2.status);
- ASSERT_EQ(returnList1[3].type,notify2.type);
-}
-
-TEST_F(CAmDatabaseHandlerTest, peekDomain_2)
-{
- std::vector<am_Domain_s> listDomains;
- am_Domain_s domain;
- am_domainID_t domainID;
- am_domainID_t domain2ID;
- pCF.createDomain(domain);
- ASSERT_EQ(E_OK,pDatabaseHandler.peekDomain(std::string("newdomain"),domainID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(listDomains));
- ASSERT_TRUE(listDomains.empty());
- ASSERT_EQ(domainID, 1);
-
- domain.name = "anotherdomain";
- ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domain2ID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(listDomains));
- ASSERT_EQ(domain2ID, 2);
-
- domain.name = "newdomain";
- ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domain2ID));
- ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(listDomains));
- ASSERT_EQ(domainID, domain2ID); // FAILS, ID is 2 instead of 1
- ASSERT_TRUE(listDomains[0].domainID==domainID);
-}
-
-//Commented out - gives always a warning..
-//TEST_F(databaseTest,registerDomainFailonID0)
-//{
-// am_Domain_s domain;
-// am_domainID_t domainID=5;
-// pCF.createDomain(domain);
-// domain.domainID=1;
-// ASSERT_DEATH(pDatabaseHandler.enterDomainDB(domain,domainID),"Assertion `domainData.domainID==0'");
-//}
-
-int main(int argc, char **argv)
-{
- CAmDltWrapper::instance()->registerApp("databse", "databasetest");
- logInfo("Database Test started ");
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-
diff --git a/AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.h b/AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.h
deleted file mode 100644
index 309f58c..0000000
--- a/AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * SPDX license identifier: MPL-2.0
- *
- * 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
- *
- * For further information see http://www.genivi.org/.
- *
- */
-
-#ifndef DATABASETEST_H_
-#define DATABASETEST_H_
-
-#define UNIT_TEST 1
-
-#include "gtest/gtest.h"
-#include "gmock/gmock.h"
-
-#include "CAmDatabaseHandlerSQLite.h"
-#include "CAmControlReceiver.h"
-#include "CAmControlSender.h"
-#include "CAmDatabaseObserver.h"
-#include "CAmRoutingSender.h"
-#include "CAmRouter.h"
-#include "CAmControlSender.h"
-#include "../IAmControlBackdoor.h"
-#include "../IAmCommandBackdoor.h"
-#include "../CAmCommonFunctions.h"
-#include "../MockIAmControlSend.h"
-#include "../MockIAmCommandSend.h"
-#include "CAmSocketHandler.h"
-
-namespace am
-{
-
-class CAmDatabaseHandlerTest: public ::testing::Test
-{
-public:
- CAmDatabaseHandlerTest();
- ~CAmDatabaseHandlerTest();
- std::vector<std::string> plistRoutingPluginDirs;
- std::vector<std::string> plistCommandPluginDirs;
- CAmSocketHandler pSocketHandler;
- CAmDatabaseHandlerSQLite pDatabaseHandler;
- CAmRoutingSender pRoutingSender;
- CAmCommandSender pCommandSender;
- MockIAmCommandSend pMockInterface;
- IAmRoutingBackdoor pRoutingInterfaceBackdoor;
- IAmCommandBackdoor pCommandInterfaceBackdoor;
- CAmControlSender pControlSender;
- CAmRouter pRouter;
- CAmControlReceiver pControlReceiver;
- CAmDatabaseObserver pObserver;
- CAmCommonFunctions pCF;
- void SetUp();
- void TearDown();
-
- void createMainConnectionSetup();
-};
-
-}
-
-#endif /* DATABASETEST_H_ */
diff --git a/AudioManagerDaemon/test/AmDatabaseHandlerTest/CMakeLists.txt b/AudioManagerDaemon/test/AmDatabaseHandlerTest/CMakeLists.txt
deleted file mode 100644
index 88b1d81..0000000
--- a/AudioManagerDaemon/test/AmDatabaseHandlerTest/CMakeLists.txt
+++ /dev/null
@@ -1,92 +0,0 @@
-# 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
-#
-# For further information see http://www.genivi.org/.
-#
-
-cmake_minimum_required(VERSION 2.8.8)
-
-project(AmDatabaseHandlerTest)
-
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager")
-
-#only build this test if sqlite is requested
-if(WITH_DATABASE_STORAGE)
-
- set (AM_LINK_LIBS
- ${CMAKE_DL_LIBS}
- AudioManagerUtilities
- rt)
-
- pkg_check_modules(SQLITE REQUIRED sqlite3)
-
- if(WITH_DLT)
- pkg_check_modules(DLT REQUIRED automotive-dlt>=2.2.0)
- set (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- ${DLT_LIBRARIES})
- endif(WITH_DLT)
-
- INCLUDE_DIRECTORIES(
- ${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDE_FOLDER}
- ${CMAKE_SOURCE_DIR}
- ${STD_INCLUDE_DIRS}
- ${INCLUDE_FOLDER}
- ${GOOGLE_TEST_INCLUDE_DIR}
- ${GMOCK_INCLUDE_DIR}
- )
-
- if(WITH_DLT)
- INCLUDE_DIRECTORIES(
- ${INCLUDE_DIRECTORIES}
- ${DLT_INCLUDE_DIRS})
- endif(WITH_DLT)
-
- file(GLOB DATABASE_SRCS_CXX
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmDatabaseHandlerSQLite.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmDatabaseObserver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmCommandSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRoutingSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmControlReceiver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmControlSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRouter.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmCommandReceiver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRoutingReceiver.cpp"
- "../CAmCommonFunctions.cpp"
- "*.cpp"
- )
-
-
- ADD_EXECUTABLE( AmDatabaseHandlerTest ${DATABASE_SRCS_CXX})
-
- TARGET_LINK_LIBRARIES( AmDatabaseHandlerTest
- ${AM_LINK_LIBS}
- ${SQLITE_LIBRARIES}
- ${CMAKE_THREAD_LIBS_INIT}
- ${CMAKE_DL_LIBS}
- gtest
- gmock
- )
-
- ADD_DEPENDENCIES(AmDatabaseHandlerTest gtest gmock AudioManagerUtilities)
-
- INSTALL(TARGETS AmDatabaseHandlerTest
- DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
- PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
- COMPONENT tests
- )
-
-endif(WITH_DATABASE_STORAGE)
-
diff --git a/AudioManagerDaemon/test/AmMapHandlerTest/CMakeLists.txt b/AudioManagerDaemon/test/AmMapHandlerTest/CMakeLists.txt
deleted file mode 100644
index 760be6c..0000000
--- a/AudioManagerDaemon/test/AmMapHandlerTest/CMakeLists.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-# 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
-#
-# For further information see http://www.genivi.org/.
-#
-
-cmake_minimum_required(VERSION 2.8.8)
-
-project(AmMapHandlerTest)
-
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager")
-
-set (AM_LINK_LIBS
- ${CMAKE_DL_LIBS}
- AudioManagerUtilities
- rt)
-
-if(WITH_DLT)
- pkg_check_modules(DLT REQUIRED automotive-dlt>=2.2.0)
- set (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- ${DLT_LIBRARIES})
-endif(WITH_DLT)
-
-IF (WITH_CAPI_WRAPPER)
- set (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- -Wl,--as-needed CommonAPI
- )
-ENDIF (WITH_CAPI_WRAPPER)
-
-INCLUDE_DIRECTORIES(
- ${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDE_FOLDER}
- ${CMAKE_SOURCE_DIR}
- ${STD_INCLUDE_DIRS}
- ${INCLUDE_FOLDER}
- ${GOOGLE_TEST_INCLUDE_DIR}
- ${GMOCK_INCLUDE_DIR}
-)
-
-if(WITH_DLT)
- INCLUDE_DIRECTORIES(
- ${INCLUDE_DIRECTORIES}
- ${DLT_INCLUDE_DIRS})
-endif(WITH_DLT)
-
-file(GLOB DATABASE_SRCS_CXX
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmDatabaseHandlerMap.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmCommandSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRoutingSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmControlReceiver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmControlSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRouter.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmCommandReceiver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRoutingReceiver.cpp"
- "../CAmCommonFunctions.cpp"
- "CAmTestDatabaseObserver.cpp"
- "*.cpp"
- )
-
-ADD_EXECUTABLE( AmMapHandlerTest ${DATABASE_SRCS_CXX})
-
-TARGET_LINK_LIBRARIES( AmMapHandlerTest
- ${AM_LINK_LIBS}
- ${CMAKE_THREAD_LIBS_INIT}
- ${CMAKE_DL_LIBS}
- gtest
- gmock
-)
-
-ADD_DEPENDENCIES(AmMapHandlerTest gtest gmock AudioManagerUtilities)
-
-INSTALL(TARGETS AmMapHandlerTest
- DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
- PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
- COMPONENT tests
-)
-
diff --git a/AudioManagerDaemon/test/AmRouterMapTest/CMakeLists.txt b/AudioManagerDaemon/test/AmRouterMapTest/CMakeLists.txt
deleted file mode 100644
index 720ef64..0000000
--- a/AudioManagerDaemon/test/AmRouterMapTest/CMakeLists.txt
+++ /dev/null
@@ -1,81 +0,0 @@
-# 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
-#
-# For further information see http://www.genivi.org/.
-#
-
-cmake_minimum_required(VERSION 2.8.8)
-
-project (AmRouterMapTest)
-
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager")
-
-set (AM_LINK_LIBS
- ${CMAKE_DL_LIBS}
- AudioManagerUtilities
- rt)
-
-IF (WITH_CAPI_WRAPPER)
- set (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- -Wl,--as-needed CommonAPI
- )
-ENDIF (WITH_CAPI_WRAPPER)
-
-if(WITH_DLT)
- pkg_check_modules(DLT REQUIRED automotive-dlt>=2.2.0)
- set (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- ${DLT_LIBRARIES})
-endif(WITH_DLT)
-
-INCLUDE_DIRECTORIES(
- ${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDE_FOLDER}
- ${CMAKE_SOURCE_DIR}
- ${INCLUDE_FOLDER}
- ${GOOGLE_TEST_INCLUDE_DIR}
- ${GMOCK_INCLUDE_DIR}
-)
-
-file(GLOB ROUTINGMAP_SRCS_CXX
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmDatabaseHandlerMap.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmDatabaseObserver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmCommandSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRoutingSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmControlReceiver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmControlSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRouter.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmCommandReceiver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRoutingReceiver.cpp"
- "../CAmCommonFunctions.cpp"
- "*.cpp"
- )
-
-ADD_EXECUTABLE( AmRouterMapTest ${ROUTINGMAP_SRCS_CXX})
-
-TARGET_LINK_LIBRARIES(AmRouterMapTest
- ${AM_LINK_LIBS}
- gtest
- gmock
-)
-
-ADD_DEPENDENCIES(AmRouterMapTest gtest gmock AudioManagerUtilities)
-
-INSTALL(TARGETS AmRouterMapTest
- DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
- PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
- COMPONENT tests
-)
-
diff --git a/AudioManagerDaemon/test/AmRouterTest/CMakeLists.txt b/AudioManagerDaemon/test/AmRouterTest/CMakeLists.txt
deleted file mode 100644
index e9b0e80..0000000
--- a/AudioManagerDaemon/test/AmRouterTest/CMakeLists.txt
+++ /dev/null
@@ -1,81 +0,0 @@
-# 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
-#
-# For further information see http://www.genivi.org/.
-#
-
-cmake_minimum_required(VERSION 2.8.8)
-
-project(AmRouterTest)
-
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager")
-
-set (AM_LINK_LIBS
- ${CMAKE_DL_LIBS}
- AudioManagerUtilities
- rt)
-
-IF (WITH_CAPI_WRAPPER)
- set (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- -Wl,--as-needed CommonAPI
- )
-ENDIF (WITH_CAPI_WRAPPER)
-
-if(WITH_DLT)
- pkg_check_modules(DLT REQUIRED automotive-dlt>=2.2.0)
- set (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- ${DLT_LIBRARIES})
-endif(WITH_DLT)
-
-INCLUDE_DIRECTORIES(
- ${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDE_FOLDER}
- ${CMAKE_SOURCE_DIR}
- ${INCLUDE_FOLDER}
- ${GOOGLE_TEST_INCLUDE_DIR}
- ${GMOCK_INCLUDE_DIR}
-)
-
-file(GLOB ROUTING_SRCS_CXX
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmDatabaseHandlerMap.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmDatabaseObserver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmCommandSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRoutingSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmControlReceiver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmControlSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRouter.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmCommandReceiver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRoutingReceiver.cpp"
- "../CAmCommonFunctions.cpp"
- "*.cpp"
- )
-
-ADD_EXECUTABLE( AmRouterTest ${ROUTING_SRCS_CXX})
-
-TARGET_LINK_LIBRARIES(AmRouterTest
- ${AM_LINK_LIBS}
- gtest
- gmock
-)
-
-ADD_DEPENDENCIES(AmRouterTest gtest gmock AudioManagerUtilities)
-
-INSTALL(TARGETS AmRouterTest
- DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
- PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
- COMPONENT tests
-)
-
diff --git a/AudioManagerDaemon/test/AmRoutingInterfaceTest/CMakeLists.txt b/AudioManagerDaemon/test/AmRoutingInterfaceTest/CMakeLists.txt
deleted file mode 100644
index 426ac7a..0000000
--- a/AudioManagerDaemon/test/AmRoutingInterfaceTest/CMakeLists.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-# 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
-#
-# For further information see http://www.genivi.org/.
-#
-
-cmake_minimum_required(VERSION 2.8.8)
-
-project (AmRoutingInterfaceTest)
-
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager")
-
-find_package(PkgConfig)
-
-set (AM_LINK_LIBS
- ${CMAKE_DL_LIBS}
- AudioManagerUtilities
- rt)
-
-IF (WITH_CAPI_WRAPPER)
- set (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- -Wl,--as-needed CommonAPI
- )
-ENDIF (WITH_CAPI_WRAPPER)
-
-if(WITH_DLT)
- pkg_check_modules(DLT REQUIRED automotive-dlt>=2.2.0)
- set (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- ${DLT_LIBRARIES})
-endif(WITH_DLT)
-
-INCLUDE_DIRECTORIES(
- ${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDE_FOLDER}
- ${CMAKE_SOURCE_DIR}
- ${STD_INCLUDE_DIRS}
- ${INCLUDE_FOLDER}
- ${GOOGLE_TEST_INCLUDE_DIR}
- ${GMOCK_INCLUDE_DIR}
-)
-
-if(WITH_DLT)
- INCLUDE_DIRECTORIES(
- ${INCLUDE_DIRECTORIES}
- ${DLT_INCLUDE_DIRS})
-endif(WITH_DLT)
-
-file(GLOB ROUTING_INTERFACE_SRCS_CXX
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmControlReceiver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmDatabaseHandlerMap.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmDatabaseObserver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmCommandSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRoutingSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRouter.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmControlSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRoutingReceiver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmCommandReceiver.cpp"
- "../CAmCommonFunctions.cpp"
- "*.cpp"
-)
-
-ADD_EXECUTABLE(AmRoutingInterfaceTest ${ROUTING_INTERFACE_SRCS_CXX})
-
-TARGET_LINK_LIBRARIES(AmRoutingInterfaceTest
- ${AM_LINK_LIBS}
- gtest
- gmock
-)
-
-ADD_DEPENDENCIES(AmRoutingInterfaceTest gtest gmock AudioManagerUtilities)
-
-INSTALL(TARGETS AmRoutingInterfaceTest
- DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
- PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
- COMPONENT tests
-)
-
diff --git a/AudioManagerDaemon/test/AmTelnetServerTest/CMakeLists.txt b/AudioManagerDaemon/test/AmTelnetServerTest/CMakeLists.txt
deleted file mode 100644
index 7f1cc2c..0000000
--- a/AudioManagerDaemon/test/AmTelnetServerTest/CMakeLists.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-# 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 Christian Linke, christian.linke@bmw.de BMW 2011,2012
-#
-# For further information see http://www.genivi.org/.
-#
-
-cmake_minimum_required(VERSION 2.8.8)
-
-PROJECT(AmTelnetServerTest)
-
-set (AM_LINK_LIBS
- ${CMAKE_DL_LIBS}
- AudioManagerUtilities
- rt)
-
-IF (WITH_CAPI_WRAPPER)
- set (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- -Wl,--as-needed CommonAPI
- )
-ENDIF (WITH_CAPI_WRAPPER)
-
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager")
-
-
-if(WITH_DLT)
- pkg_check_modules(DLT REQUIRED automotive-dlt>=2.2.0)
- set (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- ${DLT_LIBRARIES})
-endif(WITH_DLT)
-
-INCLUDE_DIRECTORIES(
- ${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDE_FOLDER}
- ${CMAKE_SOURCE_DIR}
- ${INCLUDE_FOLDER}
- ${GOOGLE_TEST_INCLUDE_DIR}
- ${GMOCK_INCLUDE_DIR}
-)
-
-if(WITH_DLT)
-INCLUDE_DIRECTORIES(
- ${INCLUDE_DIRECTORIES}
- ${DLT_INCLUDE_DIRS})
-endif(WITH_DLT)
-
-file(GLOB TELNET_SRCS_CXX
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmCommandReceiver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmCommandSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmControlReceiver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmControlSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmDatabaseObserver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRoutingReceiver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRoutingSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmTelnetServer.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRouter.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmTelnetMenuHelper.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmDatabaseHandlerMap.cpp"
- "*.cpp"
-)
-
-ADD_EXECUTABLE(AmTelnetServerTest ${TELNET_SRCS_CXX})
-
-TARGET_LINK_LIBRARIES(AmTelnetServerTest
- ${AM_LINK_LIBS}
- gtest
- gmock
-)
-
-ADD_DEPENDENCIES(AmTelnetServerTest gtest gmock AudioManagerUtilities)
-
-INSTALL(TARGETS AmTelnetServerTest
- DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
- PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
- COMPONENT tests
-)
-
-
diff --git a/AudioManagerUtilities/CMakeLists.txt b/AudioManagerUtilities/CMakeLists.txt
index 69555fa..f859026 100644
--- a/AudioManagerUtilities/CMakeLists.txt
+++ b/AudioManagerUtilities/CMakeLists.txt
@@ -15,25 +15,22 @@
# For further information see http://www.genivi.org/.
#
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
+CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
-PROJECT(AudioManagerUtilities)
-
-set(AudioManagerUtilities_VERSION_MAJOR 1)
-set(AudioManagerUtilities_VERSION_MINOR 0)
-set(AudioManagerUtilities_VERSION_PATCH 0)
-set(AudioManagerUtilities_VERSION_STRING ${AudioManagerUtilities_VERSION_MAJOR}.${AudioManagerUtilities_VERSION_MINOR}.${AudioManagerUtilities_VERSION_PATCH})
+PROJECT(AudioManagerUtilities LANGUAGES CXX VERSION ${DAEMONVERSION})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
-SET(INCLUDE_FOLDER "include")
-INCLUDE_DIRECTORIES(
- ${INCLUDE_FOLDER}
+SET(AUDIOMANAGER_UTILITIES_INCLUDE
+ ${AUDIOMANAGER_UTILITIES}/include
${AUDIO_INCLUDE_FOLDER}
- ${AUDIOMANAGER_INCLUDE_FOLDER}
- ${DBUS_INCLUDE_DIRS}
${TCLAP_INCLUDE_DIR}
-)
+ ${AUDIOMANAGER_INCLUDE_FOLDER}
+ CACHE INTERNAL "AUDIOMANAGER_INCLUDE directories" FORCE)
+
+SET(AUDIO_MANAGER_UTILITIES_LIBS
+ ${CMAKE_DL_LIBS}
+ CACHE INTERNAL "AUDIO_MANAGER_UTILITIES_LIBS libs" FORCE)
IF (WITH_SHARED_UTILITIES)
SET(LIBRARY_TYPE SHARED)
@@ -47,79 +44,117 @@ SET(AUDIO_MANAGER_UTILITIES_SRCS_CXX
src/CAmSocketHandler.cpp)
if(WITH_SYSTEMD_WATCHDOG)
-
- pkg_check_modules(SYSTEMD libsystemd>=44)
- if (SYSTEMD_FOUND)
- message(STATUS "Found libsystemd-daemon, version: ${SYSTEMD_VERSION}")
- else (SYSTEMD_FOUND)
- message(STATUS "Did not find libsystemd-daemon, using own lib")
- endif(SYSTEMD_FOUND)
-
+ pkg_check_modules(SYSTEMD REQUIRED "libsystemd >= 44")
+
+ message(STATUS "Found libsystemd-daemon, version: ${SYSTEMD_VERSION}")
+ set (AUDIO_MANAGER_UTILITIES_LIBS
+ ${AUDIO_MANAGER_UTILITIES_LIBS}
+ ${SYSTEMD_LIBRARIES}
+ CACHE INTERNAL "AUDIO_MANAGER_UTILITIES_LIBS libs" FORCE)
+ set(AUDIOMANAGER_UTILITIES_INCLUDE
+ ${AUDIOMANAGER_UTILITIES_INCLUDE}
+ ${SYSTEMD_INCLUDEDIR})
set (AUDIO_MANAGER_UTILITIES_SRCS_CXX
${AUDIO_MANAGER_UTILITIES_SRCS_CXX}
src/CAmWatchdog.cpp)
- set (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- ${SYSTEMD_LIBRARIES})
-endif(WITH_SYSTEMD_WATCHDOG)
-
-
-if (NOT SYSTEMD_FOUND)
- set (AUDIO_MANAGER_UTILITIES_SRCS_CXX
- ${AUDIO_MANAGER_UTILITIES_SRCS_CXX}
- src/sd-daemon.c)
-endif (NOT SYSTEMD_FOUND)
-
-
-IF (WITH_DBUS_WRAPPER)
- pkg_check_modules (DBUS "dbus-1 >= 1.4")
-ENDIF (WITH_DBUS_WRAPPER)
-IF (WITH_CAPI_WRAPPER)
- FIND_PACKAGE(CommonAPI REQUIRED)
-ENDIF (WITH_CAPI_WRAPPER)
+endif(WITH_SYSTEMD_WATCHDOG)
IF (WITH_DBUS_WRAPPER)
- SET (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- ${DBUS_LIBRARIES})
- SET(AUDIO_MANAGER_UTILITIES_SRCS_CXX
+ pkg_check_modules (DBUS REQUIRED "dbus-1 >= 1.4")
+
+ set(AUDIOMANAGER_UTILITIES_INCLUDE
+ ${AUDIOMANAGER_UTILITIES_INCLUDE}
+ ${DBUS_INCLUDE_DIRS}
+ CACHE INTERNAL "AUDIOMANAGER_INCLUDE directories" FORCE)
+
+ set (AUDIO_MANAGER_UTILITIES_LIBS
+ ${AUDIO_MANAGER_UTILITIES_LIBS}
+ ${DBUS_LIBRARIES}
+ CACHE INTERNAL "AUDIO_MANAGER_UTILITIES_LIBS libs" FORCE)
+
+ set(AUDIO_MANAGER_UTILITIES_SRCS_CXX
${AUDIO_MANAGER_UTILITIES_SRCS_CXX}
src/CAmDbusWrapper.cpp)
ENDIF (WITH_DBUS_WRAPPER)
IF (WITH_CAPI_WRAPPER)
- SET(AM_LINK_LIBS
- ${AM_LINK_LIBS}
- ${DBUS_LIBRARIES}
- ${COMMON_API_LIBRARIES}
- ${COMMON_API_DBUS_LIBRARIES})
- SET(AUDIO_MANAGER_UTILITIES_SRCS_CXX
+ pkg_check_modules(COMMONAPI REQUIRED "CommonAPI >= 3.1.5")
+
+ set(AUDIO_MANAGER_UTILITIES_LIBS
+ ${AUDIO_MANAGER_UTILITIES_LIBS}
+ ${COMMONAPI_LIBRARIES}
+ ${COMMONAPI_DBUS_LIBRARIES}
+ CACHE INTERNAL "AUDIO_MANAGER_UTILITIES_LIBS libs" FORCE)
+
+ set(AUDIO_MANAGER_UTILITIES_SRCS_CXX
${AUDIO_MANAGER_UTILITIES_SRCS_CXX}
src/CAmCommonAPIWrapper.cpp)
- INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES}
- ${COMMONAPI_INCLUDE_DIRS})
+
+ set(AUDIOMANAGER_UTILITIES_INCLUDE
+ ${AUDIOMANAGER_UTILITIES_INCLUDE}
+ ${COMMONAPI_INCLUDE_DIRS}
+ CACHE INTERNAL "AUDIOMANAGER_INCLUDE directories" FORCE)
ENDIF (WITH_CAPI_WRAPPER)
+if(WITH_DLT)
+ pkg_check_modules(DLT REQUIRED "automotive-dlt >= 2.2.0")
+
+ add_definitions(${DLT_CFLAGS_OTHER})
+
+ set(AUDIO_MANAGER_UTILITIES_LIBS
+ ${AUDIO_MANAGER_UTILITIES_LIBS}
+ ${DLT_LIBRARIES}
+ CACHE INTERNAL "AUDIO_MANAGER_UTILITIES_LIBS libs" FORCE)
+
+ SET(AUDIOMANAGER_UTILITIES_INCLUDE
+ ${AUDIOMANAGER_UTILITIES_INCLUDE}
+ ${DLT_LIBRARY_DIRS}
+ CACHE INTERNAL "AUDIOMANAGER_INCLUDE directories" FORCE)
+endif(WITH_DLT)
+
+
+INCLUDE_DIRECTORIES(${AUDIOMANAGER_UTILITIES_INCLUDE})
+
ADD_LIBRARY(AudioManagerUtilities ${LIBRARY_TYPE} ${AUDIO_MANAGER_UTILITIES_SRCS_CXX})
-TARGET_LINK_LIBRARIES(AudioManagerUtilities ${AM_LINK_LIBS})
+TARGET_LINK_LIBRARIES(AudioManagerUtilities ${AUDIO_MANAGER_UTILITIES_LIBS})
-set_target_properties(AudioManagerUtilities PROPERTIES VERSION ${AudioManagerUtilities_VERSION_STRING} SOVERSION ${AudioManagerUtilities_VERSION_MAJOR})
+set_target_properties(AudioManagerUtilities PROPERTIES VERSION ${AudioManagerUtilities_VERSION} SOVERSION ${AudioManagerUtilities_VERSION_MAJOR})
IF (WITH_SHARED_UTILITIES)
INSTALL(TARGETS AudioManagerUtilities
LIBRARY DESTINATION lib
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
COMPONENT bin)
- configure_file( ${CMAKE_SOURCE_DIR}/cmake/audiomanagerutilities.pc.in ${CMAKE_BINARY_DIR}/audiomanagerutilities.pc @ONLY )
- install(FILES ${CMAKE_BINARY_DIR}/audiomanagerutilities.pc DESTINATION lib/pkgconfig COMPONENT devel)
ELSE (WITH_SHARED_UTILITIES)
INSTALL(TARGETS AudioManagerUtilities
ARCHIVE DESTINATION lib
COMPONENT dev)
ENDIF (WITH_SHARED_UTILITIES)
-INSTALL(DIRECTORY "${AUDIOMANAGER_UTILITIES_INCLUDE}/"
- DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${LIB_INSTALL_SUFFIX}
+configure_file( ${CMAKE_SOURCE_DIR}/cmake/audiomanagerutilities.pc.in ${CMAKE_BINARY_DIR}/audiomanagerutilities.pc @ONLY )
+install(FILES ${CMAKE_BINARY_DIR}/audiomanagerutilities.pc DESTINATION lib/pkgconfig COMPONENT devel)
+
+configure_package_config_file (
+ ${CMAKE_SOURCE_DIR}/cmake/AudioManagerUtilitiesConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/AudioManagerUtilitiesConfig.cmake
+ INSTALL_DESTINATION lib/${LIB_INSTALL_SUFFIX}/cmake
+ PATH_VARS AUDIO_INCLUDE_FOLDER )
+
+write_basic_package_version_file(
+ ${CMAKE_CURRENT_BINARY_DIR}/AudioManagerUtilitiesConfigVersion.cmake
+ VERSION ${DAEMONVERSION}
+ COMPATIBILITY SameMajorVersion )
+
+install(
+FILES ${CMAKE_CURRENT_BINARY_DIR}/AudioManagerUtilitiesConfig.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/AudioManagerUtilitiesConfigVersion.cmake
+DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/AudioManagerUtilities-${DAEMONVERSION})
+
+INSTALL(DIRECTORY "include/"
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${LIB_INSTALL_SUFFIX}/AudioManagerUtilities
COMPONENT dev)
+
+if(WITH_TESTS)
+ add_subdirectory (test)
+endif(WITH_TESTS)
diff --git a/AudioManagerUtilities/include/CAmCommonAPIWrapper.h b/AudioManagerUtilities/include/CAmCommonAPIWrapper.h
index f9a6b01..82328d6 100644
--- a/AudioManagerUtilities/include/CAmCommonAPIWrapper.h
+++ b/AudioManagerUtilities/include/CAmCommonAPIWrapper.h
@@ -35,10 +35,6 @@
#include "audiomanagerconfig.h"
#include "CAmSocketHandler.h"
-#if COMMONAPI_VERSION_NUMBER < 300
-#error "CommonAPI versions < 300 are not supported."
-#endif
-
/**
* A Common-API wrapper class, which loads the common-api runtime and instantiates all necessary objects.
* It is implemented as singleton and usually instantiated at the beginning with CAmSocketHandler as parameter.
diff --git a/AudioManagerUtilities/include/CAmDltWrapper.h b/AudioManagerUtilities/include/CAmDltWrapper.h
index 7e4d2d4..d227929 100644
--- a/AudioManagerUtilities/include/CAmDltWrapper.h
+++ b/AudioManagerUtilities/include/CAmDltWrapper.h
@@ -131,7 +131,10 @@ public:
template<typename T = const char*> void append(const char* value)
{
#ifdef WITH_DLT
- dlt_user_log_write_string(&mDltContextData, value);
+ if(mEnableNoDLTDebug)
+ {
+ dlt_user_log_write_string(&mDltContextData, value);
+ }
#else
mDltContextData.buffer << value;
#endif
@@ -153,7 +156,8 @@ public:
"E_ABORTED",
"E_WRONG_FORMAT"
};
- append(str_error[value]);
+ if(mEnableNoDLTDebug)
+ append(str_error[value]);
}
// Template to print unknown pointer types with their address
@@ -188,10 +192,10 @@ private:
CAmDltWrapper(const bool enableNoDLTDebug); //is private because of singleton pattern
#ifndef WITH_DLT
template<class T> void appendNoDLT(T value);
- bool mEnableNoDLTDebug;
#endif
DltContext mDltContext; //!< the default context
DltContextData mDltContextData; //!< contextdata
+ bool mEnableNoDLTDebug;
static CAmDltWrapper* mpDLTWrapper; //!< pointer to the wrapper instance
static pthread_mutex_t mMutex;
diff --git a/AudioManagerUtilities/include/CAmSocketHandler.h b/AudioManagerUtilities/include/CAmSocketHandler.h
index 5e11fa5..1a988c5 100644
--- a/AudioManagerUtilities/include/CAmSocketHandler.h
+++ b/AudioManagerUtilities/include/CAmSocketHandler.h
@@ -441,16 +441,7 @@ private:
bool mRecreatePollfds; //!<when this is true, the poll list needs to be recreated
timespec mStartTime; //!<here the actual time is saved for timecorrection
-// void debugPrintTimerList ()
-// {
-// std::list<sh_timer_s>::iterator it(mListActiveTimer.begin());
-// for(;it!=mListActiveTimer.end();++it)
-// {
-// std::cout<< "Handle " << it->handle << "sec " << it->countdown.tv_sec << "nsec " << it->countdown.tv_nsec<<std::endl;
-// }
-// }
-}
-;
+};
/**
* template to create the functor for a class
@@ -465,9 +456,7 @@ public:
TAmShTimerCallBack(TClass* instance, void (TClass::*function)(sh_timerHandle_t handle, void* userData)) :
mInstance(instance), //
mFunction(function)
- {
- }
- ;
+ {};
virtual void Call(sh_timerHandle_t handle, void* userData)
{
@@ -488,15 +477,12 @@ public:
TAmShPollPrepare(TClass* instance, void (TClass::*function)(const sh_timerHandle_t handle, void* userData)) :
mInstance(instance), //
mFunction(function)
- {
- }
- ;
+ {};
virtual void Call(const sh_timerHandle_t handle, void* userData)
{
(*mInstance.*mFunction)(handle, userData);
- }
- ;
+ };
};
/**make private, not public
@@ -512,15 +498,12 @@ public:
TAmShPollFired(TClass* instance, void (TClass::*function)(const pollfd pollfd, const sh_pollHandle_t handle, void* userData)) :
mInstance(instance), //
mFunction(function)
- {
- }
- ;
+ {};
virtual void Call(const pollfd pollfd, const sh_pollHandle_t handle, void* userData)
{
(*mInstance.*mFunction)(pollfd, handle, userData);
- }
- ;
+ };
};
/**
@@ -536,15 +519,12 @@ public:
TAmShPollCheck(TClass* instance, bool (TClass::*function)(const sh_pollHandle_t handle, void* userData)) :
mInstance(instance), //
mFunction(function)
- {
- }
- ;
+ {};
virtual bool Call(const sh_pollHandle_t handle, void* userData)
{
return ((*mInstance.*mFunction)(handle, userData));
- }
- ;
+ };
};
/**
@@ -560,15 +540,12 @@ public:
TAmShPollDispatch(TClass* instance, bool (TClass::*function)(const sh_pollHandle_t handle, void* userData)) :
mInstance(instance), //
mFunction(function)
- {
- }
- ;
+ {};
virtual bool Call(const sh_pollHandle_t handle, void* userData)
{
return ((*mInstance.*mFunction)(handle, userData));
- }
- ;
+ };
};
} /* namespace am */
#endif /* SOCKETHANDLER_H_ */
diff --git a/AudioManagerUtilities/include/sd-daemon.h b/AudioManagerUtilities/include/sd-daemon.h
deleted file mode 100644
index 50f7409..0000000
--- a/AudioManagerUtilities/include/sd-daemon.h
+++ /dev/null
@@ -1,286 +0,0 @@
-/**
- * SPDX license identifier: MIT
- */
-
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-#ifndef foosddaemonhfoo
-#define foosddaemonhfoo
-
-/***
- Copyright 2010 Lennart Poettering
-
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation files
- (the "Software"), to deal in the Software without restriction,
- including without limitation the rights to use, copy, modify, merge,
- publish, distribute, sublicense, and/or sell copies of the Software,
- and to permit persons to whom the Software is furnished to do so,
- subject to the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
-***/
-
-#include <sys/types.h>
-#include <inttypes.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- Reference implementation of a few systemd related interfaces for
- writing daemons. These interfaces are trivial to implement. To
- simplify porting we provide this reference implementation.
- Applications are welcome to reimplement the algorithms described
- here if they do not want to include these two source files.
-
- The following functionality is provided:
-
- - Support for logging with log levels on stderr
- - File descriptor passing for socket-based activation
- - Daemon startup and status notification
- - Detection of systemd boots
-
- You may compile this with -DDISABLE_SYSTEMD to disable systemd
- support. This makes all those calls NOPs that are directly related to
- systemd (i.e. only sd_is_xxx() will stay useful).
-
- Since this is drop-in code we don't want any of our symbols to be
- exported in any case. Hence we declare hidden visibility for all of
- them.
-
- You may find an up-to-date version of these source files online:
-
- http://cgit.freedesktop.org/systemd/systemd/plain/src/systemd/sd-daemon.h
- http://cgit.freedesktop.org/systemd/systemd/plain/src/sd-daemon.c
-
- This should compile on non-Linux systems, too, but with the
- exception of the sd_is_xxx() calls all functions will become NOPs.
-
- See sd-daemon(7) for more information.
-*/
-
-#ifndef _sd_printf_attr_
-#if __GNUC__ >= 4
-#define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
-#else
-#define _sd_printf_attr_(a,b)
-#endif
-#endif
-
-/*
- Log levels for usage on stderr:
-
- fprintf(stderr, SD_NOTICE "Hello World!\n");
-
- This is similar to printk() usage in the kernel.
-*/
-#define SD_EMERG "<0>" /* system is unusable */
-#define SD_ALERT "<1>" /* action must be taken immediately */
-#define SD_CRIT "<2>" /* critical conditions */
-#define SD_ERR "<3>" /* error conditions */
-#define SD_WARNING "<4>" /* warning conditions */
-#define SD_NOTICE "<5>" /* normal but significant condition */
-#define SD_INFO "<6>" /* informational */
-#define SD_DEBUG "<7>" /* debug-level messages */
-
-/* The first passed file descriptor is fd 3 */
-#define SD_LISTEN_FDS_START 3
-
-/*
- Returns how many file descriptors have been passed, or a negative
- errno code on failure. Optionally, removes the $LISTEN_FDS and
- $LISTEN_PID file descriptors from the environment (recommended, but
- problematic in threaded environments). If r is the return value of
- this function you'll find the file descriptors passed as fds
- SD_LISTEN_FDS_START to SD_LISTEN_FDS_START+r-1. Returns a negative
- errno style error code on failure. This function call ensures that
- the FD_CLOEXEC flag is set for the passed file descriptors, to make
- sure they are not passed on to child processes. If FD_CLOEXEC shall
- not be set, the caller needs to unset it after this call for all file
- descriptors that are used.
-
- See sd_listen_fds(3) for more information.
-*/
-int sd_listen_fds(int unset_environment);
-
-/*
- Helper call for identifying a passed file descriptor. Returns 1 if
- the file descriptor is a FIFO in the file system stored under the
- specified path, 0 otherwise. If path is NULL a path name check will
- not be done and the call only verifies if the file descriptor
- refers to a FIFO. Returns a negative errno style error code on
- failure.
-
- See sd_is_fifo(3) for more information.
-*/
-int sd_is_fifo(int fd, const char *path);
-
-/*
- Helper call for identifying a passed file descriptor. Returns 1 if
- the file descriptor is a special character device on the file
- system stored under the specified path, 0 otherwise.
- If path is NULL a path name check will not be done and the call
- only verifies if the file descriptor refers to a special character.
- Returns a negative errno style error code on failure.
-
- See sd_is_special(3) for more information.
-*/
-int sd_is_special(int fd, const char *path);
-
-/*
- Helper call for identifying a passed file descriptor. Returns 1 if
- the file descriptor is a socket of the specified family (AF_INET,
- ...) and type (SOCK_DGRAM, SOCK_STREAM, ...), 0 otherwise. If
- family is 0 a socket family check will not be done. If type is 0 a
- socket type check will not be done and the call only verifies if
- the file descriptor refers to a socket. If listening is > 0 it is
- verified that the socket is in listening mode. (i.e. listen() has
- been called) If listening is == 0 it is verified that the socket is
- not in listening mode. If listening is < 0 no listening mode check
- is done. Returns a negative errno style error code on failure.
-
- See sd_is_socket(3) for more information.
-*/
-int sd_is_socket(int fd, int family, int type, int listening);
-
-/*
- Helper call for identifying a passed file descriptor. Returns 1 if
- the file descriptor is an Internet socket, of the specified family
- (either AF_INET or AF_INET6) and the specified type (SOCK_DGRAM,
- SOCK_STREAM, ...), 0 otherwise. If version is 0 a protocol version
- check is not done. If type is 0 a socket type check will not be
- done. If port is 0 a socket port check will not be done. The
- listening flag is used the same way as in sd_is_socket(). Returns a
- negative errno style error code on failure.
-
- See sd_is_socket_inet(3) for more information.
-*/
-int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port);
-
-/*
- Helper call for identifying a passed file descriptor. Returns 1 if
- the file descriptor is an AF_UNIX socket of the specified type
- (SOCK_DGRAM, SOCK_STREAM, ...) and path, 0 otherwise. If type is 0
- a socket type check will not be done. If path is NULL a socket path
- check will not be done. For normal AF_UNIX sockets set length to
- 0. For abstract namespace sockets set length to the length of the
- socket name (including the initial 0 byte), and pass the full
- socket path in path (including the initial 0 byte). The listening
- flag is used the same way as in sd_is_socket(). Returns a negative
- errno style error code on failure.
-
- See sd_is_socket_unix(3) for more information.
-*/
-int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length);
-
-/*
- Helper call for identifying a passed file descriptor. Returns 1 if
- the file descriptor is a POSIX Message Queue of the specified name,
- 0 otherwise. If path is NULL a message queue name check is not
- done. Returns a negative errno style error code on failure.
-*/
-int sd_is_mq(int fd, const char *path);
-
-/*
- Informs systemd about changed daemon state. This takes a number of
- newline separated environment-style variable assignments in a
- string. The following variables are known:
-
- READY=1 Tells systemd that daemon startup is finished (only
- relevant for services of Type=notify). The passed
- argument is a boolean "1" or "0". Since there is
- little value in signaling non-readiness the only
- value daemons should send is "READY=1".
-
- STATUS=... Passes a single-line status string back to systemd
- that describes the daemon state. This is free-from
- and can be used for various purposes: general state
- feedback, fsck-like programs could pass completion
- percentages and failing programs could pass a human
- readable error message. Example: "STATUS=Completed
- 66% of file system check..."
-
- ERRNO=... If a daemon fails, the errno-style error code,
- formatted as string. Example: "ERRNO=2" for ENOENT.
-
- BUSERROR=... If a daemon fails, the D-Bus error-style error
- code. Example: "BUSERROR=org.freedesktop.DBus.Error.TimedOut"
-
- MAINPID=... The main pid of a daemon, in case systemd did not
- fork off the process itself. Example: "MAINPID=4711"
-
- WATCHDOG=1 Tells systemd to update the watchdog timestamp.
- Services using this feature should do this in
- regular intervals. A watchdog framework can use the
- timestamps to detect failed services.
-
- Daemons can choose to send additional variables. However, it is
- recommended to prefix variable names not listed above with X_.
-
- Returns a negative errno-style error code on failure. Returns > 0
- if systemd could be notified, 0 if it couldn't possibly because
- systemd is not running.
-
- Example: When a daemon finished starting up, it could issue this
- call to notify systemd about it:
-
- sd_notify(0, "READY=1");
-
- See sd_notifyf() for more complete examples.
-
- See sd_notify(3) for more information.
-*/
-int sd_notify(int unset_environment, const char *state);
-
-/*
- Similar to sd_notify() but takes a format string.
-
- Example 1: A daemon could send the following after initialization:
-
- sd_notifyf(0, "READY=1\n"
- "STATUS=Processing requests...\n"
- "MAINPID=%lu",
- (unsigned long) getpid());
-
- Example 2: A daemon could send the following shortly before
- exiting, on failure:
-
- sd_notifyf(0, "STATUS=Failed to start up: %s\n"
- "ERRNO=%i",
- strerror(errno),
- errno);
-
- See sd_notifyf(3) for more information.
-*/
-int sd_notifyf(int unset_environment, const char *format, ...) _sd_printf_attr_(2,3);
-
-/*
- Returns > 0 if the system was booted with systemd. Returns < 0 on
- error. Returns 0 if the system was not booted with systemd. Note
- that all of the functions above handle non-systemd boots just
- fine. You should NOT protect them with a call to this function. Also
- note that this function checks whether the system, not the user
- session is controlled by systemd. However the functions above work
- for both user and system services.
-
- See sd_booted(3) for more information.
-*/
-int sd_booted(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/AudioManagerUtilities/src/CAmDltWrapper.cpp b/AudioManagerUtilities/src/CAmDltWrapper.cpp
index 33baa46..3b10ef4 100644
--- a/AudioManagerUtilities/src/CAmDltWrapper.cpp
+++ b/AudioManagerUtilities/src/CAmDltWrapper.cpp
@@ -48,7 +48,10 @@ CAmDltWrapper *CAmDltWrapper::instance(const bool enableNoDLTDebug)
void CAmDltWrapper::unregisterContext(DltContext & handle)
{
#ifdef WITH_DLT
- dlt_unregister_context(&handle);
+ if (mEnableNoDLTDebug)
+ {
+ dlt_unregister_context(&handle);
+ }
#else
(void) handle;
#endif
@@ -57,16 +60,17 @@ void CAmDltWrapper::unregisterContext(DltContext & handle)
void CAmDltWrapper::deinit()
{
#ifdef WITH_DLT
- unregisterContext(mDltContext);
+ if (mEnableNoDLTDebug)
+ {
+ unregisterContext(mDltContext);
+ }
#endif
}
-CAmDltWrapper::CAmDltWrapper(const bool enableNoDLTDebug) :
-#ifndef WITH_DLT
- mEnableNoDLTDebug(enableNoDLTDebug),
-#endif
+CAmDltWrapper::CAmDltWrapper(const bool enableNoDLTDebug=true) :
mDltContext(), //
- mDltContextData()
+ mDltContextData(), //
+ mEnableNoDLTDebug(enableNoDLTDebug)
{
(void) enableNoDLTDebug;
#ifndef WITH_DLT
@@ -77,9 +81,12 @@ CAmDltWrapper::CAmDltWrapper(const bool enableNoDLTDebug) :
void CAmDltWrapper::registerApp(const char *appid, const char *description)
{
#ifdef WITH_DLT
- dlt_register_app(appid, description);
- //register a default context
- dlt_register_context(&mDltContext, "def", "default Context registered by DLTWrapper CLass");
+ if (mEnableNoDLTDebug)
+ {
+ dlt_register_app(appid, description);
+ //register a default context
+ dlt_register_context(&mDltContext, "def", "default Context registered by DLTWrapper CLass");
+ }
#else
(void) appid;
(void) description;
@@ -89,7 +96,10 @@ void CAmDltWrapper::registerApp(const char *appid, const char *description)
void CAmDltWrapper::registerContext(DltContext& handle, const char *contextid, const char *description)
{
#ifdef WITH_DLT
- dlt_register_context(&handle, contextid, description);
+ if (mEnableNoDLTDebug)
+ {
+ dlt_register_context(&handle, contextid, description);
+ }
#else
strncpy(handle.contextID,contextid,4);
@@ -115,7 +125,10 @@ void CAmDltWrapper::registerContext(DltContext& handle, const char *contextid, c
const DltLogLevelType level, const DltTraceStatusType status)
{
#ifdef WITH_DLT
- dlt_register_context_ll_ts(&handle, contextid, description, level, status);
+ if (mEnableNoDLTDebug)
+ {
+ dlt_register_context_ll_ts(&handle, contextid, description, level, status);
+ }
#else
strncpy(handle.contextID,contextid,4);
@@ -144,14 +157,15 @@ bool CAmDltWrapper::init(DltLogLevelType loglevel, DltContext* context)
if (!context)
context = &mDltContext;
#ifdef WITH_DLT
- if (dlt_user_log_write_start(context, &mDltContextData, loglevel) <= 0)
+ if (mEnableNoDLTDebug)
+ if(dlt_user_log_write_start(context, &mDltContextData, loglevel) <= 0)
#else
if((mEnableNoDLTDebug == false) || (loglevel > context->log_level_user))
#endif
- {
- pthread_mutex_unlock(&mMutex);
- return false;
- }
+ {
+ pthread_mutex_unlock(&mMutex);
+ return false;
+ }
#ifndef WITH_DLT
std::cout << "\e[0;34m[" << context->contextID << "]\e[0;30m\t";
#endif
@@ -161,7 +175,10 @@ bool CAmDltWrapper::init(DltLogLevelType loglevel, DltContext* context)
void CAmDltWrapper::send()
{
#ifdef WITH_DLT
- dlt_user_log_write_finish(&mDltContextData);
+ if (mEnableNoDLTDebug)
+ {
+ dlt_user_log_write_finish(&mDltContextData);
+ }
#else
if(mEnableNoDLTDebug)
std::cout << mDltContextData.buffer.str().c_str() << std::endl;
@@ -175,7 +192,10 @@ void CAmDltWrapper::send()
void CAmDltWrapper::append(const int8_t value)
{
#ifdef WITH_DLT
- dlt_user_log_write_int8(&mDltContextData, value);
+ if (mEnableNoDLTDebug)
+ {
+ dlt_user_log_write_int8(&mDltContextData, value);
+ }
#else
appendNoDLT(value);
#endif
@@ -184,7 +204,10 @@ void CAmDltWrapper::append(const int8_t value)
void CAmDltWrapper::append(const uint8_t value)
{
#ifdef WITH_DLT
- dlt_user_log_write_uint8(&mDltContextData, value);
+ if (mEnableNoDLTDebug)
+ {
+ dlt_user_log_write_uint8(&mDltContextData, value);
+ }
#else
appendNoDLT(value);
#endif
@@ -193,7 +216,10 @@ void CAmDltWrapper::append(const uint8_t value)
void CAmDltWrapper::append(const int16_t value)
{
#ifdef WITH_DLT
- dlt_user_log_write_int16(&mDltContextData, value);
+ if (mEnableNoDLTDebug)
+ {
+ dlt_user_log_write_int16(&mDltContextData, value);
+ }
#else
appendNoDLT(value);
#endif
@@ -202,7 +228,10 @@ void CAmDltWrapper::append(const int16_t value)
void CAmDltWrapper::append(const uint16_t value)
{
#ifdef WITH_DLT
- dlt_user_log_write_uint16(&mDltContextData, value);
+ if (mEnableNoDLTDebug)
+ {
+ dlt_user_log_write_uint16(&mDltContextData, value);
+ }
#else
appendNoDLT(value);
#endif
@@ -211,7 +240,10 @@ void CAmDltWrapper::append(const uint16_t value)
void CAmDltWrapper::append(const int32_t value)
{
#ifdef WITH_DLT
- dlt_user_log_write_int32(&mDltContextData, value);
+ if (mEnableNoDLTDebug)
+ {
+ dlt_user_log_write_int32(&mDltContextData, value);
+ }
#else
appendNoDLT(value);
#endif
@@ -220,7 +252,10 @@ void CAmDltWrapper::append(const int32_t value)
void CAmDltWrapper::append(const uint32_t value)
{
#ifdef WITH_DLT
- dlt_user_log_write_uint32(&mDltContextData, value);
+ if (mEnableNoDLTDebug)
+ {
+ dlt_user_log_write_uint32(&mDltContextData, value);
+ }
#else
appendNoDLT(value);
#endif
@@ -228,13 +263,17 @@ void CAmDltWrapper::append(const uint32_t value)
void CAmDltWrapper::append(const std::string& value)
{
- append(value.c_str());
+ if (mEnableNoDLTDebug)
+ append(value.c_str());
}
void CAmDltWrapper::append(const bool value)
{
#ifdef WITH_DLT
- dlt_user_log_write_bool(&mDltContextData, static_cast<uint8_t>(value));
+ if (mEnableNoDLTDebug)
+ {
+ dlt_user_log_write_bool(&mDltContextData, static_cast<uint8_t>(value));
+ }
#else
appendNoDLT(value);
#endif
@@ -243,7 +282,10 @@ void CAmDltWrapper::append(const bool value)
void CAmDltWrapper::append(const int64_t value)
{
#ifdef WITH_DLT
- dlt_user_log_write_int64(&mDltContextData, value);
+ if (mEnableNoDLTDebug)
+ {
+ dlt_user_log_write_int64(&mDltContextData, value);
+ }
#else
appendNoDLT(value);
#endif
@@ -252,7 +294,10 @@ void CAmDltWrapper::append(const int64_t value)
void CAmDltWrapper::append(const uint64_t value)
{
#ifdef WITH_DLT
- dlt_user_log_write_uint64(&mDltContextData, value);
+ if (mEnableNoDLTDebug)
+ {
+ dlt_user_log_write_uint64(&mDltContextData, value);
+ }
#else
appendNoDLT(value);
#endif
@@ -261,7 +306,10 @@ void CAmDltWrapper::append(const uint64_t value)
void CAmDltWrapper::append(const std::vector<uint8_t> & data)
{
#ifdef WITH_DLT
- dlt_user_log_write_raw(&mDltContextData,(void*)data.data(),data.size());
+ if (mEnableNoDLTDebug)
+ {
+ dlt_user_log_write_raw(&mDltContextData,(void*)data.data(),data.size());
+ }
#else
mDltContextData.buffer << data.data();
#endif
@@ -281,7 +329,7 @@ void CAmDltWrapper::enableNoDLTDebug(const bool enableNoDLTDebug)
CAmDltWrapper::~CAmDltWrapper()
{
- if (mpDLTWrapper)
+ if (mpDLTWrapper && mEnableNoDLTDebug)
{
mpDLTWrapper->unregisterContext(mDltContext);
delete mpDLTWrapper;
diff --git a/AudioManagerUtilities/src/CAmSocketHandler.cpp b/AudioManagerUtilities/src/CAmSocketHandler.cpp
index 4b113fa..8947a5a 100644
--- a/AudioManagerUtilities/src/CAmSocketHandler.cpp
+++ b/AudioManagerUtilities/src/CAmSocketHandler.cpp
@@ -22,7 +22,6 @@
*/
#include "CAmSocketHandler.h"
-//#include <audiomanagerconfig.h>
#include <cassert>
#include <sys/fcntl.h>
#include <sys/errno.h>
@@ -113,7 +112,7 @@ void CAmSocketHandler::start_listenting()
else
{
logError("SocketHandler::start_listenting ppoll returned with error", errno);
- exit(0);
+ throw std::runtime_error(std::string("SocketHandler::start_listenting ppoll returned with error."));
}
}
diff --git a/AudioManagerUtilities/src/CAmWatchdog.cpp b/AudioManagerUtilities/src/CAmWatchdog.cpp
index db65095..9de2a85 100755
--- a/AudioManagerUtilities/src/CAmWatchdog.cpp
+++ b/AudioManagerUtilities/src/CAmWatchdog.cpp
@@ -27,12 +27,7 @@
#include <stdexcept>
#include "audiomanagerconfig.h"
#include "CAmDltWrapper.h"
-
-#ifdef SYSTEMD_FOUND
- #include <systemd/sd-daemon.h>
-#else
- #include "sd-daemon.h"
-#endif
+#include <systemd/sd-daemon.h>
namespace am
{
@@ -61,7 +56,7 @@ CAmWatchdog::CAmWatchdog(CAmSocketHandler* CAmSocketHandler) :
timeout.tv_sec = (watchdogTimeout / 2) / 1000000;
timeout.tv_nsec = ((watchdogTimeout / 2) % 1000000) * 1000;
logInfo("CAmWatchdog::CAmWatchdog setting watchdog timeout:", watchdogTimeout, "us. Notification set to:",
- timeout.tv_sec, "sec and", timeout.tv_nsec, "ns");
+ (int)timeout.tv_sec, "sec and", (int)timeout.tv_nsec, "ns");
//add the timer here
if (mpCAmSocketHandler->addTimer(timeout, &TimerCallback, mHandle, NULL))
diff --git a/AudioManagerUtilities/src/sd-daemon.c b/AudioManagerUtilities/src/sd-daemon.c
deleted file mode 100644
index cf35148..0000000
--- a/AudioManagerUtilities/src/sd-daemon.c
+++ /dev/null
@@ -1,534 +0,0 @@
-/**
- * SPDX license identifier: MIT
- */
-
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- Copyright 2010 Lennart Poettering
-
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation files
- (the "Software"), to deal in the Software without restriction,
- including without limitation the rights to use, copy, modify, merge,
- publish, distribute, sublicense, and/or sell copies of the Software,
- and to permit persons to whom the Software is furnished to do so,
- subject to the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
-***/
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#ifdef __BIONIC__
-#include <linux/fcntl.h>
-#else
-#include <sys/fcntl.h>
-#endif
-#include <netinet/in.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <limits.h>
-
-#if defined(__linux__)
-#include <mqueue.h>
-#endif
-
-#include "sd-daemon.h"
-
-#if (__GNUC__ >= 4)
-#ifdef SD_EXPORT_SYMBOLS
-/* Export symbols */
-#define _sd_export_ __attribute__ ((visibility("default")))
-#else
-/* Don't export the symbols */
-#define _sd_export_ __attribute__ ((visibility("hidden")))
-#endif
-#else
-#define _sd_export_
-#endif
-
-_sd_export_ int sd_listen_fds(int unset_environment) {
-
-#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
- return 0;
-#else
- int r, fd;
- const char *e;
- char *p = NULL;
- unsigned long l;
-
- if (!(e = getenv("LISTEN_PID"))) {
- r = 0;
- goto finish;
- }
-
- errno = 0;
- l = strtoul(e, &p, 10);
-
- if (errno != 0) {
- r = -errno;
- goto finish;
- }
-
- if (!p || *p || l <= 0) {
- r = -EINVAL;
- goto finish;
- }
-
- /* Is this for us? */
- if (getpid() != (pid_t) l) {
- r = 0;
- goto finish;
- }
-
- if (!(e = getenv("LISTEN_FDS"))) {
- r = 0;
- goto finish;
- }
-
- errno = 0;
- l = strtoul(e, &p, 10);
-
- if (errno != 0) {
- r = -errno;
- goto finish;
- }
-
- if (!p || *p) {
- r = -EINVAL;
- goto finish;
- }
-
- for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + (int) l; fd ++) {
- int flags;
-
- if ((flags = fcntl(fd, F_GETFD)) < 0) {
- r = -errno;
- goto finish;
- }
-
- if (flags & FD_CLOEXEC)
- continue;
-
- if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) {
- r = -errno;
- goto finish;
- }
- }
-
- r = (int) l;
-
-finish:
- if (unset_environment) {
- unsetenv("LISTEN_PID");
- unsetenv("LISTEN_FDS");
- }
-
- return r;
-#endif
-}
-
-_sd_export_ int sd_is_fifo(int fd, const char *path) {
- struct stat st_fd;
-
- if (fd < 0)
- return -EINVAL;
-
- memset(&st_fd, 0, sizeof(st_fd));
- if (fstat(fd, &st_fd) < 0)
- return -errno;
-
- if (!S_ISFIFO(st_fd.st_mode))
- return 0;
-
- if (path) {
- struct stat st_path;
-
- memset(&st_path, 0, sizeof(st_path));
- if (stat(path, &st_path) < 0) {
-
- if (errno == ENOENT || errno == ENOTDIR)
- return 0;
-
- return -errno;
- }
-
- return
- st_path.st_dev == st_fd.st_dev &&
- st_path.st_ino == st_fd.st_ino;
- }
-
- return 1;
-}
-
-_sd_export_ int sd_is_special(int fd, const char *path) {
- struct stat st_fd;
-
- if (fd < 0)
- return -EINVAL;
-
- if (fstat(fd, &st_fd) < 0)
- return -errno;
-
- if (!S_ISREG(st_fd.st_mode) && !S_ISCHR(st_fd.st_mode))
- return 0;
-
- if (path) {
- struct stat st_path;
-
- if (stat(path, &st_path) < 0) {
-
- if (errno == ENOENT || errno == ENOTDIR)
- return 0;
-
- return -errno;
- }
-
- if (S_ISREG(st_fd.st_mode) && S_ISREG(st_path.st_mode))
- return
- st_path.st_dev == st_fd.st_dev &&
- st_path.st_ino == st_fd.st_ino;
- else if (S_ISCHR(st_fd.st_mode) && S_ISCHR(st_path.st_mode))
- return st_path.st_rdev == st_fd.st_rdev;
- else
- return 0;
- }
-
- return 1;
-}
-
-static int sd_is_socket_internal(int fd, int type, int listening) {
- struct stat st_fd;
-
- if (fd < 0 || type < 0)
- return -EINVAL;
-
- if (fstat(fd, &st_fd) < 0)
- return -errno;
-
- if (!S_ISSOCK(st_fd.st_mode))
- return 0;
-
- if (type != 0) {
- int other_type = 0;
- socklen_t l = sizeof(other_type);
-
- if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &other_type, &l) < 0)
- return -errno;
-
- if (l != sizeof(other_type))
- return -EINVAL;
-
- if (other_type != type)
- return 0;
- }
-
- if (listening >= 0) {
- int accepting = 0;
- socklen_t l = sizeof(accepting);
-
- if (getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, &accepting, &l) < 0)
- return -errno;
-
- if (l != sizeof(accepting))
- return -EINVAL;
-
- if (!accepting != !listening)
- return 0;
- }
-
- return 1;
-}
-
-union sockaddr_union {
- struct sockaddr sa;
- struct sockaddr_in in4;
- struct sockaddr_in6 in6;
- struct sockaddr_un un;
- struct sockaddr_storage storage;
-};
-
-_sd_export_ int sd_is_socket(int fd, int family, int type, int listening) {
- int r;
-
- if (family < 0)
- return -EINVAL;
-
- if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
- return r;
-
- if (family > 0) {
- union sockaddr_union sockaddr;
- socklen_t l;
-
- memset(&sockaddr, 0, sizeof(sockaddr));
- l = sizeof(sockaddr);
-
- if (getsockname(fd, &sockaddr.sa, &l) < 0)
- return -errno;
-
- if (l < sizeof(sa_family_t))
- return -EINVAL;
-
- return sockaddr.sa.sa_family == family;
- }
-
- return 1;
-}
-
-_sd_export_ int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) {
- union sockaddr_union sockaddr;
- socklen_t l;
- int r;
-
- if (family != 0 && family != AF_INET && family != AF_INET6)
- return -EINVAL;
-
- if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
- return r;
-
- memset(&sockaddr, 0, sizeof(sockaddr));
- l = sizeof(sockaddr);
-
- if (getsockname(fd, &sockaddr.sa, &l) < 0)
- return -errno;
-
- if (l < sizeof(sa_family_t))
- return -EINVAL;
-
- if (sockaddr.sa.sa_family != AF_INET &&
- sockaddr.sa.sa_family != AF_INET6)
- return 0;
-
- if (family > 0)
- if (sockaddr.sa.sa_family != family)
- return 0;
-
- if (port > 0) {
- if (sockaddr.sa.sa_family == AF_INET) {
- if (l < sizeof(struct sockaddr_in))
- return -EINVAL;
-
- return htons(port) == sockaddr.in4.sin_port;
- } else {
- if (l < sizeof(struct sockaddr_in6))
- return -EINVAL;
-
- return htons(port) == sockaddr.in6.sin6_port;
- }
- }
-
- return 1;
-}
-
-_sd_export_ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) {
- union sockaddr_union sockaddr;
- socklen_t l;
- int r;
-
- if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
- return r;
-
- memset(&sockaddr, 0, sizeof(sockaddr));
- l = sizeof(sockaddr);
-
- if (getsockname(fd, &sockaddr.sa, &l) < 0)
- return -errno;
-
- if (l < sizeof(sa_family_t))
- return -EINVAL;
-
- if (sockaddr.sa.sa_family != AF_UNIX)
- return 0;
-
- if (path) {
- if (length <= 0)
- length = strlen(path);
-
- if (length <= 0)
- /* Unnamed socket */
- return l == offsetof(struct sockaddr_un, sun_path);
-
- if (path[0])
- /* Normal path socket */
- return
- (l >= offsetof(struct sockaddr_un, sun_path) + length + 1) &&
- memcmp(path, sockaddr.un.sun_path, length+1) == 0;
- else
- /* Abstract namespace socket */
- return
- (l == offsetof(struct sockaddr_un, sun_path) + length) &&
- memcmp(path, sockaddr.un.sun_path, length) == 0;
- }
-
- return 1;
-}
-
-_sd_export_ int sd_is_mq(int fd, const char *path) {
-#if !defined(__linux__)
- return 0;
-#else
- struct mq_attr attr;
-
- if (fd < 0)
- return -EINVAL;
-
- if (mq_getattr(fd, &attr) < 0)
- return -errno;
-
- if (path) {
- char fpath[PATH_MAX];
- struct stat a, b;
-
- if (path[0] != '/')
- return -EINVAL;
-
- if (fstat(fd, &a) < 0)
- return -errno;
-
- strncpy(stpcpy(fpath, "/dev/mqueue"), path, sizeof(fpath) - 12);
- fpath[sizeof(fpath)-1] = 0;
-
- if (stat(fpath, &b) < 0)
- return -errno;
-
- if (a.st_dev != b.st_dev ||
- a.st_ino != b.st_ino)
- return 0;
- }
-
- return 1;
-#endif
-}
-
-_sd_export_ int sd_notify(int unset_environment, const char *state) {
-#if defined(DISABLE_SYSTEMD) || !defined(__linux__) || !defined(SOCK_CLOEXEC)
- return 0;
-#else
- int fd = -1, r;
- struct msghdr msghdr;
- struct iovec iovec;
- union sockaddr_union sockaddr;
- const char *e;
-
- if (!state) {
- r = -EINVAL;
- goto finish;
- }
-
- if (!(e = getenv("NOTIFY_SOCKET")))
- return 0;
-
- /* Must be an abstract socket, or an absolute path */
- if ((e[0] != '@' && e[0] != '/') || e[1] == 0) {
- r = -EINVAL;
- goto finish;
- }
-
- if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) {
- r = -errno;
- goto finish;
- }
-
- memset(&sockaddr, 0, sizeof(sockaddr));
- sockaddr.sa.sa_family = AF_UNIX;
- strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path));
-
- if (sockaddr.un.sun_path[0] == '@')
- sockaddr.un.sun_path[0] = 0;
-
- memset(&iovec, 0, sizeof(iovec));
- iovec.iov_base = (char*) state;
- iovec.iov_len = strlen(state);
-
- memset(&msghdr, 0, sizeof(msghdr));
- msghdr.msg_name = &sockaddr;
- msghdr.msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(e);
-
- if (msghdr.msg_namelen > sizeof(struct sockaddr_un))
- msghdr.msg_namelen = sizeof(struct sockaddr_un);
-
- msghdr.msg_iov = &iovec;
- msghdr.msg_iovlen = 1;
-
- if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) {
- r = -errno;
- goto finish;
- }
-
- r = 1;
-
-finish:
- if (unset_environment)
- unsetenv("NOTIFY_SOCKET");
-
- if (fd >= 0)
- close(fd);
-
- return r;
-#endif
-}
-
-_sd_export_ int sd_notifyf(int unset_environment, const char *format, ...) {
-#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
- return 0;
-#else
- va_list ap;
- char *p = NULL;
- int r;
-
- va_start(ap, format);
- r = vasprintf(&p, format, ap);
- va_end(ap);
-
- if (r < 0 || !p)
- return -ENOMEM;
-
- r = sd_notify(unset_environment, p);
- free(p);
-
- return r;
-#endif
-}
-
-_sd_export_ int sd_booted(void) {
-#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
- return 0;
-#else
-
- struct stat a, b;
-
- /* We simply test whether the systemd cgroup hierarchy is
- * mounted */
-
- if (lstat("/sys/fs/cgroup", &a) < 0)
- return 0;
-
- if (lstat("/sys/fs/cgroup/systemd", &b) < 0)
- return 0;
-
- return a.st_dev != b.st_dev;
-#endif
-}
diff --git a/AudioManagerDaemon/test/AmSocketHandlerTest/CAmSocketHandlerTest.cpp b/AudioManagerUtilities/test/AmSocketHandlerTest/CAmSocketHandlerTest.cpp
index 50e2aa9..50e2aa9 100644
--- a/AudioManagerDaemon/test/AmSocketHandlerTest/CAmSocketHandlerTest.cpp
+++ b/AudioManagerUtilities/test/AmSocketHandlerTest/CAmSocketHandlerTest.cpp
diff --git a/AudioManagerDaemon/test/AmSocketHandlerTest/CAmSocketHandlerTest.h b/AudioManagerUtilities/test/AmSocketHandlerTest/CAmSocketHandlerTest.h
index 95e5446..95e5446 100644
--- a/AudioManagerDaemon/test/AmSocketHandlerTest/CAmSocketHandlerTest.h
+++ b/AudioManagerUtilities/test/AmSocketHandlerTest/CAmSocketHandlerTest.h
diff --git a/AudioManagerDaemon/test/AmSocketHandlerTest/CMakeLists.txt b/AudioManagerUtilities/test/AmSocketHandlerTest/CMakeLists.txt
index bff74b6..2a3b9d8 100644
--- a/AudioManagerDaemon/test/AmSocketHandlerTest/CMakeLists.txt
+++ b/AudioManagerUtilities/test/AmSocketHandlerTest/CMakeLists.txt
@@ -15,48 +15,16 @@
# For further information see http://www.genivi.org/.
#
-cmake_minimum_required(VERSION 2.8.8)
-
-project(AmSocketHandlerTest)
-
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager")
-
-set (AM_LINK_LIBS
- ${CMAKE_DL_LIBS}
- AudioManagerUtilities
- rt)
-
-IF (WITH_CAPI_WRAPPER)
- set (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- -Wl,--as-needed CommonAPI
- )
-ENDIF (WITH_CAPI_WRAPPER)
-
-if(WITH_DLT)
- pkg_check_modules(DLT REQUIRED automotive-dlt>=2.2.0)
- set (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- ${DLT_LIBRARIES})
-endif(WITH_DLT)
+cmake_minimum_required(VERSION 3.0)
+project(AmSocketHandlerTest LANGUAGES CXX VERSION ${DAEMONVERSION})
INCLUDE_DIRECTORIES(
- ${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDE_FOLDER}
- ${CMAKE_SOURCE_DIR}
- ${INCLUDE_FOLDER}
- ${GOOGLE_TEST_INCLUDE_DIR}
${AUDIOMANAGER_UTILITIES_INCLUDE}
- ${GMOCK_INCLUDE_DIR}
+ ${GMOCK_INCLUDE_DIRS}
)
-if(WITH_DLT)
- INCLUDE_DIRECTORIES(
- ${INCLUDE_DIRECTORIES}
- ${DLT_INCLUDE_DIRS})
-endif(WITH_DLT)
-
+
file(GLOB Socket_SRCS_CXX
"*.cpp"
)
@@ -64,12 +32,14 @@ file(GLOB Socket_SRCS_CXX
ADD_EXECUTABLE(AmSocketHandlerTest ${Socket_SRCS_CXX})
TARGET_LINK_LIBRARIES(AmSocketHandlerTest
- ${AM_LINK_LIBS}
- gtest
- gmock
+ ${GTEST_LIBRARIES}
+ ${GMOCK_LIBRARIES}
+ AudioManagerUtilities
)
-ADD_DEPENDENCIES(AmSocketHandlerTest gtest gmock AudioManagerUtilities)
+ADD_TEST(AmSocketHandlerTest AmSocketHandlerTest ${Socket_SRCS_CXX})
+
+ADD_DEPENDENCIES(AmSocketHandlerTest AudioManagerUtilities)
INSTALL(TARGETS AmSocketHandlerTest
DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
diff --git a/AudioManagerUtilities/test/CMakeLists.txt b/AudioManagerUtilities/test/CMakeLists.txt
new file mode 100644
index 0000000..fb55831
--- /dev/null
+++ b/AudioManagerUtilities/test/CMakeLists.txt
@@ -0,0 +1,4 @@
+add_subdirectory (AmSocketHandlerTest)
+
+
+
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9c0a238..b977b76 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,24 +16,19 @@
#
-cmake_minimum_required(VERSION 2.8.8)
-
-project(AudioManagerDeamon)
+cmake_minimum_required(VERSION 3.0)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
+include ( MacroVersionFromGit )
+
+project(AudioManager LANGUAGES CXX VERSION ${DAEMONVERSION})
include ( CMakeDependentOption )
-include ( MacroVersionFromGit )
include ( MacroInterfaceVersions )
include ( CMakePackageConfigHelpers )
include ( GNUInstallDirs )
-
-if (NOT ${CMAKE_TOOLCHAIN_FILE} EQUAL "")
- message(STATUS "Using CMAKE_TOOLCHAIN_FILE='${CMAKE_TOOLCHAIN_FILE}'" )
-endif (NOT ${CMAKE_TOOLCHAIN_FILE} EQUAL "")
-
+include ( CTest )
find_package(PkgConfig)
-find_package(CommonAPI)
option( WITH_TESTS
"Build together with all available unitTest" ON )
@@ -53,9 +48,6 @@ option( WITH_TELNET
option ( WITH_SYSTEMD_WATCHDOG
"Build with systemD support & watchdog" OFF)
-option ( USE_BUILD_LIBS
- "Build with default library path = build path" ON)
-
option ( GLIB_DBUS_TYPES_TOLERANT
"Build dbus with tolerance towards glib 16bit/32bit handling" ON)
@@ -66,11 +58,12 @@ option ( WITH_DBUS_WRAPPER
"Build with Dbus wrapper" OFF)
option ( WITH_SHARED_UTILITIES
- "Build audio manager utilities as dynamic library" OFF)
-
-option ( WITH_DATABASE_STORAGE
- "Build with sqlite as in memory storage" OFF)
-
+ "Build audio manager utilities as dynamic library" OFF)
+
+option ( WITH_SHARED_CORE
+ "Build audio manager core as dynamic library" OFF)
+
+
set(DBUS_SERVICE_PREFIX "org.genivi.audiomanager"
CACHE PROPERTY "The dbus service prefix for the AM - only changable for legacy dbus")
@@ -86,32 +79,32 @@ set(MAX_TELNETCONNECTIONS 3
set(DYNAMIC_ID_BOUNDARY 100
CACHE INTEGER "The ID boundary between static and dynamic ID ranges")
-set(PLUGINS_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin/plugins
- CACHE STRINGS "The output path of the plugins")
-
set(LIB_INSTALL_SUFFIX "audiomanager"
CACHE STRINGS "The suffix used for installation of the plugins")
-set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin
- CACHE STRINGS "The binary will be placed here")
-
-set(TEST_EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin/tests
- CACHE STRINGS "The test binaries will be placed here")
-
-set(TEST_EXECUTABLE_INSTALL_PATH "~/tests"
+set(TEST_EXECUTABLE_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/bin
CACHE STRINGS "The test binaries will be installed here")
-set(DOC_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/doc
+set(DOC_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/doc/AudioManager
CACHE STRINGS "The doxygen documentation will be placed here")
set(AM_SHARE_FOLDER ${CMAKE_INSTALL_PREFIX}/share/audiomanager
CACHE STRINGS "The share folder for the AM. Some DBus xmls will be placed here and so on")
+set(AM_MAP_CAPACITY 10
+ CACHE INTEGER "Number of preallocations for datastorage")
+
+set(AM_MAX_CONNECTIONS 0x1000
+ CACHE INTEGER "Number of max connections before rollover")
+
+set(AM_MAX_MAIN_CONNECTIONS 0x1000
+ CACHE INTEGER "Number of max Mainconnections before rollover")
+
set(AUDIOMANAGER_INCLUDE_FOLDER ${CMAKE_BINARY_DIR}/include)
set(AUDIO_INCLUDE_FOLDER ${CMAKE_SOURCE_DIR}/include)
set(AUDIOMANAGER_UTILITIES ${CMAKE_SOURCE_DIR}/AudioManagerUtilities)
-set(AUDIOMANAGER_UTILITIES_INCLUDE ${AUDIOMANAGER_UTILITIES}/include)
-set(AUDIOMANAGER_UTILITIES_SRC ${AUDIOMANAGER_UTILITIES}/src)
+set(AUDIOMANAGER_CORE ${CMAKE_SOURCE_DIR}/AudioManagerCore)
+set(AUDIOMANAGER_CORE_INCLUDE ${AUDIOMANAGER_CORE}/include)
set(DOXY_PROTOTYPE ${CMAKE_SOURCE_DIR}/cmake/DoxyFile.in)
set(DOXY_FILE ${CMAKE_CURRENT_BINARY_DIR}/DoxyFile)
set(AUDIOMANAGER_DAEMON_FOLDER ${CMAKE_SOURCE_DIR}/AudioManagerDaemon)
@@ -121,80 +114,65 @@ set(TCLAP_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/tclap-1.2.1/include)
GET_COMMAND_INTERFACE_VERSION(${AUDIO_INCLUDE_FOLDER})
GET_ROUTING_INTERFACE_VERSION(${AUDIO_INCLUDE_FOLDER})
GET_CONTROL_INTERFACE_VERSION(${AUDIO_INCLUDE_FOLDER})
-message( STATUS "CommandInterface version: ${LIB_COMMAND_INTERFACE_VERSION}")
-message( STATUS "ControlInterface version: ${LIB_CONTROL_INTERFACE_VERSION}")
-message( STATUS "RoutingInterface version: ${LIB_ROUTING_INTERFACE_VERSION}")
-
-if(USE_BUILD_LIBS)
- if(NOT DEFINED DEFAULT_PLUGIN_COMMAND_DIR)
- set(DEFAULT_PLUGIN_COMMAND_DIR "${PLUGINS_OUTPUT_PATH}/command")
- endif(NOT DEFINED DEFAULT_PLUGIN_COMMAND_DIR)
- if(NOT DEFINED DEFAULT_PLUGIN_ROUTING_DIR)
- set(DEFAULT_PLUGIN_ROUTING_DIR "${PLUGINS_OUTPUT_PATH}/routing")
- endif(NOT DEFINED DEFAULT_PLUGIN_ROUTING_DIR)
- if(NOT DEFINED CONTROLLER_PLUGIN)
- set(CONTROLLER_PLUGIN "${PLUGINS_OUTPUT_PATH}/control/libPluginControlInterface.so")
- endif(NOT DEFINED CONTROLLER_PLUGIN)
-else(USE_BUILD_LIBS)
- if(NOT DEFINED DEFAULT_PLUGIN_COMMAND_DIR)
- set(DEFAULT_PLUGIN_COMMAND_DIR "${CMAKE_INSTALL_PREFIX}/lib/${LIB_INSTALL_SUFFIX}/command")
- endif(NOT DEFINED DEFAULT_PLUGIN_COMMAND_DIR)
- if(NOT DEFINED DEFAULT_PLUGIN_ROUTING_DIR)
- set(DEFAULT_PLUGIN_ROUTING_DIR "${CMAKE_INSTALL_PREFIX}/lib/${LIB_INSTALL_SUFFIX}/routing")
- endif(NOT DEFINED DEFAULT_PLUGIN_ROUTING_DIR)
- if(NOT DEFINED CONTROLLER_PLUGIN)
- set(CONTROLLER_PLUGIN "${CMAKE_INSTALL_PREFIX}/lib/${LIB_INSTALL_SUFFIX}/control/libPluginControlInterface.so")
- endif(NOT DEFINED CONTROLLER_PLUGIN)
-endif(USE_BUILD_LIBS)
-
-
-if(USE_BUILD_LIBS)
- execute_process(COMMAND mkdir -p "${CMAKE_CURRENT_BINARY_DIR}/bin")
-endif(USE_BUILD_LIBS)
-
-if(WITH_DLT)
- pkg_check_modules(DLT REQUIRED automotive-dlt>=2.2.0)
- add_definitions(${DLT_CFLAGS_OTHER})
- include_directories(${DLT_INCLUDE_DIRS})
- link_directories(${DLT_LIBRARY_DIRS})
-endif(WITH_DLT)
-if(WITH_TESTS)
- add_subdirectory(googleMock)
- set(GMOCK_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/googleMock/include")
- set(GOOGLE_TEST_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/googleMock/gtest/include")
-endif(WITH_TESTS)
+if(NOT DEFINED DEFAULT_PLUGIN_COMMAND_DIR)
+ set(DEFAULT_PLUGIN_COMMAND_DIR "${CMAKE_INSTALL_PREFIX}/lib/${LIB_INSTALL_SUFFIX}/command")
+endif(NOT DEFINED DEFAULT_PLUGIN_COMMAND_DIR)
+if(NOT DEFINED DEFAULT_PLUGIN_ROUTING_DIR)
+ set(DEFAULT_PLUGIN_ROUTING_DIR "${CMAKE_INSTALL_PREFIX}/lib/${LIB_INSTALL_SUFFIX}/routing")
+endif(NOT DEFINED DEFAULT_PLUGIN_ROUTING_DIR)
+if(NOT DEFINED CONTROLLER_PLUGIN_DIR)
+ set(CONTROLLER_PLUGIN_DIR "${CMAKE_INSTALL_PREFIX}/lib/${LIB_INSTALL_SUFFIX}/control")
+endif(NOT DEFINED CONTROLLER_PLUGIN_DIR)
##global build flags set(CPACK_RPM_COMPONENT_INSTALL ON)
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pedantic -rdynamic -Wno-variadic-macros")
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -pedantic -rdynamic -Wno-variadic-macros")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -DDEBUG")
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O2 -DNDEBUG")
+if(WITH_TESTS)
+ #check if we can find the google stuff
+ pkg_check_modules (GTEST "gtest >= 1.6.0")
+ pkg_check_modules (GMOCK "gmock >= 1.6.0")
+ if (NOT(${GTEST_FOUND} AND ${GMOCK_FOUND}))
+ message (STATUS "Building and installing with shipped sources")
+ add_subdirectory(googleMock)
+ set(GMOCK_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/googleMock/include")
+ set(GTEST_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/googleMock/gtest/include")
+ set(GTEST_LIBRARIES gtest gtest_main)
+ set(GMOCK_LIBRARIES gmock gmock_main)
+ configure_file( ${CMAKE_SOURCE_DIR}/cmake/gtest.pc.in ${CMAKE_BINARY_DIR}/gtest.pc @ONLY )
+ configure_file( ${CMAKE_SOURCE_DIR}/cmake/gmock.pc.in ${CMAKE_BINARY_DIR}/gmock.pc @ONLY )
+ install(FILES ${CMAKE_BINARY_DIR}/gmock.pc ${CMAKE_BINARY_DIR}/gtest.pc DESTINATION lib/pkgconfig COMPONENT devel)
+ endif (NOT(${GTEST_FOUND} AND ${GMOCK_FOUND}))
+endif(WITH_TESTS)
+
configure_package_config_file (
- ${CMAKE_SOURCE_DIR}/cmake/audiomanagerConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/audiomanagerConfig.cmake
+ ${CMAKE_SOURCE_DIR}/cmake/AudioManagerConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/AudioManagerConfig.cmake
INSTALL_DESTINATION lib/${LIB_INSTALL_SUFFIX}/cmake
PATH_VARS AUDIO_INCLUDE_FOLDER )
write_basic_package_version_file(
- ${CMAKE_CURRENT_BINARY_DIR}/AudioManagerVersion.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/AudioManagerConfigVersion.cmake
VERSION ${DAEMONVERSION}
COMPATIBILITY SameMajorVersion )
-
-add_subdirectory (AudioManagerDaemon)
-add_subdirectory (AudioManagerUtilities)
-if(EXISTS "${CMAKE_SOURCE_DIR}/Plugins/")
- add_subdirectory (${CMAKE_SOURCE_DIR}/Plugins)
-endif(EXISTS "${CMAKE_SOURCE_DIR}/Plugins/")
-
-configure_file( ${CMAKE_SOURCE_DIR}/AudioManagerDaemon/docx/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/DoxyFile )
+configure_file( ${CMAKE_SOURCE_DIR}/docx/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/DoxyFile )
configure_file( ${CMAKE_SOURCE_DIR}/cmake/config.cmake.in ${CMAKE_BINARY_DIR}/include/audiomanagerconfig.h )
configure_file( ${CMAKE_SOURCE_DIR}/cmake/audiomanager.pc.in ${CMAKE_BINARY_DIR}/audiomanager.pc @ONLY )
+
+add_subdirectory (AudioManagerUtilities)
+add_subdirectory (AudioManagerCore)
+add_subdirectory (AudioManagerDaemon)
-install(FILES ${CMAKE_BINARY_DIR}/audiomanager.pc DESTINATION lib/pkgconfig COMPONENT devel)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/audiomanagerConfig.cmake
- DESTINATION lib/${LIB_INSTALL_SUFFIX}/cmake
- COMPONENT dev)
+
+install(
+ FILES ${CMAKE_BINARY_DIR}/AudioManagerConfig.cmake
+ ${CMAKE_BINARY_DIR}/AudioManagerConfigVersion.cmake
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/AudioManager-${DAEMONVERSION}
+)
+
+install(FILES ${CMAKE_BINARY_DIR}/audiomanager.pc DESTINATION lib/pkgconfig COMPONENT devel)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/audiomanagerconfig.h
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${LIB_INSTALL_SUFFIX}
COMPONENT dev)
@@ -211,29 +189,48 @@ if(WITH_DOCUMENTATION)
COMMAND ${DOXYGEN_EXECUTABLE} ${DOC_OUTPUT_PATH}/Doxyfile WORKING_DIRECTORY ${DOC_OUTPUT_PATH}
SOURCES ${CMAKE_SOURCE_DIR} ${DOC_OUTPUT_PATH}/Doxyfile
)
+ find_program(ASCIIDOC asciidoc asciidoc.py)
+
+ if (ASCIIDOC_FOUND)
+ execute_process(COMMAND ${ASCIIDOC} -o ${DOC_OUTPUT_PATH}/html/README.html ${CMAKE_SOURCE_DIR}/README )
+ endif(ASCIIDOC_FOUND)
+
install (DIRECTORY ${DOC_OUTPUT_PATH}/
DESTINATION "${CMAKE_INSTALL_DOCDIR}"
PATTERN "Doxyfile" EXCLUDE
PATTERN "def" EXCLUDE)
endif(WITH_DOCUMENTATION)
-SET(CMAKE_INSTALL_CONFIG_NAME "RelWithDebInfo")
-
-add_custom_target(bin-install
- COMMAND
- "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=bin
- -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
-)
-
-add_custom_target(dev-install
- COMMAND
- "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=dev
- -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
-)
-
-add_custom_target(test-install
- COMMAND
- "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=tests
- -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
-)
+message(STATUS)
+message(STATUS "${PROJECT_NAME} Configuration:")
+message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
+message(STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}")
+message(STATUS "BUILD_DOCUMENTATION = ${WITH_DOCUMENTATION}")
+message(STATUS "WITH_TESTS = ${WITH_TESTS}")
+message(STATUS "WITH_DLT = ${WITH_DLT}")
+message(STATUS "WITH_TESTS = ${WITH_TESTS}")
+message(STATUS "WITH_TELNET = ${WITH_TELNET}")
+message(STATUS "WITH_SYSTEMD_WATCHDOG = ${WITH_SYSTEMD_WATCHDOG}")
+message(STATUS "WITH_CAPI_WRAPPER = ${WITH_CAPI_WRAPPER}")
+message(STATUS "WITH_DBUS_WRAPPER = ${WITH_DBUS_WRAPPER}")
+message(STATUS "WITH_SHARED_UTILITIES = ${WITH_SHARED_UTILITIES}")
+message(STATUS "WITH_SHARED_CORE = ${WITH_SHARED_CORE}")
+message(STATUS "DYNAMIC_ID_BOUNDARY = ${DYNAMIC_ID_BOUNDARY}")
+message(STATUS "LIB_INSTALL_SUFFIX = ${LIB_INSTALL_SUFFIX}")
+message(STATUS "TEST_EXECUTABLE_INSTALL_PATH = ${TEST_EXECUTABLE_INSTALL_PATH}")
+message(STATUS "DEFAULT_PLUGIN_COMMAND_DIR = ${DEFAULT_PLUGIN_COMMAND_DIR}")
+message(STATUS "DEFAULT_PLUGIN_ROUTING_DIR = ${DEFAULT_PLUGIN_ROUTING_DIR}")
+message(STATUS "CONTROLLER_PLUGIN_DIR = ${CONTROLLER_PLUGIN_DIR}")
+message(STATUS "AM_SHARE_FOLDER = ${AM_SHARE_FOLDER}")
+message(STATUS "AM_MAP_CAPACITY = ${AM_MAP_CAPACITY}")
+message(STATUS "AM_MAX_CONNECTIONS = ${AM_MAX_CONNECTIONS}")
+message(STATUS "AM_MAX_MAIN_CONNECTIONS = ${AM_MAX_MAIN_CONNECTIONS}")
+message(STATUS "BUILD_TESTING = ${BUILD_TESTING}")
+message(STATUS "CMAKE_INSTALL_DOCDIR = ${CMAKE_INSTALL_DOCDIR}")
+message(STATUS "CommandInterface version: ${LIB_COMMAND_INTERFACE_VERSION}")
+message(STATUS "ControlInterface version: ${LIB_CONTROL_INTERFACE_VERSION}")
+message(STATUS "RoutingInterface version: ${LIB_ROUTING_INTERFACE_VERSION}")
+message(STATUS)
+message(STATUS)
+message(STATUS)
diff --git a/README b/README
index 2611ac4..6a53965 100755
--- a/README
+++ b/README
@@ -23,9 +23,11 @@ Author Christian Linke = Christian Linke christian.linke@bmw.de BMW 2011-2015
For further information see http://projects.genivi.org/audio-manager/.
== Repositories
-The main repository is http://git.projects.genivi.org-AudioManager.git
+The main repository is
+http://git.projects.genivi.org-AudioManager.git
-The repository for example plugins can be found here: http://git.projects.genivi.org/AudioManagerPlugins.git
+The repository for example plugins can be found here:
+http://git.projects.genivi.org/AudioManagerPlugins.git
== License
The licenses of this project are split into two parts:
@@ -67,44 +69,35 @@ The README is compiled into README.html with asciidoc
=== Compile Options
These are the compile options with default values:
-
- AM_MAP_CAPACITY 10
- AM_MAX_CONNECTIONS 0x1000
- AM_SHARE_FOLDER /usr/local/share/audiomanager
- BUILD_SHARED_LIBS OFF
- CMAKE_BUILD_TYPE
- CMAKE_INSTALL_PREFIX /usr/local
- COMMON_API_DBUS_LIBRARY /usr/local/lib/libCommonAPI-DBus.so
- COMMON_API_LIBRARY /usr/local/lib/libCommonAPI.so
- DBUS_SERVICE_OBJECT_PATH /org/genivi/audiomanager
- DBUS_SERVICE_PREFIX org.genivi.audiomanager
- DEFAULT_TELNETPORT 6080
- DOC_OUTPUT_PATH XXX/build/doc
- DYNAMIC_ID_BOUNDARY 100
- EXECUTABLE_OUTPUT_PATH XXX/build/bin
- GLIB_DBUS_TYPES_TOLERANT ON
- LIB_INSTALL_SUFFIX audiomanager
- MAX_TELNETCONNECTIONS 3
- NSM_BUS_INTERFACE org.genivi.NodeStateManager
- NSM_INTERFACE org.genivi.NodeStateManager.Consumer
- NSM_PATH /org/genivi/NodeStateManager
- PLUGINS_OUTPUT_PATH XXX/build/plugins
- TEST_EXECUTABLE_INSTALL_PATH ~/tests
- TEST_EXECUTABLE_OUTPUT_PATH XXX/build/bin/tests
- USE_BUILD_LIBS ON
- WITH_DATABASE_STORAGE OFF
- WITH_DLT ON
- WITH_DOCUMENTATION OFF
- WITH_SHARED_UTILITIES OFF
- WITH_SYSTEMD_WATCHDOG OFF
- WITH_TELNET ON
- WITH_TESTS ON
- gmock_build_tests OFF
- gtest_build_samples OFF
- gtest_build_tests OFF
- gtest_disable_pthreads OFF
- gtest_force_shared_crt OFF
-
+----
+AudioManager Configuration:
+-- CMAKE_BUILD_TYPE =
+-- CMAKE_INSTALL_PREFIX = /usr/local
+-- BUILD_DOCUMENTATION = OFF
+-- WITH_TESTS = ON
+-- WITH_DLT = ON
+-- WITH_TESTS = ON
+-- WITH_TELNET = ON
+-- WITH_SYSTEMD_WATCHDOG = OFF
+-- WITH_CAPI_WRAPPER = ON
+-- WITH_DBUS_WRAPPER = OFF
+-- WITH_SHARED_UTILITIES = OFF
+-- WITH_SHARED_CORE = OFF
+-- DYNAMIC_ID_BOUNDARY = 100
+-- LIB_INSTALL_SUFFIX = audiomanager
+-- TEST_EXECUTABLE_INSTALL_PATH = ~/tests
+-- DEFAULT_PLUGIN_COMMAND_DIR = /usr/local/lib/audiomanager/command
+-- DEFAULT_PLUGIN_ROUTING_DIR = /usr/local/lib/audiomanager/routing
+-- CONTROLLER_PLUGIN_DIR = /usr/local/lib/audiomanager/control
+-- AM_SHARE_FOLDER = /usr/local/share/audiomanager
+-- AM_MAP_CAPACITY = 10
+-- AM_MAX_CONNECTIONS = 0x1000
+-- AM_MAX_MAIN_CONNECTIONS = 0x1000
+-- BUILD_TESTING = ON
+-- CommandInterface version: 4.0
+-- ControlInterface version: 5.0
+-- RoutingInterface version: 5.0
+----
=== Passing options to cmake:
Standard CMake can be used to configure these options. Tools like ccmake can be used to visually change the values.
@@ -116,36 +109,32 @@ for example...
You will need optionally fulfill some dependencies in order to compile the GENIVI AudioManager Daemon, these are:
-* dbus (only when DBUS_WRAPPER==ON) [tested on version 1.2.16]
-* sqlite3 [tested on version 3.6.22] (only when WITH_DATABASE_STORAGE==ON)
+* dbus (only when WITH_DBUS_WRAPPER==ON) [tested on version 1.2.16]
* automotive-dlt [greater 2.5.0] (only when WITH_DLT==ON)
* doxygen [tested on version 1.6.3] (only when WITH_DOCUMENTATION==ON)
-* commonAPI [version > 2.1] (only with WITH_ENABLED_IPC CAPI), more information here http://projects.genivi.org/commonapi/
-
-To install them in a build environment like Ubuntu you can use:
-----
-sudo apt-get install libdbus-1-dev libsqlite3-dev doxygen git cmake build-essential
-----
+* commonAPI [version > 3.1.5] (only with WITH_CAPI_WRAPPER), more information here http://projects.genivi.org/commonapi/
+* systemd [ version > 44 ] (only WITH_SYSTEMD_WATCHDOG)
=== AudioManagerUtilities
In the AudioManagerUtilites you can find helper functions that can be reused by other projects as well.
The library can be shipped as a static or a dynamic link library (WITH_SHARED_UTILITIES).
-=== The NodeStateManager
+=== AudioManagerCore
-The nodestatemanager headers are needed to compile the audiomanager. If the nodestatemanager includes are not found,
-the headers shipped with the audiomanager are used.
-The nodestatemanager can be retrieved from projects.genivi.org .
+The AudioMangerCore is build as a static (or with WITH_SHARED_CORE) library. Sometimes it is useful for unit testing of a plugin to compile against the core.
-Please note that the NSM interface must be compatible with Dbus properties. This requires for CommonAPI to use the commonAPI fdepl.
-It used to work, but currently with CommmonAPI 2.6.1 the generation does not work anymore.
+=== CommonAPI Wrapper
-=== CommonAPI File generation
+The commonapi wrapper provides the mainloop intergration for commonapi into the Mainloop of the audiomanager (CAmSockethandler).
+In order to use it, just use:
-The audiomanager will search in /usr/share or /usr/local/share for a generator. He will generate all necessary files with this generator into the build tree.
+----
+CAPI->registerService(....)
+CAPI->buildProxy(...)
+----
-The addresses used for commonAPI are fixed. If you need to change them, you can use a central or local configure file. More information on CommonAPI documentation: http://projects.genivi.org/commonapi/
+instead of the standard calls. The CAPIWrapper will serialize the commands and integrate it smoothly with the mainloop.
=== Tests
@@ -184,39 +173,26 @@ sudo make install
this installs everything.
-== Build targets
+== Compiling plugins
-Several install targets exists:
+Once the Audiomanager is installed, it will also install *.pc files for autotools and *Config.cmake files for cmake projects.
+In order to compile and link against the AudioMananger, you can use:
-just install the audiomanager
----
-sudo make bin-install
+find_package(AudioManager REQUIRED )
+find_package(AudioManagerUtilities)
----
-
-just install the dev package with all headers and cmake file, needed to compile plugins out of source
-----
-sudo make dev-install
+to find the configuration files. To use the right include paths, use:
----
-
-just install the tests
+${AudioManager_INCLUDE_DIRS}
+${AudioManagerUtilities_INCLUDE_DIRS}
----
-sudo make test-install
-----
-
-just install the plugins (only available if plugins are compiled)
+to link agains the right libs use:
----
-sudo make plugins-install
+${AudioManagerUtilities_LIBRARIES}
----
-just install the test for the plugins (only available if plugins are compiled)
-----
-sudo make plugin-test-install
-----
-
-If you want to compile the Audiomanager together with the plugins, simply clone the plugins into a folder
-Plugins on the main level. The Plugins will be then compiled together with the AudioManager.
-
-If the plugins are compiled separately, the AudioManager needs to be installed on the system. The plugins will find and read the important CMake variables and use them.
+for example, see the AudiomanagerPlugins
=== Adding own plugins
To keep the own sources away from the GENIVI code the project specific elements can be reconfigured with own type definitions.
diff --git a/README.html b/README.html
index 57eea58..3204c5d 100644
--- a/README.html
+++ b/README.html
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
-<meta name="generator" content="AsciiDoc 8.6.6" />
+<meta name="generator" content="AsciiDoc 8.6.9" />
<title>GENIVI_AudioManager</title>
<style type="text/css">
/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
@@ -87,10 +87,16 @@ ul, ol, li > p {
ul > li { color: #aaa; }
ul > li > * { color: black; }
-pre {
+.monospaced, code, pre {
+ font-family: "Courier New", Courier, monospace;
+ font-size: inherit;
+ color: navy;
padding: 0;
margin: 0;
}
+pre {
+ white-space: pre-wrap;
+}
#author {
color: #527bbd;
@@ -219,7 +225,7 @@ div.exampleblock > div.content {
}
div.imageblock div.content { padding-left: 0; }
-span.image img { border-style: none; }
+span.image img { border-style: none; vertical-align: text-bottom; }
a.image:visited { color: white; }
dl {
@@ -349,7 +355,7 @@ div.colist td img {
margin-bottom: 0.1em;
}
-div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
+div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
margin-top: 0;
margin-bottom: 0;
}
@@ -407,18 +413,14 @@ span.underline { text-decoration: underline; }
span.overline { text-decoration: overline; }
span.line-through { text-decoration: line-through; }
+div.unbreakable { page-break-inside: avoid; }
+
/*
* xhtml11 specific
*
* */
-tt {
- font-family: monospace;
- font-size: inherit;
- color: navy;
-}
-
div.tableblock {
margin-top: 1.0em;
margin-bottom: 1.5em;
@@ -452,12 +454,6 @@ div.tableblock > table[frame="vsides"] {
*
* */
-.monospaced {
- font-family: monospace;
- font-size: inherit;
- color: navy;
-}
-
table.tableblock {
margin-top: 1.0em;
margin-bottom: 1.5em;
@@ -537,6 +533,8 @@ body.manpage div.sectionbody {
@media print {
body.manpage div#toc { display: none; }
}
+
+
</style>
<script type="text/javascript">
/*<![CDATA[*/
@@ -581,7 +579,7 @@ toc: function (toclevels) {
function tocEntries(el, toclevels) {
var result = new Array;
- var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
+ var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
// Function that scans the DOM tree for header elements (the DOM2
// nodeIterator API would be a better technique but not supported by all
// browsers).
@@ -610,7 +608,7 @@ toc: function (toclevels) {
var i;
for (i = 0; i < toc.childNodes.length; i++) {
var entry = toc.childNodes[i];
- if (entry.nodeName == 'div'
+ if (entry.nodeName.toLowerCase() == 'div'
&& entry.getAttribute("class")
&& entry.getAttribute("class").match(/^toclevel/))
tocEntriesToRemove.push(entry);
@@ -656,7 +654,7 @@ footnotes: function () {
var entriesToRemove = [];
for (i = 0; i < noteholder.childNodes.length; i++) {
var entry = noteholder.childNodes[i];
- if (entry.nodeName == 'div' && entry.getAttribute("class") == "footnote")
+ if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
entriesToRemove.push(entry);
}
for (i = 0; i < entriesToRemove.length; i++) {
@@ -746,20 +744,22 @@ asciidoc.install();
Copyright &#169; 2012, BMW AG</p></div>
<div class="paragraph"><p>This file is part of GENIVI Project AudioManager.</p></div>
<div class="paragraph"><p>Contributions are licensed to the GENIVI Alliance under one or more
-Contribution License Agreements or MPL 2.0 .</p></div>
+Contribution License Agreements or MPL 2.0.</p></div>
<div class="paragraph"><p>&#169; 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 <a href="http://mozilla.org/MPL/2.0/">http://mozilla.org/MPL/2.0/</a>.</p></div>
-<div class="paragraph"><p>author Christian Linke = Christian Linke <a href="mailto:christian.linke@bmw.de">christian.linke@bmw.de</a> BMW 2011-2015</p></div>
+<div class="paragraph"><p>Author Christian Linke = Christian Linke <a href="mailto:christian.linke@bmw.de">christian.linke@bmw.de</a> BMW 2011-2015</p></div>
<div class="paragraph"><p>For further information see <a href="http://projects.genivi.org/audio-manager/">http://projects.genivi.org/audio-manager/</a>.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_repositories">Repositories</h2>
<div class="sectionbody">
-<div class="paragraph"><p>The main repository is <a href="http://git.projects.genivi.org-AudioManager.git">http://git.projects.genivi.org-AudioManager.git</a></p></div>
-<div class="paragraph"><p>The repository for example plugins can be found here: <a href="http://git.projects.genivi.org/AudioManagerPlugins.git">http://git.projects.genivi.org/AudioManagerPlugins.git</a></p></div>
+<div class="paragraph"><p>The main repository is
+<a href="http://git.projects.genivi.org-AudioManager.git">http://git.projects.genivi.org-AudioManager.git</a></p></div>
+<div class="paragraph"><p>The repository for example plugins can be found here:
+<a href="http://git.projects.genivi.org/AudioManagerPlugins.git">http://git.projects.genivi.org/AudioManagerPlugins.git</a></p></div>
</div>
</div>
<div class="sect1">
@@ -769,21 +769,21 @@ this file, You can obtain one at <a href="http://mozilla.org/MPL/2.0/">http://mo
<div class="paragraph"><p>1) the AudioManagerDaemon, licensed under MPL 2.0</p></div>
<div class="paragraph"><p>2) the plugins that serve as example code that can be taken to build up an own project with it -
these parts are licensed with the MIT license</p></div>
-<div class="paragraph"><p>Contribution is done under GENIVI CLA or MPL2.0.</p></div>
+<div class="paragraph"><p>Contribution is done under MPL2.0 or MIT License, depending on the location of the code.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_version">Version</h2>
<div class="sectionbody">
-<div class="paragraph"><p>The current version can be taken out of the git. The version 1.0.0 is the first GENIVI compliant code,in the compliance statement of discovery (2.0).
-For every GENIVI release, there is a release of the AudioManager, each of the releases have an own bugfix branch that will get the most important fixes.
+<div class="paragraph"><p>The current version can be taken out of the git. The version 1.0.0 is the first GENIVI compliant code, in the compliance statement of Discovery (2.0).
+For every GENIVI release, there is a release of the AudioManager, each of the releases have their own bug fix branch that will get the most important fixes.
Development is done on the master branch.</p></div>
<div class="sect2">
<h3 id="_versioning_scheme">Versioning Scheme</h3>
<div class="paragraph"><p>The versioning scheme was decided in the February face2face 2012.
-The firs number describes the release branch. This is 1 for discovery, 2 for excalibur and 3 for photon. For major features or release, the second number will be increased.
-Each new GENIVI version (releases are every half year, around april and october) will get the current HEAD (for example 2.0.34 for excalibur) and release with the increase of the second number (2.1).
-The next commit on the master branch gets then the new first numner (3) and starts from zero.</p></div>
+The first number describes the release branch. This is 1 for Discovery, 2 for Excalibur and 3 for Foton. For major features or release, the second number will be increased.
+Each new GENIVI version (releases are every half year, around April and October) will get the current HEAD (for example 2.0.34 for Excalibur) and release with the increase of the second number (2.1).
+The next commit on the master branch gets then the new first number (3) and starts from zero.</p></div>
<div class="paragraph"><p>For the daemon the third number (for example 1.0.X) describes the patch version. The versions are automatically created by git during the build process.
The versioning scheme is used for the AudioManager daemon itself and for each of it&#8217;s interfaces. The versioning of the Interfaces in EA is defined via the tag "version" and the name of the interfaceversion versionName, for example "CommandReceiveVersion". This information is generated into the interface header files and is used then by cmake to set the interface versions.
Whenever changes are done, the minor version of the interface needs to be incremented.</p></div>
@@ -797,10 +797,10 @@ Whenever changes are done, the minor version of the interface needs to be increm
<div class="paragraph"><p>A very detailed documentation is provided by doxygen. In order to use this, please compile the AudioManager with</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>cmake -DWITH_DOCUMENTATION=ON
+<pre><code>cmake -DWITH_DOCUMENTATION=ON
make
-The README is compiled into README.html with asciidoc</tt></pre>
+The README is compiled into README.html with asciidoc</code></pre>
</div></div>
</div>
</div>
@@ -810,45 +810,35 @@ The README is compiled into README.html with asciidoc</tt></pre>
<div class="sect2">
<h3 id="_compile_options">Compile Options</h3>
<div class="paragraph"><p>These are the compile options with default values:</p></div>
-<div class="literalblock">
+<div class="listingblock">
<div class="content">
-<pre><tt>AM_MAP_CAPACITY 10
-AM_MAX_CONNECTIONS 0x1000
-AM_SHARE_FOLDER /usr/local/share/audiomanager
-BUILD_SHARED_LIBS OFF
-CMAKE_BUILD_TYPE
-CMAKE_INSTALL_PREFIX /usr/local
-COMMON_API_DBUS_LIBRARY /usr/local/lib/libCommonAPI-DBus.so
-COMMON_API_LIBRARY /usr/local/lib/libCommonAPI.so
-DBUS_SERVICE_OBJECT_PATH /org/genivi/audiomanager
-DBUS_SERVICE_PREFIX org.genivi.audiomanager
-DEFAULT_TELNETPORT 6080
-DOC_OUTPUT_PATH XXX/build/doc
-DYNAMIC_ID_BOUNDARY 100
-EXECUTABLE_OUTPUT_PATH XXX/build/bin
-GLIB_DBUS_TYPES_TOLERANT ON
-LIB_INSTALL_SUFFIX audiomanager
-MAX_TELNETCONNECTIONS 3
-NSM_BUS_INTERFACE org.genivi.NodeStateManager
-NSM_INTERFACE org.genivi.NodeStateManager.Consumer
-NSM_PATH /org/genivi/NodeStateManager
-PLUGINS_OUTPUT_PATH XXX/build/plugins
-TEST_EXECUTABLE_INSTALL_PATH ~/tests
-TEST_EXECUTABLE_OUTPUT_PATH XXX/build/bin/tests
-USE_BUILD_LIBS ON
-WITH_DATABASE_STORAGE OFF
-WITH_DLT ON
-WITH_DOCUMENTATION OFF
-WITH_ENABLED_IPC CAPI
-WITH_NSM OFF
-WITH_SYSTEMD_WATCHDOG OFF
-WITH_TELNET ON
-WITH_TESTS ON
-gmock_build_tests OFF
-gtest_build_samples OFF
-gtest_build_tests OFF
-gtest_disable_pthreads OFF
-gtest_force_shared_crt OFF</tt></pre>
+<pre><code>AudioManager Configuration:
+-- CMAKE_BUILD_TYPE =
+-- CMAKE_INSTALL_PREFIX = /usr/local
+-- BUILD_DOCUMENTATION = OFF
+-- WITH_TESTS = ON
+-- WITH_DLT = ON
+-- WITH_TESTS = ON
+-- WITH_TELNET = ON
+-- WITH_SYSTEMD_WATCHDOG = OFF
+-- WITH_CAPI_WRAPPER = ON
+-- WITH_DBUS_WRAPPER = OFF
+-- WITH_SHARED_UTILITIES = OFF
+-- WITH_SHARED_CORE = OFF
+-- DYNAMIC_ID_BOUNDARY = 100
+-- LIB_INSTALL_SUFFIX = audiomanager
+-- TEST_EXECUTABLE_INSTALL_PATH = ~/tests
+-- DEFAULT_PLUGIN_COMMAND_DIR = /usr/local/lib/audiomanager/command
+-- DEFAULT_PLUGIN_ROUTING_DIR = /usr/local/lib/audiomanager/routing
+-- CONTROLLER_PLUGIN_DIR = /usr/local/lib/audiomanager/control
+-- AM_SHARE_FOLDER = /usr/local/share/audiomanager
+-- AM_MAP_CAPACITY = 10
+-- AM_MAX_CONNECTIONS = 0x1000
+-- AM_MAX_MAIN_CONNECTIONS = 0x1000
+-- BUILD_TESTING = ON
+-- CommandInterface version: 4.0
+-- ControlInterface version: 5.0
+-- RoutingInterface version: 5.0</code></pre>
</div></div>
</div>
<div class="sect2">
@@ -860,56 +850,54 @@ For each option, some hints are given.</p></div>
<h3 id="_build_dependencies">Build dependencies</h3>
<div class="paragraph"><p>Basically, all build dependencies are optional- but you might need to use some if you want to have support for Dbus,
for example&#8230;</p></div>
-<div class="paragraph"><p>You will need optionally fullfill some dependencies in order to comile the GENIVI AudioManager Daemon, these are:</p></div>
+<div class="paragraph"><p>You will need optionally fulfill some dependencies in order to compile the GENIVI AudioManager Daemon, these are:</p></div>
<div class="ulist"><ul>
<li>
<p>
-dbus (only when DBUS_WRAPPER==ON) [tested on version 1.2.16]
+dbus (only when WITH_DBUS_WRAPPER==ON) [tested on version 1.2.16]
</p>
</li>
<li>
<p>
-sqlite3 [tested on version 3.6.22] (only when WITH_DATABASE_STORAGE==ON)
+automotive-dlt [greater 2.5.0] (only when WITH_DLT==ON)
</p>
</li>
<li>
<p>
-automotive-dlt [greater 2.5.0] (only when WITH_DLT==ON)
+doxygen [tested on version 1.6.3] (only when WITH_DOCUMENTATION==ON)
</p>
</li>
<li>
<p>
-doxygen [tested on version 1.6.3] (only when WITH_DOCUMENTATION==ON)
+commonAPI [version &gt; 3.1.5] (only with WITH_CAPI_WRAPPER), more information here <a href="http://projects.genivi.org/commonapi/">http://projects.genivi.org/commonapi/</a>
</p>
</li>
<li>
<p>
-commonAPI [version &gt; 2.1] (only with WITH_ENABLED_IPC CAPI), more information here <a href="http://projects.genivi.org/commonapi/">http://projects.genivi.org/commonapi/</a>
+systemd [ version &gt; 44 ] (only WITH_SYSTEMD_WATCHDOG)
</p>
</li>
</ul></div>
-<div class="paragraph"><p>To install them in a build environment like Ubuntu you can use:</p></div>
-<div class="listingblock">
-<div class="content">
-<pre><tt>sudo apt-get install libdbus-1-dev libsqlite3-dev doxygen git cmake build-essential</tt></pre>
-</div></div>
</div>
<div class="sect2">
<h3 id="_audiomanagerutilities">AudioManagerUtilities</h3>
-<div class="paragraph"><p>In the AudioManagerUtilites you can find hany helper functions that can be reused by other projects as well.</p></div>
+<div class="paragraph"><p>In the AudioManagerUtilites you can find helper functions that can be reused by other projects as well.
+The library can be shipped as a static or a dynamic link library (WITH_SHARED_UTILITIES).</p></div>
</div>
<div class="sect2">
-<h3 id="_the_nodestatemanager">The NodeStateManager</h3>
-<div class="paragraph"><p>The nodestatemanager headers are needed to compile the audiomanager. If the nodestatemanagerincludes are not found,
-the headers shipped with the audiomanager are used.
-The nodestatemanager can be retrieved from projects.genivi.org .</p></div>
-<div class="paragraph"><p>Please note that the NSM interface must be compatible with Dbus properties. This requires for CommonAPI to use the commonAPI fdepl.
-It used to work, but currently with CommmonAPI 2.6.1 the generation does not work anymore.</p></div>
+<h3 id="_audiomanagercore">AudioManagerCore</h3>
+<div class="paragraph"><p>The AudioMangerCore is build as a static (or with WITH_SHARED_CORE) library. Sometimes it is useful for unit testing of a plugin to compile against the core.</p></div>
</div>
<div class="sect2">
-<h3 id="_commonapi_file_generation">CommonAPI File generation</h3>
-<div class="paragraph"><p>The audiomanager will search in /usr/share or /usr/local/share for a generator. He will generate all neccessary files with this generator into the build tree.</p></div>
-<div class="paragraph"><p>The adresses used for commonAPI are fixed. If you need to change them, you can use a central or local configure file. More information on CommonAPI documentation: <a href="http://projects.genivi.org/commonapi/">http://projects.genivi.org/commonapi/</a></p></div>
+<h3 id="_commonapi_wrapper">CommonAPI Wrapper</h3>
+<div class="paragraph"><p>The commonapi wrapper provides the mainloop intergration for commonapi into the Mainloop of the audiomanager (CAmSockethandler).
+In order to use it, just use:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>CAPI-&gt;registerService(....)
+CAPI-&gt;buildProxy(...)</code></pre>
+</div></div>
+<div class="paragraph"><p>instead of the standard calls. The CAPIWrapper will serialize the commands and integrate it smoothly with the mainloop.</p></div>
</div>
<div class="sect2">
<h3 id="_tests">Tests</h3>
@@ -921,16 +909,16 @@ python [tested on version 2.6, should work on higher versions as well]
</p>
</li>
</ul></div>
-<div class="paragraph"><p>GoogleMock and GoogleTest are as source code integrated in the sourcetree
+<div class="paragraph"><p>GoogleMock and GoogleTest are as source code integrated in the source tree
To install them in a build environment like Ubuntu you can use:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>sudo apt-get install python2.6-dev</tt></pre>
+<pre><code>sudo apt-get install python2.6-dev</code></pre>
</div></div>
-<div class="paragraph"><p>For compiling, you will need a compiler, linker etc. On most linux systems you will get this via</p></div>
+<div class="paragraph"><p>For compiling, you will need a compiler, linker etc. On most Linux systems you will get this via</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>sudo apt-get install build-essential</tt></pre>
+<pre><code>sudo apt-get install build-essential</code></pre>
</div></div>
<div class="paragraph"><p>More details in the CMake Files CmakeList.txt in the projects.</p></div>
</div>
@@ -939,53 +927,43 @@ To install them in a build environment like Ubuntu you can use:</p></div>
<div class="paragraph"><p>To compile open a shell, browse to the AudioManager folder and</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>mkdir /build
+<pre><code>mkdir /build
cd build
cmake ..
-make</tt></pre>
+make</code></pre>
</div></div>
-<div class="paragraph"><p>The AudioManager executable will be placed in the bin folder of your build folder, tests in a subfolder below.-</p></div>
+<div class="paragraph"><p>The AudioManager executable will be placed in the bin folder of your build folder, tests in a sub folder below.-</p></div>
<div class="paragraph"><p>In order to install the AudioManager, you can do</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>sudo make install</tt></pre>
+<pre><code>sudo make install</code></pre>
</div></div>
<div class="paragraph"><p>this installs everything.</p></div>
</div>
</div>
</div>
<div class="sect1">
-<h2 id="_build_targets">Build targets</h2>
+<h2 id="_compiling_plugins">Compiling plugins</h2>
<div class="sectionbody">
-<div class="paragraph"><p>Several install targets exists:</p></div>
-<div class="paragraph"><p>just install the audiomanager</p></div>
-<div class="listingblock">
-<div class="content">
-<pre><tt>sudo make bin-install</tt></pre>
-</div></div>
-<div class="paragraph"><p>just install the dev package with all headers and cmake file, needed to compile plugins out of source</p></div>
-<div class="listingblock">
-<div class="content">
-<pre><tt>sudo make dev-install</tt></pre>
-</div></div>
-<div class="paragraph"><p>just install the tests</p></div>
+<div class="paragraph"><p>Once the Audiomanager is installed, it will also install *.pc files for autotools and *Config.cmake files for cmake projects.
+In order to compile and link against the AudioMananger, you can use:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>sudo make test-install</tt></pre>
+<pre><code>find_package(AudioManager REQUIRED )
+find_package(AudioManagerUtilities)</code></pre>
</div></div>
-<div class="paragraph"><p>just install the plugins (only available if plugins are compiled)</p></div>
+<div class="paragraph"><p>to find the configuration files. To use the right include paths, use:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>sudo make plugins-install</tt></pre>
+<pre><code>${AudioManager_INCLUDE_DIRS}
+${AudioManagerUtilities_INCLUDE_DIRS}</code></pre>
</div></div>
-<div class="paragraph"><p>just install the test for the plugins (only available if plugins are compiled)</p></div>
+<div class="paragraph"><p>to link agains the right libs use:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>sudo make plugin-test-install</tt></pre>
+<pre><code>${AudioManagerUtilities_LIBRARIES}</code></pre>
</div></div>
-<div class="paragraph"><p>If you want to compile the Audiomanager together with the plugins, simply clone the plugins into a folder
-Plugins on the mainlevel. The Plugins will be then compiled together with the AudioManager.</p></div>
-<div class="paragraph"><p>If the plugins are compiled seperatly, the AudioManager needs to be installed on the system. The plugins will find and read the important CMake variables and use them.</p></div>
+<div class="paragraph"><p>for example, see the AudiomanagerPlugins</p></div>
<div class="sect2">
<h3 id="_adding_own_plugins">Adding own plugins</h3>
<div class="paragraph"><p>To keep the own sources away from the GENIVI code the project specific elements can be reconfigured with own type definitions.
@@ -993,7 +971,7 @@ You can copy paste the CMake scripts from the example plugins for example.</p></
<div class="listingblock">
<div class="title">The are already examples given in audiomanagertypes.h:</div>
<div class="content">
-<pre><tt>/**
+<pre><code>/**
* This type gives the information about reason for Source/Sink change
*/
typedef uint16_t am_CustomAvailabilityReason_t;
@@ -1071,7 +1049,7 @@ static const am_CustomRampType_t RAMP_GENIVI_LINEAR = 4;
static const am_CustomRampType_t RAMP_GENIVI_EXP = 5;
/**
- * Within genivi only the some example properties are defined.
+ * Within GENIVI only the some example properties are defined.
* For products these should be changed or extended.
*/
typedef uint16_t am_CustomSoundPropertyType_t;
@@ -1087,7 +1065,7 @@ static const am_CustomSoundPropertyType_t SP_GENIVI_BASS = 3;
* Describes the different system properties which are project specific.
*/
typedef uint16_t am_CustomSystemPropertyType_t;
-static const am_CustomSystemPropertyType_t SYP_UNKNOWN = 0;</tt></pre>
+static const am_CustomSystemPropertyType_t SYP_UNKNOWN = 0;</code></pre>
</div></div>
</div>
<div class="sect2">
@@ -1095,7 +1073,7 @@ static const am_CustomSystemPropertyType_t SYP_UNKNOWN = 0;</tt></pre>
<div class="paragraph"><p>The commandline options of the AudioManager:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>USAGE:
+<pre><code>USAGE:
./AudioManager [-K &lt;string&gt;] [-m &lt;int&gt;] [-t &lt;int&gt;] [-i] [-r &lt;string&gt;]
[-R &lt;string&gt;] [-l &lt;string&gt;] [-L &lt;string&gt;] [-c &lt;string&gt;]
@@ -1143,7 +1121,7 @@ Where:
Displays usage information and exits.
- The team of the AudioManager wishes you a nice day!</tt></pre>
+ The team of the AudioManager wishes you a nice day!</code></pre>
</div></div>
<div class="paragraph"><p>To learn more about the commandline options, check the doxygen documentation.</p></div>
</div>
@@ -1152,24 +1130,24 @@ Where:
<div class="sect1">
<h2 id="_telnet_server">Telnet Server</h2>
<div class="sectionbody">
-<div class="paragraph"><p>The audiomanager has a build- in telnetserver that serves for debuggin purposes.
-If you compile your AudioManager with TelnetServer support (cmake -DWITH_TELNET=ON), you will be able to
+<div class="paragraph"><p>The audiomanager has a build- in telnet server that serves for debugging purposes.
+If you compile your AudioManager with Telnet Server support (cmake -DWITH_TELNET=ON), you will be able to
set with commandline argument -t the port number and with -m the maximum supported connections.
The default telnet port is 6060.</p></div>
<div class="literalblock">
<div class="title">For example, launch a telnet session on port 6080:</div>
<div class="content">
-<pre><tt>telnet localhost 6060</tt></pre>
+<pre><code>telnet localhost 6060</code></pre>
</div></div>
<div class="literalblock">
<div class="content">
-<pre><tt>#&gt;Welcome to GENIVI AudioManager ver-0.0.1-37-ga004215
-#&gt;</tt></pre>
+<pre><code>#&gt;Welcome to GENIVI AudioManager ver-0.0.1-37-ga004215
+#&gt;</code></pre>
</div></div>
<div class="literalblock">
<div class="title">press <em>help</em> to get a list of all supported commands on this level:</div>
<div class="content">
-<pre><tt>#&gt;help
+<pre><code>#&gt;help
####################################################
####### The following commands are supported: ######
####################################################
@@ -1181,12 +1159,12 @@ The default telnet port is 6060.</p></div>
#list - Go into 'list'-submenu
#set - Go into 'set'-submenu
#
-#\&gt;</tt></pre>
+#\&gt;</code></pre>
</div></div>
<div class="literalblock">
<div class="title">Now type one of these commands, for example <em>get</em>, followed with another <em>help</em> to get a list of supported commands:</div>
<div class="content">
-<pre><tt>#\&gt;get
+<pre><code>#\&gt;get
#
#\Get&gt;help
####################################################
@@ -1200,12 +1178,12 @@ The default telnet port is 6060.</p></div>
#routing - show current routing
#sendv - show senderversion
#
-#\Get&gt;</tt></pre>
+#\Get&gt;</code></pre>
</div></div>
<div class="literalblock">
<div class="title">You can also execute several commands in a line:</div>
<div class="content">
-<pre><tt>#\Get&gt;recv sendv .. help exit
+<pre><code>#\Get&gt;recv sendv .. help exit
# Receiver versions:
# Ctrl: 1 | Cmd: 1 | Routing: 1
# Sender versions:
@@ -1222,7 +1200,7 @@ The default telnet port is 6060.</p></div>
#set - Go into 'set'-submenu
#
#Your wish is my command ... bye!
-#Connection closed by foreign host.</tt></pre>
+#Connection closed by foreign host.</code></pre>
</div></div>
</div>
</div>
@@ -1232,7 +1210,7 @@ The default telnet port is 6060.</p></div>
<div class="paragraph"><p>The source code if formatted with eclipse, the style sheet used can be found in the Foo folder:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>cmake/AudioManager_Codestyle.xml</tt></pre>
+<pre><code>cmake/AudioManager_Codestyle.xml</code></pre>
</div></div>
</div>
</div>
@@ -1242,36 +1220,36 @@ The default telnet port is 6060.</p></div>
<div class="literalblock">
<div class="title">First get the code from the git:</div>
<div class="content">
-<pre><tt>git clone</tt></pre>
+<pre><code>git clone</code></pre>
</div></div>
<div class="literalblock">
<div class="title">Get an overview of all branches:</div>
<div class="content">
-<pre><tt>git branch</tt></pre>
+<pre><code>git branch</code></pre>
</div></div>
<div class="literalblock">
-<div class="title">Switch to the branch you want to work on (see versioning schmeme, the master is the feature branch) and verify that it has switched (* changed)</div>
+<div class="title">Switch to the branch you want to work on (see versioning scheme, the master is the feature branch) and verify that it has switched (* changed)</div>
<div class="content">
-<pre><tt>git checkout &lt;your branch&gt;
-git branch</tt></pre>
+<pre><code>git checkout &lt;your branch&gt;
+git branch</code></pre>
</div></div>
<div class="literalblock">
<div class="title">Best practice is to create a local branch based on the current branch:</div>
<div class="content">
-<pre><tt>git branch working_branch</tt></pre>
+<pre><code>git branch working_branch</code></pre>
</div></div>
-<div class="paragraph"><p>Start working, best practice is to commit smaller, compilable peaced during the work that makes it easier to
+<div class="paragraph"><p>Start working, best practice is to commit smaller, buildable peices during the work that makes it easier to
handle later on.</p></div>
<div class="literalblock">
<div class="title">If you want to commit you changes, send them to the audiomanager-dev list, you can create a patch like this:</div>
<div class="content">
-<pre><tt>git format-patch working_branch &lt;your branch&gt;</tt></pre>
+<pre><code>git format-patch working_branch &lt;your branch&gt;</code></pre>
</div></div>
<div class="paragraph"><p>This creates a set of patches that are published via the mailing list.The patches will be discussed and then merged &amp; uploaded on the git by the maintainer.</p></div>
<div class="paragraph"><p>Patches can be accepted either under GENIVI Cla or MPL 2.0 (see section License). Please be sure that the signed-off-by is set correctly. For more, check out <a href="http://gerrit.googlecode.com/svn/documentation/2.0/user-signedoffby.html">http://gerrit.googlecode.com/svn/documentation/2.0/user-signedoffby.html</a></p></div>
<div class="listingblock">
<div class="content">
-<pre><tt> _ _ _ __ __
+<pre><code> _ _ _ __ __
/ \ _ _ __| (_) ___ | \/ | __ _ _ __ __ _ __ _ ___ _ __
/ _ \| | | |/ _` | |/ _ \| |\/| |/ _` | '_ \ / _` |/ _` |/ _ \ '__|
/ ___ \ |_| | (_| | | (_) | | | | (_| | | | | (_| | (_| | __/ |
@@ -1315,7 +1293,7 @@ handle later on.</p></div>
]QQQ[ ]QQQQWWQQf ]QQQQQQQWQWQWQf ]QQQf ?QQQQa ]QQQf ]QQQQ i4QQQ6 qQQQQ' ]QQQQ
]QQQ6, . qQQQf ]QQQf ]QQQf ]4QQQ6jQQQf ]QQQQ 4QQQ6gQWQQ' ]QQQQ
4QQQQQQQQQQQQQQW' ]QQQQQQWQWQWQWQ ]QQQf i?QQQQQQQf ]QQQQ ]QQQQQQQ' ]QQQQ
- ++"??????????` ]""!"""""""""""S ]""!' ]"""!""' -""!" """!""' ]""!"</tt></pre>
+ ++"??????????` ]""!"""""""""""S ]""!' ]"""!""' -""!" """!""' ]""!"</code></pre>
</div></div>
</div>
</div>
@@ -1323,7 +1301,8 @@ handle later on.</p></div>
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
-Last updated 2015-04-16 10:44:06 CEST
+Last updated
+ 2016-02-10 17:38:39 CET
</div>
</div>
</body>
diff --git a/cmake/AudioManagerConfig.cmake.in b/cmake/AudioManagerConfig.cmake.in
new file mode 100644
index 0000000..2668767
--- /dev/null
+++ b/cmake/AudioManagerConfig.cmake.in
@@ -0,0 +1,35 @@
+@PACKAGE_INIT@
+
+set_and_check(AudioManager_INCLUDE_DIRS @CMAKE_INSTALL_PREFIX@/include/@LIB_INSTALL_SUFFIX@)
+
+set(DAEMONVERSION "@DAEMONVERSION@")
+set(TEST_EXECUTABLE_INSTALL_PATH "@TEST_EXECUTABLE_INSTALL_PATH@")
+set(AM_SHARE_FOLDER "@AM_SHARE_FOLDER@")
+set(CONTROLLER_PLUGIN "@CONTROLLER_PLUGIN@")
+set(LIB_INSTALL_SUFFIX "@LIB_INSTALL_SUFFIX@")
+set(LIB_CONTROL_INTERFACE_VERSION "@LIB_CONTROL_INTERFACE_VERSION@")
+set(LIB_ROUTING_INTERFACE_VERSION "@LIB_ROUTING_INTERFACE_VERSION@")
+set(LIB_COMMAND_INTERFACE_VERSION "@LIB_COMMAND_INTERFACE_VERSION@")
+set(DEFAULT_PLUGIN_COMMAND_DIR "@DEFAULT_PLUGIN_COMMAND_DIR@")
+set(DEFAULT_PLUGIN_ROUTING_DIR "@DEFAULT_PLUGIN_ROUTING_DIR@")
+set(CONTROLLER_PLUGIN_DIR "@CONTROLLER_PLUGIN_DIR@")
+set(CMAKE_CXX_FLAGS "@CMAKE_CXX_FLAGS@")
+set(CMAKE_CXX_FLAGS_DEBUG "@CMAKE_CXX_FLAGS_DEBUG@")
+set(CMAKE_CXX_FLAGS_RELEASE "@CMAKE_CXX_FLAGS_RELEASE@")
+set(WITH_CAPI_WRAPPER "@WITH_CAPI_WRAPPER@")
+set(WITH_DBUS_WRAPPER "@WITH_DBUS_WRAPPER@")
+set(WITH_SHARED_UTILITIES "@WITH_SHARED_UTILITIES@")
+set(WITH_SHARED_CORE "@WITH_SHARED_CORE@")
+
+check_required_components(AudioManagerDaemon)
+if (WITH_SHARED_UTILITIES)
+ check_required_components(AudioManagerUtilities)
+endif (WITH_SHARED_UTILITIES)
+if (WITH_SHARED_CORE)
+ check_required_components(AudioManagerCore)
+endif(WITH_SHARED_CORE)
+
+
+
+
+
diff --git a/cmake/AudioManagerCoreConfig.cmake.in b/cmake/AudioManagerCoreConfig.cmake.in
new file mode 100644
index 0000000..f07cdef
--- /dev/null
+++ b/cmake/AudioManagerCoreConfig.cmake.in
@@ -0,0 +1,17 @@
+@PACKAGE_INIT@
+
+set_and_check(AudioManagerCore_INCLUDE_DIRS @CMAKE_INSTALL_PREFIX@/include/@LIB_INSTALL_SUFFIX@/AudioManagerCore)
+find_library(AudioManagerCore_LIBRARIES NAMES AudioManagerCore HINTS ${@CMAKE_INSTALL_PREFIX@/lib})
+
+set(DAEMONVERSION "@DAEMONVERSION@")
+set(CMAKE_CXX_FLAGS "@CMAKE_CXX_FLAGS@")
+set(CMAKE_CXX_FLAGS_DEBUG "@CMAKE_CXX_FLAGS_DEBUG@")
+set(CMAKE_CXX_FLAGS_RELEASE "@CMAKE_CXX_FLAGS_RELEASE@")
+set(WITH_SHARED_CORE "@WITH_SHARED_CORE@")
+
+
+
+
+
+
+
diff --git a/cmake/AudioManagerUtilitiesConfig.cmake.in b/cmake/AudioManagerUtilitiesConfig.cmake.in
new file mode 100644
index 0000000..5148f34
--- /dev/null
+++ b/cmake/AudioManagerUtilitiesConfig.cmake.in
@@ -0,0 +1,17 @@
+@PACKAGE_INIT@
+
+set_and_check(AudioManagerUtilities_INCLUDE_DIRS @CMAKE_INSTALL_PREFIX@/include/@LIB_INSTALL_SUFFIX@/AudioManagerUtilities)
+find_library(AudioManagerUtilities_LIBRARY NAMES AudioManagerUtilities HINTS ${@CMAKE_INSTALL_PREFIX@/lib})
+
+set(AudioManagerUtilities_LIBRARIES @AUDIO_MANAGER_UTILITIES_LIBS@ ${AudioManagerUtilities_LIBRARY})
+set(DAEMONVERSION "@DAEMONVERSION@")
+set(CMAKE_CXX_FLAGS "@CMAKE_CXX_FLAGS@")
+set(CMAKE_CXX_FLAGS_DEBUG "@CMAKE_CXX_FLAGS_DEBUG@")
+set(CMAKE_CXX_FLAGS_RELEASE "@CMAKE_CXX_FLAGS_RELEASE@")
+set(WITH_CAPI_WRAPPER "@WITH_CAPI_WRAPPER@")
+set(WITH_DBUS_WRAPPER "@WITH_DBUS_WRAPPER@")
+set(WITH_SHARED_UTILITIES "@WITH_SHARED_UTILITIES@")
+
+
+
+
diff --git a/cmake/MacroVersionFromGit.cmake b/cmake/MacroVersionFromGit.cmake
index 1687443..d146754 100644
--- a/cmake/MacroVersionFromGit.cmake
+++ b/cmake/MacroVersionFromGit.cmake
@@ -17,7 +17,6 @@ endif(NOT DAEMONVERSION)
message(STATUS "Build Version ${DAEMONVERSION}")
-
execute_process(COMMAND git log --pretty=short WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/CHANGELOG)
diff --git a/cmake/audiomanagerConfig.cmake.in b/cmake/audiomanagerConfig.cmake.in
deleted file mode 100644
index 4cff130..0000000
--- a/cmake/audiomanagerConfig.cmake.in
+++ /dev/null
@@ -1,44 +0,0 @@
-set(AudioManagerVersion @DAEMONVERSION@ )
-
-@PACKAGE_INIT@
-
-
-set(CMAKE_MODULE_PATH "@CMAKE_MODULE_PATH@")
-set(DAEMONVERSION "@DAEMONVERSION@")
-set(TEST_EXECUTABLE_OUTPUT_PATH "@TEST_EXECUTABLE_OUTPUT_PATH@")
-set(TEST_EXECUTABLE_INSTALL_PATH "@TEST_EXECUTABLE_INSTALL_PATH@")
-set(AM_SHARE_FOLDER "@AM_SHARE_FOLDER@")
-set(WITH_TESTS "@WITH_TESTS@")
-set(AUDIOMANAGER_DAEMON_FOLDER "@AUDIOMANAGER_DAEMON_FOLDER@")
-set(WITH_DOCUMENTATION "@WITH_DOCUMENTATION@")
-set(WITH_DLT "@WITH_DLT@")
-set(DBUS_SERVICE_PREFIX "@DBUS_SERVICE_PREFIX@")
-set(DBUS_SERVICE_OBJECT_PATH "@DBUS_SERVICE_OBJECT_PATH@")
-set(DYNAMIC_ID_BOUNDARY "@DYNAMIC_ID_BOUNDARY@")
-set(DEFAULT_PLUGIN_COMMAND_DIR "@DEFAULT_PLUGIN_COMMAND_DIR@")
-set(DEFAULT_PLUGIN_ROUTING_DIR "@DEFAULT_PLUGIN_ROUTING_DIR@")
-set(CONTROLLER_PLUGIN "@CONTROLLER_PLUGIN@")
-set(LIB_INSTALL_SUFFIX "@LIB_INSTALL_SUFFIX@")
-set(COMMONAPI_DBUS_CONFIGURATIONS "@COMMONAPI_DBUS_CONFIGURATIONS")
-set(LIB_CONTROL_INTERFACE_VERSION "@LIB_CONTROL_INTERFACE_VERSION")
-set(LIB_ROUTING_INTERFACE_VERSION "@LIB_ROUTING_INTERFACE_VERSION")
-set(LIB_COMMAND_INTERFACE_VERSION "@LIB_COMMAND_INTERFACE_VERSION")
-set(CMAKE_CXX_FLAGS "@CMAKE_CXX_FLAGS@")
-set(CMAKE_CXX_FLAGS_DEBUG "@CMAKE_CXX_FLAGS_DEBUG@")
-set(CMAKE_CXX_FLAGS_RELEASE "@CMAKE_CXX_FLAGS_RELEASE@")
-set(AUDIOMANAGER_UTILITIES_SRC "@AUDIOMANAGER_UTILITIES_SRC@")
-set(COMMONAPI_VERSION_NUMBER "@COMMONAPI_VERSION_NUMBER@")
-set(WITH_CAPI_WRAPPER "@WITH_CAPI_WRAPPER@")
-
-
-IF(WITH_TESTS)
- set_and_check(GOOGLE_MOCK_PROJECT_FOLDER "@GOOGLE_MOCK_PROJECT_FOLDER@")
- set_and_check(GMOCK_INCLUDE_DIR "@GMOCK_INCLUDE_DIR@")
- set_and_check(GOOGLE_TEST_INCLUDE_DIR "@GOOGLE_TEST_INCLUDE_DIR@")
-ENDIF(WITH_TESTS)
-
-check_required_components(AudioManagerDaemon)
-check_required_components(AudioManagerUtilities)
-
-
-
diff --git a/cmake/audiomanagercore.pc.in b/cmake/audiomanagercore.pc.in
new file mode 100644
index 0000000..6e2eea1
--- /dev/null
+++ b/cmake/audiomanagercore.pc.in
@@ -0,0 +1,10 @@
+libdir=@CMAKE_INSTALL_PREFIX@/lib/@LIB_INSTALL_SUFFIX@
+includedir=@CMAKE_INSTALL_PREFIX@/include/@LIB_INSTALL_SUFFIX@/AudioManagerCore
+
+Name: Audiomanager Core
+Description: The Audiomanager Core Lib
+Version: @AudioManagerCore_VERSION_STRING@
+Requires: AudioManagerUtilities
+Libs: -L${libdir} lAudioManagerCore
+Cflags: -I${includedir} @CMAKE_CXX_FLAGS@
+
diff --git a/cmake/audiomanagerutilities.pc.in b/cmake/audiomanagerutilities.pc.in
index 1ae953a..2227cf1 100644
--- a/cmake/audiomanagerutilities.pc.in
+++ b/cmake/audiomanagerutilities.pc.in
@@ -1,9 +1,9 @@
libdir=@CMAKE_INSTALL_PREFIX@/lib/@LIB_INSTALL_SUFFIX@
-includedir=@CMAKE_INSTALL_PREFIX@/include/@LIB_INSTALL_SUFFIX@
+includedir=@CMAKE_INSTALL_PREFIX@/include/@LIB_INSTALL_SUFFIX@/AudioMangerUtilities
Name: Audiomanager Utilities
Description: The Audiomanager Utilities
-Version: @DAEMONVERSION@
+Version: @AudioManagerUtilities_VERSION_STRING@
Requires:
Libs: -L${libdir} -lAudioManagerUtilities
Cflags: -I${includedir} @CMAKE_CXX_FLAGS@
diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in
index 9334dc1..a03a79f 100644
--- a/cmake/config.cmake.in
+++ b/cmake/config.cmake.in
@@ -5,16 +5,14 @@
#cmakedefine WITH_CAPI_WRAPPER
#cmakedefine WITH_DBUS_WRAPPER
-#cmakedefine WITH_DATABASE_STORAGE
#cmakedefine WITH_DLT
#cmakedefine WITH_TELNET
#cmakedefine GLIB_DBUS_TYPES_TOLERANT
#cmakedefine WITH_SYSTEMD_WATCHDOG
-#cmakedefine SYSTEMD_FOUND
#cmakedefine DEFAULT_PLUGIN_COMMAND_DIR "@DEFAULT_PLUGIN_COMMAND_DIR@"
#cmakedefine DEFAULT_PLUGIN_ROUTING_DIR "@DEFAULT_PLUGIN_ROUTING_DIR@"
-#cmakedefine CONTROLLER_PLUGIN "@CONTROLLER_PLUGIN@"
+#cmakedefine CONTROLLER_PLUGIN_DIR "@CONTROLLER_PLUGIN_DIR@"
#cmakedefine DEFAULT_TELNETPORT @DEFAULT_TELNETPORT@
#cmakedefine MAX_TELNETCONNECTIONS @MAX_TELNETCONNECTIONS@
@@ -32,6 +30,9 @@
#cmakedefine AM_MAP_CAPACITY @AM_MAP_CAPACITY@
#cmakedefine AM_MAX_CONNECTIONS @AM_MAX_CONNECTIONS@
#cmakedefine AM_MAX_MAIN_CONNECTIONS @AM_MAX_MAIN_CONNECTIONS@
+#cmakedefine LIB_COMMAND_INTERFACE_VERSION @LIB_COMMAND_INTERFACE_VERSION@
+#cmakedefine LIB_CONTROL_INTERFACE_VERSION @LIB_CONTROL_INTERFACE_VERSION@
+#cmakedefine LIB_ROUTING_INTERFACE_VERSION @LIB_ROUTING_INTERFACE_VERSION@
enum { DYNAMIC_ID_BOUNDARY = @DYNAMIC_ID_BOUNDARY@ };
diff --git a/cmake/gmock.pc.in b/cmake/gmock.pc.in
new file mode 100644
index 0000000..76d5c0c
--- /dev/null
+++ b/cmake/gmock.pc.in
@@ -0,0 +1,9 @@
+Name: libgmock
+Version: 1.6.0
+Description: Google's framework for writing C++ tests on a variety of platforms
+
+prefix=@CMAKE_INSTALL_PREFIX@
+includedir=${prefix}/include
+libdir=${prefix}/lib
+Cflags:-I${includedir}/gmock
+Libs: -L${libdir} -lgmock
diff --git a/cmake/gtest.pc.in b/cmake/gtest.pc.in
new file mode 100644
index 0000000..37b8209
--- /dev/null
+++ b/cmake/gtest.pc.in
@@ -0,0 +1,9 @@
+Name: libgtest
+Version: 1.6.0
+Description: Google's framework for writing C++ tests on a variety of platforms
+
+prefix=@CMAKE_INSTALL_PREFIX@
+includedir=${prefix}/include
+libdir=${prefix}/lib
+Cflags:-I${includedir}/gtest
+Libs: -L${libdir} -lgtest
diff --git a/AudioManagerDaemon/docx/01_mainpage.dox b/docx/01_mainpage.dox
index ad0848b..ad0848b 100644
--- a/AudioManagerDaemon/docx/01_mainpage.dox
+++ b/docx/01_mainpage.dox
diff --git a/AudioManagerDaemon/docx/02_license.dox b/docx/02_license.dox
index d7fc220..d7fc220 100644
--- a/AudioManagerDaemon/docx/02_license.dox
+++ b/docx/02_license.dox
diff --git a/AudioManagerDaemon/docx/02_x_dependecies.dox b/docx/02_x_dependecies.dox
index ff5c346..ff5c346 100644
--- a/AudioManagerDaemon/docx/02_x_dependecies.dox
+++ b/docx/02_x_dependecies.dox
diff --git a/AudioManagerDaemon/docx/02_y_versioning.dox b/docx/02_y_versioning.dox
index 864a04e..864a04e 100644
--- a/AudioManagerDaemon/docx/02_y_versioning.dox
+++ b/docx/02_y_versioning.dox
diff --git a/AudioManagerDaemon/docx/03_architecture_overview.dox b/docx/03_architecture_overview.dox
index c38bb60..c38bb60 100644
--- a/AudioManagerDaemon/docx/03_architecture_overview.dox
+++ b/docx/03_architecture_overview.dox
diff --git a/AudioManagerDaemon/docx/03_x_uml_model.dox b/docx/03_x_uml_model.dox
index 802d181..802d181 100644
--- a/AudioManagerDaemon/docx/03_x_uml_model.dox
+++ b/docx/03_x_uml_model.dox
diff --git a/AudioManagerDaemon/docx/04_components.dox b/docx/04_components.dox
index 7c8f9b4..7c8f9b4 100644
--- a/AudioManagerDaemon/docx/04_components.dox
+++ b/docx/04_components.dox
diff --git a/AudioManagerDaemon/docx/04_d_commonAPI.dox b/docx/04_d_commonAPI.dox
index 7e837dd..7e837dd 100644
--- a/AudioManagerDaemon/docx/04_d_commonAPI.dox
+++ b/docx/04_d_commonAPI.dox
diff --git a/AudioManagerDaemon/docx/04_x_elements.dox b/docx/04_x_elements.dox
index 7990d37..7990d37 100644
--- a/AudioManagerDaemon/docx/04_x_elements.dox
+++ b/docx/04_x_elements.dox
diff --git a/AudioManagerDaemon/docx/04_y_audiomanager_and_sources.dox b/docx/04_y_audiomanager_and_sources.dox
index fd0f1e3..fd0f1e3 100644
--- a/AudioManagerDaemon/docx/04_y_audiomanager_and_sources.dox
+++ b/docx/04_y_audiomanager_and_sources.dox
diff --git a/AudioManagerDaemon/docx/05_unique.dox b/docx/05_unique.dox
index 5bf021a..5bf021a 100644
--- a/AudioManagerDaemon/docx/05_unique.dox
+++ b/docx/05_unique.dox
diff --git a/AudioManagerDaemon/docx/06_classification.dox b/docx/06_classification.dox
index 0fb72cd..0fb72cd 100644
--- a/AudioManagerDaemon/docx/06_classification.dox
+++ b/docx/06_classification.dox
diff --git a/AudioManagerDaemon/docx/07_interrupts.dox b/docx/07_interrupts.dox
index 0e26b88..0e26b88 100644
--- a/AudioManagerDaemon/docx/07_interrupts.dox
+++ b/docx/07_interrupts.dox
diff --git a/AudioManagerDaemon/docx/08_connections.dox b/docx/08_connections.dox
index fd8a194..fd8a194 100644
--- a/AudioManagerDaemon/docx/08_connections.dox
+++ b/docx/08_connections.dox
diff --git a/AudioManagerDaemon/docx/09_lipsync.dox b/docx/09_lipsync.dox
index 6229198..6229198 100644
--- a/AudioManagerDaemon/docx/09_lipsync.dox
+++ b/docx/09_lipsync.dox
diff --git a/AudioManagerDaemon/docx/10_early_audio.dox b/docx/10_early_audio.dox
index bdd72f5..bdd72f5 100644
--- a/AudioManagerDaemon/docx/10_early_audio.dox
+++ b/docx/10_early_audio.dox
diff --git a/AudioManagerDaemon/docx/11_views.dox b/docx/11_views.dox
index 2dda7c9..2dda7c9 100644
--- a/AudioManagerDaemon/docx/11_views.dox
+++ b/docx/11_views.dox
diff --git a/AudioManagerDaemon/docx/12_volumes.dox b/docx/12_volumes.dox
index 60603bc..60603bc 100644
--- a/AudioManagerDaemon/docx/12_volumes.dox
+++ b/docx/12_volumes.dox
diff --git a/AudioManagerDaemon/docx/13_properties.dox b/docx/13_properties.dox
index 2597fdf..2597fdf 100644
--- a/AudioManagerDaemon/docx/13_properties.dox
+++ b/docx/13_properties.dox
diff --git a/AudioManagerDaemon/docx/13_x_notifications.dox b/docx/13_x_notifications.dox
index 135d4a5..135d4a5 100644
--- a/AudioManagerDaemon/docx/13_x_notifications.dox
+++ b/docx/13_x_notifications.dox
diff --git a/AudioManagerDaemon/docx/14_misc.dox b/docx/14_misc.dox
index 8ae15c2..8ae15c2 100644
--- a/AudioManagerDaemon/docx/14_misc.dox
+++ b/docx/14_misc.dox
diff --git a/AudioManagerDaemon/docx/14_u_last_user_mode.dox b/docx/14_u_last_user_mode.dox
index 0c90f89..0c90f89 100644
--- a/AudioManagerDaemon/docx/14_u_last_user_mode.dox
+++ b/docx/14_u_last_user_mode.dox
diff --git a/AudioManagerDaemon/docx/14_x_mainloop.dox b/docx/14_x_mainloop.dox
index 8f112bc..8f112bc 100644
--- a/AudioManagerDaemon/docx/14_x_mainloop.dox
+++ b/docx/14_x_mainloop.dox
diff --git a/AudioManagerDaemon/docx/14_y_watchdog.dox b/docx/14_y_watchdog.dox
index a1facc5..a1facc5 100644
--- a/AudioManagerDaemon/docx/14_y_watchdog.dox
+++ b/docx/14_y_watchdog.dox
diff --git a/AudioManagerDaemon/docx/14_zz_Startup_Rundown.dox b/docx/14_zz_Startup_Rundown.dox
index 88f8dc6..88f8dc6 100644
--- a/AudioManagerDaemon/docx/14_zz_Startup_Rundown.dox
+++ b/docx/14_zz_Startup_Rundown.dox
diff --git a/AudioManagerDaemon/docx/15_a_CommandLineParsing.dox b/docx/15_a_CommandLineParsing.dox
index 74dd2e0..74dd2e0 100644
--- a/AudioManagerDaemon/docx/15_a_CommandLineParsing.dox
+++ b/docx/15_a_CommandLineParsing.dox
diff --git a/AudioManagerDaemon/docx/15_dlt_support.dox b/docx/15_dlt_support.dox
index ca34896..ca34896 100644
--- a/AudioManagerDaemon/docx/15_dlt_support.dox
+++ b/docx/15_dlt_support.dox
diff --git a/AudioManagerDaemon/docx/15_x_eclipse.dox b/docx/15_x_eclipse.dox
index 95c8e9f..95c8e9f 100644
--- a/AudioManagerDaemon/docx/15_x_eclipse.dox
+++ b/docx/15_x_eclipse.dox
diff --git a/AudioManagerDaemon/docx/16_readme.dox b/docx/16_readme.dox
index 7798fee..7798fee 100644
--- a/AudioManagerDaemon/docx/16_readme.dox
+++ b/docx/16_readme.dox
diff --git a/docx/Doxyfile.in b/docx/Doxyfile.in
new file mode 100644
index 0000000..802d5f8
--- /dev/null
+++ b/docx/Doxyfile.in
@@ -0,0 +1,2326 @@
+# Doxyfile 1.8.10
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all text
+# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
+# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
+# for the list of possible encodings.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME = AudioManager
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER = @DAEMONVERSION@
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF = "Native Application Runtime Environment"
+
+# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
+# in the documentation. The maximum height of the logo should not exceed 55
+# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
+# the logo to the output directory.
+
+PROJECT_LOGO =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = "@GEN_DOC_DIR@"
+
+# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
+# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
+# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
+# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
+# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
+# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
+# Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES = YES
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@ \
+ @PROJECT_BINARY_DIR@
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF = YES
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new
+# page for each member. If set to NO, the documentation of a member will be part
+# of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines.
+
+ALIASES =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
+# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
+# Fortran. In the later case the parser tries to guess whether the code is fixed
+# or free formatted code, this is the default for Fortran type files), VHDL. For
+# instance to make doxygen treat .inc files as Fortran files (default is PHP),
+# and .f files as C (default is Fortran), use: inc=Fortran f=C.
+#
+# Note: For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT = YES
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by putting a % sign in front of the word or
+# globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE = NO
+
+# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO,
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. If set to YES, local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO, only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO, these classes will be included in the various overviews. This option
+# has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO, these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO, these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES, upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES, the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
+# grouped member an include statement to the documentation, telling the reader
+# which file to include in order to use the member.
+# The default value is: NO.
+
+SHOW_GROUPED_MEMB_INC = NO
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo
+# list. This list is created by putting \todo commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test
+# list. This list is created by putting \test commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS = @ENABLED_SECTIONS@
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES, the
+# list will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. See also \cite for info how to create references.
+
+CITE_BIB_FILES =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS = NO
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED = NO
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR = NO
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO, doxygen will only warn about wrong or incomplete
+# parameter documentation, but not about the absence of documentation.
+# The default value is: NO.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The s