* 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
#include "tpsession.h"
#include <QDebug>
+
+
+
+
+/**
+ * \class TpSession
+ * \headerfile <tpsession.h>
+ *
+ * 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();
}
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);
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;