X-Git-Url: http://git.maemo.org/git/?p=vicar;a=blobdiff_plain;f=src%2Fvicar-telepathy%2Fcpp%2Fmain.cpp;fp=src%2Fvicar-telepathy%2Fcpp%2Fmain.cpp;h=b6024ca4967a69820cbf0a2bc6e44ac21bfce374;hp=0000000000000000000000000000000000000000;hb=74800375ecf7f41e290cf7cc7fa9ee8b230be68e;hpb=89f0017e6a73945ea83247472a6fa07d6ee536b5 diff --git a/src/vicar-telepathy/cpp/main.cpp b/src/vicar-telepathy/cpp/main.cpp new file mode 100644 index 0000000..b6024ca --- /dev/null +++ b/src/vicar-telepathy/cpp/main.cpp @@ -0,0 +1,130 @@ +/* +@version: 0.6 +@author: Sudheer K. +@license: GNU General Public License + +Based on Telepathy-SNOM with copyright notice below. +*/ + +/* + * Telepathy SNOM VoIP phone connection manager + * Copyright (C) 2006 by basyskom GmbH + * @author Tobias Hunger + * + * This library is free software; you can redisQObject::tribute 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 library is disQObject::tributed 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin SQObject::treet, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include "names.h" +#include "connectionmanager.h" +#include "basetypes.h" +#include "connectionmanagertypes.h" +#include "connectiontypes.h" +#include "connectioninterfacerequeststypes.h" +#include "connectioninterfacecapabilitiestypes.h" + + +using namespace std; + +/* +ofstream logfile; + +void MyOutputHandler(QtMsgType type, const char *msg) { + switch (type) { + case QtDebugMsg: + logfile << QTime::currentTime().toString().toAscii().data() << " Debug: " << msg << "\n"; + break; + case QtCriticalMsg: + logfile << QTime::currentTime().toString().toAscii().data() << " Critical: " << msg << "\n"; + break; + case QtWarningMsg: + logfile << QTime::currentTime().toString().toAscii().data() << " Warning: " << msg << "\n"; + break; + case QtFatalMsg: + logfile << QTime::currentTime().toString().toAscii().data() << " Fatal: " << msg << "\n"; + abort(); + } +} + +*/ + +int main(int argc, char ** argv) +{ + +// logfile.open("/var/log/logfile.txt", ios::app); +// #ifndef QT_NO_DEBUG_OUTPUT +// qInstallMsgHandler(MyOutputHandler); +// #endif + + + QCoreApplication app(argc, argv); + + // register types: + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + + QDBusConnection connection = QDBusConnection::sessionBus(); + + if (!connection.interface()->isServiceRegistered(cm_service_name)) + { + + // register CM on D-BUS: + bool success = connection.registerService(cm_service_name); + if (success){ + qDebug(qPrintable(QObject::tr("Vicar-Telepathy: Service %1 registered with session bus."). + arg(cm_service_name))); + } + else{ + + QDBusError error = connection.interface()->lastError(); + + qDebug(qPrintable(QObject::tr("Vicar-Telepathy: Unable to register service %1 with session bus due to error %2."). + arg(cm_service_name,error.message()))); + } + + } + + ConnectionManager connection_mgr(&app); + if (!connection.registerObject(cm_object_path,&connection_mgr)){ + qDebug(qPrintable(QObject::tr("Vicar-Telepathy: Unable to register VICaR connection manager at path %1 with session bus."). + arg(cm_object_path))); + } + + qDebug(qPrintable(QObject::tr("Vicar-Telepathy: Enternig main loop."))); + return app.exec(); +}