1
/****************************************************************************
3
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
** All rights reserved.
5
** Contact: Nokia Corporation (qt-info@nokia.com)
7
** This file is part of the Qt Mobility Components.
9
** $QT_BEGIN_LICENSE:LGPL$
11
** Licensees holding valid Qt Commercial licenses may use this file in
12
** accordance with the Qt Commercial License Agreement provided with
13
** the Software or, alternatively, in accordance with the terms
14
** contained in a written agreement between you and Nokia.
16
** GNU Lesser General Public License Usage
17
** Alternatively, this file may be used under the terms of the GNU Lesser
18
** General Public License version 2.1 as published by the Free Software
19
** Foundation and appearing in the file LICENSE.LGPL included in the
20
** packaging of this file. Please review the following information to
21
** ensure the GNU Lesser General Public License version 2.1 requirements
22
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24
** In addition, as a special exception, Nokia gives you certain additional
25
** rights. These rights are described in the Nokia Qt LGPL Exception
26
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28
** GNU General Public License Usage
29
** Alternatively, this file may be used under the terms of the GNU
30
** General Public License version 3.0 as published by the Free Software
31
** Foundation and appearing in the file LICENSE.GPL included in the
32
** packaging of this file. Please review the following information to
33
** ensure the GNU General Public License version 3.0 requirements will be
34
** met: http://www.gnu.org/copyleft/gpl.html.
36
** If you are unsure which license is appropriate for your use, please
37
** contact the sales department at qt-sales@nokia.com.
40
****************************************************************************/
42
#ifndef QREMOTESERVICEREGISTER_S60_P_H
43
#define QREMOTESERVICEREGISTER_S60_P_H
45
//#define QT_SFW_SYMBIAN_IPC_DEBUG
47
#include "qremoteserviceregister.h"
48
#include "qremoteserviceregister_p.h"
49
//#include "qremoteserviceclassregister.h"
50
#include "qservicepackage_p.h"
54
#ifdef QT_SFW_SYMBIAN_IPC_DEBUG
62
class ServiceMessageListener;
64
const TUint KServerMajorVersionNumber = 1;
65
const TUint KServerMinorVersionNumber = 0;
66
const TUint KServerBuildVersionNumber = 0;
68
enum TServiceProviderRequest
72
EPackageRequestCancel = 3,
73
EPackageRequestComplete = 4
77
// Forward declarations
79
class CServiceProviderServerSession;
80
class CServiceProviderServer;
81
class SymbianServerEndPoint;
82
class SymbianClientEndPoint;
83
class QRemoteServiceRegisterSymbianPrivate;
86
typedef TPckgBuf<TInt> TError;
88
#ifdef QT_SFW_SYMBIAN_IPC_DEBUG
89
void printServicePackage(const QServicePackage& package);
93
// Internal class handling the actual communication with the service provider.
94
// Communication is based on standard Symbian client-server architecture.
95
class RServiceSession : public QObject, public RSessionBase
99
RServiceSession(QString address);
100
virtual ~RServiceSession();
103
TVersion Version() const;
104
void SendServicePackage(const QServicePackage& aPackage);
107
// 255 bytes seems to cover a lot of test cases in house
108
// this size might need to be increased to avoid a lot
109
// of context switches
110
TBuf8<255> iMessageFromServer;
111
TPckgBuf<TInt> iSize; // TPckgBuf type can be used directly as IPC parameter
113
void setListener(ServiceMessageListener* listener);
116
void ipcFailure(QService::UnrecoverableIPCError);
120
void errorUnrecoverableIPCFault(QService::UnrecoverableIPCError);
123
void ListenForPackages(TRequestStatus& aStatus);
124
void CancelListenForPackages();
130
TIpcArgs iArgs; // These two are used in actively listening to server
132
QString iServerAddress;
133
ServiceMessageListener* iListener;
135
friend class ServiceMessageListener;
138
// needed for creating server thread.
139
const TUint KDefaultHeapSize = 0x10000;
141
class CServiceProviderServer : public CPolicyServer
144
CServiceProviderServer(QRemoteServiceRegisterSymbianPrivate* aOwner);
145
CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
149
void IncreaseSessions();
150
void DecreaseSessions();
152
void setSecurityFilter(QRemoteServiceRegister::SecurityFilter filter);
155
virtual TCustomResult CustomSecurityCheckL(const RMessage2 &,TInt &,TSecurityInfo &);
160
QRemoteServiceRegisterSymbianPrivate* iOwner;
161
QRemoteServiceRegister::SecurityFilter iFilter;
164
class CServiceProviderServerSession : public CSession2
167
static CServiceProviderServerSession* NewL(CServiceProviderServer& aServer);
168
static CServiceProviderServerSession* NewLC(CServiceProviderServer& aServer);
169
virtual ~CServiceProviderServerSession();
170
void ServiceL(const RMessage2& aMessage);
171
void SetParent(SymbianServerEndPoint* aOwner);
172
void SendServicePackageL(const QServicePackage& aPackage);
174
TInt HandleServicePackageL(const RMessage2& aMessage);
175
void HandlePackageRequestL(const RMessage2& aMessage);
176
void HandlePackageRequestCancelL(const RMessage2& aMessage);
179
CServiceProviderServerSession(CServiceProviderServer& aServer);
183
CServiceProviderServer& iServer;
184
SymbianServerEndPoint* iOwner;
185
QByteArray* iByteArray;
186
RMessage2 iMsg; // For replying pending service package requests
187
QQueue<QServicePackage> iPendingPackageQueue;
188
TBool iPendingPackageRequest;
189
QByteArray iBlockData;
194
class QRemoteServiceRegisterSymbianPrivate: public QRemoteServiceRegisterPrivate
199
QRemoteServiceRegisterSymbianPrivate(QObject* parent);
200
void publishServices(const QString& ident );
201
static QObject* proxyForService(const QRemoteServiceRegister::Entry& entry, const QString& location);
202
void processIncoming(CServiceProviderServerSession* session);
204
virtual QRemoteServiceRegister::SecurityFilter setSecurityFilter(QRemoteServiceRegister::SecurityFilter filter);
207
CServiceProviderServer *m_server;
210
// A helper class that actively listens for serviceprovider messages.
211
// Needed because Symbian server cannot send messages without active request
213
class ServiceMessageListener : public CActive
216
ServiceMessageListener(RServiceSession* aSession, SymbianClientEndPoint* aOwner);
217
~ServiceMessageListener();
220
void StartListening();
221
// from CActive baseclass
226
RServiceSession* iClientSession;
227
SymbianClientEndPoint* iOwnerEndPoint;
228
QByteArray iByteArray;
233
#endif // QREMOTESERVICEREGISTER_S60_P_H