summaryrefslogtreecommitdiff
path: root/PluginCommandInterfaceDbus
diff options
context:
space:
mode:
authorchristian mueller <christian.ei.mueller@bmw.de>2012-01-26 18:10:02 +0100
committerchristian mueller <christian.ei.mueller@bmw.de>2012-01-27 14:44:44 +0100
commit58d62c4af578c10375bf9baa946e33f340c42a1f (patch)
treec09d7547e4ec8ecdcbeac22b7bc6d845f0d50858 /PluginCommandInterfaceDbus
parent93c6b1973d59ce225e9cb5d2bcaea7d01c5fda52 (diff)
downloadaudiomanager-58d62c4af578c10375bf9baa946e33f340c42a1f.tar.gz
* regenerated EA code based on Conti Feedback.
* changed paths of audiomanagertypes include in generated files * changed order of parameters in asyncSetSinkSoundProperty / asyncSetSourceSoundProperty / cbTimingInformationChanged to have common style over all interfaces. * changed default include paths for Controller etc... * cleanup of warnings
Diffstat (limited to 'PluginCommandInterfaceDbus')
-rw-r--r--PluginCommandInterfaceDbus/include/DBusCommandSender.h2
-rw-r--r--PluginCommandInterfaceDbus/src/DBusCommandSender.cpp2
-rw-r--r--PluginCommandInterfaceDbus/test/dbuscommandpluginInterfaceTest.cpp1
-rw-r--r--PluginCommandInterfaceDbus/test/dbuscommaninterfacesignalsTest.cpp1625
4 files changed, 806 insertions, 824 deletions
diff --git a/PluginCommandInterfaceDbus/include/DBusCommandSender.h b/PluginCommandInterfaceDbus/include/DBusCommandSender.h
index 3a01c14..215a9e9 100644
--- a/PluginCommandInterfaceDbus/include/DBusCommandSender.h
+++ b/PluginCommandInterfaceDbus/include/DBusCommandSender.h
@@ -67,7 +67,7 @@ public:
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_timeSync_t time, const am_mainConnectionID_t mainConnectionID);
+ void cbTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time);
uint16_t getInterfaceVersion() const;
#ifdef UNIT_TEST
diff --git a/PluginCommandInterfaceDbus/src/DBusCommandSender.cpp b/PluginCommandInterfaceDbus/src/DBusCommandSender.cpp
index bbc2778..3c1afd6 100644
--- a/PluginCommandInterfaceDbus/src/DBusCommandSender.cpp
+++ b/PluginCommandInterfaceDbus/src/DBusCommandSender.cpp
@@ -269,7 +269,7 @@ void DbusCommandSender::cbSystemPropertyChanged(const am_SystemProperty_s & Syst
mDBUSMessageHandler.sendMessage();
}
-void am::DbusCommandSender::cbTimingInformationChanged(const am_timeSync_t time, const am_mainConnectionID_t mainConnectionID)
+void am::DbusCommandSender::cbTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time)
{
DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("cbTimingInformationChanged called, mainConnectionID"), DLT_INT16(mainConnectionID), DLT_STRING("time"), DLT_INT16(time));
diff --git a/PluginCommandInterfaceDbus/test/dbuscommandpluginInterfaceTest.cpp b/PluginCommandInterfaceDbus/test/dbuscommandpluginInterfaceTest.cpp
index d1faced..1ba6a30 100644
--- a/PluginCommandInterfaceDbus/test/dbuscommandpluginInterfaceTest.cpp
+++ b/PluginCommandInterfaceDbus/test/dbuscommandpluginInterfaceTest.cpp
@@ -44,6 +44,7 @@ void* run_the_loop(void* wrapper)
{
DBusWrapper* wrap=(DBusWrapper*)wrapper;
wrap->dbusMainLoop();
+ return (NULL);
}
dbuscommandpluginInterfaceTest::dbuscommandpluginInterfaceTest()
diff --git a/PluginCommandInterfaceDbus/test/dbuscommaninterfacesignalsTest.cpp b/PluginCommandInterfaceDbus/test/dbuscommaninterfacesignalsTest.cpp
index a46a59e..1c90d55 100644
--- a/PluginCommandInterfaceDbus/test/dbuscommaninterfacesignalsTest.cpp
+++ b/PluginCommandInterfaceDbus/test/dbuscommaninterfacesignalsTest.cpp
@@ -1,33 +1,32 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file dbuscommandinterfacesignalsTest.cpp
-*
-* \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
-*/
-
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file dbuscommandinterfacesignalsTest.cpp
+ *
+ * \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
+ */
#include "dbuscommaninterfacesignalsTest.h"
#include <iostream>
#include <fstream>
-#include <Python.h>
+#include <python2.6/Python.h>
#include "../include/DBusCommandSender.h"
#include "../include/DBusMessageHandler.h"
#include "DbusCommandInterfaceBackdoor.h"
@@ -40,889 +39,871 @@ DLT_IMPORT_CONTEXT(DLT_CONTEXT)
dbuscommaninterfacesignalsTest::dbuscommaninterfacesignalsTest()
{
- DLT_REGISTER_APP("DPtest","RoutingInterfacetest");
- DLT_REGISTER_CONTEXT(DLT_CONTEXT,"Main","Main Context");
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("RoutingSendInterface Test started "));
+ DLT_REGISTER_APP("DPtest", "RoutingInterfacetest");
+ DLT_REGISTER_CONTEXT(DLT_CONTEXT, "Main", "Main Context");
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("RoutingSendInterface Test started "));
}
dbuscommaninterfacesignalsTest::~dbuscommaninterfacesignalsTest()
{
- DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
+ DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
}
void* NumberOfMainConnectionsChanged(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- sender.cbNumberOfMainConnectionsChanged();
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ sender.cbNumberOfMainConnectionsChanged();
+ return (NULL);
}
void* cbSinkAdded(void*)
{
- sleep(1);
- std::vector<am_SinkType_s> list;
- am_SinkType_s mysink;
- mysink.name="MySink";
- mysink.sinkID=23;
- mysink.availability.availability=A_MAX;
- mysink.availability.availabilityReason=AR_MIN;
- mysink.muteState=MS_MIN;
- mysink.sinkClassID=3;
- mysink.volume=234;
- list.push_back(mysink);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- EXPECT_CALL(receiver,getListMainSinks(_)).WillOnce(DoAll(SetArgReferee<0>(list),Return(E_OK)));
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- sender.cbNumberOfSinksChanged();
+ sleep(1);
+ std::vector<am_SinkType_s> list;
+ am_SinkType_s mysink;
+ mysink.name = "MySink";
+ mysink.sinkID = 23;
+ mysink.availability.availability = A_MAX;
+ mysink.availability.availabilityReason = AR_MIN;
+ mysink.muteState = MS_MIN;
+ mysink.sinkClassID = 3;
+ mysink.volume = 234;
+ list.push_back(mysink);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ EXPECT_CALL(receiver,getListMainSinks(_)).WillOnce(DoAll(SetArgReferee<0>(list), Return(E_OK)));
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ sender.cbNumberOfSinksChanged();
+ return (NULL);
}
void* cbSourceAdded(void*)
{
- sleep(1);
- std::vector<am_SourceType_s> list;
- am_SourceType_s myource;
- myource.name="MySink";
- myource.sourceID=42;
- myource.availability.availability=A_MAX;
- myource.availability.availabilityReason=AR_MIN;
- myource.sourceClassID=15;
- list.push_back(myource);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- EXPECT_CALL(receiver,getListMainSources(_)).WillOnce(DoAll(SetArgReferee<0>(list),Return(E_OK)));
- sender.cbNumberOfSourcesChanged();
+ sleep(1);
+ std::vector<am_SourceType_s> list;
+ am_SourceType_s myource;
+ myource.name = "MySink";
+ myource.sourceID = 42;
+ myource.availability.availability = A_MAX;
+ myource.availability.availabilityReason = AR_MIN;
+ myource.sourceClassID = 15;
+ list.push_back(myource);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ EXPECT_CALL(receiver,getListMainSources(_)).WillOnce(DoAll(SetArgReferee<0>(list), Return(E_OK)));
+ sender.cbNumberOfSourcesChanged();
+ return (NULL);
}
void* cbSourceRemoved(void*)
{
- sleep(1);
- std::vector<am_SourceType_s> list;
- am_SourceType_s myource;
- myource.name="MySink";
- myource.sourceID=42;
- myource.availability.availability=A_MAX;
- myource.availability.availabilityReason=AR_MIN;
- myource.sourceClassID=15;
- list.push_back(myource);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- backdoor.setListSources(&sender,list);
- DBusError error;
- dbus_error_init(&error);
- list.clear();
- EXPECT_CALL(receiver,getListMainSources(_)).WillOnce(DoAll(SetArgReferee<0>(list),Return(E_OK)));
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- sender.cbNumberOfSourcesChanged();
+ sleep(1);
+ std::vector<am_SourceType_s> list;
+ am_SourceType_s myource;
+ myource.name = "MySink";
+ myource.sourceID = 42;
+ myource.availability.availability = A_MAX;
+ myource.availability.availabilityReason = AR_MIN;
+ myource.sourceClassID = 15;
+ list.push_back(myource);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ backdoor.setListSources(&sender, list);
+ DBusError error;
+ dbus_error_init(&error);
+ list.clear();
+ EXPECT_CALL(receiver,getListMainSources(_)).WillOnce(DoAll(SetArgReferee<0>(list), Return(E_OK)));
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ sender.cbNumberOfSourcesChanged();
+ return (NULL);
}
void* cbSinkRemoved(void*)
{
- sleep(1);
- std::vector<am_SinkType_s> list;
- am_SinkType_s mysink;
- mysink.name="MySink";
- mysink.sinkID=23;
- mysink.availability.availability=A_MAX;
- mysink.availability.availabilityReason=AR_MIN;
- mysink.muteState=MS_MIN;
- mysink.sinkClassID=3;
- mysink.volume=234;
- list.push_back(mysink);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- backdoor.setListSinks(&sender,list);
- DBusError error;
- dbus_error_init(&error);
- list.clear();
- EXPECT_CALL(receiver,getListMainSinks(_)).WillOnce(DoAll(SetArgReferee<0>(list),Return(E_OK)));
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- sender.cbNumberOfSinksChanged();
+ sleep(1);
+ std::vector<am_SinkType_s> list;
+ am_SinkType_s mysink;
+ mysink.name = "MySink";
+ mysink.sinkID = 23;
+ mysink.availability.availability = A_MAX;
+ mysink.availability.availabilityReason = AR_MIN;
+ mysink.muteState = MS_MIN;
+ mysink.sinkClassID = 3;
+ mysink.volume = 234;
+ list.push_back(mysink);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ backdoor.setListSinks(&sender, list);
+ DBusError error;
+ dbus_error_init(&error);
+ list.clear();
+ EXPECT_CALL(receiver,getListMainSinks(_)).WillOnce(DoAll(SetArgReferee<0>(list), Return(E_OK)));
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ sender.cbNumberOfSinksChanged();
+ return (NULL);
}
void* NumberOfSinkClassesChanged(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- sender.cbNumberOfSinkClassesChanged();
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ sender.cbNumberOfSinkClassesChanged();
+ return (NULL);
}
void* NumberOfSourceClassesChanged(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- sender.cbNumberOfSourceClassesChanged();
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ sender.cbNumberOfSourceClassesChanged();
+ return (NULL);
}
-
void* MainConnectionStateChanged(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- am_connectionID_t id=4;
- am_ConnectionState_e state=CS_CONNECTING;
- sender.cbMainConnectionStateChanged(id,state);
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ am_connectionID_t id = 4;
+ am_ConnectionState_e state = CS_CONNECTING;
+ sender.cbMainConnectionStateChanged(id, state);
+ return (NULL);
}
void* MainSinkSoundPropertyChanged(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- am_sinkID_t sinkID=3;
- am_MainSoundProperty_s soundProperty;
- soundProperty.type=MSP_TEST;
- soundProperty.value=23;
- sender.cbMainSinkSoundPropertyChanged(sinkID,soundProperty);
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ am_sinkID_t sinkID = 3;
+ am_MainSoundProperty_s soundProperty;
+ soundProperty.type = MSP_TEST;
+ soundProperty.value = 23;
+ sender.cbMainSinkSoundPropertyChanged(sinkID, soundProperty);
+ return (NULL);
}
void* MainSourceSoundPropertyChanged(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- am_sourceID_t sourceID=35;
- am_MainSoundProperty_s soundProperty;
- soundProperty.type=MSP_TEST;
- soundProperty.value=233;
- sender.cbMainSourceSoundPropertyChanged(sourceID,soundProperty);
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ am_sourceID_t sourceID = 35;
+ am_MainSoundProperty_s soundProperty;
+ soundProperty.type = MSP_TEST;
+ soundProperty.value = 233;
+ sender.cbMainSourceSoundPropertyChanged(sourceID, soundProperty);
+ return (NULL);
}
void* cbSinkAvailabilityChangedLoop(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- am_Availability_s av;
- av.availability=A_AVAILABLE;
- av.availabilityReason=AR_UNKNOWN;
- sender.cbSinkAvailabilityChanged(4,av);
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ am_Availability_s av;
+ av.availability = A_AVAILABLE;
+ av.availabilityReason = AR_UNKNOWN;
+ sender.cbSinkAvailabilityChanged(4, av);
+ return (NULL);
}
void* VolumeChanged(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- am_volume_t volume=344;
- sender.cbVolumeChanged(23,volume);
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ am_volume_t volume = 344;
+ sender.cbVolumeChanged(23, volume);
+ return (NULL);
}
void* cbSourceAvailabilityChangedLoop(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- am_Availability_s av;
- av.availability=A_AVAILABLE;
- av.availabilityReason=AR_UNKNOWN;
- sender.cbSourceAvailabilityChanged(2,av);
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ am_Availability_s av;
+ av.availability = A_AVAILABLE;
+ av.availabilityReason = AR_UNKNOWN;
+ sender.cbSourceAvailabilityChanged(2, av);
+ return (NULL);
}
void* SinkMuteStateChanged(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- sender.cbSinkMuteStateChanged(42,MS_MUTED);
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ sender.cbSinkMuteStateChanged(42, MS_MUTED);
+ return (NULL);
}
void* SystemPropertyChanged(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- am_SystemProperty_s property;
- property.type=SYP_TEST;
- property.value=355;
- sender.cbSystemPropertyChanged(property);
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ am_SystemProperty_s property;
+ property.type = SYP_TEST;
+ property.value = 355;
+ sender.cbSystemPropertyChanged(property);
+ return (NULL);
}
void* TimingInformationChanged(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- sender.cbTimingInformationChanged(42,233);
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ sender.cbTimingInformationChanged(42, 233);
+ return (NULL);
}
TEST_F(dbuscommaninterfacesignalsTest,cbSourceAvailabilityChanged)
{
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_t pythonloop;
- pthread_create(&pythonloop,NULL,NumberOfMainConnectionsChanged,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchsignal(*arg, **kwarg):\n"
- " print ('Caught NumberOfMainConnectionsChanged') \n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchsignal, signal_name='NumberOfMainConnectionsChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- pthread_create(&pythonloop,NULL,cbSinkAdded,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSinkAdded(*arg, **karg):\n"
- " print ('Caught signal (in SinkAdded handler) ') \n"
- " print (arg[0])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSinkAdded, signal_name='SinkAdded', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- std::ifstream ifs("/tmp/result.txt");
- std::string line;
- int lineCounter=0, result=0;
- while(std::getline(ifs, line))
- {
- ASSERT_EQ(line.compare("dbus.Struct((dbus.UInt16(23), dbus.String(u'MySink'), dbus.Struct((dbus.Int16(3), dbus.Int16(0)), signature=None), dbus.Int16(234), dbus.Int16(0), dbus.UInt16(3)), signature=None)"),0);
- }
- ifs.close();
-
- pthread_create(&pythonloop,NULL,cbSinkRemoved,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSinkRemoved(*arg, **karg):\n"
- " print ('Caught signal (in SinkRemoved handler) ') \n"
- " print (arg[0])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSinkRemoved, signal_name='SinkRemoved', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,23);
- }
- ifs.close();
-
- pthread_create(&pythonloop,NULL,cbSourceAdded,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSourceAdded(*arg, **karg):\n"
- " print ('Caught signal (in SourceAdded handler) ') \n"
- " print (arg[0])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSourceAdded, signal_name='SourceAdded', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- ASSERT_EQ(line.compare("dbus.Struct((dbus.UInt16(42), dbus.String(u'MySink'), dbus.Struct((dbus.Int16(3), dbus.Int16(0)), signature=None), dbus.UInt16(15)), signature=None)"),0);
- }
- ifs.close();
-
-
- pthread_create(&pythonloop,NULL,cbSourceRemoved,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSourceRemoved(*arg, **karg):\n"
- " print ('Caught signal (in SinkRemoved handler) ') \n"
- " print (arg[0])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSourceRemoved, signal_name='SourceRemoved', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,42);
- }
- ifs.close();
-
-
- pthread_create(&pythonloop,NULL,NumberOfSinkClassesChanged,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchNumberOfSinkClassesChanged(*arg, **kwarg):\n"
- " print ('Caught catchNumberOfSinkClassesChanged') \n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchNumberOfSinkClassesChanged, signal_name='NumberOfSinkClassesChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- pthread_create(&pythonloop,NULL,NumberOfSourceClassesChanged,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def CatchNumberOfSourceClassesChanged(*arg, **kwarg):\n"
- " print ('Caught CatchNumberOfSourceClassesChanged') \n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(CatchNumberOfSourceClassesChanged, signal_name='NumberOfSourceClassesChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop,NULL,MainConnectionStateChanged,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchMainConnectionStateChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchMainConnectionStateChanged handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchMainConnectionStateChanged, signal_name='MainConnectionStateChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- if(lineCounter==0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,4);
- }
- else if (lineCounter==1)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,CS_CONNECTING);
- }
- lineCounter++;
- }
- ifs.close();
-
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop,NULL,MainSinkSoundPropertyChanged,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchMainSinkSoundPropertyChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchMainSinkSoundPropertyChanged handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchMainSinkSoundPropertyChanged, signal_name='MainSinkSoundPropertyChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- if(lineCounter==0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,3);
- }
- else if (lineCounter==1)
- {
- ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(1), dbus.Int16(23)), signature=None)"),0);
- }
- lineCounter++;
- }
- ifs.close();
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop,NULL,MainSourceSoundPropertyChanged,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchMainSourceSoundPropertyChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchMainSourceSoundPropertyChanged handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchMainSourceSoundPropertyChanged, signal_name='MainSourceSoundPropertyChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- if(lineCounter==0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,35);
- }
- else if (lineCounter==1)
- {
- ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(1), dbus.Int16(233)), signature=None)"),0);
- }
- lineCounter++;
- }
- ifs.close();
-
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop,NULL,cbSinkAvailabilityChangedLoop,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSinkAvailabilityChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchSinkAvailabilityChanged handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSinkAvailabilityChanged, signal_name='SinkAvailabilityChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- if(lineCounter==0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,4);
- }
- else if (lineCounter==1)
- {
- ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(0), dbus.Int16(3)), signature=None)"),0);
- }
- lineCounter++;
- }
- ifs.close();
-
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop,NULL,cbSourceAvailabilityChangedLoop,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSourceAvailability(*arg, **karg):\n"
- " print ('Caught signal (in catchSourceAvailability handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSourceAvailability, signal_name='SourceAvailabilityChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- if(lineCounter==0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,2);
- }
- else if (lineCounter==1)
- {
- ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(0), dbus.Int16(3)), signature=None)"),0);
- }
- lineCounter++;
- }
- ifs.close();
-
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop,NULL,VolumeChanged,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchVolumeChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchVolumeChanged handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchVolumeChanged, signal_name='VolumeChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- if(lineCounter==0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,23);
- }
- else if (lineCounter==1)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,344);
- }
- lineCounter++;
- }
- ifs.close();
-
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop,NULL,SinkMuteStateChanged,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSinkMuteStateChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchSinkMuteStateChanged handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSinkMuteStateChanged, signal_name='SinkMuteStateChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- if(lineCounter==0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,42);
- }
- else if (lineCounter==1)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,MS_MUTED);
- }
- lineCounter++;
- }
- ifs.close();
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop,NULL,SystemPropertyChanged,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSystemPropertyChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchSystemPropertyChanged handler) ') \n"
- " print (arg[0])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSystemPropertyChanged, signal_name='SystemPropertyChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(0), dbus.Int16(355)), signature=None)"),0);
- }
- ifs.close();
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop,NULL,TimingInformationChanged,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchTimingInformationChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchTimingInformationChanged handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchTimingInformationChanged, signal_name='TimingInformationChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- if(lineCounter==0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,42);
- }
- else if (lineCounter==1)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,233);
- }
- lineCounter++;
- }
- ifs.close();
+ //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
+ //so it is running in the main context and the signals are send from threads...
+ pthread_t pythonloop;
+ pthread_create(&pythonloop, NULL, NumberOfMainConnectionsChanged, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchsignal(*arg, **kwarg):\n"
+ " print ('Caught NumberOfMainConnectionsChanged') \n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchsignal, signal_name='NumberOfMainConnectionsChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ pthread_create(&pythonloop, NULL, cbSinkAdded, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchSinkAdded(*arg, **karg):\n"
+ " print ('Caught signal (in SinkAdded handler) ') \n"
+ " print (arg[0])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchSinkAdded, signal_name='SinkAdded', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ std::ifstream ifs("/tmp/result.txt");
+ std::string line;
+ int lineCounter = 0, result = 0;
+ while (std::getline(ifs, line))
+ {
+ ASSERT_EQ(line.compare("dbus.Struct((dbus.UInt16(23), dbus.String(u'MySink'), dbus.Struct((dbus.Int16(3), dbus.Int16(0)), signature=None), dbus.Int16(234), dbus.Int16(0), dbus.UInt16(3)), signature=None)"), 0);
+ }
+ ifs.close();
+
+ pthread_create(&pythonloop, NULL, cbSinkRemoved, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchSinkRemoved(*arg, **karg):\n"
+ " print ('Caught signal (in SinkRemoved handler) ') \n"
+ " print (arg[0])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchSinkRemoved, signal_name='SinkRemoved', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 23);
+ }
+ ifs.close();
+
+ pthread_create(&pythonloop, NULL, cbSourceAdded, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchSourceAdded(*arg, **karg):\n"
+ " print ('Caught signal (in SourceAdded handler) ') \n"
+ " print (arg[0])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchSourceAdded, signal_name='SourceAdded', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ ASSERT_EQ(line.compare("dbus.Struct((dbus.UInt16(42), dbus.String(u'MySink'), dbus.Struct((dbus.Int16(3), dbus.Int16(0)), signature=None), dbus.UInt16(15)), signature=None)"), 0);
+ }
+ ifs.close();
+
+ pthread_create(&pythonloop, NULL, cbSourceRemoved, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchSourceRemoved(*arg, **karg):\n"
+ " print ('Caught signal (in SinkRemoved handler) ') \n"
+ " print (arg[0])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchSourceRemoved, signal_name='SourceRemoved', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 42);
+ }
+ ifs.close();
+
+ pthread_create(&pythonloop, NULL, NumberOfSinkClassesChanged, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchNumberOfSinkClassesChanged(*arg, **kwarg):\n"
+ " print ('Caught catchNumberOfSinkClassesChanged') \n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchNumberOfSinkClassesChanged, signal_name='NumberOfSinkClassesChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ pthread_create(&pythonloop, NULL, NumberOfSourceClassesChanged, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def CatchNumberOfSourceClassesChanged(*arg, **kwarg):\n"
+ " print ('Caught CatchNumberOfSourceClassesChanged') \n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(CatchNumberOfSourceClassesChanged, signal_name='NumberOfSourceClassesChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
+ //so it is running in the main context and the signals are send from threads...
+ pthread_create(&pythonloop, NULL, MainConnectionStateChanged, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchMainConnectionStateChanged(*arg, **karg):\n"
+ " print ('Caught signal (in catchMainConnectionStateChanged handler) ') \n"
+ " print (arg[0])\n"
+ " print (arg[1])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchMainConnectionStateChanged, signal_name='MainConnectionStateChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ if (lineCounter == 0)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 4);
+ }
+ else if (lineCounter == 1)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, CS_CONNECTING);
+ }
+ lineCounter++;
+ }
+ ifs.close();
+
+ //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
+ //so it is running in the main context and the signals are send from threads...
+ pthread_create(&pythonloop, NULL, MainSinkSoundPropertyChanged, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchMainSinkSoundPropertyChanged(*arg, **karg):\n"
+ " print ('Caught signal (in catchMainSinkSoundPropertyChanged handler) ') \n"
+ " print (arg[0])\n"
+ " print (arg[1])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchMainSinkSoundPropertyChanged, signal_name='MainSinkSoundPropertyChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ if (lineCounter == 0)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 3);
+ }
+ else if (lineCounter == 1)
+ {
+ ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(1), dbus.Int16(23)), signature=None)"), 0);
+ }
+ lineCounter++;
+ }
+ ifs.close();
+
+ //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
+ //so it is running in the main context and the signals are send from threads...
+ pthread_create(&pythonloop, NULL, MainSourceSoundPropertyChanged, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchMainSourceSoundPropertyChanged(*arg, **karg):\n"
+ " print ('Caught signal (in catchMainSourceSoundPropertyChanged handler) ') \n"
+ " print (arg[0])\n"
+ " print (arg[1])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchMainSourceSoundPropertyChanged, signal_name='MainSourceSoundPropertyChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ if (lineCounter == 0)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 35);
+ }
+ else if (lineCounter == 1)
+ {
+ ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(1), dbus.Int16(233)), signature=None)"), 0);
+ }
+ lineCounter++;
+ }
+ ifs.close();
+
+ //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
+ //so it is running in the main context and the signals are send from threads...
+ pthread_create(&pythonloop, NULL, cbSinkAvailabilityChangedLoop, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchSinkAvailabilityChanged(*arg, **karg):\n"
+ " print ('Caught signal (in catchSinkAvailabilityChanged handler) ') \n"
+ " print (arg[0])\n"
+ " print (arg[1])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchSinkAvailabilityChanged, signal_name='SinkAvailabilityChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ if (lineCounter == 0)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 4);
+ }
+ else if (lineCounter == 1)
+ {
+ ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(0), dbus.Int16(3)), signature=None)"), 0);
+ }
+ lineCounter++;
+ }
+ ifs.close();
+
+ //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
+ //so it is running in the main context and the signals are send from threads...
+ pthread_create(&pythonloop, NULL, cbSourceAvailabilityChangedLoop, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchSourceAvailability(*arg, **karg):\n"
+ " print ('Caught signal (in catchSourceAvailability handler) ') \n"
+ " print (arg[0])\n"
+ " print (arg[1])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchSourceAvailability, signal_name='SourceAvailabilityChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ if (lineCounter == 0)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 2);
+ }
+ else if (lineCounter == 1)
+ {
+ ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(0), dbus.Int16(3)), signature=None)"), 0);
+ }
+ lineCounter++;
+ }
+ ifs.close();
+
+ //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
+ //so it is running in the main context and the signals are send from threads...
+ pthread_create(&pythonloop, NULL, VolumeChanged, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchVolumeChanged(*arg, **karg):\n"
+ " print ('Caught signal (in catchVolumeChanged handler) ') \n"
+ " print (arg[0])\n"
+ " print (arg[1])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchVolumeChanged, signal_name='VolumeChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ if (lineCounter == 0)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 23);
+ }
+ else if (lineCounter == 1)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 344);
+ }
+ lineCounter++;
+ }
+ ifs.close();
+
+ //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
+ //so it is running in the main context and the signals are send from threads...
+ pthread_create(&pythonloop, NULL, SinkMuteStateChanged, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchSinkMuteStateChanged(*arg, **karg):\n"
+ " print ('Caught signal (in catchSinkMuteStateChanged handler) ') \n"
+ " print (arg[0])\n"
+ " print (arg[1])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchSinkMuteStateChanged, signal_name='SinkMuteStateChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ if (lineCounter == 0)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 42);
+ }
+ else if (lineCounter == 1)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, MS_MUTED);
+ }
+ lineCounter++;
+ }
+ ifs.close();
+
+ //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
+ //so it is running in the main context and the signals are send from threads...
+ pthread_create(&pythonloop, NULL, SystemPropertyChanged, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchSystemPropertyChanged(*arg, **karg):\n"
+ " print ('Caught signal (in catchSystemPropertyChanged handler) ') \n"
+ " print (arg[0])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchSystemPropertyChanged, signal_name='SystemPropertyChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(0), dbus.Int16(355)), signature=None)"), 0);
+ }
+ ifs.close();
+
+ //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
+ //so it is running in the main context and the signals are send from threads...
+ pthread_create(&pythonloop, NULL, TimingInformationChanged, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchTimingInformationChanged(*arg, **karg):\n"
+ " print ('Caught signal (in catchTimingInformationChanged handler) ') \n"
+ " print (arg[0])\n"
+ " print (arg[1])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchTimingInformationChanged, signal_name='TimingInformationChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ if (lineCounter == 0)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 42);
+ }
+ else if (lineCounter == 1)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 233);
+ }
+ lineCounter++;
+ }
+ ifs.close();
}
-
-
int main(int argc, char **argv)
{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
}
void dbuscommaninterfacesignalsTest::SetUp()
{
- Py_Initialize();
+ Py_Initialize();
}
-
-
void dbuscommaninterfacesignalsTest::TearDown()
{
- Py_Finalize();
+ Py_Finalize();
}
-
-
-
-
-