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); |
|
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 */ |
|
59 TInt sendRequest(QByteArray& aSerializedData, |
|
60 QString aInterfaceName, |
|
61 SmfRequestTypeID requestType); |
|
62 /** |
|
63 * This overloaded API is for ESmfGetServices, where data should be |
|
64 * fetched synchronously |
|
65 */ |
|
66 QByteArray sendRequest(QString aInterfaceName, |
|
67 SmfRequestTypeID requestType); |
|
68 /** |
|
69 * For testing purpose only |
|
70 */ |
|
71 TInt sendDummyRequest(QByteArray* provider,QString aInterfaceName, |
|
72 SmfRequestTypeID requestType); |
|
73 |
|
74 /** |
|
75 * CancelRequest. |
|
76 * Cancels an outstanding request. |
|
77 */ |
|
78 void CancelRequest() ; |
|
79 |
|
80 |
|
81 |
|
82 protected: // Functions from base classes |
|
83 |
|
84 /** |
|
85 * From CActive, RunL. |
|
86 * Callback function. |
|
87 * Invoked to handle responses from the server. |
|
88 */ |
|
89 void RunL(); |
|
90 |
|
91 /** |
|
92 * From CActive, DoCancel. |
|
93 * Cancels any outstanding operation. |
|
94 */ |
|
95 void DoCancel(); |
|
96 |
|
97 TInt RunError(TInt aError); |
|
98 |
|
99 private: // Constructors and destructors |
|
100 |
|
101 /** |
|
102 * CSmfClientSymbian. |
|
103 * Performs the first phase of two phase construction. |
|
104 */ |
|
105 CSmfClientSymbian(); |
|
106 |
|
107 /** |
|
108 * ConstructL. |
|
109 * Performs the second phase construction of a |
|
110 * CSmfClientSymbian object. |
|
111 */ |
|
112 void ConstructL(); |
|
113 |
|
114 //debugging |
|
115 void writeLog(QString log); |
|
116 |
|
117 private: // Data |
|
118 |
|
119 /** |
|
120 * iSession, the server session. |
|
121 */ |
|
122 RSmfClientSymbianSession iSession; |
|
123 /** |
|
124 * For callback, when the client gets serviced by the server |
|
125 */ |
|
126 smfObserver* iObserver; |
|
127 |
|
128 //Interface name, to be passed to the server |
|
129 TBuf<128> iInterfaceName; |
|
130 QString iInterfaceNameQt; |
|
131 //Data ptr |
|
132 TPtr iDataPtr; |
|
133 |
|
134 //Bytearray |
|
135 QByteArray* iBytearray; |
|
136 HBufC* iBuffer; |
|
137 TInt iMaxMessageSize; |
|
138 |
|
139 /** |
|
140 * Testing |
|
141 */ |
|
142 QStringList dummyList; |
|
143 QByteArray* dummyArray; |
|
144 |
|
145 |
|
146 }; |
|
147 |
|
148 #endif /* SMFCLIENTSYMBIAN_H_ */ |
|