smf/smfservermodule/smfclient/smfclient.h
changeset 26 83d6a149c755
parent 18 013a02bf2bb0
equal deleted inserted replaced
25:a180113055cb 26:83d6a149c755
    21 
    21 
    22 #ifndef SMFCLIENT_H
    22 #ifndef SMFCLIENT_H
    23 #define SMFCLIENT_H
    23 #define SMFCLIENT_H
    24 
    24 
    25 #include <QObject>
    25 #include <QObject>
       
    26 #include <qprocess.h>
    26 
    27 
    27 #include "smfclientglobal.h"
    28 #include "smfclientglobal.h"
    28 #include "smfglobal.h"
    29 #include "smfglobal.h"
    29 
    30 
    30 //Forward declarations
    31 //Forward declarations
    31 class SmfProvider;
    32 class SmfProvider;
    32 class SmfClientPrivate;
    33 class SmfClientPrivate;
       
    34 
       
    35 enum SMFProviderAuthorizationStatus
       
    36 	{
       
    37 	SMFProviderAuthStatusUnknown,	 	//status unknown
       
    38 	SMFProviderAuthStatusAuthorised, 	//user logged in
       
    39 	SMFProviderAuthStatusUnauthorised, 	//user logged out/not logged in
       
    40 	SMFProviderAuthStatusBlocked		//user chosen to block this service
       
    41 	};
    33 
    42 
    34 /**
    43 /**
    35  * @ingroup smf_client_group 
    44  * @ingroup smf_client_group 
    36  * Interface for a base service provider. Other service provider classes contains 
    45  * Interface for a base service provider. Other service provider classes contains 
    37  * implementation of this base class so that each has access to service provider 
    46  * implementation of this base class so that each has access to service provider 
    38  * information.
    47  * information.
    39  * All of the functionality described here should be implemented by a service
    48  * All of the functionality described here should be implemented by a service
    40  * specific plug-in object.
    49  * specific plug-in object.
    41  */
    50  */
    42 class  SMFCLIENT_EXPORT SmfClient
    51 class  SMFCLIENT_EXPORT SmfClient : public QObject
    43 	{
    52 	{
       
    53 	Q_OBJECT
    44 public:
    54 public:
    45 	/**
    55 	/**
    46 	 * Constructs SmfClient
    56 	 * Constructs SmfClient
    47 	 */
    57 	 */
    48 	SmfClient();
    58 	SmfClient();
    58 	 * @return Service provider's list (ownership of memory is transferred 
    68 	 * @return Service provider's list (ownership of memory is transferred 
    59 	 * to the calling party)
    69 	 * to the calling party)
    60 	 */
    70 	 */
    61 	QList<SmfProvider>* GetServices(const QString& serviceName);
    71 	QList<SmfProvider>* GetServices(const QString& serviceName);
    62 	
    72 	
       
    73 	/**
       
    74 	 * Checks the current status of the service. Application might want to 
       
    75 	 * launch authorization process by calling loginToService() for the 
       
    76 	 * service which is not authorised.
       
    77 	 * @param provider The SmfProvider instance for the requested service
       
    78 	 * @return Authorization status (loggedin, logged out, blocked, unknown etc)
       
    79 	 */
       
    80 	SMFProviderAuthorizationStatus checkAuthorization(const SmfProvider& provider);
       
    81 	
       
    82 	/**
       
    83 	 * Method to launch the authentication application for this service.
       
    84 	 * This would pop-up service specific login window. Till user logs in 
       
    85 	 * successfully, any call to SMF APIs for this service Provider would 
       
    86 	 * return SmfServiceAuthFailed. Symbian application should have 
       
    87 	 * UserData capability.
       
    88 	 * @param provider The SmfProvider instance for the requested service
       
    89 	 * @return SmfError value 
       
    90 	 */
       
    91 	SmfError loginToService(SmfProvider* provider);
       
    92 	
       
    93 	/**
       
    94 	 * Method to log-out of (unauthorise) this service. Please note that 
       
    95 	 * this might not immediately log-out of the service if there are other 
       
    96 	 * applications using this service. Application need not use this function 
       
    97 	 * for normal operations - being logged in doesn't cost data charges and would 
       
    98 	 * avoid disturbing log-in pop-ups. Please note that there is no notification 
       
    99 	 * when user has logged out of service. Please use checkAuthorization() to 
       
   100 	 * determine the current status
       
   101 	 * @param provider The SmfProvider instance for the requested service
       
   102 	 * @return SmfError value  
       
   103 	 */
       
   104 	SmfError logoutOfService(SmfProvider* provider); 
       
   105 	
    63 	// ToDo :- More overloaded APIs will be provided later
   106 	// ToDo :- More overloaded APIs will be provided later
    64 	//QList<SmfProvider>* GetServices(const QString& serviceName, const QString& providerName);
   107 	/**
       
   108 	 * Get provider details for a particular service provider for a particular service interface
       
   109 	 * The provider name is always English lowercase with the domain separator 
       
   110 	 * e.g. "facebook.com", "last.fm","linkedin.com"
       
   111 	 * for updated list of service provider names please refer SMF wiki in SF
       
   112 	 * TODO: provide url here.
       
   113 	 */
       
   114 	//SmfProvider* GetServices(const QString& serviceName, const QString& providerName);
    65 	//QList<SmfProvider>* GetServices(const QString& serviceName, const SmfProvider& provider);
   115 	//QList<SmfProvider>* GetServices(const QString& serviceName, const SmfProvider& provider);
    66   
   116   
    67 	/**
   117 	/**
    68 	 * This method returns the error message for the mentioned argument error code
   118 	 * This method returns the error message for the mentioned argument error code
    69 	 * @param aErrorCode The SmfError code for which the error string is required
   119 	 * @param aErrorCode The SmfError code for which the error string is required
    70 	 * @returns a QString object containing the required error message
   120 	 * @returns a QString object containing the required error message
    71 	 */
   121 	 */
    72 	QString errorString ( const SmfError &aErrorCode ) const;
   122 	QString errorString ( const SmfError &aErrorCode ) const;
    73 
   123 
       
   124 private slots:
       
   125 	/**
       
   126 	 * Slot that connects to the started() signal of QProcess
       
   127 	 */
       
   128     void started();
       
   129     
       
   130 	/**
       
   131 	 * Slot that connects to the stateChanged() signal of QProcess
       
   132 	 * @param newState The newState of the started Process
       
   133 	 */
       
   134     void stateChanged(QProcess::ProcessState newState);
       
   135     
       
   136 	/**
       
   137 	 * Slot that connects to the error() signal of QProcess
       
   138 	 * @param error The error that occured in the started process
       
   139 	 */
       
   140     void error(QProcess::ProcessError error);
       
   141     
       
   142 	/**
       
   143 	 * Slot that connects to the finished() signal of QProcess. This signal 
       
   144 	 * is emitted when the process finishes
       
   145 	 * @param exitCode The exit code of the process
       
   146 	 * @param exitStatus The exit status of the process
       
   147 	 */
       
   148     void finished(int exitCode, QProcess::ExitStatus exitStatus);
       
   149     
    74 private:
   150 private:
    75 	/**
   151 	/**
    76 	 * Private impl wrapper.
   152 	 * Private impl wrapper.
    77 	 */
   153 	 */
    78 	SmfClientPrivate* m_private;
   154 	SmfClientPrivate* m_private;
    79 	
   155 	
    80 	/**
   156 	/**
    81 	 * List of SmfProvider to be returned to the requested code
   157 	 * List of SmfProvider to be returned to the requested code
    82 	 */
   158 	 */
    83 	QList<SmfProvider>* m_providerList;
   159 	QList<SmfProvider>* m_providerList;
       
   160 	QProcess *m_authAppProcess;
    84   
   161   
    85 	};
   162 	};
    86 
   163 
    87 #endif // SMFCLIENT_H
   164 #endif // SMFCLIENT_H