|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "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 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: PC Connectivity server |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __SCONPCCONNSERVER_H__ |
|
20 #define __SCONPCCONNSERVER_H__ |
|
21 |
|
22 #include "sconconmlhandler.h" |
|
23 #include "sconconmltask.h" |
|
24 |
|
25 |
|
26 class CSConPCD; |
|
27 class CSConCSC; |
|
28 class CSConConMLParser; |
|
29 |
|
30 const TUint KSConDefaultHeapSize=0x10000; |
|
31 const TInt KSConFirstDrive = 65; |
|
32 |
|
33 _LIT8 ( KParamNameSilent, "Silent" ); |
|
34 |
|
35 |
|
36 // PCD Handler Dll |
|
37 _LIT(KSConPCDLibName, "sconpcd.dll"); |
|
38 const TInt KSConPCDUidValue = 0x10009D8D; |
|
39 const TUid KSConPCDUid = {KSConPCDUidValue}; |
|
40 |
|
41 // CSC Handler Dll |
|
42 _LIT(KSConCSCLibName, "sconcsc.dll"); |
|
43 const TInt KSConCSCUidValue = 0x10009D8D; |
|
44 const TUid KSConCSCUid = {KSConCSCUidValue}; |
|
45 |
|
46 // ConML Handler Dll |
|
47 _LIT (KSConConMLHandlerLibName, "sconconmlhandler.dll"); |
|
48 const TInt KSConConMLHandlerUidValue = 0x10009D8D; |
|
49 const TUid KSConConMLHandlerUid = {KSConConMLHandlerUidValue}; |
|
50 |
|
51 // debug file for put and get messages |
|
52 _LIT ( KSConConMLDebugFile, "c:\\data\\handler_result.txt"); |
|
53 |
|
54 // Secure ids |
|
55 _LIT_SECURE_ID(KSConPCConnClientSecureId,0x101F7C87); |
|
56 |
|
57 // PCD types |
|
58 _LIT8( KSConPCDXMLObjectType, "application/vnd.nokia.conml+xml" ); |
|
59 _LIT8( KSConPCDXMLObjectType2, "application/vnd.nokia.pcd+xml" ); |
|
60 _LIT8( KSConPCDWBXMLObjectType, "application/vnd.nokia.conml+wbxml" ); |
|
61 _LIT8( KSConPCDWBXMLObjectType2, "application/vnd.nokia.pcd+wbxml" ); |
|
62 |
|
63 // CSC types |
|
64 _LIT8( KSConCapabilityObjectType, "x-obex/capability" ); |
|
65 |
|
66 // Drives |
|
67 _LIT( KSConNoDrive, "\x0" ); |
|
68 _LIT( KSConDriveExists, "\x1" ); |
|
69 |
|
70 // user permissions |
|
71 _LIT8( KSConPermReadOnly, "R" ); |
|
72 _LIT8( KSConPermNormal, "RW" ); |
|
73 // Java hash id for ConML |
|
74 _LIT8( KSConJavaHashId, "JAVA_"); |
|
75 |
|
76 _LIT8( KSConAppInfoSeparator, "#" ); |
|
77 |
|
78 //********************************** |
|
79 //CSConPCConnServer - PC Connectivity Server |
|
80 //********************************** |
|
81 |
|
82 class CSConPCConnServer : public CServer2 |
|
83 { |
|
84 public: |
|
85 // From CServer2 |
|
86 IMPORT_C static CSConPCConnServer* NewLC(); |
|
87 IMPORT_C ~CSConPCConnServer(); |
|
88 |
|
89 /** |
|
90 * Function to start the server |
|
91 * @param none |
|
92 * @return Error code |
|
93 */ |
|
94 static TInt RunServer(); |
|
95 |
|
96 /** |
|
97 * Function to start the server |
|
98 * @param none |
|
99 * @return none |
|
100 */ |
|
101 static void RunServerL(); |
|
102 |
|
103 /** |
|
104 * Increments session count. |
|
105 * @param none |
|
106 * @return none |
|
107 */ |
|
108 void IncSessionCount(); |
|
109 |
|
110 /** |
|
111 * Decrements session count. |
|
112 * When count reaches zero, stops active scheduler |
|
113 * @param none |
|
114 * @return none |
|
115 */ |
|
116 void DecSessionCount(); |
|
117 |
|
118 |
|
119 protected: |
|
120 virtual CSession2* NewSessionL( const TVersion &aVersion, |
|
121 const RMessage2& aMessage) const; |
|
122 |
|
123 private: |
|
124 CSConPCConnServer(); |
|
125 |
|
126 TInt iSessionCount; |
|
127 |
|
128 }; |
|
129 |
|
130 |
|
131 class CSconFolderLister; |
|
132 class CSconBtEngine; |
|
133 |
|
134 //********************************** |
|
135 //CSConPCConnSession - Server session class, handles the requested operations |
|
136 //********************************** |
|
137 class CSConPCConnSession : public CSession2, public MWBXMLConMLCallback |
|
138 { |
|
139 |
|
140 public: |
|
141 static CSConPCConnSession* NewL(CSConPCConnServer& aServer); |
|
142 |
|
143 /** |
|
144 * From CSession2 |
|
145 */ |
|
146 void ServiceL( const RMessage2 &aMessage); |
|
147 |
|
148 private: |
|
149 void DispatchRequestL( const RMessage2 &aMessage); |
|
150 void LoadPCDDllL(); |
|
151 void LoadCSCDllL(); |
|
152 void LoadConMLHandlerDllL(); |
|
153 |
|
154 protected: |
|
155 // Callback funktion for WBXML parsing |
|
156 void ConMLL ( ConML_ConMLPtr_t aContent ); |
|
157 |
|
158 private: |
|
159 void ConstructL(); |
|
160 CSConPCConnSession ( CSConPCConnServer& aServer); |
|
161 ~CSConPCConnSession(); |
|
162 |
|
163 TInt HandlePutMessageL(); |
|
164 TInt HandleGetMessageL(); |
|
165 TInt HandleWBXMLGetRequestL( const TDesC& aFileName ); |
|
166 TInt HandleResetMessage(); |
|
167 TInt HandleChunkMessage( const RMessage2& aMessage ); |
|
168 TInt OptionsFromExecuteL ( ConML_ExecutePtr_t aContent ); |
|
169 TInt TaskCancelL(ConML_CancelPtr_t aContent); |
|
170 TInt TaskGetStatusL(ConML_GetStatusPtr_t aContent ); |
|
171 TInt TaskInstallL( ConML_InstallPtr_t aContent ); |
|
172 TInt TaskUnInstallL( ConML_UnInstallPtr_t aContent ); |
|
173 void SplitL( const TDesC8& aText, const TChar aSeparator, RArray<TPtrC8>& aArray ); |
|
174 TInt TaskListInstalledAppsL( ConML_ListInstalledAppsPtr_t aContent ); |
|
175 TInt TaskListDataOwnersL(); |
|
176 TInt TaskSetBURModeL( ConML_SetBURModePtr_t aContent ); |
|
177 TInt TaskGetDataSizeL( ConML_GetDataSizePtr_t aContent ); |
|
178 TInt TaskRequestDataL( ConML_RequestDataPtr_t aContent ); |
|
179 TInt TaskUpdateDeviceInfoL( ConML_UpdateDeviceInfoPtr_t aContent ); |
|
180 TInt TaskListPublicFilesL( ConML_ListPublicFilesPtr_t aContent ); |
|
181 TInt TaskGetDataOwnerStatusL( ConML_GetDataOwnerStatusPtr_t aContent ); |
|
182 TInt TaskSupplyDataL ( ConML_SupplyDataPtr_t aContent ); |
|
183 TInt TaskRebootL(); |
|
184 TInt TaskGetMetadataL( ConML_GetMetadataPtr_t aContent ); |
|
185 void AppendStatusL( ConML_ConMLPtr_t aContent, CSConStatusReply* reply ); |
|
186 void AppendUpdateDeviceInfoResultsL( ConML_ResultsPtr_t aContent, |
|
187 CSConUpdateDeviceInfo* aResult ); |
|
188 void AppendSetBURModeResultsL ( ConML_ResultsPtr_t aContent, |
|
189 CSConSetBURMode* aResult ); |
|
190 void AppendListInstalledAppsResultsL ( ConML_ResultsPtr_t aContent, |
|
191 CSConListInstApps* aResult ); |
|
192 void AppendListPublicFilesResultsL ( ConML_ResultsPtr_t aContent, |
|
193 CSConListPublicFiles* aResult ); |
|
194 void AppendRequestDataResultsL( ConML_ResultsPtr_t aContent, |
|
195 CSConRequestData* aResult ); |
|
196 void AppendSupplyDataResultsL( ConML_ResultsPtr_t aContent, |
|
197 CSConSupplyData* aResult ); |
|
198 void AppendInstallResultsL( ConML_ResultsPtr_t aContent, |
|
199 CSConInstall* aResult ); |
|
200 void AppendUninstallResultsL( ConML_ResultsPtr_t aContent, |
|
201 CSConUninstall* aResult ); |
|
202 void AppendListDataOwnersResultsL ( ConML_ResultsPtr_t aContent, |
|
203 CSConListDataOwners* aResult ); |
|
204 void AppendGetDataOwnerStatusResultsL ( ConML_ResultsPtr_t aContent, |
|
205 CSConGetDataOwnerStatus* aResult ); |
|
206 void AppendGetDataSizeResultsL ( ConML_ResultsPtr_t aContent, |
|
207 CSConGetDataSize* aResult ); |
|
208 void AppendGetMetadataResultsL ( ConML_ResultsPtr_t aContent, |
|
209 CSConGetMetadata* aResult ); |
|
210 void AppendProgressL ( ConML_ResultsPtr_t aContent, TInt progress ); |
|
211 void AppendDrivesL( ConML_DrivesPtr_t aContent, TDriveList aDrives ); |
|
212 TDriveList DriveList( ConML_DriveListPtr_t aContent ); |
|
213 TDesC8& IntToDesLC( const TInt& anInt); |
|
214 TDesC8& DriveNumToDesLC( const TInt& anInt ); |
|
215 TDesC8& BufToDesLC( const TDesC& aBuf ); |
|
216 TDesC8& UidToDesLC( const TUid& aUid ); |
|
217 TUid DesToUid ( const TDesC8& aDes ); |
|
218 TInt DesToInt( const TDesC8& aDes); |
|
219 TBool HasDrives( TDriveList& aDrive ); |
|
220 TDesC8& HashToDesLC( const TDesC& aBuf ); |
|
221 TPtr DesToHashLC( const TDesC8& aDes ); |
|
222 TBool IsJavaHash( const TDesC8& aDes ); |
|
223 |
|
224 TInt ReadOviAccountInfoL( RWriteStream& aAccountInfoStream ); |
|
225 |
|
226 // data |
|
227 private: |
|
228 CSConPCConnServer& iServer; |
|
229 |
|
230 RLibrary iPCDlib; |
|
231 RLibrary iCSClib; |
|
232 RLibrary iConMLHandlerLib; |
|
233 |
|
234 CSConPCD* iPCDHandler; |
|
235 CSConCSC* iCSCHandler; |
|
236 CSConConMLHandler* iConMLHandler; |
|
237 |
|
238 RChunk iChunk; |
|
239 CBufFlat* iBuffer; |
|
240 TInt iResult; |
|
241 |
|
242 CSconFolderLister* iFolderLister; |
|
243 RFs iFs; |
|
244 CSconBtEngine* iBtEngine; |
|
245 }; |
|
246 |
|
247 #endif // __SCONPCCONNSERVER_H__ |