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 |
* Describes the classes that implement the symbian client part of Smf server.
|
|
16 |
* Private client implementation for Symbian.
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
#ifndef SMFCLIENTSYMBIAN_H_
|
|
21 |
#define SMFCLIENTSYMBIAN_H_
|
|
22 |
|
|
23 |
#include <e32base.h>
|
|
24 |
#include <e32cmn.h>
|
|
25 |
#include <QStringList>
|
|
26 |
#include <smfglobal.h>
|
|
27 |
#include <smfobserver.h>
|
|
28 |
#include <smfprovider.h>
|
|
29 |
|
|
30 |
#include "smfclientsymbiansession.h"
|
|
31 |
|
|
32 |
/**
|
|
33 |
* Private client implementation for Symbian.
|
|
34 |
*/
|
|
35 |
class CSmfClientSymbian : public CActive
|
|
36 |
{
|
|
37 |
|
|
38 |
public: // Constructors and destructors
|
|
39 |
/**
|
|
40 |
* Two phase contruction - NewL
|
|
41 |
* @param aObserver For callback
|
|
42 |
*/
|
|
43 |
static CSmfClientSymbian* NewL(smfObserver* aObserver=NULL);
|
|
44 |
|
|
45 |
/**
|
|
46 |
* Two phase contruction - NewLC
|
|
47 |
* @param aObserver For callback
|
|
48 |
*/
|
|
49 |
static CSmfClientSymbian* NewLC(smfObserver* aObserver);
|
|
50 |
|
|
51 |
/**
|
|
52 |
* Destructor.
|
|
53 |
* Destroys the object and release all memory objects.
|
|
54 |
*/
|
|
55 |
virtual ~CSmfClientSymbian();
|
|
56 |
|
|
57 |
public:
|
|
58 |
/**
|
|
59 |
* This overloaded API is for Synchronous calls to plugin APIs
|
|
60 |
* @param aSerializedData serialized by the caller.
|
|
61 |
* @param aInterfaceName Interface name
|
|
62 |
* @param requestType Opcode
|
|
63 |
* @param aMaxAllocation Max data size that is allocated in the client side for
|
|
64 |
* receiving this data
|
|
65 |
* @return QByteArray
|
|
66 |
*/
|
|
67 |
QByteArray sendRequest(QString aInterfaceName, SmfRequestTypeID requestType,
|
|
68 |
TInt aMaxAllocation, QByteArray& aSerializedData);
|
|
69 |
|
|
70 |
/**
|
|
71 |
* This API is for Synchronous calls to server
|
|
72 |
* @param aInterfaceName Interface name
|
|
73 |
* @param requestType Opcode
|
|
74 |
* @param maxSize Max data size that is allocated in the client side for
|
|
75 |
* receiving this data
|
|
76 |
* @param aSerializedData serialized by the caller.
|
|
77 |
* @return QByteArray
|
|
78 |
*/
|
|
79 |
QByteArray sendSyncRequest ( QString aInterfaceName,
|
|
80 |
SmfRequestTypeID requestType, TInt maxSize,
|
|
81 |
QByteArray &aSerializedData );
|
|
82 |
|
|
83 |
/**
|
|
84 |
* For sending request specific to DSM. These are used by SmfRelationMngr API
|
|
85 |
* @param requestType Opcode
|
|
86 |
* @param aSerializedData Data to be passed to DSM through server, interpretation
|
|
87 |
* depends on Relation manager and DSM
|
|
88 |
* @maxSize Size to be allocated in the client side
|
|
89 |
* @return Data received from server, interpretation depends on SmfRelationMngr and DSM
|
|
90 |
*/
|
|
91 |
QByteArray sendDSMSyncRequest ( SmfRequestTypeID requestType,
|
|
92 |
QByteArray& aSerializedData, SmfError& aErr, TInt maxSize = 10 );
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Calls SendReceive (Asynchronous) of the RSessionBase object.
|
|
96 |
* @param aSerializedData serialized by the caller.
|
|
97 |
* @param aInterfaceName Interface name
|
|
98 |
* @param requestType Opcode
|
|
99 |
* @param aMaxAllocation Max data size that is allocated in the
|
|
100 |
* client side for receiving this data
|
|
101 |
* @param xtraInfo XtraInfo when required by server other than smfProvider
|
|
102 |
*/
|
|
103 |
TInt sendRequest( QByteArray& aSerializedData, QString aInterfaceName,
|
|
104 |
SmfRequestTypeID requestType, TInt aMaxAllocation );
|
|
105 |
|
|
106 |
/**
|
|
107 |
* CancelRequest.
|
|
108 |
* Cancels an outstanding request.
|
|
109 |
*/
|
|
110 |
void CancelRequest() ;
|
|
111 |
|
|
112 |
protected: // Functions from the base class CActive
|
|
113 |
/**
|
|
114 |
* From CActive, RunL.
|
|
115 |
* Callback function.
|
|
116 |
* Invoked to handle responses from the server.
|
|
117 |
*/
|
|
118 |
void RunL();
|
|
119 |
|
|
120 |
/**
|
|
121 |
* From CActive, DoCancel.
|
|
122 |
* Cancels any outstanding operation.
|
|
123 |
*/
|
|
124 |
void DoCancel();
|
|
125 |
|
|
126 |
/**
|
|
127 |
* From CActive, RunError.
|
|
128 |
*/
|
|
129 |
TInt RunError(TInt aError);
|
|
130 |
|
|
131 |
private: // Constructors
|
|
132 |
/**
|
|
133 |
* CSmfClientSymbian.
|
|
134 |
* Performs the first phase of two phase construction.
|
|
135 |
*/
|
|
136 |
CSmfClientSymbian(smfObserver* aObserver);
|
|
137 |
|
|
138 |
/**
|
|
139 |
* ConstructL.
|
|
140 |
* Performs the second phase construction of a
|
|
141 |
* CSmfClientSymbian object.
|
|
142 |
*/
|
|
143 |
void ConstructL();
|
|
144 |
|
|
145 |
private: // Data
|
|
146 |
/**
|
|
147 |
* iSession, the server session.
|
|
148 |
*/
|
|
149 |
RSmfClientSymbianSession iSession;
|
|
150 |
|
|
151 |
/**
|
|
152 |
* For callback, when the client gets serviced by the server
|
|
153 |
*/
|
|
154 |
smfObserver* iObserver;
|
|
155 |
|
|
156 |
//Interface name, to be passed to the server
|
|
157 |
TBuf<128> iInterfaceName;
|
|
158 |
QString iInterfaceNameQt;
|
|
159 |
//Data ptr
|
|
160 |
TPtr iDataPtr;
|
|
161 |
//Bytearray
|
|
162 |
QByteArray* iBytearray;
|
|
163 |
HBufC* iBuffer;
|
|
164 |
TInt iMaxMessageSize;
|
|
165 |
|
|
166 |
};
|
|
167 |
|
|
168 |
#endif /* SMFCLIENTSYMBIAN_H_ */
|