18
|
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 |
* Description:
|
|
16 |
* The SmfClient class provides a set of APIs to get list of service provider
|
|
17 |
* who implement the given interface. Calling GetServices of the instance of this
|
|
18 |
* class is mandatory before using any other interface.
|
|
19 |
*
|
|
20 |
*/
|
|
21 |
|
|
22 |
#ifndef SMFCLIENT_H
|
|
23 |
#define SMFCLIENT_H
|
|
24 |
|
|
25 |
#include <QObject>
|
26
|
26 |
#include <qprocess.h>
|
18
|
27 |
|
|
28 |
#include "smfclientglobal.h"
|
|
29 |
#include "smfglobal.h"
|
|
30 |
|
|
31 |
//Forward declarations
|
|
32 |
class SmfProvider;
|
|
33 |
class SmfClientPrivate;
|
|
34 |
|
26
|
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 |
};
|
|
42 |
|
18
|
43 |
/**
|
|
44 |
* @ingroup smf_client_group
|
|
45 |
* Interface for a base service provider. Other service provider classes contains
|
|
46 |
* implementation of this base class so that each has access to service provider
|
|
47 |
* information.
|
|
48 |
* All of the functionality described here should be implemented by a service
|
|
49 |
* specific plug-in object.
|
|
50 |
*/
|
26
|
51 |
class SMFCLIENT_EXPORT SmfClient : public QObject
|
18
|
52 |
{
|
26
|
53 |
Q_OBJECT
|
18
|
54 |
public:
|
|
55 |
/**
|
|
56 |
* Constructs SmfClient
|
|
57 |
*/
|
|
58 |
SmfClient();
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Destructor
|
|
62 |
*/
|
|
63 |
~SmfClient();
|
|
64 |
|
|
65 |
/**
|
|
66 |
* Method to get the list of services for a given service (interface name)
|
|
67 |
* @param serviceName The name of the service
|
|
68 |
* @return Service provider's list (ownership of memory is transferred
|
|
69 |
* to the calling party)
|
|
70 |
*/
|
|
71 |
QList<SmfProvider>* GetServices(const QString& serviceName);
|
|
72 |
|
26
|
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 |
|
18
|
106 |
// ToDo :- More overloaded APIs will be provided later
|
26
|
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);
|
18
|
115 |
//QList<SmfProvider>* GetServices(const QString& serviceName, const SmfProvider& provider);
|
|
116 |
|
|
117 |
/**
|
|
118 |
* This method returns the error message for the mentioned argument error code
|
|
119 |
* @param aErrorCode The SmfError code for which the error string is required
|
|
120 |
* @returns a QString object containing the required error message
|
|
121 |
*/
|
|
122 |
QString errorString ( const SmfError &aErrorCode ) const;
|
|
123 |
|
26
|
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 |
|
18
|
150 |
private:
|
|
151 |
/**
|
|
152 |
* Private impl wrapper.
|
|
153 |
*/
|
|
154 |
SmfClientPrivate* m_private;
|
|
155 |
|
|
156 |
/**
|
|
157 |
* List of SmfProvider to be returned to the requested code
|
|
158 |
*/
|
|
159 |
QList<SmfProvider>* m_providerList;
|
26
|
160 |
QProcess *m_authAppProcess;
|
18
|
161 |
|
|
162 |
};
|
|
163 |
|
|
164 |
#endif // SMFCLIENT_H
|