X-Git-Url: http://git.maemo.org/git/?p=tpsession;a=blobdiff_plain;f=tpsession-0.1%2Ftpsession%2Ftpsession.cpp;h=903e92beb8f070e12b1ea716b264e8e527841f7a;hp=95161a02c82a1a1b341eb6cba16ce118de26f06a;hb=39c01267eba450aed214c0b91fda0d9c45245a57;hpb=fa60d89533e6cc5cfdda4a7fea370ab86cbe6faa diff --git a/tpsession-0.1/tpsession/tpsession.cpp b/tpsession-0.1/tpsession/tpsession.cpp index 95161a0..903e92b 100644 --- a/tpsession-0.1/tpsession/tpsession.cpp +++ b/tpsession-0.1/tpsession/tpsession.cpp @@ -2,7 +2,7 @@ * This file is part of TpSession * * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * Contact Kate Alhola kate.alholanokia.com + * Contact Kate Alhola kate.alhola(a)nokia.com * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -21,6 +21,50 @@ #include "tpsession.h" #include + + + + +/** + * \class TpSession + * \headerfile + * + * Top level class, counterpart of Account Manager. TpSession connects to account manager and requests accounts from it. TpSession creates TpSessionAccount for all accounts . + * As top level class TpSession provides simålified interface to send and receive messages via any account. TpSession provides signal when it has accounts ready. + * If you require some specific account in constructor, you will receive signal only when this account is ready. If you use constructor without any parameters, you will get one + * signal for every account. If synchronous is true, constructor is executed as synchronous and it does return after transactions to set up accounts are done. + */ +/** + * \fn void TpSession::accountReady(TpSessionAccount *); + * + * Emitted when the account becomes ready + * + * \param TpSessionAccount pointer to account become ready + */ +/** + * \fn void TpSession::amReady(TpSession *); + * + * Emitted when the account Manager becomes ready + * + * \param TpSession pointer to TpSession class + */ +/** + * \fn void TpSession::messageReceived(const Tp::ReceivedMessage &,TpSessionAccount *); + * + * Emitted when any of Account Managers recived message + * + * \param Tp::ReceivedMessage Message received + * \param TpSessionAccount pointer to account received message + */ + + +/** + * Construct a new TpSession object. + * + * \param cmname Name of the default connection manager. Can be empty or omnitted, then there is no default connection manager + * \param synchronous if false, asynchronous behavior, function returns immediately and accountReady signals are emitted when accounts are ready + * if True, synchronous behavior and function returns when accounts are ready + */ TpSession::TpSession(QString cmname,bool synchronous) { Tp::registerTypes(); @@ -42,6 +86,12 @@ TpSession::TpSession(QString cmname,bool synchronous) } TpSession* TpSession::instancePtr=NULL; +/** + * Returns pointer to TpSession singleton. If there is not yet TpSession Object, creates it with "Ring" connection manager as default + * + * \param synchronous if false, asynchronous behavior, function returns immediately and accountReady signals are emitted when accounts are ready + * if True, synchronous behavior and function returns when accounts are ready + */ TpSession* TpSession::instance(bool synchronous) { if(instancePtr==NULL) instancePtr=new TpSession("ring",synchronous); @@ -92,12 +142,24 @@ void TpSession::onMessageReceived(const Tp::ReceivedMessage &msg,TpSessionAccoun emit messageReceived(msg,acc); } +/** + * Send message using specified connection manager to address + * + * \param connectionMgr Name of the connection manager + * \param address Valid address for this connection manager type. Asexample telephone number to Ring, GoogleTalk address for Gabble + * \param message Message body + */ void TpSession::sendMessageToAddress(QString connectionMgr,QString address,QString message) { TpSessionAccount *tpsa=getAccount(connectionMgr); if(tpsa) tpsa->sendMessageToAddress(address,message); } - +/** + * Returns pointer to TpSessionAccout object with specified connection manager or protocol, returns NULL if no match found + * + * \param cm Name of the connection manager, if left empty matches every entry + * \param protocol Name of the protocol manager, if left empty matches every entry + */ TpSessionAccount* TpSession::getAccount(const QString cm,QString protocol) { qDebug() << "TpSession::getAccount" << cm << " " << protocol;