smf/smfservermodule/smfclient/common/smfprovider.cpp
changeset 14 a469c0e6e7fb
parent 7 be09cf1f39dd
equal deleted inserted replaced
13:b5d63d5fc252 14:a469c0e6e7fb
     1 /*
     1 /**
     2  * smfprovider.cpp
     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"
     3  *
     8  *
     4  *  Created on: Apr 15, 2010
     9  * Initial Contributors:
     5  *      Author: manasij
    10  * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
       
    11  *
       
    12  * Contributors:
       
    13  * Manasij Roy, Nalina Hariharan
       
    14  * 
       
    15  * Description:
       
    16  * Interface for a base service provider
       
    17  *
     6  */
    18  */
     7 #include "smfprovider.h"
    19 #include "smfprovider.h"
     8 
    20 
     9   SmfProvider::SmfProvider(QObject* parent)//:QObject(parent)
    21  SmfProvider::SmfProvider()
    10 	  {
       
    11 	  
       
    12 	  }
       
    13   SmfProvider::~SmfProvider()
       
    14 	  {
       
    15 	  
       
    16 	  }
       
    17 
       
    18   /**
       
    19    * Localizable name of the service 
       
    20    * @return service name
       
    21    */
       
    22   QString SmfProvider::serviceName() const
       
    23   {
    22   {
    24 	  return m_serviceName;
    23   
    25   }
    24   }
       
    25  SmfProvider::~SmfProvider()
       
    26   {
    26   
    27   
    27   /**
    28   }
    28    * Logo of the service
    29 QString SmfProvider::serviceName() const
    29    * @return logo image of the service
    30  {
    30    */
    31 	return m_serviceName;
    31   QImage SmfProvider::serviceIcon() const
    32  }
    32 		  {
    33 QImage SmfProvider::serviceIcon() const
    33 			  return m_serviceIcon;
    34  {
    34 		  }
    35 	return m_serviceIcon;
    35   
    36  }
    36   /**
    37 QString SmfProvider::description() const
    37    * Readable service description
    38  {
    38    * @return service description
    39 	 return m_description;
    39    */
    40  }
    40   QString SmfProvider::description() const
    41 QUrl SmfProvider::serviceUrl() const
    41 		  {
    42  {
    42 	  return m_description;
    43 	 return m_serviceUrl;
    43 		  }
    44  }
    44   
    45 QUrl SmfProvider::applicationUrl() const  
    45   /*
    46  {
    46    * Website of the service
       
    47    */
       
    48   QUrl SmfProvider::serviceUrl() const
       
    49 		  {
       
    50 	  return m_serviceUrl;
       
    51 		  }
       
    52   
       
    53   /**
       
    54    * URL of the application providing this service
       
    55    */
       
    56   QUrl SmfProvider::applicationUrl() const  //
       
    57 		  {
       
    58 	  return m_appUrl;
    47 	  return m_appUrl;
    59 		  }
    48  }
    60   
    49 QList<QString> SmfProvider::supportedInterfaces() const
    61   /**
    50  {
    62    * service types - list of interfaces that this provider support
    51 	return m_serviceTypes;
    63    */
    52  }
    64   QList<QString> SmfProvider::serviceTypes() const
    53 /**
    65 		  {
    54  * List of languages supported by this service provider
    66 	  return m_serviceTypes;
    55  * @return a QStringList of languages supported by this service 
    67 		  }
    56  * provider in 2 letter ISO 639-1 format.
    68   
    57  */
    69   /////////////////////////////////////////set APIs
    58 QStringList SmfProvider::supportedLanguages() const
    70   /**
    59 	{
    71    * Localizable name of the service 
    60 	return m_supportedLanguages;
    72    * 
    61 	}
    73    */
    62 void SmfProvider::setServiceName(QString& name)
    74   void SmfProvider::serviceName(QString& name)
       
    75 	  {
    63 	  {
    76 	  m_serviceName = name;
    64 	  m_serviceName = name;
    77 	  }
    65 	  }
    78   
    66 void SmfProvider::setServiceIcon(QImage& image)
    79   /**
       
    80    * Logo of the service
       
    81    * 
       
    82    */
       
    83   void SmfProvider::serviceIcon(QImage& image)
       
    84 	  {
    67 	  {
    85 	  m_serviceIcon = image;
    68 	  m_serviceIcon = image;
    86 	  }
    69 	  }
    87   
    70 void SmfProvider::setDescription(QString& desc)
    88   /**
       
    89    * Readable service description
       
    90    * 
       
    91    */
       
    92   void SmfProvider::description(QString& desc)
       
    93 	  {
    71 	  {
    94 	  m_description = desc;
    72 	  m_description = desc;
    95 	  }
    73 	  }
    96   
    74 void SmfProvider::setServiceUrl(QUrl& url)
    97   /*
       
    98    * Website of the service
       
    99    */
       
   100   void SmfProvider::serviceUrl(QUrl& url)
       
   101 	  {
    75 	  {
   102 	  m_serviceUrl = url;
    76 	  m_serviceUrl = url;
   103 	  }
    77 	  }
   104   
    78 void SmfProvider::setApplicationUrl(QUrl& url)
   105   /**
       
   106    * URL of the application providing this service
       
   107    */
       
   108   void SmfProvider::applicationUrl(QUrl& url)
       
   109 	  {
    79 	  {
   110 	  m_appUrl = url;
    80 	  m_appUrl = url;
   111 	  }
    81 	  }
   112   
    82 void SmfProvider::setSupportedInterfaces( QStringList& types)
   113   /**
       
   114    * service types - list of interfaces that this provider support
       
   115    */
       
   116  void SmfProvider::serviceTypes( QStringList& types)
       
   117 	 {
    83 	 {
   118 	 m_serviceTypes = types;
    84 	 m_serviceTypes = types;
   119 	 }
    85 	 }
   120  /**
    86 /**
   121   * Externalization
    87  * Sets the list of languages supported by this service provider
   122   */
    88  * @param lang A QStringList of languages supported by this service 
   123  QDataStream &operator<<(QDataStream& out, const SmfProvider& base)
    89  * provider in 2 letter ISO 639-1 format.
       
    90  */
       
    91 void SmfProvider::setSupportedLanguages( QStringList& lang )
       
    92 	{
       
    93 	m_supportedLanguages = lang;
       
    94 	}
       
    95 
       
    96 QDataStream &operator<<(QDataStream& out, const SmfProvider& base)
   124  	{
    97  	{
   125 // 	base.writeLog("operator<<");
    98 	out<<base.m_serviceName;
   126 // 	base.writeLog("base info:-");
       
   127 // 	base.writeLog(base.m_serviceName);
       
   128  //	base.writeLog(base.m_serviceIcon);
       
   129 // 	base.writeLog(base.m_description);
       
   130 // 	base.writeLog(base.m_serviceUrl);
       
   131 // 	base.writeLog(base.m_appUrl);
       
   132 // 	
       
   133  	
       
   134  	out<<base.m_serviceName;
       
   135  	out<<base.m_serviceIcon;
    99  	out<<base.m_serviceIcon;
   136  	out<<base.m_description;
   100  	out<<base.m_description;
   137  	out<<base.m_serviceUrl;
   101  	out<<base.m_serviceUrl;
   138  	out<<base.m_appUrl;
   102  	out<<base.m_appUrl;
   139  	return out; 
   103  	return out; 
   140  	}
   104  	}
   141 
   105 QDataStream &operator>>(QDataStream& in, SmfProvider& base)
   142  /**
       
   143   * Internalization
       
   144   */
       
   145  QDataStream &operator>>(QDataStream& in, SmfProvider& base)
       
   146  	{
   106  	{
   147 // 	base.writeLog("operator>>");
       
   148 
       
   149  	
       
   150  	in>>base.m_serviceName;
   107  	in>>base.m_serviceName;
   151  	in>>base.m_serviceIcon;
   108  	in>>base.m_serviceIcon;
   152  	in>>base.m_description;
   109  	in>>base.m_description;
   153  	in>>base.m_serviceUrl;
   110  	in>>base.m_serviceUrl;
   154  	in>>base.m_appUrl;
   111  	in>>base.m_appUrl;
   155 // 	base.writeLog("After writing,base info:-");
       
   156 // 	base.writeLog(base.m_serviceName);
       
   157 // //	base.writeLog(base.m_serviceIcon);
       
   158 // 	base.writeLog(base.m_description);
       
   159 // 	base.writeLog(base.m_serviceUrl);
       
   160 // 	base.writeLog(base.m_appUrl);
       
   161  	return in; 
   112  	return in; 
   162  	}
   113  	}