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