2 * Copyright (c) 2012 BMW
4 * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
7 * 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,
8 * 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,
9 * subject to the following conditions:
10 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
11 * 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.
12 * 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
13 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15 * For further information see http://www.genivi.org/.
18 #ifndef COMMANDRECEIVERSHADOW_H_
19 #define COMMANDRECEIVERSHADOW_H_
23 #include <dbus/dbus.h>
26 #include "command/IAmCommandReceive.h"
27 #include "CAmDbusMessageHandler.h"
28 #include "shared/CAmDbusWrapper.h"
33 class IAmCommandReceiverShadow;
35 typedef void (IAmCommandReceiverShadow::*CallBackMethod)(DBusConnection *connection, DBusMessage *message);
38 * receives the DBus Callbacks, marhsalls and demarshalls the parameters and calls CommandReceive
40 class IAmCommandReceiverShadow
43 IAmCommandReceiverShadow();
44 virtual ~IAmCommandReceiverShadow();
45 void connect(DBusConnection *conn, DBusMessage *msg);
46 void disconnect(DBusConnection *conn, DBusMessage *msg);
47 void setVolume(DBusConnection *conn, DBusMessage *msg);
48 void volumeStep(DBusConnection *conn, DBusMessage *msg);
49 void setSinkMuteState(DBusConnection *conn, DBusMessage *msg);
50 void setMainSinkSoundProperty(DBusConnection *conn, DBusMessage *msg);
51 void setMainSourceSoundProperty(DBusConnection *conn, DBusMessage *msg);
52 void setSystemProperty(DBusConnection *conn, DBusMessage *msg);
53 void getListMainConnections(DBusConnection *conn, DBusMessage *msg);
54 void getListMainSinks(DBusConnection *conn, DBusMessage *msg);
55 void getListMainSources(DBusConnection *conn, DBusMessage *msg);
56 void getListMainSinkSoundProperties(DBusConnection *conn, DBusMessage *msg);
57 void getListMainSourceSoundProperties(DBusConnection *conn, DBusMessage *msg);
58 void getListSourceClasses(DBusConnection *conn, DBusMessage *msg);
59 void getListSinkClasses(DBusConnection *conn, DBusMessage *msg);
60 void getListSystemProperties(DBusConnection *conn, DBusMessage *msg);
61 void getTimingInformation(DBusConnection *conn, DBusMessage *msg);
62 void getListSinkMainNotificationConfigurations(DBusConnection *conn, DBusMessage *msg);
63 void getListSourceMainNotificationConfigurations(DBusConnection *conn, DBusMessage *msg);
64 void setSinkMainNotificationConfiguration(DBusConnection *conn, DBusMessage *msg);
65 void setSourceMainNotificationConfiguration(DBusConnection *conn, DBusMessage *msg);
68 * sets the pointer to the CommandReceiveInterface and registers Callback
71 void setCommandReceiver(IAmCommandReceive*& receiver);
73 typedef std::map<std::string, CallBackMethod> functionMap_t;
74 functionMap_t mFunctionMap;
75 CAmDbusMessageHandler mDBUSMessageHandler;
76 IAmCommandReceive* mpIAmCommandReceive;
77 CAmDbusWrapper* mpCAmDbusWrapper;
80 * receives a callback whenever the path of the plugin is called
82 static DBusHandlerResult receiveCallback(DBusConnection *conn, DBusMessage *msg, void *user_data);
85 * dynamic delegate that handles the Callback of the static receiveCallback
86 * @param conn DBus connection
87 * @param msg DBus message
88 * @param user_data pointer to instance of CommandReceiverShadow
91 DBusHandlerResult receiveCallbackDelegate(DBusConnection *conn, DBusMessage *msg);
94 * sends out introspectiondata read from an xml file.
98 void sendIntrospection(DBusConnection* conn, DBusMessage* msg);
101 * creates the function map needed to combine DBus messages and function adresses
104 functionMap_t createMap();
109 #endif /* COMMANDRECEIVERSHADOW_H_ */