From df88fefdd7df890aaf2a3206483678851cffc5c5 Mon Sep 17 00:00:00 2001 From: Christian Mueller Date: Tue, 26 Jul 2011 21:02:37 +0200 Subject: - first time synchronisation with EA - remodelled some interfaces - new plugin structure for CommandInterfaces --- .../AudiomanagerInterface.cpp | 5 -- PluginRoutingInterfaceDbus/CMakeLists.txt | 6 +- PluginRoutingInterfaceDbus/DBUSMessageHandler.h | 6 ++ PluginRoutingInterfaceDbus/DbusInterface.cpp | 68 +++++++++++++++++----- PluginRoutingInterfaceDbus/DbusInterface.h | 18 +++--- PluginRoutingInterfaceDbus/headers.h | 6 +- 6 files changed, 74 insertions(+), 35 deletions(-) (limited to 'PluginRoutingInterfaceDbus') diff --git a/PluginRoutingInterfaceDbus/AudiomanagerInterface.cpp b/PluginRoutingInterfaceDbus/AudiomanagerInterface.cpp index 0cccdb7..4810d89 100644 --- a/PluginRoutingInterfaceDbus/AudiomanagerInterface.cpp +++ b/PluginRoutingInterfaceDbus/AudiomanagerInterface.cpp @@ -153,8 +153,6 @@ void AudioManagerInterface::emit_systemReady() { void* AudioManagerInterface::run(void * arg) { DLT_LOG(DBusPlugin, DLT_LOG_INFO, DLT_STRING("Main loop running")); - // pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL); - // pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL); m_reference = (AudioManagerInterface*) arg; DBusMessage* msg = 0; DBusConnection* conn = g_pDbusMessage->getConnection(); @@ -186,10 +184,7 @@ void* AudioManagerInterface::run(void * arg) } i++; } - } else if (dbus_message_is_signal(msg, DBUS_INTERFACE_DBUS, "NameAcquired")) { - DLT_LOG(DBusPlugin, DLT_LOG_INFO, DLT_STRING("Got Signal Name Aquired")); } - dbus_connection_flush(conn); dbus_message_unref(msg); msg = NULL; diff --git a/PluginRoutingInterfaceDbus/CMakeLists.txt b/PluginRoutingInterfaceDbus/CMakeLists.txt index cfac03b..827d309 100644 --- a/PluginRoutingInterfaceDbus/CMakeLists.txt +++ b/PluginRoutingInterfaceDbus/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 2.6) -PROJECT(PluginRoutingInterfaceDbus) +PROJECT(PluginCommandInterfaceDbus) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xlinker -export-dynamic") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic") @@ -42,9 +42,9 @@ SET(PLUGINDBUS_SRCS_CXX DbusSend.cpp ) -add_library(PluginRoutingInterfaceDbus SHARED ${PLUGINDBUS_SRCS_CXX}) +add_library(PluginCommandInterfaceDbus SHARED ${PLUGINDBUS_SRCS_CXX}) -TARGET_LINK_LIBRARIES(PluginRoutingInterfaceDbus +TARGET_LINK_LIBRARIES(PluginCommandInterfaceDbus ${DLT_LIBRARIES} ${DBUS_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} diff --git a/PluginRoutingInterfaceDbus/DBUSMessageHandler.h b/PluginRoutingInterfaceDbus/DBUSMessageHandler.h index 6d0d935..ad685df 100644 --- a/PluginRoutingInterfaceDbus/DBUSMessageHandler.h +++ b/PluginRoutingInterfaceDbus/DBUSMessageHandler.h @@ -74,4 +74,10 @@ inline DBusConnection* DBUSMessageHandler::getConnection() return m_pConnection; } +void DBUSMessageHandler::appendArrayOfStringString(std::list list) +{ +} + + + #endif // _DBUSMESSAGEWRAPPER_H_ diff --git a/PluginRoutingInterfaceDbus/DbusInterface.cpp b/PluginRoutingInterfaceDbus/DbusInterface.cpp index 878d556..822b35c 100644 --- a/PluginRoutingInterfaceDbus/DbusInterface.cpp +++ b/PluginRoutingInterfaceDbus/DbusInterface.cpp @@ -67,14 +67,17 @@ void DbusInterface::return_BusName(char* BusName) { strcpy(BusName, BUS_NAME); } -connection_t DbusInterface::connect(source_t source, sink_t sink, connection_t connID) { +genError_t DbusInterface::connect(source_t source, sink_t sink, connection_t connID) { int reply; DbusSend send = DbusSend(m_conn,"PULSE",(const char*)m_busname,(const char*)m_path, "connect"); send.appendInteger(source); send.appendInteger(sink); send.appendInteger(connID); send.sendReply(&reply); - return (connection_t) reply; + return GEN_OK; + /** + * \todo always OK... + */ } void DbusInterface::system_ready() { @@ -82,62 +85,95 @@ void DbusInterface::system_ready() { m_DbusInterface->emit_systemReady(); } -bool DbusInterface::disconnect(connection_t connectionID) { +genError_t DbusInterface::disconnect(connection_t connectionID) { bool reply; DbusSend send = DbusSend(m_conn,"PULSE",(const char*)m_busname,(const char*)m_path,"disconnect"); send.appendInteger(connectionID); send.sendReply(&reply); - return reply; + return GEN_OK; + /** + * \todo always OK... + */ } -volume_t DbusInterface::setSinkVolume(volume_t volume, sink_t sink) { +genError_t DbusInterface::setSinkVolume(volume_t volume, sink_t sink) { int reply; DbusSend send = DbusSend(m_conn,"PULSE",(const char*)m_busname,(const char*)m_path,"setSinkVolume"); send.appendInteger(volume); send.appendInteger(sink); send.sendReply(&reply); - return (volume_t) reply; + return GEN_OK; + /** + * \todo always OK... + */ } -volume_t DbusInterface::setSourceVolume(volume_t volume, source_t source) { +genError_t DbusInterface::setSourceVolume(volume_t volume, source_t source) { int reply; DbusSend send = DbusSend(m_conn,"PULSE",(const char*)m_busname,(const char*)m_path,"setSourceVolume"); send.appendInteger(volume); send.appendInteger(source); send.sendReply(&reply); - return (volume_t) reply; + return GEN_OK; + /** + * \todo always OK... + */ } -bool DbusInterface::muteSource(source_t sourceID) { +genError_t DbusInterface::muteSource(source_t sourceID) { bool reply; DbusSend send = DbusSend(m_conn,"PULSE",(const char*)m_busname,(const char*)m_path,"muteSource"); send.appendInteger(sourceID); send.sendReply(&reply); - return reply; + return GEN_OK; + /** + * \todo always OK... + */ } -bool DbusInterface::muteSink(sink_t sinkID) { +genError_t DbusInterface::muteSink(sink_t sinkID) { bool reply; DbusSend send = DbusSend(m_conn,"PULSE",(const char*)m_busname,(const char*)m_path,"muteSink"); send.appendInteger(sinkID); send.sendReply(&reply); - return reply; + return GEN_OK; + /** + * \todo always OK... + */ } -bool DbusInterface::unmuteSource(source_t sourceID) { +genError_t DbusInterface::unmuteSource(source_t sourceID) { bool reply; DbusSend send = DbusSend(m_conn,"PULSE",(const char*)m_busname,(const char*)m_path,"unmuteSource"); send.appendInteger(sourceID); send.sendReply(&reply); - return reply; + return GEN_OK; + /** + * \todo always OK... + */ } -bool DbusInterface::unmuteSink(sink_t sinkID) { +genError_t DbusInterface::unmuteSink(sink_t sinkID) { bool reply; DbusSend send = DbusSend(m_conn,"PULSE",(const char*)m_busname,(const char*)m_path,"unmuteSink"); send.appendInteger(sinkID); send.sendReply(&reply); - return reply; + return GEN_OK; + /** + * \todo always OK... + */ +} + +genError_t DbusInterface::asyncConnect(source_t source, sink_t sink, connection_t con_ID) { + /** + * \todo implement + */ +} + +genError_t DbusInterface::asyncDisconnect(connection_t connection_ID){ + /** + * \todo implement + */ } //That is the actual implementation of the Factory Class returning the real sendInterface diff --git a/PluginRoutingInterfaceDbus/DbusInterface.h b/PluginRoutingInterfaceDbus/DbusInterface.h index 9f7b7f5..7de8cc8 100644 --- a/PluginRoutingInterfaceDbus/DbusInterface.h +++ b/PluginRoutingInterfaceDbus/DbusInterface.h @@ -39,14 +39,16 @@ public: void startup_interface(RoutingReceiveInterface * audioman); void return_BusName(char * BusName); - connection_t connect(source_t source, sink_t sink, connection_t connID); - bool disconnect(connection_t connectionID); - volume_t setSinkVolume(volume_t volume, sink_t sink); - volume_t setSourceVolume(volume_t volume, source_t source); - bool muteSource(source_t sourceID); - bool muteSink(sink_t sinkID); - bool unmuteSource(source_t sourceID); - bool unmuteSink(sink_t sinkID); + genError_t connect(source_t source, sink_t sink, connection_t connID); + genError_t disconnect(connection_t connectionID); + genError_t setSinkVolume(volume_t volume, sink_t sink); + genError_t setSourceVolume(volume_t volume, source_t source); + genError_t muteSource(source_t sourceID); + genError_t muteSink(sink_t sinkID); + genError_t unmuteSource(source_t sourceID); + genError_t unmuteSink(sink_t sinkID); + genError_t asyncConnect(source_t source, sink_t sink, connection_t con_ID); + virtual genError_t asyncDisconnect(connection_t connection_ID); void system_ready(); private: diff --git a/PluginRoutingInterfaceDbus/headers.h b/PluginRoutingInterfaceDbus/headers.h index 15652e9..54e3b25 100644 --- a/PluginRoutingInterfaceDbus/headers.h +++ b/PluginRoutingInterfaceDbus/headers.h @@ -19,11 +19,11 @@ #define BUS_NAME "DBUS" -#define DBUS_BUSNAME "org.genivi.pulse" +#define DBUS_BUSNAME "org.genivi.command" #define DBUS_PATH "/pulse" -DLT_IMPORT_CONTEXT(DBusPlugin); -const char DBUS_SERVICE_PREFIX[] = "org.genivi.audiomanager\0"; +const char DBUS_SERVICE_PREFIX[] = "org.genivi.audiomanagerCommand\0"; +DLT_IMPORT_CONTEXT(DBusPlugin); #endif /* HEADERS_H_ */ -- cgit v1.2.1