summaryrefslogtreecommitdiff
path: root/PluginCommandInterfaceDbus/include
diff options
context:
space:
mode:
authorChristian Mueller <christian@lmuc329619u.(none)>2011-12-08 18:43:48 +0100
committerChristian Mueller <christian@lmuc329619u.(none)>2011-12-08 18:43:48 +0100
commit5773404eb801e27179b7c3c7803a990145d6e94a (patch)
tree4bb9db13fbfb3f72479fd7e6ce342768f299d073 /PluginCommandInterfaceDbus/include
parent9826492b0066d47cfa9ba68d6efe737cc3c317a3 (diff)
downloadaudiomanager-5773404eb801e27179b7c3c7803a990145d6e94a.tar.gz
total rework
no more QT
Diffstat (limited to 'PluginCommandInterfaceDbus/include')
-rw-r--r--PluginCommandInterfaceDbus/include/CommandReceiverShadow.h110
-rw-r--r--PluginCommandInterfaceDbus/include/CommandSender.h108
-rw-r--r--PluginCommandInterfaceDbus/include/DBusMessageHandler.h130
-rw-r--r--PluginCommandInterfaceDbus/include/mainpage.h33
4 files changed, 381 insertions, 0 deletions
diff --git a/PluginCommandInterfaceDbus/include/CommandReceiverShadow.h b/PluginCommandInterfaceDbus/include/CommandReceiverShadow.h
new file mode 100644
index 0000000..5f1aae4
--- /dev/null
+++ b/PluginCommandInterfaceDbus/include/CommandReceiverShadow.h
@@ -0,0 +1,110 @@
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger DbusPlugin
+*
+* \file CommandReceiverShadow.h
+*
+* \date 20-Oct-2011 3:42:04 PM
+* \author Christian Mueller (christian.ei.mueller@bmw.de)
+*
+* \section License
+* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+*
+* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+*
+* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+*/
+
+#ifndef COMMANDRECEIVERSHADOW_H_
+#define COMMANDRECEIVERSHADOW_H_
+
+#include "DBusMessageHandler.h"
+
+#include <command/CommandReceiveInterface.h>
+#include <dbus/dbus.h>
+#include <dlt/dlt.h>
+#include <map>
+
+DLT_IMPORT_CONTEXT(DBusCommandPlugin);
+
+#define INTROSPECTION_XML_FILE "/home/christian/workspace/gitserver/dbusIncludes/CommandInterface.xml"
+
+class CommandReceiverShadow;
+using namespace am;
+
+typedef void (CommandReceiverShadow::*CallBackMethod)(DBusConnection *connection, DBusMessage *message);
+
+/**
+ * receives the DBus Callbacks, marhsalls and demarshalls the parameters and calls CommandReceive
+ */
+class CommandReceiverShadow {
+public:
+ CommandReceiverShadow();
+ virtual ~CommandReceiverShadow();
+ void connect(DBusConnection *conn, DBusMessage *msg) ;
+ void disconnect(DBusConnection *conn, DBusMessage *msg) ;
+ void setVolume(DBusConnection *conn, DBusMessage *msg) ;
+ void volumeStep(DBusConnection *conn, DBusMessage *msg) ;
+ void setSinkMuteState(DBusConnection *conn, DBusMessage *msg) ;
+ void setMainSinkSoundProperty(DBusConnection *conn, DBusMessage *msg) ;
+ void setMainSourceSoundProperty(DBusConnection *conn, DBusMessage *msg) ;
+ void setSystemProperty(DBusConnection *conn, DBusMessage *msg) ;
+ void getListMainConnections(DBusConnection *conn, DBusMessage *msg) ;
+ void getListMainSinks(DBusConnection *conn, DBusMessage *msg) ;
+ void getListMainSources(DBusConnection *conn, DBusMessage *msg) ;
+ void getListMainSinkSoundProperties(DBusConnection *conn, DBusMessage *msg) ;
+ void getListMainSourceSoundProperties(DBusConnection *conn, DBusMessage *msg) ;
+ void getListSourceClasses(DBusConnection *conn, DBusMessage *msg) ;
+ void getListSinkClasses(DBusConnection *conn, DBusMessage *msg) ;
+ void getListSystemProperties(DBusConnection *conn, DBusMessage *msg) ;
+ void getTimingInformation(DBusConnection *conn, DBusMessage *msg) ;
+
+ /**
+ * sets the pointer to the CommandReceiveInterface and registers Callback
+ * @param receiver
+ */
+ void setCommandReceiver(CommandReceiveInterface*& receiver);
+private:
+ CommandReceiveInterface* mCommandReceiveInterface;
+ DBusWrapper* mDBusWrapper;
+ typedef std::map<std::string,CallBackMethod> functionMap_t;
+ functionMap_t mFunctionMap;
+ DBusMessageHandler mDBUSMessageHandler;
+
+ /**
+ * receives a callback whenever the path of the plugin is called
+ */
+ static DBusHandlerResult receiveCallback(DBusConnection *conn, DBusMessage *msg, void *user_data);
+
+ /**
+ * dynamic delegate that handles the Callback of the static receiveCallback
+ * @param conn DBus connection
+ * @param msg DBus message
+ * @param user_data pointer to instance of CommandReceiverShadow
+ * @return
+ */
+ DBusHandlerResult receiveCallbackDelegate(DBusConnection *conn, DBusMessage *msg);
+
+ /**
+ * sends out introspectiondata read from an xml file.
+ * @param conn
+ * @param msg
+ */
+ void sendIntrospection(DBusConnection* conn, DBusMessage* msg) ;
+
+ /**
+ * creates the function map needed to combine DBus messages and function adresses
+ * @return the map
+ */
+ functionMap_t createMap();
+};
+
+#endif /* COMMANDRECEIVERSHADOW_H_ */
diff --git a/PluginCommandInterfaceDbus/include/CommandSender.h b/PluginCommandInterfaceDbus/include/CommandSender.h
new file mode 100644
index 0000000..88fb47e
--- /dev/null
+++ b/PluginCommandInterfaceDbus/include/CommandSender.h
@@ -0,0 +1,108 @@
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger DbusPlugin
+*
+* \file CommandSender.h
+*
+* \date 20-Oct-2011 3:42:04 PM
+* \author Christian Mueller (christian.ei.mueller@bmw.de)
+*
+* \section License
+* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+*
+* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+*
+* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+*/
+
+
+#ifndef COMMANDSENDER_H_
+#define COMMANDSENDER_H_
+
+#include "DBusMessageHandler.h"
+#include "CommandReceiverShadow.h"
+#include "DBusWrapper.h"
+
+#include <command/CommandSendInterface.h>
+#include <dbus/dbus.h>
+#include <map>
+
+using namespace am;
+
+#define DLT_CONTEXT DBusCommandPlugin
+const char MY_NODE[]="CommandInterface";
+
+/**
+ * Dbus Implementation of CommandSendInterface
+ */
+class DbusCommandSender: public CommandSendInterface {
+public:
+ DbusCommandSender();
+ virtual ~DbusCommandSender();
+ am_Error_e startupInterface(CommandReceiveInterface* commandreceiveinterface) ;
+ am_Error_e stopInterface() ;
+ am_Error_e cbCommunicationReady() ;
+ am_Error_e cbCommunicationRundown() ;
+ void cbNumberOfMainConnectionsChanged() ;
+ void cbNumberOfSinksChanged() ;
+ void cbNumberOfSourcesChanged() ;
+ void cbNumberOfSinkClassesChanged() ;
+ void cbNumberOfSourceClassesChanged() ;
+ void cbMainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState) ;
+ void cbMainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s SoundProperty) ;
+ void cbMainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s& SoundProperty) ;
+ void cbSinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s& availability) ;
+ void cbSourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s& availability) ;
+ void cbVolumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume) ;
+ void cbSinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState) ;
+ void cbSystemPropertyChanged(const am_SystemProperty_s& SystemProperty) ;
+ void cbTimingInformationChanged(const am_mainConnectionID_t mainConnection, const am_timeSync_t time) ;
+private:
+ DBusMessageHandler mDBUSMessageHandler;
+ CommandReceiverShadow mCommandReceiverShadow;
+ DBusWrapper* mDBusWrapper;
+ CommandReceiveInterface* mCommandReceiveInterface;
+
+ /**
+ * list of sinks, needed to send out only deltas
+ */
+ std::vector<am_SinkType_s> mlistSinks;
+
+ /**
+ * list of sources, needed to send out only deltas
+ */
+ std::vector<am_SourceType_s> mlistSources;
+
+ /**
+ * used as comparison function for am_SinkType_s
+ */
+ struct sortBySinkID
+ {
+ bool operator()(const am_SinkType_s & a, const am_SinkType_s & b)
+ {
+ return (a.sinkID < b.sinkID);
+ }
+ };
+
+ /**
+ * used as comparison function for am_SourceType_s
+ */
+ struct sortBySourceID
+ {
+ bool operator()(const am_SourceType_s & a, const am_SourceType_s & b)
+ {
+ return (a.sourceID < b.sourceID);
+ }
+ };
+
+};
+
+#endif /* COMMANDSENDER_H_ */
diff --git a/PluginCommandInterfaceDbus/include/DBusMessageHandler.h b/PluginCommandInterfaceDbus/include/DBusMessageHandler.h
new file mode 100644
index 0000000..09966cf
--- /dev/null
+++ b/PluginCommandInterfaceDbus/include/DBusMessageHandler.h
@@ -0,0 +1,130 @@
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger DbusPlugin
+*
+* \file DBusMessageHandler
+*
+* \date 20-Oct-2011 3:42:04 PM
+* \author Christian Mueller (christian.ei.mueller@bmw.de)
+*
+* \section License
+* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+*
+* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+*
+* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+*/
+
+#ifndef _DBUSMESSAGEHANDLER_H_
+#define _DBUSMESSAGEHANDLER_H_
+
+
+#include <audiomanagertypes.h>
+#include <vector>
+#include <sstream>
+using std::stringstream;
+
+#include <string>
+using std::string;
+
+#include <dbus/dbus.h>
+#include <list>
+#include <dlt/dlt.h>
+
+DLT_IMPORT_CONTEXT(DBusCommandPlugin);
+
+/**
+ * handles DBus Messages, is used to extract & append parameters and send messages
+ */
+class DBusMessageHandler
+{
+public:
+ DBusMessageHandler();
+ ~DBusMessageHandler();
+
+ /**
+ * sets the DBus Connection
+ * @param connection pointer to the DBus Connection
+ */
+ void setDBusConnection(DBusConnection*& connection);
+
+ /**
+ * is called to initiate the receiving of a message
+ * @param msg pointer to the message to be received
+ */
+ void initReceive(DBusMessage* msg);
+
+ /**
+ * is called to initiate the reply to a message
+ * @param msg pointer to the message the reply is for
+ */
+ void initReply(DBusMessage* msg);
+
+ /**
+ * inits a signal to be sent via dbus
+ * parameters can be added before sending the signal
+ * @param path the path
+ * @param signalName the signal name
+ */
+ void initSignal(std::string path, std::string signalName);
+
+ /**
+ * sends out the message
+ */
+ void sendMessage();
+
+ /**
+ * the get functions return a value from the received dbus message
+ * @return
+ */
+ dbus_uint16_t getUInt();
+ dbus_int16_t getInt();
+ dbus_bool_t getBool();
+ char getByte();
+ double getDouble();
+ char* getString();
+ void getProperty(dbus_int16_t& type, dbus_int16_t& value);
+
+ /**
+ * the overloaded append function appends different datatypes to the dbusmessage
+ */
+ void append(dbus_int16_t toAppend);
+ void append(dbus_uint16_t toAppend);
+ void append(char toAppend);
+ void append(bool toAppend);
+ void append(double toAppend);
+ void append(const am::am_SinkType_s& sinkType);
+ void append(const am::am_SourceType_s& sourceType);
+ void append(const am::am_MainSoundProperty_s mainSoundProperty);
+ void append(const am::am_Availability_s & availability);
+ void append(const am::am_SystemProperty_s & SystemProperty);
+ void append(const std::vector<am::am_MainConnectionType_s>& listMainConnections);
+ void append(const std::vector<am::am_SinkType_s>& listMainSinks);
+ void append(const std::vector<am::am_SourceType_s>& listMainSources);
+ void append(const std::vector<am::am_MainSoundProperty_s>& listMainSoundProperties);
+ void append(const std::vector<am::am_SourceClass_s>& listSourceClasses);
+ void append(const std::vector<am::am_SinkClass_s>& listSinkClasses);
+ void append(const std::vector<am::am_SystemProperty_s>& listSystemProperties);
+
+
+private:
+
+ DBusMessageIter mDBusMessageIter;
+ DBusError mDBusError;
+ dbus_uint32_t mSerial;
+ std::string mErrorName;
+ std::string mErrorMsg;
+ DBusMessage* mDbusMessage;
+ DBusMessage* mReveiveMessage;
+ DBusConnection* mDBusConnection;
+};
+
+#endif // _DBUSMESSAGEWRAPPER_H_
diff --git a/PluginCommandInterfaceDbus/include/mainpage.h b/PluginCommandInterfaceDbus/include/mainpage.h
new file mode 100644
index 0000000..19789d0
--- /dev/null
+++ b/PluginCommandInterfaceDbus/include/mainpage.h
@@ -0,0 +1,33 @@
+/**
+ * \mainpage
+ * \image html "Bild1.png"
+ * Copyright Copyright (C) 2011, BMW AG
+ *
+ * \date 22.06.2011
+ * \author Christian Müller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG – Christian Müller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ * \section About About PluginInterfaceDBus
+ * This plugin for the Genivi AudioManager serves as interface for DBus.
+ *
+ * \section Info More information
+ * can be found at <https://collab.genivi.org/wiki/display/genivi/GENIVI+Home>
+ *
+ */
+
+#ifndef MAINPAGE_H_
+#define MAINPAGE_H_
+
+
+#endif /* MAINPAGE_H_ */