smf/smfservermodule/smfclient/client/smfclient.cpp
changeset 7 be09cf1f39dd
equal deleted inserted replaced
6:c39a6cfd1fb9 7:be09cf1f39dd
       
     1 /**
       
     2  * Copyright (c) 2010 Sasken Communication Technologies Ltd.
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the "Eclipse Public License v1.0" 
       
     6  * which accompanies  this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html"
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
       
    11  *
       
    12  * Contributors:
       
    13  * Manasij Roy, Nalina Hariharan
       
    14  */
       
    15 #include "smfclient.h"
       
    16 #include "smfclient_p.h"
       
    17 
       
    18 
       
    19 SmfClient::SmfClient()
       
    20 	{
       
    21 	writeLog("SmfClient::SmfClient");
       
    22 	//Create instance of the private wrapper
       
    23 	m_private = new SmfClientPrivate(this);
       
    24 	m_providerList = NULL;
       
    25 	}
       
    26 SmfClient::~SmfClient()
       
    27 	{
       
    28 	if(m_private)
       
    29 		{
       
    30 		delete m_private;
       
    31 		m_private = NULL;
       
    32 		}
       
    33 	}
       
    34 
       
    35 QList<SmfProvider>* SmfClient::GetServices(const QString& serviceName)
       
    36 	{
       
    37 	writeLog("SmfClient::GetServices");
       
    38 	if(m_providerList)
       
    39 		{
       
    40 		delete m_providerList;
       
    41 		m_providerList = NULL;
       
    42 		}
       
    43 	writeLog("Before m_private->GetServices");
       
    44 	//Getting the data synchronously
       
    45 	m_providerList = m_private->GetServices(serviceName);
       
    46 	writeLog("After m_private->GetServices");
       
    47 	return m_providerList;
       
    48 	}
       
    49 void SmfClient::writeLog(QString log) const
       
    50 	{
       
    51 #ifdef WRITE_LOG
       
    52 	QFile file("c:\\data\\SmfClientLogs.txt");
       
    53     if (!file.open(QIODevice::Append | QIODevice::Text))
       
    54 	         ;
       
    55     QTextStream out(&file);
       
    56     out << log << "\n";
       
    57     file.close();
       
    58 #endif
       
    59 	}