|
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 SMFCLIENTSYMBIANSESSION_H_ |
|
17 #define SMFCLIENTSYMBIANSESSION_H_ |
|
18 |
|
19 #include <e32cmn.h> |
|
20 #include <QByteArray> |
|
21 #include <QString> |
|
22 #include <QVariant> |
|
23 #include <QList> |
|
24 #include <smfglobal.h> |
|
25 |
|
26 /** |
|
27 * Corresponds to client session in Symbian |
|
28 */ |
|
29 class RSmfClientSymbianSession : public RSessionBase |
|
30 { |
|
31 public: |
|
32 /** |
|
33 * Constructs |
|
34 */ |
|
35 RSmfClientSymbianSession(); |
|
36 |
|
37 /** |
|
38 * Creates the server process if not already running and creates session |
|
39 * @return Error code while creating server process/ creating session |
|
40 */ |
|
41 TInt connectToServer(); |
|
42 |
|
43 /** |
|
44 * Version |
|
45 */ |
|
46 TVersion Version() const{return TVersion(0,0,1);}; |
|
47 |
|
48 void Close(){}; |
|
49 |
|
50 bool isConnected(); |
|
51 |
|
52 bool connected; |
|
53 |
|
54 /** |
|
55 * Calls SendReceive with requestType opcode and packaged data |
|
56 * depending on requestType |
|
57 */ |
|
58 TInt sendRequest(SmfRequestTypeID requestType); |
|
59 |
|
60 /** |
|
61 * Sends sync request to the Smf server - overloaded |
|
62 */ |
|
63 TPtr8 sendSyncRequest(QByteArray& aSerializedData, |
|
64 QString aInterfaceName, |
|
65 SmfRequestTypeID aRequestType, |
|
66 TInt maxSize); |
|
67 |
|
68 /** |
|
69 * Sends DSM related sync request to the Smf server |
|
70 */ |
|
71 TPtr8 sendDSMSyncRequest(SmfRequestTypeID aRequestType, |
|
72 QByteArray& aSerializedData, |
|
73 SmfError aErr, TInt maxSize = 0 ); |
|
74 |
|
75 /** |
|
76 * Sends synchronous requests to the Smf server |
|
77 */ |
|
78 TPtr8 sendSyncRequest( QString aInterfaceName, |
|
79 SmfRequestTypeID aRequestType, |
|
80 TInt maxSize, QByteArray& aSerializedData ); |
|
81 |
|
82 /** |
|
83 * Sends async request to the Smf server |
|
84 * @param aSerializedData Serialized data to be sent to the server. |
|
85 * Consists of provider Info(SmfProvider*)+ Other common class data |
|
86 * (when applicable)-serialized |
|
87 * @param aInterfaceName Name of the interface |
|
88 * @param aStatus TRequestStatus |
|
89 * @param maxSize Size of the data to be allocated. This info is sent to the server |
|
90 */ |
|
91 void sendAsyncRequest(QByteArray& aSerializedData, |
|
92 QString aInterfaceName, SmfRequestTypeID aRequestType, |
|
93 TRequestStatus& aStatus, TInt aMaxAllocation); |
|
94 |
|
95 /** |
|
96 * Returns data,used to return back the data received from server |
|
97 */ |
|
98 TPtr8 getData() |
|
99 { |
|
100 return iDataPtr8; |
|
101 } |
|
102 |
|
103 TInt getLastRequest() |
|
104 { |
|
105 return iLastRequest; |
|
106 } |
|
107 TPtr8 iDataPtr8; |
|
108 TPtr iDataPtr16; |
|
109 private: |
|
110 /** |
|
111 * Following are to form message body. |
|
112 */ |
|
113 QByteArray iBaseProvider; |
|
114 TBuf8<525> iProviderSymbian; |
|
115 TBuf<125> iInterfaceSymbian; |
|
116 TBuf8<125> iInterfaceSymbian8; |
|
117 QString iInterfaceName; |
|
118 HBufC* iIntfNameBuffer; |
|
119 TPtr iIntfNamePtr; |
|
120 HBufC* iBuffer16; |
|
121 TPtr iPtrToXtraInfo; |
|
122 TPtr iPtrProvider; |
|
123 QByteArray iInterfaceNamebyte; |
|
124 TBuf<100> iDSMErr; |
|
125 HBufC8* iProviderBuf8; |
|
126 TPtr8 iPtrProvider8; |
|
127 HBufC8* iIntfNameBuffer8; |
|
128 TPtr8 iIntfNamePtr8; |
|
129 HBufC8* iBuffer8; |
|
130 HBufC8* iXtraInfoBuf8; |
|
131 TPtr8 iPtrToXtraInfo8; |
|
132 HBufC8* iSlot0Buffer8; |
|
133 TPtr8 iPtr8ToSlot0; |
|
134 TInt iMaxMessageSize; |
|
135 TInt iMaxSize; |
|
136 /** |
|
137 * Last request opcode |
|
138 */ |
|
139 TInt iLastRequest; |
|
140 |
|
141 private: |
|
142 QList<QVariant*> result; |
|
143 |
|
144 }; |
|
145 |
|
146 #endif /* SMFCLIENTSYMBIANSESSION_H_ */ |