From cda52886e8898878d9b89a2ffcb0b2cccc0a693e Mon Sep 17 00:00:00 2001 From: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> Date: Tue, 28 Aug 2007 12:02:49 -0400 Subject: [PATCH] Integration into sflphoned in xml: floats are represented as d --- configure.ac | 7 +++- src/Makefile.am | 3 +- src/dbus/Makefile.am | 12 ++++-- src/dbus/callmanager-glue.h | 28 +++++++------- src/dbus/callmanager-introspec.xml | 8 ++-- src/dbus/callmanager.h | 60 ++++++++++++++++++++++++++++++ src/dbus/dbusmanager.h | 28 ++++++++++++++ src/dbus/dbusmanagerimpl.cpp | 20 ++++++++++ src/dbus/dbusmanagerimpl.h | 32 ++++++++++++++++ 9 files changed, 174 insertions(+), 24 deletions(-) create mode 100644 src/dbus/callmanager.h create mode 100644 src/dbus/dbusmanager.h create mode 100644 src/dbus/dbusmanagerimpl.cpp create mode 100644 src/dbus/dbusmanagerimpl.h diff --git a/configure.ac b/configure.ac index c1e87e5dee..57a9d5a73f 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ dnl dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) AC_INIT([SFLPhone],[0.7],[sflphoneteam@savoirfairelinux.com],[sflphone]) -AC_COPYRIGHT([[Copyright (c) Savoir-Faire Linux 2004-2006]]) +AC_COPYRIGHT([[Copyright (c) Savoir-Faire Linux 2004-2007]]) AC_REVISION([$Revision$]) dnl Compute canonical system name @@ -185,6 +185,11 @@ PKG_CHECK_MODULES(libportaudiocpp, portaudiocpp >= ${LIBPORTAUDIOCPP_MIN_VERSION SFLPHONE_CFLAGS="$SFLPHONE_CFLAGS $libportaudiocpp_CFLAGS" SFLPHONE_LIBS="$SFLPHONE_LIBS $libportaudiocpp_LIBS" +LIBDBUSCPP_MIN_VERSION=0.5 +PKG_CHECK_MODULES(libdbuscpp, dbus-c++-1 >= ${LIBDBUSCPP_MIN_VERSION}) +SFLPHONE_CFLAGS="$SFLPHONE_CFLAGS $libdbuscpp_CFLAGS" +SFLPHONE_LIBS="$SFLPHONE_LIBS $libdbuscpp_LIBS" + dnl Check for speex AC_ARG_ENABLE(speex, AS_HELP_STRING( diff --git a/src/Makefile.am b/src/Makefile.am index dfcbfcfd34..f08b8f687d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -36,7 +36,7 @@ sflphoned_SOURCES = eventthread.cpp main.cpp voIPLink.cpp \ sflphoned_CXXFLAGS = -DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone\" $(ZEROCONFFLAGS) $(IAX_FLAGS) $(SFLPHONE_CFLAGS) $(SIP_CFLAGS) #sflphoned_LDFLAGS = -static -sflphoned_LDADD = ./libsflphone.la $(SFLPHONE_LIBS) $(ZEROCONFLIB) $(LIB_DNSSD) $(IAX_LIBS) $(EXOSIP_LIBS) +sflphoned_LDADD = ./libsflphone.la $(SFLPHONE_LIBS) $(ZEROCONFLIB) $(LIB_DNSSD) $(IAX_LIBS) $(EXOSIP_LIBS) AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libs $(libccext2_CFLAGS) $(libccgnu2_CFLAGS) $(IAX_CFLAGS) $(USER_INCLUDES) #libsflphone_la_LDFLAGS= -version-info 0:1:0 @@ -45,6 +45,7 @@ libsflphone_la_LIBADD = \ $(top_builddir)/libs/utilspp/libutilspp.la \ ./audio/libaudio.la \ ./gui/libguiframework.la \ + ./dbus/libdbus.la \ ./config/libconfig.la \ $(IAX_LIBS) diff --git a/src/dbus/Makefile.am b/src/dbus/Makefile.am index 99d24a797a..7af659bdc5 100644 --- a/src/dbus/Makefile.am +++ b/src/dbus/Makefile.am @@ -1,12 +1,16 @@ SUBDIRS = -EXTRA_DIST = *.xml +EXTRA_DIST = *.xml README noinst_LTLIBRARIES = libdbus.la libdbus_la_SOURCES = \ - callmanager-glue.h + callmanager-glue.h \ + configurationmanager-glue.h \ + callmanager.h callmanager.cpp \ + dbusmanager.h dbusmanagerimpl.h dbusmanagerimp.cpp \ + configurationmanager.h -AM_CXXFLAGS = $(libccext2_CFLAGS) -libdbus_la_LIBADD = $(LIB_DNSSD) +AM_CXXFLAGS = +libdbus_la_LIBADD = diff --git a/src/dbus/callmanager-glue.h b/src/dbus/callmanager-glue.h index 154442e3a0..15405360af 100644 --- a/src/dbus/callmanager-glue.h +++ b/src/dbus/callmanager-glue.h @@ -19,7 +19,7 @@ public: CallManager() : ::DBus::InterfaceAdaptor("org.sflphone.CallManager") { - register_method(CallManager, call, _call_stub); + register_method(CallManager, placeCall, _placeCall_stub); register_method(CallManager, refuse, _refuse_stub); register_method(CallManager, accept, _accept_stub); register_method(CallManager, hangUp, _hangUp_stub); @@ -35,7 +35,7 @@ public: ::DBus::IntrospectedInterface* const introspect() const { - static ::DBus::IntrospectedArgument call_args[] = + static ::DBus::IntrospectedArgument placeCall_args[] = { { "accountID", "s", true }, { "callID", "s", true }, @@ -76,13 +76,13 @@ public: static ::DBus::IntrospectedArgument setVolume_args[] = { { "device", "s", true }, - { "value", "f", true }, + { "value", "d", true }, { 0, 0, 0 } }; static ::DBus::IntrospectedArgument getVolume_args[] = { { "device", "s", true }, - { "value", "f", false }, + { "value", "d", false }, { 0, 0, 0 } }; static ::DBus::IntrospectedArgument getVoiceMailCount_args[] = @@ -132,7 +132,7 @@ public: static ::DBus::IntrospectedArgument volumeChanged_args[] = { { "device", "s", false }, - { "value", "f", false }, + { "value", "d", false }, { 0, 0, 0 } }; static ::DBus::IntrospectedArgument error_args[] = @@ -142,7 +142,7 @@ public: }; static ::DBus::IntrospectedMethod CallManager_methods[] = { - { "call", call_args }, + { "placeCall", placeCall_args }, { "refuse", refuse_args }, { "accept", accept_args }, { "hangUp", hangUp_args }, @@ -192,15 +192,15 @@ public: /* methods exported by this interface, * you will have to implement them in your ObjectAdaptor */ - virtual void call( const ::DBus::String& accountID, const ::DBus::String& callID, const ::DBus::String& to ) = 0; + virtual void placeCall( const ::DBus::String& accountID, const ::DBus::String& callID, const ::DBus::String& to ) = 0; virtual void refuse( const ::DBus::String& callID ) = 0; virtual void accept( const ::DBus::String& callID ) = 0; virtual void hangUp( const ::DBus::String& callID ) = 0; virtual void hold( const ::DBus::String& callID ) = 0; virtual void unhold( const ::DBus::String& callID ) = 0; virtual void transfert( const ::DBus::String& callID, const ::DBus::String& to ) = 0; - virtual void setVolume( const ::DBus::String& device, const & value ) = 0; - virtual getVolume( const ::DBus::String& device ) = 0; + virtual void setVolume( const ::DBus::String& device, const ::DBus::Double& value ) = 0; + virtual ::DBus::Double getVolume( const ::DBus::String& device ) = 0; virtual ::DBus::Int32 getVoiceMailCount( ) = 0; virtual std::map< ::DBus::String, ::DBus::String > getCallDetails( const ::DBus::String& callID ) = 0; virtual ::DBus::String getCurrentCallID( ) = 0; @@ -247,7 +247,7 @@ public: wi << arg1; emit_signal(sig); } - void volumeChanged( const ::DBus::String& arg1, const & arg2 ) + void volumeChanged( const ::DBus::String& arg1, const ::DBus::Double& arg2 ) { ::DBus::SignalMessage sig("volumeChanged"); ::DBus::MessageIter wi = sig.writer(); @@ -267,14 +267,14 @@ private: /* unmarshalers (to unpack the DBus message before calling the actual interface method) */ - ::DBus::Message _call_stub( const ::DBus::CallMessage& call ) + ::DBus::Message _placeCall_stub( const ::DBus::CallMessage& call ) { ::DBus::MessageIter ri = call.reader(); ::DBus::String argin1; ri >> argin1; ::DBus::String argin2; ri >> argin2; ::DBus::String argin3; ri >> argin3; - call(argin1, argin2, argin3); + placeCall(argin1, argin2, argin3); ::DBus::ReturnMessage reply(call); return reply; } @@ -338,7 +338,7 @@ private: ::DBus::MessageIter ri = call.reader(); ::DBus::String argin1; ri >> argin1; - argin2; ri >> argin2; + ::DBus::Double argin2; ri >> argin2; setVolume(argin1, argin2); ::DBus::ReturnMessage reply(call); return reply; @@ -348,7 +348,7 @@ private: ::DBus::MessageIter ri = call.reader(); ::DBus::String argin1; ri >> argin1; - argout1 = getVolume(argin1); + ::DBus::Double argout1 = getVolume(argin1); ::DBus::ReturnMessage reply(call); ::DBus::MessageIter wi = reply.writer(); wi << argout1; diff --git a/src/dbus/callmanager-introspec.xml b/src/dbus/callmanager-introspec.xml index aae53626fa..82eefbe162 100644 --- a/src/dbus/callmanager-introspec.xml +++ b/src/dbus/callmanager-introspec.xml @@ -2,7 +2,7 @@ <node name="/org/sflphone/CallManager"> <interface name="org.sflphone.CallManager"> - <method name="call"> + <method name="placeCall"> <arg type="s" name="accountID" direction="in"/> <arg type="s" name="callID" direction="in"/> <arg type="s" name="to" direction="in"/> @@ -35,12 +35,12 @@ <method name="setVolume"> <arg type="s" name="device" direction="in"/> - <arg type="f" name="value" direction="in"/> + <arg type="d" name="value" direction="in"/> </method> <method name="getVolume"> <arg type="s" name="device" direction="in"/> - <arg type="f" name="value" direction="out"/> + <arg type="d" name="value" direction="out"/> </method> <method name="getVoiceMailCount"> @@ -81,7 +81,7 @@ <signal name="volumeChanged"> <arg type="s" name="device" /> - <arg type="f" name="value" /> + <arg type="d" name="value" /> </signal> <signal name="error"> diff --git a/src/dbus/callmanager.h b/src/dbus/callmanager.h new file mode 100644 index 0000000000..58a77778c8 --- /dev/null +++ b/src/dbus/callmanager.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2007 Savoir-Faire Linux inc. + * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef CALLMANAGER_H +#define CALLMANAGER_H + +#include "callmanager-glue.h" +#include <dbus-c++/dbus.h> + +static const char* SERVER_NAME = "org.sflphone.CallManager"; +static const char* SERVER_PATH = "/org/sflphone/CallManager"; + +class CallManager +: public org::sflphone::CallManager, + public DBus::IntrospectableAdaptor, + public DBus::ObjectAdaptor +{ +public: + + CallManager(DBus::Connection& connection); + static int exec(); + + +public: + + /* methods exported by this interface, + * you will have to implement them in your ObjectAdaptor + */ + void placeCall( const ::DBus::String& accountID, const ::DBus::String& callID, const ::DBus::String& to ); + void refuse( const ::DBus::String& callID ); + void accept( const ::DBus::String& callID ); + void hangUp( const ::DBus::String& callID ); + void hold( const ::DBus::String& callID ); + void unhold( const ::DBus::String& callID ); + void transfert( const ::DBus::String& callID, const ::DBus::String& to ); + void setVolume( const ::DBus::String& device, const ::DBus::Double& value ); + ::DBus::Double getVolume( const ::DBus::String& device ); + ::DBus::Int32 getVoiceMailCount( ); + std::map< ::DBus::String, ::DBus::String > getCallDetails( const ::DBus::String& callID ); + ::DBus::String getCurrentCallID( ); + +}; + +#endif//CALLMANAGER_H diff --git a/src/dbus/dbusmanager.h b/src/dbus/dbusmanager.h new file mode 100644 index 0000000000..2b096ac3fc --- /dev/null +++ b/src/dbus/dbusmanager.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2007 Savoir-Faire Linux inc. + * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __DBUSMANAGERSINGLETON_H__ +#define __DBUSMANAGERSINGLETON_H__ + +#include "utilspp/Singleton.hpp" +#include "dbusmanagerimpl.h" + +typedef utilspp::SingletonHolder< DBusManagerImpl > DBusManager; + +#endif // __DBUSMANAGERSINGLETON_H__ diff --git a/src/dbus/dbusmanagerimpl.cpp b/src/dbus/dbusmanagerimpl.cpp new file mode 100644 index 0000000000..6a46563540 --- /dev/null +++ b/src/dbus/dbusmanagerimpl.cpp @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2007 Savoir-Faire Linux inc. + * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <dbusmanagerimpl.h> diff --git a/src/dbus/dbusmanagerimpl.h b/src/dbus/dbusmanagerimpl.h new file mode 100644 index 0000000000..42871b86a9 --- /dev/null +++ b/src/dbus/dbusmanagerimpl.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2007 Savoir-Faire Linux inc. + * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef DBUSMANAGERIMPL_H +#define DBUSMANAGERIMPL_H + +class DBusManager { + public: + void connect(); + int exec(); + + private: + CallManager * _callManager; +} + +#endif -- GitLab