|
1 /** |
|
2 * Copyright (c) 2010 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <e32math.h> |
|
21 #include "tmservertest.h" |
|
22 #include <ecom/ecom.h> |
|
23 #include "testtimer.h" |
|
24 #include "discoverytesttimer.h" |
|
25 #include <upnpdevice.h> |
|
26 #include <upnptmserverdeviceinfo.h> |
|
27 #include <upnpsettings.h> |
|
28 |
|
29 // LOCAL CONSTANTS AND MACROS |
|
30 _LIT8(KTestSvgMimeType, "image/svg+xml"); |
|
31 _LIT8(KTmServerDevice, "urn:schemas-upnp-org:device:TmServerDevice:1" ); |
|
32 _LIT8(KTmServerService, "urn:schemas-upnp-org:service:TmApplicationServer:1" ); |
|
33 _LIT8(KTmServerServiceType, "TmApplicationServer:1" ); |
|
34 _LIT8(KTmServerServiceType1, "TmClientProfile:1" ); |
|
35 _LIT8(KBtMacValue, "00257df016d5"); |
|
36 _LIT8(KArgTypeAppStatusUpdate, "AppStatusUpdate"); |
|
37 _LIT8(KGetAppStatus, "GetApplicationStatus"); |
|
38 _LIT8(KAppStatus, "AppStatus"); |
|
39 _LIT8(KGetApplicationList, "GetApplicationList"); |
|
40 _LIT8(KAppListing, "AppListing"); |
|
41 _LIT8(KLaunchApp, "LaunchApplication"); |
|
42 _LIT8(KTerminateApp, "TerminateApplication"); |
|
43 _LIT8(KAppLaunchStatus, "AppURI"); |
|
44 _LIT8(KAppTerminateStatus, "TerminationResult"); |
|
45 _LIT8(KAppId , "AppID"); |
|
46 _LIT8(KAppFilter, "AppListingFilter"); |
|
47 _LIT8(KResultProfile , "resultProfile"); |
|
48 _LIT8(KSetClientProfile , "SetClientProfile"); |
|
49 _LIT8(KGetClientProfile, "GetClientProfile"); |
|
50 _LIT8(KGetMaxNumProfiles, "GetMaxNumProfiles"); |
|
51 _LIT8(KClientProfile , "clientProfile"); |
|
52 _LIT8(KNumProfilesAllowed , "numProfilesAllowed"); |
|
53 _LIT8(KProfileId, "ProfileID"); |
|
54 _LIT8(KProfileId1, "profileID"); |
|
55 _LIT8(KBackground, "Background"); |
|
56 _LIT8(KForeground, "Foreground"); |
|
57 _LIT8(KAppListFilterValue1, "\"icon@mimetype=\"*svg+xml*\",icon@width=\"*\",icon@height=\"*\",icon@depth=\"*\"\""); |
|
58 _LIT8(KAppListFilterValue2, "\"name=\"*nav*\",description=\"*\",appInfo@appCategory=\"*\",displayInfo@contentCategory=\"*\",allowedProfileIDs=\"*\"\""); |
|
59 _LIT8(KAppListFilterValue3, "\"name=\"*bluetooth*\",description=\"*\",icon@mimetype=\"*svg+xml*\",remotingInfo@protocolID=\"*\",appInfo@appCategory=\"*\",audioInfo@audioType=\"*\",resourceStatus=\"free\",signature=\"*\"\""); |
|
60 _LIT8(KAppListFilterValue4, "\"name=\"*\",description=\"*Audio*\",icon@mimetype=\"*svg+xml*\",remotingInfo@protocolID=\"*\",appInfo@appCategory=\"*\",audioInfo@audioType=\"*\",resourceStatus=\"free\",signature=\"*\"\""); |
|
61 _LIT8(KWildCard, "*"); |
|
62 _LIT(KIconPathMusicUnLaunched, "c:\\upnptmserver\\icons\\music_unlaunched.svg"); |
|
63 _LIT(KIconPathMusicLaunched, "c:\\upnptmserver\\icons\\music_launched.svg"); |
|
64 _LIT(KIconPathMaps, "c:\\upnptmserver\\icons\\maps.svg"); |
|
65 _LIT(KIconPathBtA2DpUnLaunched, "c:\\upnptmserver\\icons\\gallery.svg"); |
|
66 _LIT(KIconPathBtA2DpLaunched, "c:\\upnptmserver\\icons\\homemedia.svg"); |
|
67 _LIT(KIconPathBtHfp, "c:\\upnptmserver\\icons\\videos.svg"); |
|
68 _LIT(KIconDevicePath, "c:\\upnptmserver\\icons\\s60_device.svg"); |
|
69 _LIT8(KDeviceInfo, "<X_Nokia_deviceInfo><version><major>1</major><minor>0</minor></version><mtp_tc>true</mtp_tc>" |
|
70 "<license_model>pre,post</license_model><sound_feedback><enabled>true</enabled></sound_feedback><ipRouting><enabled>false</enabled></ipRouting>" |
|
71 "</X_Nokia_deviceInfo>"); |
|
72 |
|
73 _LIT8(KClientProfileInfo, "<clientProfile><clientID>Cl_1</clientID><friendlyName>Client One</friendlyName><manufacturer>man_2</manufacturer><modelName>CL_Model2</modelName><modelNumber>2009</modelNumber><iconPreference><width>240</width><height>240</height></iconPreference><contentRules><rule><ruleId>0</ruleId><ruleValue>0.1</ruleValue></rule><rule><ruleId>1</ruleId></rule></contentRules></clientProfile>"); |
|
74 |
|
75 _LIT8(KDeviceLockedClientProfile, "<clientProfile><clientID>Cl_2</clientID></clientProfile>"); |
|
76 |
|
77 _LIT8(KXmlSignature, "<Signature Id= "AppListSignature" xmlns="http://www.w3.org/2000/09/xmldsig#"> <SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2006/12/xml-c14n11"/><SignatureMethodAlgorithm="http://www.w3.org/2000/09/xmldsig#dsa-sha1"/> <Reference URI=""></Reference></SignedInfo></Signature>"); |
|
78 |
|
79 // ============================ MEMBER FUNCTIONS =============================== |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // CTmServerTest::Case |
|
83 // Returns a test case by number. |
|
84 // |
|
85 // This function contains an array of all available test cases |
|
86 // i.e pair of case name and test function. If case specified by parameter |
|
87 // aCaseNumber is found from array, then that item is returned. |
|
88 // |
|
89 // The reason for this rather complicated function is to specify all the |
|
90 // test cases only in one place. It is not necessary to understand how |
|
91 // function pointers to class member functions works when adding new test |
|
92 // cases. See function body for instructions how to add new test case. |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 const TCaseInfo CTmServerTest::Case ( |
|
96 const TInt aCaseNumber ) const |
|
97 { |
|
98 |
|
99 /** |
|
100 * To add new test cases, implement new test case function and add new |
|
101 * line to KCases array specify the name of the case and the function |
|
102 * doing the test case |
|
103 * In practice, do following |
|
104 * 1) Make copy of existing test case function and change its name |
|
105 * and functionality. Note that the function must be added to |
|
106 * TmServerTest.cpp file and to TmServerTest.h |
|
107 * header file. |
|
108 * |
|
109 * 2) Add entry to following KCases array either by using: |
|
110 * |
|
111 * 2.1: FUNCENTRY or ENTRY macro |
|
112 * ENTRY macro takes two parameters: test case name and test case |
|
113 * function name. |
|
114 * |
|
115 * FUNCENTRY macro takes only test case function name as a parameter and |
|
116 * uses that as a test case name and test case function name. |
|
117 * |
|
118 * Or |
|
119 * |
|
120 * 2.2: OOM_FUNCENTRY or OOM_ENTRY macro. Note that these macros are used |
|
121 * only with OOM (Out-Of-Memory) testing! |
|
122 * |
|
123 * OOM_ENTRY macro takes five parameters: test case name, test case |
|
124 * function name, TBool which specifies is method supposed to be run using |
|
125 * OOM conditions, TInt value for first heap memory allocation failure and |
|
126 * TInt value for last heap memory allocation failure. |
|
127 * |
|
128 * OOM_FUNCENTRY macro takes test case function name as a parameter and uses |
|
129 * that as a test case name, TBool which specifies is method supposed to be |
|
130 * run using OOM conditions, TInt value for first heap memory allocation |
|
131 * failure and TInt value for last heap memory allocation failure. |
|
132 */ |
|
133 |
|
134 static TCaseInfoInternal const KCases[] = |
|
135 { |
|
136 // [test cases entries] - do not remove |
|
137 |
|
138 ENTRY( "Start TM Server Device", CTmServerTest::StartTmServerDeviceL ), |
|
139 ENTRY( "Publish TM Server Service", CTmServerTest::PublishTmServerServiceL ), |
|
140 ENTRY( "Stop TM Server Device", CTmServerTest::StopTmServerDeviceL ), |
|
141 ENTRY( "ReStart TM Server Device", CTmServerTest::ReStartTmServerDeviceL ), |
|
142 ENTRY( "Handle LaunchApp Command", CTmServerTest::HandleLaunchAppActionL ), |
|
143 ENTRY( "Handle Invalid AppId LaunchApp Command", CTmServerTest::HandleInvalidAppIdLaunchAppActionL ), |
|
144 ENTRY( "Handle Invalid ProfileId LaunchApp Command", CTmServerTest::HandleInvalidProfileIdLaunchAppActionL ), |
|
145 ENTRY( "Handle LaunchApp Command For Non-Existent AppID", CTmServerTest::HandleNonExistentLaunchAppActionL ), |
|
146 ENTRY( "Handle LaunchApp Command For UnAuthorized AppID", CTmServerTest::HandleUnauthorizedLaunchAppActionL ), |
|
147 ENTRY( "Handle Device Locked Condition For LaunchApp Command", CTmServerTest::HandleDeviceLockedLaunchAppActionL ), |
|
148 ENTRY( "Handle TerminateApp Command", CTmServerTest::HandleTerminateAppActionL), |
|
149 ENTRY( "Handle TerminateApp Command For Non-Existent AppID", CTmServerTest::HandleNonExistentTerminateAppActionL), |
|
150 ENTRY( "Handle Invalid AppId TerminateApp Command", CTmServerTest::HandleInvalidAppIdTerminateAppActionL), |
|
151 ENTRY( "Handle Invalid ProfileId TerminateApp Command", CTmServerTest::HandleInvalidProfileIdTerminateAppActionL), |
|
152 ENTRY( "Handle TerminateApp Command For UnAuthorized AppID", CTmServerTest::HandleUnauthorizedTerminateAppActionL), |
|
153 ENTRY( "Handle Device Locked Condition For TerminateApp Command", CTmServerTest::HandleDeviceLockedTerminateAppActionL ), |
|
154 ENTRY( "Handle GetAppStatus Command ", CTmServerTest::HandleGetAppStatusActionL ), |
|
155 ENTRY( "Handle GetAppStatus Command For All the Applications", CTmServerTest::HandleWildcardGetAppStatusActionL ), |
|
156 ENTRY( "Handle GetAppStatus Command For Invalid AppId", CTmServerTest::HandleInvalidAppIdGetAppStatusActionL ), |
|
157 ENTRY( "Handle GetAppStatus Command For Non-Existent AppID", CTmServerTest::HandleNonExistentGetAppStatusActionL ), |
|
158 ENTRY( "Handle GetAppList Command with Filter1", CTmServerTest:: HandleGetAppListActionFilter1L ), |
|
159 ENTRY( "Handle GetAppList Command with Filter2", CTmServerTest:: HandleGetAppListActionFilter2L ), |
|
160 ENTRY( "Handle GetAppList Command with Filter3", CTmServerTest:: HandleGetAppListActionFilter3L ), |
|
161 ENTRY( "Handle GetAppList Command with Filter4", CTmServerTest:: HandleGetAppListActionFilter4L ), |
|
162 ENTRY( "Handle GetAppList Command with No Filter", CTmServerTest:: HandleGetAppListActionNoFilterL ), |
|
163 ENTRY( "Handle GetAppList Command with Invalid Arg1", CTmServerTest:: HandleGetAppListActionInvalidArg1L ), |
|
164 ENTRY( "Handle GetAppList Command with Invalid Arg2", CTmServerTest:: HandleGetAppListActionInvalidArg2L ), |
|
165 ENTRY( "Handle GetAppList Command with Invalid Arg3", CTmServerTest:: HandleGetAppListActionInvalidArg3L ), |
|
166 ENTRY( "Handle GetAppList Command with Invalid Arg4", CTmServerTest:: HandleGetAppListActionInvalidArg4L ), |
|
167 ENTRY( "Handle GetAppList Command with Invalid Arg5", CTmServerTest:: HandleGetAppListActionInvalidArg5L ), |
|
168 ENTRY( "Handle Invalid ProfileId GetAppList Command", CTmServerTest:: HandleInvalidProfileIdGetAppListActionL), |
|
169 ENTRY( "Handle Operation Rejected Condition For GetAppList Command", CTmServerTest:: HandleGetAppListActionOperationRejectedL), |
|
170 ENTRY( "Handle SetClientProfile Command", CTmServerTest:: HandleSetClientProfileActionL ), |
|
171 ENTRY( "Handle Invalid ProfileId SetClientProfile Command", CTmServerTest:: HandleInvalidProfileIdSetClientProfileActionL ), |
|
172 ENTRY( "Handle Invalid Profile SetClientProfile Command", CTmServerTest:: HandleInvalidProfileSetClientProfileActionL ), |
|
173 ENTRY( "Handle Device Locked Condition For SetClientProfile Command", CTmServerTest:: HandleDeviceLockedSetClientProfileActionL ), |
|
174 ENTRY( "Handle Resource Busy Condition For SetClientProfile Command", CTmServerTest:: HandleResourceBusySetClientProfileActionL ), |
|
175 ENTRY( "Handle GetClientProfile Command", CTmServerTest:: HandleGetClientProfileActionL ), |
|
176 ENTRY( "Handle Invalid ProfileId GetClientProfile Command", CTmServerTest:: HandleInvalidProfileIdGetClientProfileActionL ), |
|
177 ENTRY( "Handle GetMaxNumProfiles Command", CTmServerTest:: HandleGetMaxNumProfilesActionL ), |
|
178 ENTRY( "Handle Operation Rejected Condition For GetMaxNumProfiles Command", CTmServerTest:: HandleGetMaxNumProfilesOperationRejectedL ), |
|
179 ENTRY( "Register Duplicate Application", CTmServerTest::RegisterDuplicateAppL), |
|
180 ENTRY( "Register Duplicate Applications", CTmServerTest::RegisterDuplicateAppsL), |
|
181 ENTRY( "UnRegister Application", CTmServerTest::UnRegisterAppL), |
|
182 ENTRY( "UnRegister Multiple Applications", CTmServerTest::UnRegisterAppsL), |
|
183 ENTRY( "UnRegister UnRegistered Application", CTmServerTest::UnRegisterUnRegisteredAppL), |
|
184 ENTRY( "UnRegister Multiple UnRegistered Applications", CTmServerTest::UnRegisterUnRegisteredAppsL), |
|
185 ENTRY( "Handle Event For AppStatus Update", CTmServerTest::HandleEventAppStatusUpdateL ), |
|
186 ENTRY( "Handle Event For AppList Update", CTmServerTest::HandleEventAppListUpdateL ), |
|
187 ENTRY( "Handle Event For Duplicate AppStatus Update", CTmServerTest::HandleEventDuplicateAppStatusUpdateL), |
|
188 ENTRY( "Handle Event For ProfileIdList Status Update", CTmServerTest::HandleEventProfileIdListStatusUpdateL), |
|
189 |
|
190 // OOM Testcases |
|
191 OOM_ENTRY( "[OOM_StartTmServerDevice]", CTmServerTest::StartTmServerDeviceL,ETrue,1,5 ), |
|
192 OOM_ENTRY( "[OOM_HandleGetAppListWithFilter]", CTmServerTest:: HandleGetAppListActionFilter1L,ETrue,1,5 ), |
|
193 OOM_ENTRY( "[OOM_HandleGetAppListWithoutFilter]", CTmServerTest:: HandleGetAppListActionNoFilterL,ETrue,1,5 ), |
|
194 OOM_ENTRY( "[OOM_HandleSetClientProfileCommand]", CTmServerTest:: HandleSetClientProfileActionL,ETrue,1,5 ), |
|
195 OOM_ENTRY( "[OOM_HandleGetAppStatusCommand]", CTmServerTest:: HandleGetAppStatusActionL,ETrue,1,5 ), |
|
196 OOM_ENTRY( "[OOM_HandleGetAppStatusForAllApplications]", CTmServerTest::HandleWildcardGetAppStatusActionL,ETrue,1,5 ), |
|
197 OOM_ENTRY( "[OOM_HandleAppStatusUpdateEvent]", CTmServerTest::HandleEventAppStatusUpdateL,ETrue,1,5 ), |
|
198 OOM_ENTRY( "[OOM_HandleDuplicateAppStatusUpdateEvent]", CTmServerTest::HandleEventDuplicateAppStatusUpdateL,ETrue,1,5 ), |
|
199 OOM_ENTRY( "[OOM_UnRegisterApplications]", CTmServerTest::UnRegisterAppsL,ETrue,1,5 ) |
|
200 }; |
|
201 |
|
202 // Verify that case number is valid |
|
203 if( (TUint) aCaseNumber >= sizeof( KCases ) / |
|
204 sizeof( TCaseInfoInternal ) ) |
|
205 { |
|
206 // Invalid case, construct empty object |
|
207 TCaseInfo null( (const TText*) L"" ); |
|
208 null.iMethod = NULL; |
|
209 null.iIsOOMTest = EFalse; |
|
210 null.iFirstMemoryAllocation = 0; |
|
211 null.iLastMemoryAllocation = 0; |
|
212 return null; |
|
213 } |
|
214 |
|
215 // Construct TCaseInfo object and return it |
|
216 TCaseInfo tmp ( KCases[ aCaseNumber ].iCaseName ); |
|
217 tmp.iMethod = KCases[ aCaseNumber ].iMethod; |
|
218 tmp.iIsOOMTest = KCases[ aCaseNumber ].iIsOOMTest; |
|
219 tmp.iFirstMemoryAllocation = KCases[ aCaseNumber ].iFirstMemoryAllocation; |
|
220 tmp.iLastMemoryAllocation = KCases[ aCaseNumber ].iLastMemoryAllocation; |
|
221 return tmp; |
|
222 } |
|
223 |
|
224 |
|
225 //========================= TEST CASES ======================================================= |
|
226 |
|
227 TInt CTmServerTest::StartTmServerDeviceL ( TTestResult& aResult ) |
|
228 { |
|
229 _LIT( KLogInfo, "Start Terminalmode Server Device" ); |
|
230 iLog->Log( KLogInfo ); |
|
231 |
|
232 iTmServerDeviceType = ETrue; |
|
233 |
|
234 //Sets the information associated with the terminal mode server device |
|
235 SetTmServerSettingsL(); |
|
236 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo,*this ); |
|
237 |
|
238 //Register all the desired applications |
|
239 RegisterApplicationsL(*iTmServer); |
|
240 |
|
241 // Start the tmserver device and its services |
|
242 iTmServer->StartL(); |
|
243 |
|
244 //Start the control point and search for device |
|
245 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
246 iTestTimer = CTestTimer::NewL(*this); |
|
247 iTestTimer->After(15); |
|
248 CActiveScheduler::Start(); |
|
249 |
|
250 if ( iDeviceVerified) |
|
251 { |
|
252 _LIT( KDescription , "Terminalmode Server Device started successfully"); |
|
253 aResult.SetResult( KErrNone, KDescription ); |
|
254 iLog->Log( KDescription ); |
|
255 } |
|
256 else |
|
257 { |
|
258 aResult.iResult = KErrGeneral; |
|
259 _LIT( KDescription , "Start of Terminalmode Server Device Failed"); |
|
260 aResult.SetResult( KErrNone, KDescription ); |
|
261 iLog->Log( KDescription ); |
|
262 } |
|
263 |
|
264 delete iTestTimer; |
|
265 iTestTimer = NULL; |
|
266 REComSession::FinalClose(); |
|
267 return KErrNone; |
|
268 } |
|
269 |
|
270 TInt CTmServerTest::PublishTmServerServiceL ( TTestResult& aResult ) |
|
271 { |
|
272 _LIT( KLogInfo, "Publish Terminalmode server Service" ); |
|
273 iLog->Log( KLogInfo ); |
|
274 |
|
275 iTmServerServiceType = ETrue; |
|
276 //Sets the information associated with the terminal mode server device |
|
277 SetTmServerSettingsL(); |
|
278 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo,*this ); |
|
279 |
|
280 //Register all the desired applications |
|
281 RegisterApplicationsL(*iTmServer); |
|
282 |
|
283 //Start the tmserver device and its services |
|
284 iTmServer->StartL(); |
|
285 |
|
286 //Start the control point and search for device |
|
287 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
288 iTestTimer = CTestTimer::NewL(*this); |
|
289 iTestTimer->After(15); |
|
290 CActiveScheduler::Start(); |
|
291 |
|
292 if ( iServiceVerified) |
|
293 { |
|
294 _LIT( KDescription , "Terminalmode server Service published successfully"); |
|
295 aResult.SetResult( KErrNone, KDescription ); |
|
296 iLog->Log( KDescription ); |
|
297 } |
|
298 else |
|
299 { |
|
300 aResult.iResult = KErrGeneral; |
|
301 _LIT( KDescription , "Publishing of Terminalmode server Service Failed"); |
|
302 aResult.SetResult( KErrNone, KDescription ); |
|
303 iLog->Log( KDescription ); |
|
304 } |
|
305 delete iTestTimer; |
|
306 iTestTimer = NULL; |
|
307 REComSession::FinalClose(); |
|
308 return KErrNone; |
|
309 } |
|
310 |
|
311 TInt CTmServerTest::StopTmServerDeviceL ( TTestResult& aResult ) |
|
312 { |
|
313 _LIT( KLogInfo, "Stop Terminalmode server Device" ); |
|
314 iLog->Log( KLogInfo ); |
|
315 |
|
316 iTmServerDeviceType = ETrue; |
|
317 //Sets the information associated with the terminal mode server device |
|
318 SetTmServerSettingsL(); |
|
319 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo,*this ); |
|
320 |
|
321 //Register all the desired applications |
|
322 RegisterApplicationsL(*iTmServer); |
|
323 |
|
324 //Start the tmserver device and its services |
|
325 iTmServer->StartL(); |
|
326 |
|
327 //Start the control point and search for device |
|
328 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
329 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
330 iDiscoveryTestTimer->AfterDiscovery(15); |
|
331 CActiveScheduler::Start(); |
|
332 |
|
333 if ( iDeviceVerified ) |
|
334 { |
|
335 //Stop the tmserver device and its services |
|
336 iTmServer->StopL(); |
|
337 } |
|
338 |
|
339 iTestTimer = CTestTimer::NewL(*this); |
|
340 iTestTimer->After(15); |
|
341 CActiveScheduler::Start(); |
|
342 |
|
343 if ( iDeviceLostVerified ) |
|
344 { |
|
345 _LIT( KDescription , "Terminalmode server Device stopped successfully"); |
|
346 aResult.SetResult( KErrNone, KDescription ); |
|
347 iLog->Log( KDescription ); |
|
348 } |
|
349 else |
|
350 { |
|
351 aResult.iResult = KErrGeneral; |
|
352 _LIT( KDescription , "Stopping of Terminalmode server Device Failed"); |
|
353 aResult.SetResult( KErrNone, KDescription ); |
|
354 iLog->Log( KDescription ); |
|
355 } |
|
356 |
|
357 delete iDiscoveryTestTimer; |
|
358 iDiscoveryTestTimer = NULL; |
|
359 delete iTestTimer; |
|
360 iTestTimer = NULL; |
|
361 REComSession::FinalClose(); |
|
362 return KErrNone; |
|
363 } |
|
364 |
|
365 |
|
366 TInt CTmServerTest::ReStartTmServerDeviceL ( TTestResult& aResult ) |
|
367 { |
|
368 _LIT( KLogInfo, "ReStart Terminalmode server Device" ); |
|
369 iLog->Log( KLogInfo ); |
|
370 |
|
371 iTmServerDeviceType = ETrue; |
|
372 //Sets the information associated with the terminal mode server device |
|
373 SetTmServerSettingsL(); |
|
374 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo,*this ); |
|
375 |
|
376 //Register all the desired applications |
|
377 RegisterApplicationsL(*iTmServer); |
|
378 //Start the tmserver device and its services |
|
379 iTmServer->StartL(); |
|
380 //Stop the tmserver device and its services |
|
381 iTmServer->StopL(); |
|
382 //Start the tmserver device and its services |
|
383 iTmServer->StartL(); |
|
384 |
|
385 //Start the control point and search for device |
|
386 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
387 iTestTimer = CTestTimer::NewL(*this); |
|
388 iTestTimer->After(15); |
|
389 CActiveScheduler::Start(); |
|
390 |
|
391 if ( iDeviceVerified) |
|
392 { |
|
393 _LIT( KDescription , "Terminalmode server Device re-started successfully"); |
|
394 aResult.SetResult( KErrNone, KDescription ); |
|
395 iLog->Log( KDescription ); |
|
396 } |
|
397 else |
|
398 { |
|
399 aResult.iResult = KErrGeneral; |
|
400 _LIT( KDescription , "Re-starting of Terminalmode server Device Failed"); |
|
401 aResult.SetResult( KErrNone, KDescription ); |
|
402 iLog->Log( KDescription ); |
|
403 } |
|
404 |
|
405 delete iTestTimer; |
|
406 iTestTimer = NULL; |
|
407 REComSession::FinalClose(); |
|
408 return KErrNone; |
|
409 } |
|
410 |
|
411 |
|
412 TInt CTmServerTest::RegisterDuplicateAppL( TTestResult& aResult ) |
|
413 { |
|
414 _LIT( KLogInfo, "Register Duplicate Application" ); |
|
415 iLog->Log( KLogInfo ); |
|
416 |
|
417 //Sets the information associated with the terminal mode server device |
|
418 SetTmServerSettingsL(); |
|
419 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
420 |
|
421 _LIT8(KAppDesc, "Bluetooth A2DP Audio Server"); |
|
422 iRemotableApp = CUpnpRemotableApp::NewL( KAppId2Value ,_L8("Bluetooth A2DP")); |
|
423 iRemotableApp->SetAppDescriptionL(KAppDesc()); |
|
424 |
|
425 CUpnpTmInfoElement& tmInfoElement = iRemotableApp->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo); |
|
426 tmInfoElement.AddTmInfoElementL(_L8("protocolID"),_L8("BTA2DP")); |
|
427 tmInfoElement.AddTmInfoElementL(_L8("direction"),_L8("out")); |
|
428 |
|
429 CUpnpTmInfoElement& tmInfoElement1 = iRemotableApp->CreateTmInfoElementL(CUpnpTmInfoElement::EAppInfo); |
|
430 tmInfoElement1.AddTmInfoElementL(_L8("appCategory"),_L8("0x0000003")); |
|
431 tmInfoElement1.AddTmInfoElementL(_L8("trustLevel"),_L8("0x00000001")); |
|
432 |
|
433 iRemotableApp->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathBtA2DpUnLaunched, KIconWidth2, KIconHeight2, KIconDepth1,KTestSvgMimeType)); |
|
434 iRemotableApp->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathBtA2DpLaunched,KIconWidth3, KIconHeight3, KIconDepth1,KTestSvgMimeType)); |
|
435 iRemotableApp->SetResourceStatusL(_L8("free")); |
|
436 |
|
437 // Register the application |
|
438 iTmServer->RegisterAppL(iRemotableApp); |
|
439 |
|
440 iRemotableApp1 = CUpnpRemotableApp::NewL( KAppId2Value ,_L8("Bluetooth A2DP")); |
|
441 iRemotableApp1->SetAppDescriptionL(KAppDesc()); |
|
442 |
|
443 CUpnpTmInfoElement& tmInfoElement2 = iRemotableApp1->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo); |
|
444 tmInfoElement2.AddTmInfoElementL(_L8("protocolID"),_L8("BTA2DP")); |
|
445 tmInfoElement2.AddTmInfoElementL(_L8("direction"),_L8("out")); |
|
446 |
|
447 CUpnpTmInfoElement& tmInfoElement3 = iRemotableApp1->CreateTmInfoElementL(CUpnpTmInfoElement::EAppInfo); |
|
448 tmInfoElement3.AddTmInfoElementL(_L8("appCategory"),_L8("0x0000003")); |
|
449 tmInfoElement3.AddTmInfoElementL(_L8("trustLevel"),_L8("0x00000001")); |
|
450 |
|
451 iRemotableApp1->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathBtA2DpUnLaunched, KIconWidth2, KIconHeight2, KIconDepth1,KTestSvgMimeType)); |
|
452 iRemotableApp1->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathBtA2DpLaunched,KIconWidth3, KIconHeight3, KIconDepth1,KTestSvgMimeType)); |
|
453 iRemotableApp1->SetResourceStatusL(_L8("free")); |
|
454 |
|
455 // Register the application which is already registered |
|
456 iTmServer->RegisterAppL(iRemotableApp1); |
|
457 |
|
458 _LIT( KDescription , "Registering of duplicate app is handled successfully"); |
|
459 aResult.SetResult( KErrNone, KDescription ); |
|
460 iLog->Log( KDescription ); |
|
461 |
|
462 delete iTmServer; |
|
463 iTmServer = NULL; |
|
464 |
|
465 REComSession::FinalClose(); |
|
466 return KErrNone; |
|
467 } |
|
468 |
|
469 TInt CTmServerTest::RegisterDuplicateAppsL( TTestResult& aResult ) |
|
470 { |
|
471 _LIT( KLogInfo, "Register Duplicate Applications" ); |
|
472 iLog->Log( KLogInfo ); |
|
473 |
|
474 //Sets the information associated with the terminal mode server device |
|
475 SetTmServerSettingsL(); |
|
476 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
477 |
|
478 _LIT8(KAppDesc, "Mobile Navigation Application"); |
|
479 iRemotableApp = CUpnpRemotableApp::NewL( KAppIdValue ,_L8("Navigation")); |
|
480 iRemotableApp->SetAppDescriptionL(KAppDesc()); |
|
481 CUpnpTmInfoElement& tmInfoElement = iRemotableApp->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo); |
|
482 tmInfoElement.AddTmInfoElementL(_L8("protocolID"),_L8("VNC")); |
|
483 |
|
484 CUpnpTmInfoElement& tmInfoElement1 = iRemotableApp->CreateTmInfoElementL(CUpnpTmInfoElement::EAppInfo); |
|
485 tmInfoElement1.AddTmInfoElementL(_L8("appCategory"),_L8("0x00010001")); |
|
486 tmInfoElement1.AddTmInfoElementL(_L8("trustLevel"),_L8("0x80")); |
|
487 |
|
488 CUpnpTmInfoElement& tmInfoElement2 = iRemotableApp->CreateTmInfoElementL(CUpnpTmInfoElement::EDisplayInfo); |
|
489 tmInfoElement2.AddTmInfoElementL(_L8("contentCategory"),_L8("0x0000001")); |
|
490 tmInfoElement2.AddTmInfoElementL(_L8("contentRules"),_L8("0x00000FE")); |
|
491 tmInfoElement2.AddTmInfoElementL(_L8("trustLevel"),_L8("0x00000001")); |
|
492 iRemotableApp->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathMaps, KIconWidth1, KIconHeight1, KIconDepth,KTestSvgMimeType)); |
|
493 |
|
494 // Register the application |
|
495 iTmServer->RegisterAppL(iRemotableApp); |
|
496 |
|
497 _LIT8(KAppDesc1, "RTP Audio Server"); |
|
498 iRemotableApp1 = CUpnpRemotableApp::NewL( KAppId1Value ,_L8("RTP Server")); |
|
499 iRemotableApp1->SetAppDescriptionL(KAppDesc1()); |
|
500 |
|
501 CUpnpTmInfoElement& tmInfoElement3 = iRemotableApp1->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo); |
|
502 tmInfoElement3.AddTmInfoElementL(_L8("protocolID"),_L8("RTP")); |
|
503 tmInfoElement3.AddTmInfoElementL(_L8("format"),_L8("99")); |
|
504 tmInfoElement3.AddTmInfoElementL(_L8("direction"),_L8("out")); |
|
505 |
|
506 CUpnpTmInfoElement& tmInfoElement4 = iRemotableApp1->CreateTmInfoElementL(CUpnpTmInfoElement::EAppInfo); |
|
507 tmInfoElement4.AddTmInfoElementL(_L8("appCategory"),_L8("0x0000002")); |
|
508 tmInfoElement4.AddTmInfoElementL(_L8("trustLevel"),_L8("0x00000001")); |
|
509 |
|
510 CUpnpTmInfoElement& tmInfoElement5 = iRemotableApp1->CreateTmInfoElementL(CUpnpTmInfoElement::EAudioInfo); |
|
511 tmInfoElement5.AddTmInfoElementL(_L8("audioType"),_L8("all")); |
|
512 iRemotableApp1->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathMusicUnLaunched,KIconWidth, KIconHeight, KIconDepth,KTestSvgMimeType)); |
|
513 iRemotableApp1->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathMusicLaunched,KIconWidth, KIconHeight, KIconDepth,KTestSvgMimeType)); |
|
514 iRemotableApp1->SetResourceStatusL(_L8("free")); |
|
515 |
|
516 iRemotableAppArray.AppendL(iRemotableApp1); |
|
517 |
|
518 iRemotableApp2 = CUpnpRemotableApp::NewL( KAppId1Value ,_L8("RTP Server")); |
|
519 iRemotableApp2->SetAppDescriptionL(KAppDesc1()); |
|
520 |
|
521 CUpnpTmInfoElement& tmInfoElement6 = iRemotableApp2->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo); |
|
522 tmInfoElement6.AddTmInfoElementL(_L8("protocolID"),_L8("RTP")); |
|
523 tmInfoElement6.AddTmInfoElementL(_L8("format"),_L8("99")); |
|
524 tmInfoElement6.AddTmInfoElementL(_L8("direction"),_L8("out")); |
|
525 |
|
526 CUpnpTmInfoElement& tmInfoElement7 = iRemotableApp2->CreateTmInfoElementL(CUpnpTmInfoElement::EAppInfo); |
|
527 tmInfoElement7.AddTmInfoElementL(_L8("appCategory"),_L8("0x0000002")); |
|
528 tmInfoElement7.AddTmInfoElementL(_L8("trustLevel"),_L8("0x00000001")); |
|
529 |
|
530 CUpnpTmInfoElement& tmInfoElement8 = iRemotableApp2->CreateTmInfoElementL(CUpnpTmInfoElement::EAudioInfo); |
|
531 tmInfoElement8.AddTmInfoElementL(_L8("audioType"),_L8("all")); |
|
532 iRemotableApp2->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathMusicUnLaunched,KIconWidth, KIconHeight, KIconDepth,KTestSvgMimeType)); |
|
533 iRemotableApp2->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathMusicLaunched,KIconWidth, KIconHeight, KIconDepth,KTestSvgMimeType)); |
|
534 iRemotableApp2->SetResourceStatusL(_L8("free")); |
|
535 iRemotableAppArray.AppendL(iRemotableApp2); |
|
536 |
|
537 // Register the dulplicate applications |
|
538 iTmServer->RegisterAppsL( iRemotableAppArray); |
|
539 |
|
540 _LIT( KDescription , "Registering of duplicate applications is handled successfully"); |
|
541 aResult.SetResult( KErrNone, KDescription ); |
|
542 iLog->Log( KDescription ); |
|
543 iRemotableAppArray.Close(); |
|
544 delete iTmServer; |
|
545 iTmServer = NULL; |
|
546 |
|
547 REComSession::FinalClose(); |
|
548 return KErrNone; |
|
549 } |
|
550 |
|
551 |
|
552 TInt CTmServerTest::UnRegisterAppL( TTestResult& aResult ) |
|
553 { |
|
554 _LIT( KLogInfo, "UnRegister Application" ); |
|
555 iLog->Log( KLogInfo ); |
|
556 |
|
557 //Sets the information associated with the terminal mode server device |
|
558 SetTmServerSettingsL(); |
|
559 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
560 |
|
561 //Register all the desired applications |
|
562 RegisterApplicationsL(*iTmServer); |
|
563 |
|
564 //Unregister the application by specifying AppId |
|
565 iTmServer->UnRegisterApp( KAppIdValue ); |
|
566 iTestTimer = CTestTimer::NewL(*this); |
|
567 iTestTimer->After(15); |
|
568 CActiveScheduler::Start(); |
|
569 |
|
570 _LIT( KDescription , "Application is un-registered successfully"); |
|
571 aResult.SetResult( KErrNone, KDescription ); |
|
572 iLog->Log( KDescription ); |
|
573 |
|
574 delete iTestTimer; |
|
575 iTestTimer = NULL; |
|
576 |
|
577 REComSession::FinalClose(); |
|
578 return KErrNone; |
|
579 } |
|
580 |
|
581 TInt CTmServerTest::UnRegisterAppsL( TTestResult& aResult ) |
|
582 { |
|
583 _LIT( KLogInfo, "UnRegister Multiple Applications" ); |
|
584 iLog->Log( KLogInfo ); |
|
585 |
|
586 //Sets the information associated with the terminal mode server device |
|
587 SetTmServerSettingsL(); |
|
588 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
589 |
|
590 //Register all the desired applications |
|
591 RegisterApplicationsL(*iTmServer); |
|
592 |
|
593 RArray<TUint> appIdArray; |
|
594 appIdArray.AppendL( KAppId1Value ); |
|
595 appIdArray.AppendL( KAppId2Value ); |
|
596 |
|
597 //Unregister multiple applications by specifying array of AppIds |
|
598 iTmServer->UnRegisterApps( appIdArray); |
|
599 |
|
600 iTestTimer = CTestTimer::NewL(*this); |
|
601 iTestTimer->After(15); |
|
602 CActiveScheduler::Start(); |
|
603 |
|
604 _LIT( KDescription , "Multiple Applications are un-registered successfully"); |
|
605 aResult.SetResult( KErrNone, KDescription ); |
|
606 iLog->Log( KDescription ); |
|
607 appIdArray.Close(); |
|
608 |
|
609 delete iTestTimer; |
|
610 iTestTimer = NULL; |
|
611 REComSession::FinalClose(); |
|
612 return KErrNone; |
|
613 } |
|
614 |
|
615 TInt CTmServerTest::UnRegisterUnRegisteredAppL( TTestResult& aResult ) |
|
616 { |
|
617 _LIT( KLogInfo, "UnRegister UnRegistered Application" ); |
|
618 iLog->Log( KLogInfo ); |
|
619 |
|
620 //Sets the information associated with the terminal mode server device |
|
621 SetTmServerSettingsL(); |
|
622 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
623 |
|
624 //Register all the desired applications |
|
625 RegisterApplicationsL(*iTmServer); |
|
626 |
|
627 //Unregister the application which is already unregistered |
|
628 iTmServer->UnRegisterApp( KNonExistentAppIdValue ); |
|
629 |
|
630 iTestTimer = CTestTimer::NewL(*this); |
|
631 iTestTimer->After(15); |
|
632 CActiveScheduler::Start(); |
|
633 |
|
634 _LIT( KDescription , "UnRegistering of UnRegistered Application is handled successfully"); |
|
635 aResult.SetResult( KErrNone, KDescription ); |
|
636 iLog->Log( KDescription ); |
|
637 |
|
638 delete iTestTimer; |
|
639 iTestTimer = NULL; |
|
640 |
|
641 REComSession::FinalClose(); |
|
642 return KErrNone; |
|
643 } |
|
644 |
|
645 TInt CTmServerTest::UnRegisterUnRegisteredAppsL( TTestResult& aResult ) |
|
646 { |
|
647 _LIT( KLogInfo, "UnRegister Multiple UnRegistered Applications" ); |
|
648 iLog->Log( KLogInfo ); |
|
649 |
|
650 //Sets the information associated with the terminal mode server device |
|
651 SetTmServerSettingsL(); |
|
652 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
653 |
|
654 //Register all the desired applications |
|
655 RegisterApplicationsL(*iTmServer); |
|
656 |
|
657 RArray<TUint> appIdArray; |
|
658 appIdArray.AppendL( KNonExistentAppIdValue ); |
|
659 appIdArray.AppendL( KNonExistentAppId1Value ); |
|
660 |
|
661 //Unregister multiple applications which are already unregistered |
|
662 iTmServer->UnRegisterApps( appIdArray); |
|
663 |
|
664 iTestTimer = CTestTimer::NewL(*this); |
|
665 iTestTimer->After(15); |
|
666 CActiveScheduler::Start(); |
|
667 |
|
668 _LIT( KDescription , "UnRegistering of UnRegistered Applications is handled successfully"); |
|
669 aResult.SetResult( KErrNone, KDescription ); |
|
670 iLog->Log( KDescription ); |
|
671 |
|
672 appIdArray.Close(); |
|
673 delete iTestTimer; |
|
674 iTestTimer = NULL; |
|
675 |
|
676 REComSession::FinalClose(); |
|
677 return KErrNone; |
|
678 } |
|
679 |
|
680 TInt CTmServerTest::HandleEventDuplicateAppStatusUpdateL( TTestResult& aResult ) |
|
681 { |
|
682 _LIT( KLogInfo, "Handle Event For Duplicate AppStatus Update" ); |
|
683 iLog->Log( KLogInfo ); |
|
684 |
|
685 iTmServerDeviceType = ETrue; |
|
686 //Sets the information associated with the terminal mode server device |
|
687 SetTmServerSettingsL(); |
|
688 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
689 |
|
690 //Register all the desired applications |
|
691 RegisterApplicationsL(*iTmServer); |
|
692 |
|
693 //Start the tmserver device and its services |
|
694 iTmServer ->StartL(); |
|
695 //Start the control point and search for device |
|
696 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
697 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
698 iDiscoveryTestTimer->AfterDiscovery(15); |
|
699 CActiveScheduler::Start(); |
|
700 |
|
701 if ( iDeviceVerified ) |
|
702 { |
|
703 //Subscribe to Services |
|
704 iSearchDevice->SubscribeToServiceL(); |
|
705 } |
|
706 |
|
707 RArray<TUint> updatedAppIdList; |
|
708 updatedAppIdList.Append(KAppId1Value); |
|
709 updatedAppIdList.Append(KAppId1Value); |
|
710 //Update the status of applications which have undergone some change |
|
711 iTmServer->UpdateAppStatusL(updatedAppIdList); |
|
712 |
|
713 iTestTimer = CTestTimer::NewL(*this); |
|
714 iTestTimer->After(15); |
|
715 CActiveScheduler::Start(); |
|
716 |
|
717 if ( iStatusNotified ) |
|
718 { |
|
719 _LIT( KDescription , "Handle Event For Duplicate AppStatus Update handled successfully"); |
|
720 aResult.SetResult( KErrNone, KDescription ); |
|
721 iLog->Log( KDescription ); |
|
722 } |
|
723 else |
|
724 { |
|
725 aResult.iResult = KErrGeneral; |
|
726 _LIT( KDescription , "Handle Event For Duplicate AppStatus Update handling Failed"); |
|
727 aResult.SetResult( KErrNone, KDescription ); |
|
728 iLog->Log( KDescription ); |
|
729 } |
|
730 updatedAppIdList.Close(); |
|
731 delete iDiscoveryTestTimer; |
|
732 iDiscoveryTestTimer = NULL; |
|
733 delete iTestTimer; |
|
734 iTestTimer = NULL; |
|
735 REComSession::FinalClose(); |
|
736 return KErrNone; |
|
737 } |
|
738 |
|
739 TInt CTmServerTest::HandleEventProfileIdListStatusUpdateL( TTestResult& aResult ) |
|
740 { |
|
741 _LIT( KLogInfo, "Handle Event For ProfileIdList Status Update" ); |
|
742 iLog->Log( KLogInfo ); |
|
743 |
|
744 iTmServerDeviceType = ETrue; |
|
745 //Sets the information associated with the terminal mode server device |
|
746 SetTmServerSettingsL(); |
|
747 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
748 |
|
749 //Register all the desired applications |
|
750 RegisterApplicationsL(*iTmServer); |
|
751 |
|
752 //Start the tmserver device and its services |
|
753 iTmServer ->StartL(); |
|
754 //Start the control point and search for device |
|
755 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
756 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
757 iDiscoveryTestTimer->AfterDiscovery(15); |
|
758 CActiveScheduler::Start(); |
|
759 |
|
760 if ( iDeviceVerified ) |
|
761 { |
|
762 //Subscribes to a service |
|
763 iSearchDevice->SubscribeToServiceL(); |
|
764 } |
|
765 |
|
766 RArray<TUint> UnusedProfileIdList; |
|
767 UnusedProfileIdList.Append(5); |
|
768 UnusedProfileIdList.Append(6); |
|
769 //Update the list of profile IDs for profiles which are not used |
|
770 iTmServer->UpdateUnusedProfileIdsL(UnusedProfileIdList); |
|
771 |
|
772 iTestTimer = CTestTimer::NewL(*this); |
|
773 iTestTimer->After(15); |
|
774 CActiveScheduler::Start(); |
|
775 |
|
776 if ( iStatusNotified ) |
|
777 { |
|
778 _LIT( KDescription , "Handle Event For ProfileIdList Status Update handled successfully"); |
|
779 aResult.SetResult( KErrNone, KDescription ); |
|
780 iLog->Log( KDescription ); |
|
781 } |
|
782 else |
|
783 { |
|
784 aResult.iResult = KErrGeneral; |
|
785 _LIT( KDescription , "Handle Event For ProfileIdList Status Update handling failed"); |
|
786 aResult.SetResult( KErrNone, KDescription ); |
|
787 iLog->Log( KDescription ); |
|
788 } |
|
789 |
|
790 UnusedProfileIdList.Close(); |
|
791 delete iDiscoveryTestTimer; |
|
792 iDiscoveryTestTimer = NULL; |
|
793 delete iTestTimer; |
|
794 iTestTimer = NULL; |
|
795 REComSession::FinalClose(); |
|
796 return KErrNone; |
|
797 } |
|
798 |
|
799 TInt CTmServerTest::HandleLaunchAppActionL ( TTestResult& aResult ) |
|
800 { |
|
801 _LIT( KLogInfo, "Handle LaunchApp Command" ); |
|
802 iLog->Log( KLogInfo ); |
|
803 |
|
804 iTmServerDeviceType = ETrue; |
|
805 |
|
806 //Sets the information associated with the terminal mode server device |
|
807 SetTmServerSettingsL(); |
|
808 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
809 |
|
810 //Register all the desired applications |
|
811 RegisterApplicationsL(*iTmServer); |
|
812 |
|
813 //Start the tmserver device and its services |
|
814 iTmServer ->StartL(); |
|
815 //Start the control point and search for device |
|
816 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
817 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
818 iDiscoveryTestTimer->AfterDiscovery(15); |
|
819 CActiveScheduler::Start(); |
|
820 |
|
821 if ( iDeviceVerified ) |
|
822 { |
|
823 //Launch the application remotely by specifying appId and profileId |
|
824 iSearchDevice->LaunchAppActionL(KAppId1Value,KProfileIdValue); |
|
825 } |
|
826 |
|
827 iTestTimer = CTestTimer::NewL(*this); |
|
828 iTestTimer->After(15); |
|
829 CActiveScheduler::Start(); |
|
830 |
|
831 if (iStartApp ) |
|
832 { |
|
833 _LIT( KDescription , "LaunchApp Command handled successfully"); |
|
834 aResult.SetResult( KErrNone, KDescription ); |
|
835 iLog->Log( KDescription ); |
|
836 } |
|
837 else |
|
838 { |
|
839 aResult.iResult = KErrGeneral; |
|
840 _LIT( KDescription , "LaunchApp Command handled Failed"); |
|
841 aResult.SetResult( KErrNone, KDescription ); |
|
842 iLog->Log( KDescription ); |
|
843 } |
|
844 delete iDiscoveryTestTimer; |
|
845 iDiscoveryTestTimer = NULL; |
|
846 delete iTestTimer; |
|
847 iTestTimer = NULL; |
|
848 REComSession::FinalClose(); |
|
849 return KErrNone; |
|
850 } |
|
851 |
|
852 TInt CTmServerTest::HandleTerminateAppActionL( TTestResult& aResult ) |
|
853 { |
|
854 _LIT( KLogInfo, "Handle TerminateApp Command" ); |
|
855 iLog->Log( KLogInfo ); |
|
856 |
|
857 iTmServerDeviceType = ETrue; |
|
858 //Sets the information associated with the terminal mode server device |
|
859 SetTmServerSettingsL(); |
|
860 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
861 |
|
862 //Register all the desired applications |
|
863 RegisterApplicationsL(*iTmServer); |
|
864 |
|
865 //Start the tmserver device and its services |
|
866 iTmServer->StartL(); |
|
867 |
|
868 //Start the control point and search for device |
|
869 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
870 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
871 iDiscoveryTestTimer->AfterDiscovery(15); |
|
872 CActiveScheduler::Start(); |
|
873 |
|
874 if ( iDeviceVerified ) |
|
875 { |
|
876 //Terminate the application which is already running |
|
877 iSearchDevice->TerminateAppActionL( KAppId1Value,KProfileIdValue); |
|
878 } |
|
879 |
|
880 iTestTimer = CTestTimer::NewL(*this); |
|
881 iTestTimer->After(15); |
|
882 CActiveScheduler::Start(); |
|
883 |
|
884 if ( iStopApp) |
|
885 { |
|
886 _LIT( KDescription , "TerminateApp Command handled successfully"); |
|
887 aResult.SetResult( KErrNone, KDescription ); |
|
888 iLog->Log( KDescription ); |
|
889 } |
|
890 else |
|
891 { |
|
892 aResult.iResult = KErrGeneral; |
|
893 _LIT( KDescription , "TerminateApp Command handling Failed"); |
|
894 aResult.SetResult( KErrNone, KDescription ); |
|
895 iLog->Log( KDescription ); |
|
896 } |
|
897 delete iDiscoveryTestTimer; |
|
898 iDiscoveryTestTimer = NULL; |
|
899 delete iTestTimer; |
|
900 iTestTimer = NULL; |
|
901 REComSession::FinalClose(); |
|
902 return KErrNone; |
|
903 } |
|
904 |
|
905 TInt CTmServerTest::HandleInvalidAppIdLaunchAppActionL ( TTestResult& aResult ) |
|
906 { |
|
907 _LIT( KLogInfo, "Handle Invalid AppId LaunchApp Command" ); |
|
908 iLog->Log( KLogInfo ); |
|
909 |
|
910 iTmServerDeviceType = ETrue; |
|
911 //Sets the information associated with the terminal mode server device |
|
912 SetTmServerSettingsL(); |
|
913 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
914 |
|
915 //Register all the desired applications |
|
916 RegisterApplicationsL(*iTmServer); |
|
917 |
|
918 //Start the tmserver device and its services |
|
919 iTmServer->StartL(); |
|
920 //Start the control point and search for device |
|
921 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
922 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
923 iDiscoveryTestTimer->AfterDiscovery(15); |
|
924 CActiveScheduler::Start(); |
|
925 |
|
926 if ( iDeviceVerified ) |
|
927 { |
|
928 //Launch the application by specifying invalid appId |
|
929 iSearchDevice->LaunchAppActionL( KInvalidAppIdValue,KProfileIdValue); |
|
930 } |
|
931 |
|
932 iTestTimer = CTestTimer::NewL(*this); |
|
933 iTestTimer->After(15); |
|
934 CActiveScheduler::Start(); |
|
935 |
|
936 if (iStartApp ) |
|
937 { |
|
938 _LIT( KDescription , "LaunchApp Command with invalid AppId handled successfully"); |
|
939 aResult.SetResult( KErrNone, KDescription ); |
|
940 iLog->Log( KDescription ); |
|
941 } |
|
942 else |
|
943 { |
|
944 aResult.iResult = KErrGeneral; |
|
945 _LIT( KDescription , "LaunchApp Command with invalid AppId handling Failed"); |
|
946 aResult.SetResult( KErrNone, KDescription ); |
|
947 iLog->Log( KDescription ); |
|
948 } |
|
949 delete iDiscoveryTestTimer; |
|
950 iDiscoveryTestTimer = NULL; |
|
951 delete iTestTimer; |
|
952 iTestTimer = NULL; |
|
953 REComSession::FinalClose(); |
|
954 return KErrNone; |
|
955 } |
|
956 |
|
957 TInt CTmServerTest::HandleInvalidProfileIdLaunchAppActionL ( TTestResult& aResult ) |
|
958 { |
|
959 _LIT( KLogInfo, "Handle Invalid ProfileId LaunchApp Command" ); |
|
960 iLog->Log( KLogInfo ); |
|
961 |
|
962 iTmServerDeviceType = ETrue; |
|
963 //Sets the information associated with the terminal mode server device |
|
964 SetTmServerSettingsL(); |
|
965 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
966 //Register all the desired applications |
|
967 RegisterApplicationsL(*iTmServer); |
|
968 //Start the tmserver device and its services |
|
969 iTmServer->StartL(); |
|
970 |
|
971 //Start the control point and search for device |
|
972 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
973 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
974 iDiscoveryTestTimer->AfterDiscovery(15); |
|
975 CActiveScheduler::Start(); |
|
976 |
|
977 if ( iDeviceVerified ) |
|
978 { |
|
979 //Launch the application by specifying invalid profileId |
|
980 iSearchDevice->LaunchAppActionL( KAppId1Value,KInvalidProfileIdValue); |
|
981 } |
|
982 |
|
983 iTestTimer = CTestTimer::NewL(*this); |
|
984 iTestTimer->After(15); |
|
985 CActiveScheduler::Start(); |
|
986 if (iStartApp ) |
|
987 { |
|
988 _LIT( KDescription , "LaunchApp Command with invalid ProfileId handled successfully"); |
|
989 aResult.SetResult( KErrNone, KDescription ); |
|
990 iLog->Log( KDescription ); |
|
991 } |
|
992 else |
|
993 { |
|
994 aResult.iResult = KErrGeneral; |
|
995 _LIT( KDescription , "LaunchApp Command with invalid ProfileId handling Failed"); |
|
996 aResult.SetResult( KErrNone, KDescription ); |
|
997 iLog->Log( KDescription ); |
|
998 } |
|
999 delete iDiscoveryTestTimer; |
|
1000 iDiscoveryTestTimer = NULL; |
|
1001 delete iTestTimer; |
|
1002 iTestTimer = NULL; |
|
1003 REComSession::FinalClose(); |
|
1004 return KErrNone; |
|
1005 } |
|
1006 |
|
1007 TInt CTmServerTest::HandleNonExistentLaunchAppActionL( TTestResult& aResult ) |
|
1008 { |
|
1009 _LIT( KLogInfo, "Handle LaunchApp Command For Non-Existent AppID" ); |
|
1010 iLog->Log( KLogInfo ); |
|
1011 |
|
1012 iTmServerDeviceType = ETrue; |
|
1013 //Sets the information associated with the terminal mode server device |
|
1014 SetTmServerSettingsL(); |
|
1015 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
1016 |
|
1017 //Register all the desired applications |
|
1018 RegisterApplicationsL(*iTmServer); |
|
1019 |
|
1020 //Start the tmserver device and its services |
|
1021 iTmServer->StartL(); |
|
1022 |
|
1023 //Start the control point and search for device |
|
1024 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
1025 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
1026 iDiscoveryTestTimer->AfterDiscovery(15); |
|
1027 CActiveScheduler::Start(); |
|
1028 |
|
1029 if ( iDeviceVerified ) |
|
1030 { |
|
1031 //Launch the application by specifying non-existent appId |
|
1032 iSearchDevice->LaunchAppActionL( KNonExistentAppIdValue, KProfileIdValue ); |
|
1033 } |
|
1034 |
|
1035 iTestTimer = CTestTimer::NewL(*this); |
|
1036 iTestTimer->After(15); |
|
1037 CActiveScheduler::Start(); |
|
1038 |
|
1039 if (iStartApp ) |
|
1040 { |
|
1041 _LIT( KDescription , "LaunchApp Command For Non-Existent AppID handled successfully"); |
|
1042 aResult.SetResult( KErrNone, KDescription ); |
|
1043 iLog->Log( KDescription ); |
|
1044 } |
|
1045 else |
|
1046 { |
|
1047 aResult.iResult = KErrGeneral; |
|
1048 _LIT( KDescription , "LaunchApp Command For Non-Existent AppID handled Failed"); |
|
1049 aResult.SetResult( KErrNone, KDescription ); |
|
1050 iLog->Log( KDescription ); |
|
1051 } |
|
1052 delete iDiscoveryTestTimer; |
|
1053 iDiscoveryTestTimer = NULL; |
|
1054 delete iTestTimer; |
|
1055 iTestTimer = NULL; |
|
1056 REComSession::FinalClose(); |
|
1057 return KErrNone; |
|
1058 } |
|
1059 |
|
1060 TInt CTmServerTest::HandleUnauthorizedLaunchAppActionL ( TTestResult& aResult ) |
|
1061 { |
|
1062 _LIT( KLogInfo, "Handle LaunchApp Command For UnAuthorized AppID" ); |
|
1063 iLog->Log( KLogInfo ); |
|
1064 |
|
1065 iTmServerDeviceType = ETrue; |
|
1066 |
|
1067 //Sets the information associated with the terminal mode server device |
|
1068 SetTmServerSettingsL(); |
|
1069 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
1070 |
|
1071 //Register all the desired applications |
|
1072 RegisterApplicationsL(*iTmServer); |
|
1073 |
|
1074 //Start the tmserver device and its services |
|
1075 iTmServer ->StartL(); |
|
1076 |
|
1077 //Start the control point and search for device |
|
1078 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
1079 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
1080 iDiscoveryTestTimer->AfterDiscovery(15); |
|
1081 CActiveScheduler::Start(); |
|
1082 |
|
1083 if ( iDeviceVerified ) |
|
1084 { |
|
1085 //Launch the application by specifying unauthorized appId |
|
1086 iSearchDevice->LaunchAppActionL(KAppId5Value,KProfileIdValue); |
|
1087 } |
|
1088 |
|
1089 iTestTimer = CTestTimer::NewL(*this); |
|
1090 iTestTimer->After(15); |
|
1091 CActiveScheduler::Start(); |
|
1092 if (iStartApp ) |
|
1093 { |
|
1094 _LIT( KDescription , "LaunchApp Command For UnAuthorized AppID handled successfully"); |
|
1095 aResult.SetResult( KErrNone, KDescription ); |
|
1096 iLog->Log( KDescription ); |
|
1097 } |
|
1098 else |
|
1099 { |
|
1100 aResult.iResult = KErrGeneral; |
|
1101 _LIT( KDescription , "LaunchApp Command For UnAuthorized AppID handled Failed"); |
|
1102 aResult.SetResult( KErrNone, KDescription ); |
|
1103 iLog->Log( KDescription ); |
|
1104 } |
|
1105 delete iDiscoveryTestTimer; |
|
1106 iDiscoveryTestTimer = NULL; |
|
1107 delete iTestTimer; |
|
1108 iTestTimer = NULL; |
|
1109 REComSession::FinalClose(); |
|
1110 return KErrNone; |
|
1111 } |
|
1112 |
|
1113 TInt CTmServerTest::HandleDeviceLockedLaunchAppActionL ( TTestResult& aResult ) |
|
1114 { |
|
1115 _LIT( KLogInfo, "Handle Device Locked Condition For LaunchApp Command" ); |
|
1116 iLog->Log( KLogInfo ); |
|
1117 |
|
1118 iTmServerDeviceType = ETrue; |
|
1119 |
|
1120 //Sets the information associated with the terminal mode server device |
|
1121 SetTmServerSettingsL(); |
|
1122 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
1123 |
|
1124 //Register all the desired applications |
|
1125 RegisterApplicationsL(*iTmServer); |
|
1126 |
|
1127 //Start the tmserver device and its services |
|
1128 iTmServer ->StartL(); |
|
1129 |
|
1130 //Start the control point and search for device |
|
1131 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
1132 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
1133 iDiscoveryTestTimer->AfterDiscovery(15); |
|
1134 CActiveScheduler::Start(); |
|
1135 |
|
1136 if ( iDeviceVerified ) |
|
1137 { |
|
1138 //Launch the application |
|
1139 iSearchDevice->LaunchAppActionL(KAppId4Value,KProfileIdValue); |
|
1140 } |
|
1141 |
|
1142 iTestTimer = CTestTimer::NewL(*this); |
|
1143 iTestTimer->After(15); |
|
1144 CActiveScheduler::Start(); |
|
1145 if (iStartApp ) |
|
1146 { |
|
1147 _LIT( KDescription , "LaunchApp Command For Device Locked Condition handled successfully"); |
|
1148 aResult.SetResult( KErrNone, KDescription ); |
|
1149 iLog->Log( KDescription ); |
|
1150 } |
|
1151 else |
|
1152 { |
|
1153 aResult.iResult = KErrGeneral; |
|
1154 _LIT( KDescription , "LaunchApp Command For Device Locked Condition handling Failed"); |
|
1155 aResult.SetResult( KErrNone, KDescription ); |
|
1156 iLog->Log( KDescription ); |
|
1157 } |
|
1158 delete iDiscoveryTestTimer; |
|
1159 iDiscoveryTestTimer = NULL; |
|
1160 delete iTestTimer; |
|
1161 iTestTimer = NULL; |
|
1162 REComSession::FinalClose(); |
|
1163 return KErrNone; |
|
1164 } |
|
1165 |
|
1166 TInt CTmServerTest::HandleNonExistentTerminateAppActionL( TTestResult& aResult ) |
|
1167 { |
|
1168 _LIT( KLogInfo, "Handle TerminateApp Command For Non-Existent AppID" ); |
|
1169 iLog->Log( KLogInfo ); |
|
1170 |
|
1171 iTmServerDeviceType = ETrue; |
|
1172 //Sets the information associated with the terminal mode server device |
|
1173 SetTmServerSettingsL(); |
|
1174 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
1175 |
|
1176 //Register all the desired applications |
|
1177 RegisterApplicationsL(*iTmServer); |
|
1178 |
|
1179 //Start the tmserver device and its services |
|
1180 iTmServer->StartL(); |
|
1181 |
|
1182 //Start the control point and search for device |
|
1183 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
1184 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
1185 iDiscoveryTestTimer->AfterDiscovery(15); |
|
1186 CActiveScheduler::Start(); |
|
1187 |
|
1188 if ( iDeviceVerified ) |
|
1189 { |
|
1190 //Terminate the application by specifying unauthorized appId |
|
1191 iSearchDevice->TerminateAppActionL( KNonExistentAppIdValue,KProfileIdValue ); |
|
1192 } |
|
1193 |
|
1194 iTestTimer = CTestTimer::NewL(*this); |
|
1195 iTestTimer->After(15); |
|
1196 CActiveScheduler::Start(); |
|
1197 if ( iStopApp) |
|
1198 { |
|
1199 _LIT( KDescription , "TerminateApp Command For Non-Existent App ID handled successfully"); |
|
1200 aResult.SetResult( KErrNone, KDescription ); |
|
1201 iLog->Log( KDescription ); |
|
1202 } |
|
1203 else |
|
1204 { |
|
1205 aResult.iResult = KErrGeneral; |
|
1206 _LIT( KDescription , "TerminateApp Command handling for Non-Existent App Id Failed"); |
|
1207 aResult.SetResult( KErrNone, KDescription ); |
|
1208 iLog->Log( KDescription ); |
|
1209 } |
|
1210 delete iDiscoveryTestTimer; |
|
1211 iDiscoveryTestTimer = NULL; |
|
1212 delete iTestTimer; |
|
1213 iTestTimer = NULL; |
|
1214 REComSession::FinalClose(); |
|
1215 return KErrNone; |
|
1216 } |
|
1217 |
|
1218 TInt CTmServerTest::HandleInvalidAppIdTerminateAppActionL( TTestResult& aResult ) |
|
1219 { |
|
1220 _LIT( KLogInfo, "Handle Invalid AppId TerminateApp Command" ); |
|
1221 iLog->Log( KLogInfo ); |
|
1222 |
|
1223 iTmServerDeviceType = ETrue; |
|
1224 //Sets the information associated with the terminal mode server device |
|
1225 SetTmServerSettingsL(); |
|
1226 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
1227 |
|
1228 //Register all the desired applications |
|
1229 RegisterApplicationsL(*iTmServer); |
|
1230 |
|
1231 //Start the tmserver device and its services |
|
1232 iTmServer->StartL(); |
|
1233 //Start the control point and search for device |
|
1234 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
1235 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
1236 iDiscoveryTestTimer->AfterDiscovery(15); |
|
1237 CActiveScheduler::Start(); |
|
1238 |
|
1239 if ( iDeviceVerified ) |
|
1240 { |
|
1241 //Terminate the application by specifying invalid appId |
|
1242 iSearchDevice->TerminateAppActionL( KInvalidAppIdValue,KProfileIdValue ); |
|
1243 } |
|
1244 |
|
1245 iTestTimer = CTestTimer::NewL(*this); |
|
1246 iTestTimer->After(15); |
|
1247 CActiveScheduler::Start(); |
|
1248 if ( iStopApp) |
|
1249 { |
|
1250 _LIT( KDescription , "TerminateApp Command with invalid AppId handled successfully"); |
|
1251 aResult.SetResult( KErrNone, KDescription ); |
|
1252 iLog->Log( KDescription ); |
|
1253 } |
|
1254 else |
|
1255 { |
|
1256 aResult.iResult = KErrGeneral; |
|
1257 _LIT( KDescription , "TerminateApp Command with invalid AppId handling Failed"); |
|
1258 aResult.SetResult( KErrNone, KDescription ); |
|
1259 iLog->Log( KDescription ); |
|
1260 } |
|
1261 delete iDiscoveryTestTimer; |
|
1262 iDiscoveryTestTimer = NULL; |
|
1263 delete iTestTimer; |
|
1264 iTestTimer = NULL; |
|
1265 REComSession::FinalClose(); |
|
1266 return KErrNone; |
|
1267 } |
|
1268 |
|
1269 TInt CTmServerTest::HandleInvalidProfileIdTerminateAppActionL( TTestResult& aResult ) |
|
1270 { |
|
1271 _LIT( KLogInfo, "Handle Invalid ProfileId TerminateApp Command" ); |
|
1272 iLog->Log( KLogInfo ); |
|
1273 |
|
1274 iTmServerDeviceType = ETrue; |
|
1275 //Sets the information associated with the terminal mode server device |
|
1276 SetTmServerSettingsL(); |
|
1277 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
1278 |
|
1279 //Register all the desired applications |
|
1280 RegisterApplicationsL(*iTmServer); |
|
1281 |
|
1282 //Start the tmserver device and its services |
|
1283 iTmServer->StartL(); |
|
1284 |
|
1285 //Start the control point and search for device |
|
1286 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
1287 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
1288 iDiscoveryTestTimer->AfterDiscovery(15); |
|
1289 CActiveScheduler::Start(); |
|
1290 |
|
1291 if ( iDeviceVerified ) |
|
1292 { |
|
1293 //Terminate the application by specifying invalid profileId |
|
1294 iSearchDevice->TerminateAppActionL( KAppId1Value,KInvalidProfileIdValue ); |
|
1295 } |
|
1296 |
|
1297 iTestTimer = CTestTimer::NewL(*this); |
|
1298 iTestTimer->After(15); |
|
1299 CActiveScheduler::Start(); |
|
1300 if ( iStopApp) |
|
1301 { |
|
1302 _LIT( KDescription , "TerminateApp Command with invalid ProfileId handled successfully"); |
|
1303 aResult.SetResult( KErrNone, KDescription ); |
|
1304 iLog->Log( KDescription ); |
|
1305 } |
|
1306 else |
|
1307 { |
|
1308 aResult.iResult = KErrGeneral; |
|
1309 _LIT( KDescription , "TerminateApp Command with invalid ProfileId handling Failed"); |
|
1310 aResult.SetResult( KErrNone, KDescription ); |
|
1311 iLog->Log( KDescription ); |
|
1312 } |
|
1313 delete iDiscoveryTestTimer; |
|
1314 iDiscoveryTestTimer = NULL; |
|
1315 delete iTestTimer; |
|
1316 iTestTimer = NULL; |
|
1317 REComSession::FinalClose(); |
|
1318 return KErrNone; |
|
1319 } |
|
1320 |
|
1321 TInt CTmServerTest::HandleUnauthorizedTerminateAppActionL( TTestResult& aResult ) |
|
1322 { |
|
1323 _LIT( KLogInfo, "Handle TerminateApp Command UnAuthorized AppID" ); |
|
1324 iLog->Log( KLogInfo ); |
|
1325 |
|
1326 iTmServerDeviceType = ETrue; |
|
1327 |
|
1328 //Sets the information associated with the terminal mode server device |
|
1329 SetTmServerSettingsL(); |
|
1330 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
1331 |
|
1332 //Register all the desired applications |
|
1333 RegisterApplicationsL(*iTmServer); |
|
1334 |
|
1335 //Start the tmserver device and its services |
|
1336 iTmServer->StartL(); |
|
1337 |
|
1338 //Start the control point and search for device |
|
1339 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
1340 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
1341 iDiscoveryTestTimer->AfterDiscovery(15); |
|
1342 CActiveScheduler::Start(); |
|
1343 |
|
1344 if ( iDeviceVerified ) |
|
1345 { |
|
1346 //Terminate the application by specifying unauthorized appId |
|
1347 iSearchDevice->TerminateAppActionL( KAppId5Value,KProfileIdValue ); |
|
1348 } |
|
1349 |
|
1350 iTestTimer = CTestTimer::NewL(*this); |
|
1351 iTestTimer->After(15); |
|
1352 CActiveScheduler::Start(); |
|
1353 if ( iStopApp) |
|
1354 { |
|
1355 _LIT( KDescription , "TerminateApp Command For Un-Authorized App ID handled successfully"); |
|
1356 aResult.SetResult( KErrNone, KDescription ); |
|
1357 iLog->Log( KDescription ); |
|
1358 } |
|
1359 else |
|
1360 { |
|
1361 aResult.iResult = KErrGeneral; |
|
1362 _LIT( KDescription , "TerminateApp Command handling For Un-Authorized App ID Failed"); |
|
1363 aResult.SetResult( KErrNone, KDescription ); |
|
1364 iLog->Log( KDescription ); |
|
1365 } |
|
1366 delete iDiscoveryTestTimer; |
|
1367 iDiscoveryTestTimer = NULL; |
|
1368 delete iTestTimer; |
|
1369 iTestTimer = NULL; |
|
1370 REComSession::FinalClose(); |
|
1371 return KErrNone; |
|
1372 } |
|
1373 |
|
1374 TInt CTmServerTest::HandleDeviceLockedTerminateAppActionL ( TTestResult& aResult ) |
|
1375 { |
|
1376 _LIT( KLogInfo, "Handle Device Locked Condition For TerminateApp Command" ); |
|
1377 iLog->Log( KLogInfo ); |
|
1378 |
|
1379 iTmServerDeviceType = ETrue; |
|
1380 |
|
1381 //Sets the information associated with the terminal mode server device |
|
1382 SetTmServerSettingsL(); |
|
1383 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
1384 |
|
1385 //Register all the desired applications |
|
1386 RegisterApplicationsL(*iTmServer); |
|
1387 |
|
1388 //Start the tmserver device and its services |
|
1389 iTmServer ->StartL(); |
|
1390 |
|
1391 //Start the control point and search for device |
|
1392 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
1393 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
1394 iDiscoveryTestTimer->AfterDiscovery(15); |
|
1395 CActiveScheduler::Start(); |
|
1396 |
|
1397 if ( iDeviceVerified ) |
|
1398 { |
|
1399 //Terminate the application |
|
1400 iSearchDevice->TerminateAppActionL(KAppId4Value,KProfileIdValue); |
|
1401 } |
|
1402 |
|
1403 iTestTimer = CTestTimer::NewL(*this); |
|
1404 iTestTimer->After(15); |
|
1405 CActiveScheduler::Start(); |
|
1406 if (iStopApp ) |
|
1407 { |
|
1408 _LIT( KDescription , "TerminateApp Command For Device Locked Condition handled successfully"); |
|
1409 aResult.SetResult( KErrNone, KDescription ); |
|
1410 iLog->Log( KDescription ); |
|
1411 } |
|
1412 else |
|
1413 { |
|
1414 aResult.iResult = KErrGeneral; |
|
1415 _LIT( KDescription , "TerminateApp Command For Device Locked Condition handling Failed"); |
|
1416 aResult.SetResult( KErrNone, KDescription ); |
|
1417 iLog->Log( KDescription ); |
|
1418 } |
|
1419 delete iDiscoveryTestTimer; |
|
1420 iDiscoveryTestTimer = NULL; |
|
1421 delete iTestTimer; |
|
1422 iTestTimer = NULL; |
|
1423 REComSession::FinalClose(); |
|
1424 return KErrNone; |
|
1425 } |
|
1426 |
|
1427 TInt CTmServerTest::HandleGetAppStatusActionL ( TTestResult& aResult ) |
|
1428 { |
|
1429 _LIT( KLogInfo, "Handle GetAppStatus Command" ); |
|
1430 iLog->Log( KLogInfo ); |
|
1431 |
|
1432 iTmServerDeviceType = ETrue; |
|
1433 |
|
1434 //Sets the information associated with the terminal mode server device |
|
1435 SetTmServerSettingsL(); |
|
1436 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
1437 |
|
1438 //Register all the desired applications |
|
1439 RegisterApplicationsL(*iTmServer); |
|
1440 |
|
1441 //Start the tmserver device and its services |
|
1442 iTmServer->StartL(); |
|
1443 |
|
1444 //Start the control point and search for device |
|
1445 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
1446 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
1447 iDiscoveryTestTimer->AfterDiscovery(15); |
|
1448 CActiveScheduler::Start(); |
|
1449 |
|
1450 if ( iDeviceVerified ) |
|
1451 { |
|
1452 //Retrieve the status of application |
|
1453 iSearchDevice->GetAppStatusActionL( KAppId1Value ); |
|
1454 } |
|
1455 |
|
1456 iTestTimer = CTestTimer::NewL(*this); |
|
1457 iTestTimer->After(15); |
|
1458 CActiveScheduler::Start(); |
|
1459 |
|
1460 if (iGetAppStatus) |
|
1461 { |
|
1462 _LIT( KDescription , "GetAppStatus Command handled successfully"); |
|
1463 aResult.SetResult( KErrNone, KDescription ); |
|
1464 iLog->Log( KDescription ); |
|
1465 } |
|
1466 else |
|
1467 { |
|
1468 aResult.iResult = KErrGeneral; |
|
1469 _LIT( KDescription , "GetAppStatus Command handling Failed"); |
|
1470 aResult.SetResult( KErrNone, KDescription ); |
|
1471 iLog->Log( KDescription ); |
|
1472 } |
|
1473 delete iDiscoveryTestTimer; |
|
1474 iDiscoveryTestTimer = NULL; |
|
1475 delete iTestTimer; |
|
1476 iTestTimer = NULL; |
|
1477 REComSession::FinalClose(); |
|
1478 return KErrNone; |
|
1479 } |
|
1480 |
|
1481 TInt CTmServerTest::HandleWildcardGetAppStatusActionL( TTestResult& aResult ) |
|
1482 { |
|
1483 _LIT( KLogInfo, "Handle GetAppStatus Command For All the Applications" ); |
|
1484 iLog->Log( KLogInfo ); |
|
1485 |
|
1486 iTmServerDeviceType = ETrue; |
|
1487 |
|
1488 //Sets the information associated with the terminal mode server device |
|
1489 SetTmServerSettingsL(); |
|
1490 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
1491 |
|
1492 //Register all the desired applications |
|
1493 RegisterApplicationsL(*iTmServer); |
|
1494 |
|
1495 //Start the tmserver device and its services |
|
1496 iTmServer->StartL(); |
|
1497 |
|
1498 //Start the control point and search for device |
|
1499 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
1500 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
1501 iDiscoveryTestTimer->AfterDiscovery(15); |
|
1502 CActiveScheduler::Start(); |
|
1503 |
|
1504 if ( iDeviceVerified ) |
|
1505 { |
|
1506 //Retrieve the status of all the application |
|
1507 iSearchDevice->GetAppStatusActionL( KAppId5Value ); |
|
1508 } |
|
1509 |
|
1510 iTestTimer = CTestTimer::NewL(*this); |
|
1511 iTestTimer->After(15); |
|
1512 CActiveScheduler::Start(); |
|
1513 |
|
1514 if (iGetAppStatus) |
|
1515 { |
|
1516 _LIT( KDescription , "GetAppStatus Command handled successfully"); |
|
1517 aResult.SetResult( KErrNone, KDescription ); |
|
1518 iLog->Log( KDescription ); |
|
1519 } |
|
1520 else |
|
1521 { |
|
1522 aResult.iResult = KErrGeneral; |
|
1523 _LIT( KDescription , "GetAppStatus Command handling Failed"); |
|
1524 aResult.SetResult( KErrNone, KDescription ); |
|
1525 iLog->Log( KDescription ); |
|
1526 } |
|
1527 delete iDiscoveryTestTimer; |
|
1528 iDiscoveryTestTimer = NULL; |
|
1529 delete iTestTimer; |
|
1530 iTestTimer = NULL; |
|
1531 REComSession::FinalClose(); |
|
1532 return KErrNone; |
|
1533 } |
|
1534 |
|
1535 |
|
1536 TInt CTmServerTest::HandleInvalidAppIdGetAppStatusActionL ( TTestResult& aResult ) |
|
1537 { |
|
1538 _LIT( KLogInfo, "Handle GetAppStatus Command For Invalid AppId" ); |
|
1539 iLog->Log( KLogInfo ); |
|
1540 |
|
1541 iTmServerDeviceType = ETrue; |
|
1542 |
|
1543 //Sets the information associated with the terminal mode server device |
|
1544 SetTmServerSettingsL(); |
|
1545 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
1546 |
|
1547 //Register all the desired applications |
|
1548 RegisterApplicationsL(*iTmServer); |
|
1549 |
|
1550 //Start the tmserver device and its services |
|
1551 iTmServer->StartL(); |
|
1552 |
|
1553 //Start the control point and search for device |
|
1554 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
1555 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
1556 iDiscoveryTestTimer->AfterDiscovery(15); |
|
1557 CActiveScheduler::Start(); |
|
1558 |
|
1559 if ( iDeviceVerified ) |
|
1560 { |
|
1561 //Retrieve the status of the application by specifying invalid appId |
|
1562 iSearchDevice->GetAppStatusActionL( KInvalidAppIdValue ); |
|
1563 } |
|
1564 |
|
1565 iTestTimer = CTestTimer::NewL(*this); |
|
1566 iTestTimer->After(15); |
|
1567 CActiveScheduler::Start(); |
|
1568 |
|
1569 if (iGetAppStatus) |
|
1570 { |
|
1571 _LIT( KDescription , "GetAppStatus Command with invalid AppId handled successfully"); |
|
1572 aResult.SetResult( KErrNone, KDescription ); |
|
1573 iLog->Log( KDescription ); |
|
1574 } |
|
1575 else |
|
1576 { |
|
1577 aResult.iResult = KErrGeneral; |
|
1578 _LIT( KDescription , "GetAppStatus Command with invalid AppId handling Failed"); |
|
1579 aResult.SetResult( KErrNone, KDescription ); |
|
1580 iLog->Log( KDescription ); |
|
1581 } |
|
1582 delete iDiscoveryTestTimer; |
|
1583 iDiscoveryTestTimer = NULL; |
|
1584 delete iTestTimer; |
|
1585 iTestTimer = NULL; |
|
1586 REComSession::FinalClose(); |
|
1587 return KErrNone; |
|
1588 } |
|
1589 |
|
1590 TInt CTmServerTest::HandleNonExistentGetAppStatusActionL( TTestResult& aResult ) |
|
1591 { |
|
1592 _LIT( KLogInfo, "Handle GetAppStatus Command For Non-Existent AppID" ); |
|
1593 iLog->Log( KLogInfo ); |
|
1594 |
|
1595 iTmServerDeviceType = ETrue; |
|
1596 |
|
1597 //Sets the information associated with the terminal mode server device |
|
1598 SetTmServerSettingsL(); |
|
1599 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
1600 |
|
1601 //Register all the desired applications |
|
1602 RegisterApplicationsL(*iTmServer); |
|
1603 |
|
1604 //Start the tmserver device and its services |
|
1605 iTmServer->StartL(); |
|
1606 |
|
1607 //Start the control point and search for device |
|
1608 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
1609 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
1610 iDiscoveryTestTimer->AfterDiscovery(15); |
|
1611 CActiveScheduler::Start(); |
|
1612 |
|
1613 if ( iDeviceVerified ) |
|
1614 { |
|
1615 //Retrieve the status of the application by specifying non existent appId |
|
1616 iSearchDevice->GetAppStatusActionL( KNonExistentAppIdValue ); |
|
1617 } |
|
1618 |
|
1619 iTestTimer = CTestTimer::NewL(*this); |
|
1620 iTestTimer->After(15); |
|
1621 CActiveScheduler::Start(); |
|
1622 |
|
1623 if (iGetAppStatus) |
|
1624 { |
|
1625 _LIT( KDescription , "GetAppStatus Command for Non-Existent App ID handled successfully"); |
|
1626 aResult.SetResult( KErrNone, KDescription ); |
|
1627 iLog->Log( KDescription ); |
|
1628 } |
|
1629 else |
|
1630 { |
|
1631 aResult.iResult = KErrGeneral; |
|
1632 _LIT( KDescription , "GetAppStatus Command handling for Non-Existent App ID Failed"); |
|
1633 aResult.SetResult( KErrNone, KDescription ); |
|
1634 iLog->Log( KDescription ); |
|
1635 } |
|
1636 delete iDiscoveryTestTimer; |
|
1637 iDiscoveryTestTimer = NULL; |
|
1638 delete iTestTimer; |
|
1639 iTestTimer = NULL; |
|
1640 REComSession::FinalClose(); |
|
1641 return KErrNone; |
|
1642 } |
|
1643 |
|
1644 TInt CTmServerTest::HandleEventAppStatusUpdateL( TTestResult& aResult ) |
|
1645 { |
|
1646 _LIT( KLogInfo, "Handle Event For AppStatus Update" ); |
|
1647 iLog->Log( KLogInfo ); |
|
1648 |
|
1649 iTmServerDeviceType = ETrue; |
|
1650 //Sets the information associated with the terminal mode server device |
|
1651 SetTmServerSettingsL(); |
|
1652 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
1653 |
|
1654 //Register all the desired applications |
|
1655 RegisterApplicationsL(*iTmServer); |
|
1656 |
|
1657 //Start the tmserver device and its services |
|
1658 iTmServer ->StartL(); |
|
1659 |
|
1660 //Start the control point and search for device |
|
1661 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
1662 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
1663 iDiscoveryTestTimer->AfterDiscovery(15); |
|
1664 CActiveScheduler::Start(); |
|
1665 |
|
1666 if ( iDeviceVerified ) |
|
1667 { |
|
1668 //Subscribes to a service |
|
1669 iSearchDevice->SubscribeToServiceL(); |
|
1670 } |
|
1671 RArray<TUint> updatedAppIdList; |
|
1672 updatedAppIdList.Append(KAppId1Value); |
|
1673 updatedAppIdList.Append(KAppId2Value); |
|
1674 |
|
1675 //Update the status of applications which have undergone some change |
|
1676 iTmServer->UpdateAppStatusL(updatedAppIdList); |
|
1677 |
|
1678 iTestTimer = CTestTimer::NewL(*this); |
|
1679 iTestTimer->After(15); |
|
1680 CActiveScheduler::Start(); |
|
1681 |
|
1682 if ( iStatusNotified ) |
|
1683 { |
|
1684 _LIT( KDescription , "Handle Event For AppStatus Update handled successfully"); |
|
1685 aResult.SetResult( KErrNone, KDescription ); |
|
1686 iLog->Log( KDescription ); |
|
1687 } |
|
1688 else |
|
1689 { |
|
1690 aResult.iResult = KErrGeneral; |
|
1691 _LIT( KDescription , "Handle Event For AppStatus Update handling Failed"); |
|
1692 aResult.SetResult( KErrNone, KDescription ); |
|
1693 iLog->Log( KDescription ); |
|
1694 } |
|
1695 updatedAppIdList.Close(); |
|
1696 delete iDiscoveryTestTimer; |
|
1697 iDiscoveryTestTimer = NULL; |
|
1698 delete iTestTimer; |
|
1699 iTestTimer = NULL; |
|
1700 REComSession::FinalClose(); |
|
1701 return KErrNone; |
|
1702 } |
|
1703 |
|
1704 TInt CTmServerTest::HandleEventAppListUpdateL( TTestResult& aResult ) |
|
1705 { |
|
1706 _LIT( KLogInfo, "Handle Event For AppList Update" ); |
|
1707 iLog->Log( KLogInfo ); |
|
1708 |
|
1709 iTmServerDeviceType = ETrue; |
|
1710 //Sets the information associated with the terminal mode server device |
|
1711 SetTmServerSettingsL(); |
|
1712 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
1713 |
|
1714 //Register all the desired applications |
|
1715 RegisterApplicationsL(*iTmServer); |
|
1716 |
|
1717 //Start the tmserver device and its services |
|
1718 iTmServer ->StartL(); |
|
1719 |
|
1720 //Start the control point and search for device |
|
1721 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
1722 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
1723 iDiscoveryTestTimer->AfterDiscovery(15); |
|
1724 CActiveScheduler::Start(); |
|
1725 |
|
1726 if ( iDeviceVerified ) |
|
1727 { |
|
1728 //Subscribes to a service |
|
1729 iSearchDevice->SubscribeToServiceL(); |
|
1730 } |
|
1731 |
|
1732 TInt errorCode; |
|
1733 CUpnpRemotableApp& aRemotableApp = iTmServer->GetRemotableApp(KAppIdValue ,errorCode ); |
|
1734 if (errorCode == KErrNone) |
|
1735 { |
|
1736 _LIT8(KAppDesc, "Mobile Device Display"); |
|
1737 aRemotableApp.SetAppDescriptionL(KAppDesc()); |
|
1738 } |
|
1739 RArray<TUint> updatedAppIdList; |
|
1740 updatedAppIdList.Append(KAppIdValue); |
|
1741 updatedAppIdList.Append(KAppId2Value); |
|
1742 |
|
1743 //Update the list of applications which have been modified to/from the list |
|
1744 iTmServer->UpdateAppListL(updatedAppIdList); |
|
1745 iTestTimer = CTestTimer::NewL(*this); |
|
1746 iTestTimer->After(15); |
|
1747 CActiveScheduler::Start(); |
|
1748 |
|
1749 if ( iStatusNotified ) |
|
1750 { |
|
1751 _LIT( KDescription , "Handle Event For AppList Update handled successfully"); |
|
1752 aResult.SetResult( KErrNone, KDescription ); |
|
1753 iLog->Log( KDescription ); |
|
1754 } |
|
1755 else |
|
1756 { |
|
1757 aResult.iResult = KErrGeneral; |
|
1758 _LIT( KDescription , "Handle Event For AppList Update handling Failed"); |
|
1759 aResult.SetResult( KErrNone, KDescription ); |
|
1760 iLog->Log( KDescription ); |
|
1761 } |
|
1762 updatedAppIdList.Close(); |
|
1763 delete iDiscoveryTestTimer; |
|
1764 iDiscoveryTestTimer = NULL; |
|
1765 delete iTestTimer; |
|
1766 iTestTimer = NULL; |
|
1767 REComSession::FinalClose(); |
|
1768 return KErrNone; |
|
1769 } |
|
1770 |
|
1771 TInt CTmServerTest::HandleGetAppListActionFilter1L ( TTestResult& aResult ) |
|
1772 { |
|
1773 _LIT( KLogInfo, "Handle GetAppList Command with Filter1" ); |
|
1774 iLog->Log( KLogInfo ); |
|
1775 |
|
1776 iTmServerDeviceType = ETrue; |
|
1777 |
|
1778 //Sets the information associated with the terminal mode server device |
|
1779 SetTmServerSettingsL(); |
|
1780 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
1781 |
|
1782 //Register all the desired applications |
|
1783 RegisterApplicationsL(*iTmServer); |
|
1784 |
|
1785 //Start the tmserver device and its services |
|
1786 iTmServer->StartL(); |
|
1787 |
|
1788 //Start the control point and search for device |
|
1789 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
1790 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
1791 iDiscoveryTestTimer->AfterDiscovery(15); |
|
1792 CActiveScheduler::Start(); |
|
1793 |
|
1794 if ( iDeviceVerified ) |
|
1795 { |
|
1796 //Retrieve the list of applications by specifying filter value |
|
1797 iSearchDevice->GetAppListActionL(KAppListFilterValue1(),KProfileIdValue); |
|
1798 } |
|
1799 |
|
1800 iTestTimer = CTestTimer::NewL(*this); |
|
1801 iTestTimer->After(15); |
|
1802 CActiveScheduler::Start(); |
|
1803 if (iGetAppList) |
|
1804 { |
|
1805 _LIT( KDescription , "GetAppList Command with Filter1 handled successfully"); |
|
1806 aResult.SetResult( KErrNone, KDescription ); |
|
1807 iLog->Log( KDescription ); |
|
1808 } |
|
1809 else |
|
1810 { |
|
1811 aResult.iResult = KErrGeneral; |
|
1812 _LIT( KDescription , "GetAppList Command with Filter1 handling Failed"); |
|
1813 aResult.SetResult( KErrNone, KDescription ); |
|
1814 iLog->Log( KDescription ); |
|
1815 } |
|
1816 delete iDiscoveryTestTimer; |
|
1817 iDiscoveryTestTimer = NULL; |
|
1818 delete iTestTimer; |
|
1819 iTestTimer = NULL; |
|
1820 REComSession::FinalClose(); |
|
1821 return KErrNone; |
|
1822 } |
|
1823 |
|
1824 TInt CTmServerTest::HandleGetAppListActionFilter2L ( TTestResult& aResult ) |
|
1825 { |
|
1826 _LIT( KLogInfo, "Handle GetAppList with Filter2 Command" ); |
|
1827 iLog->Log( KLogInfo ); |
|
1828 |
|
1829 iTmServerDeviceType = ETrue; |
|
1830 |
|
1831 //Sets the information associated with the terminal mode server device |
|
1832 SetTmServerSettingsL(); |
|
1833 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
1834 |
|
1835 //Register all the desired applications |
|
1836 RegisterApplicationsL(*iTmServer); |
|
1837 |
|
1838 //Start the tmserver device and its services |
|
1839 iTmServer->StartL(); |
|
1840 |
|
1841 //Start the control point and search for device |
|
1842 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
1843 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
1844 iDiscoveryTestTimer->AfterDiscovery(15); |
|
1845 CActiveScheduler::Start(); |
|
1846 |
|
1847 if ( iDeviceVerified ) |
|
1848 { |
|
1849 //Retrieve the list of applications by specifying filter value |
|
1850 iSearchDevice->GetAppListActionL(KAppListFilterValue2(),KProfileIdValue); |
|
1851 } |
|
1852 |
|
1853 iTestTimer = CTestTimer::NewL(*this); |
|
1854 iTestTimer->After(15); |
|
1855 CActiveScheduler::Start(); |
|
1856 if (iGetAppList) |
|
1857 { |
|
1858 _LIT( KDescription , "GetAppList Command with Filter2 handled successfully"); |
|
1859 aResult.SetResult( KErrNone, KDescription ); |
|
1860 iLog->Log( KDescription ); |
|
1861 } |
|
1862 else |
|
1863 { |
|
1864 aResult.iResult = KErrGeneral; |
|
1865 _LIT( KDescription , "GetAppList Command with Filter2 handling Failed"); |
|
1866 aResult.SetResult( KErrNone, KDescription ); |
|
1867 iLog->Log( KDescription ); |
|
1868 } |
|
1869 delete iDiscoveryTestTimer; |
|
1870 iDiscoveryTestTimer = NULL; |
|
1871 delete iTestTimer; |
|
1872 iTestTimer = NULL; |
|
1873 REComSession::FinalClose(); |
|
1874 return KErrNone; |
|
1875 } |
|
1876 |
|
1877 TInt CTmServerTest::HandleGetAppListActionFilter3L ( TTestResult& aResult ) |
|
1878 { |
|
1879 _LIT( KLogInfo, "Handle GetAppList with Filter3 Command" ); |
|
1880 iLog->Log( KLogInfo ); |
|
1881 |
|
1882 iTmServerDeviceType = ETrue; |
|
1883 |
|
1884 //Sets the information associated with the terminal mode server device |
|
1885 SetTmServerSettingsL(); |
|
1886 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
1887 |
|
1888 //Register all the desired applications |
|
1889 RegisterApplicationsL(*iTmServer); |
|
1890 |
|
1891 //Start the tmserver device and its services |
|
1892 iTmServer->StartL(); |
|
1893 |
|
1894 //Start the control point and search for device |
|
1895 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
1896 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
1897 iDiscoveryTestTimer->AfterDiscovery(15); |
|
1898 CActiveScheduler::Start(); |
|
1899 |
|
1900 if ( iDeviceVerified ) |
|
1901 { |
|
1902 //Retrieve the list of applications by specifying filter value |
|
1903 iSearchDevice->GetAppListActionL(KAppListFilterValue3(),KProfileIdValue); |
|
1904 } |
|
1905 |
|
1906 iTestTimer = CTestTimer::NewL(*this); |
|
1907 iTestTimer->After(15); |
|
1908 CActiveScheduler::Start(); |
|
1909 if (iGetAppList) |
|
1910 { |
|
1911 _LIT( KDescription , "GetAppList Command with Filter3 handled successfully"); |
|
1912 aResult.SetResult( KErrNone, KDescription ); |
|
1913 iLog->Log( KDescription ); |
|
1914 } |
|
1915 else |
|
1916 { |
|
1917 aResult.iResult = KErrGeneral; |
|
1918 _LIT( KDescription , "GetAppList Command with Filter3 handling Failed"); |
|
1919 aResult.SetResult( KErrNone, KDescription ); |
|
1920 iLog->Log( KDescription ); |
|
1921 } |
|
1922 delete iDiscoveryTestTimer; |
|
1923 iDiscoveryTestTimer = NULL; |
|
1924 delete iTestTimer; |
|
1925 iTestTimer = NULL; |
|
1926 REComSession::FinalClose(); |
|
1927 return KErrNone; |
|
1928 } |
|
1929 |
|
1930 TInt CTmServerTest::HandleGetAppListActionFilter4L ( TTestResult& aResult ) |
|
1931 { |
|
1932 _LIT( KLogInfo, "Handle GetAppList with Filter4 Command" ); |
|
1933 iLog->Log( KLogInfo ); |
|
1934 |
|
1935 iTmServerDeviceType = ETrue; |
|
1936 |
|
1937 //Sets the information associated with the terminal mode server device |
|
1938 SetTmServerSettingsL(); |
|
1939 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
1940 |
|
1941 //Register all the desired applications |
|
1942 RegisterApplicationsL(*iTmServer); |
|
1943 |
|
1944 //Start the tmserver device and its services |
|
1945 iTmServer->StartL(); |
|
1946 |
|
1947 //Start the control point and search for device |
|
1948 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
1949 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
1950 iDiscoveryTestTimer->AfterDiscovery(15); |
|
1951 CActiveScheduler::Start(); |
|
1952 |
|
1953 if ( iDeviceVerified ) |
|
1954 { |
|
1955 //Retrieve the list of applications by specifying filter value |
|
1956 iSearchDevice->GetAppListActionL(KAppListFilterValue4(),KProfileIdValue); |
|
1957 } |
|
1958 |
|
1959 iTestTimer = CTestTimer::NewL(*this); |
|
1960 iTestTimer->After(15); |
|
1961 CActiveScheduler::Start(); |
|
1962 if (iGetAppList) |
|
1963 { |
|
1964 _LIT( KDescription , "GetAppList Command with Filter4 handled successfully"); |
|
1965 aResult.SetResult( KErrNone, KDescription ); |
|
1966 iLog->Log( KDescription ); |
|
1967 } |
|
1968 else |
|
1969 { |
|
1970 aResult.iResult = KErrGeneral; |
|
1971 _LIT( KDescription , "GetAppList Command with Filter4 handling Failed"); |
|
1972 aResult.SetResult( KErrNone, KDescription ); |
|
1973 iLog->Log( KDescription ); |
|
1974 } |
|
1975 delete iDiscoveryTestTimer; |
|
1976 iDiscoveryTestTimer = NULL; |
|
1977 delete iTestTimer; |
|
1978 iTestTimer = NULL; |
|
1979 REComSession::FinalClose(); |
|
1980 return KErrNone; |
|
1981 } |
|
1982 |
|
1983 TInt CTmServerTest::HandleGetAppListActionInvalidArg1L ( TTestResult& aResult ) |
|
1984 { |
|
1985 _LIT( KLogInfo, "Handle GetAppList Command with Invalid Arg1" ); |
|
1986 iLog->Log( KLogInfo ); |
|
1987 |
|
1988 iTmServerDeviceType = ETrue; |
|
1989 |
|
1990 //Sets the information associated with the terminal mode server device |
|
1991 SetTmServerSettingsL(); |
|
1992 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
1993 |
|
1994 //Register all the desired applications |
|
1995 RegisterApplicationsL(*iTmServer); |
|
1996 |
|
1997 //Start the tmserver device and its services |
|
1998 iTmServer->StartL(); |
|
1999 |
|
2000 //Start the control point and search for device |
|
2001 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
2002 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
2003 iDiscoveryTestTimer->AfterDiscovery(15); |
|
2004 CActiveScheduler::Start(); |
|
2005 |
|
2006 if ( iDeviceVerified ) |
|
2007 { |
|
2008 _LIT8(KInvalidFilter1,"\"name=\"*Audio*\"" ); |
|
2009 //Retrieve the list of applications by specifying invalid filter value |
|
2010 iSearchDevice->GetAppListActionL(KInvalidFilter1(),KProfileIdValue); |
|
2011 } |
|
2012 |
|
2013 iTestTimer = CTestTimer::NewL(*this); |
|
2014 iTestTimer->After(15); |
|
2015 CActiveScheduler::Start(); |
|
2016 if (iGetAppList) |
|
2017 { |
|
2018 _LIT( KDescription , "GetAppList Command with Invalid Arg1 handled successfully"); |
|
2019 aResult.SetResult( KErrNone, KDescription ); |
|
2020 iLog->Log( KDescription ); |
|
2021 } |
|
2022 else |
|
2023 { |
|
2024 aResult.iResult = KErrGeneral; |
|
2025 _LIT( KDescription , "GetAppList Command with Invalid Arg1 handling Failed"); |
|
2026 aResult.SetResult( KErrNone, KDescription ); |
|
2027 iLog->Log( KDescription ); |
|
2028 } |
|
2029 delete iDiscoveryTestTimer; |
|
2030 iDiscoveryTestTimer = NULL; |
|
2031 delete iTestTimer; |
|
2032 iTestTimer = NULL; |
|
2033 REComSession::FinalClose(); |
|
2034 return KErrNone; |
|
2035 } |
|
2036 |
|
2037 |
|
2038 TInt CTmServerTest::HandleGetAppListActionInvalidArg2L ( TTestResult& aResult ) |
|
2039 { |
|
2040 _LIT( KLogInfo, "Handle GetAppList Command with Invalid Arg2" ); |
|
2041 iLog->Log( KLogInfo ); |
|
2042 |
|
2043 iTmServerDeviceType = ETrue; |
|
2044 |
|
2045 //Sets the information associated with the terminal mode server device |
|
2046 SetTmServerSettingsL(); |
|
2047 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
2048 |
|
2049 //Register all the desired applications |
|
2050 RegisterApplicationsL(*iTmServer); |
|
2051 |
|
2052 //Start the tmserver device and its services |
|
2053 iTmServer->StartL(); |
|
2054 |
|
2055 //Start the control point and search for device |
|
2056 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
2057 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
2058 iDiscoveryTestTimer->AfterDiscovery(15); |
|
2059 CActiveScheduler::Start(); |
|
2060 |
|
2061 if ( iDeviceVerified ) |
|
2062 { |
|
2063 _LIT8(KInvalidFilter2, "\"name=\"*nav*\",appInfo=\"*\"\""); |
|
2064 //Retrieve the list of applications by specifying invalid filter value |
|
2065 iSearchDevice->GetAppListActionL(KInvalidFilter2(),KProfileIdValue); |
|
2066 } |
|
2067 |
|
2068 iTestTimer = CTestTimer::NewL(*this); |
|
2069 iTestTimer->After(15); |
|
2070 CActiveScheduler::Start(); |
|
2071 if (iGetAppList) |
|
2072 { |
|
2073 _LIT( KDescription , "GetAppList Command with Invalid Arg2 handled successfully"); |
|
2074 aResult.SetResult( KErrNone, KDescription ); |
|
2075 iLog->Log( KDescription ); |
|
2076 } |
|
2077 else |
|
2078 { |
|
2079 aResult.iResult = KErrGeneral; |
|
2080 _LIT( KDescription , "GetAppList Command with Invalid Arg2 handling Failed"); |
|
2081 aResult.SetResult( KErrNone, KDescription ); |
|
2082 iLog->Log( KDescription ); |
|
2083 } |
|
2084 delete iDiscoveryTestTimer; |
|
2085 iDiscoveryTestTimer = NULL; |
|
2086 delete iTestTimer; |
|
2087 iTestTimer = NULL; |
|
2088 REComSession::FinalClose(); |
|
2089 return KErrNone; |
|
2090 } |
|
2091 |
|
2092 TInt CTmServerTest::HandleGetAppListActionInvalidArg3L ( TTestResult& aResult ) |
|
2093 { |
|
2094 _LIT( KLogInfo, "Handle GetAppList Command with Invalid Arg3" ); |
|
2095 iLog->Log( KLogInfo ); |
|
2096 |
|
2097 iTmServerDeviceType = ETrue; |
|
2098 //Sets the information associated with the terminal mode server device |
|
2099 SetTmServerSettingsL(); |
|
2100 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
2101 |
|
2102 //Register all the desired applications |
|
2103 RegisterApplicationsL(*iTmServer); |
|
2104 |
|
2105 //Start the tmserver device and its services |
|
2106 iTmServer->StartL(); |
|
2107 |
|
2108 //Start the control point and search for device |
|
2109 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
2110 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
2111 iDiscoveryTestTimer->AfterDiscovery(15); |
|
2112 CActiveScheduler::Start(); |
|
2113 |
|
2114 if ( iDeviceVerified ) |
|
2115 { |
|
2116 _LIT8(KInvalidFilter3, "\"name=\"*Audio*\",@audioType=\"*\"\""); |
|
2117 //Retrieve the list of applications by specifying invalid filter value |
|
2118 iSearchDevice->GetAppListActionL(KInvalidFilter3(),KProfileIdValue); |
|
2119 } |
|
2120 |
|
2121 iTestTimer = CTestTimer::NewL(*this); |
|
2122 iTestTimer->After(15); |
|
2123 CActiveScheduler::Start(); |
|
2124 if (iGetAppList) |
|
2125 { |
|
2126 _LIT( KDescription , "GetAppList Command with Invalid Arg3 handled successfully"); |
|
2127 aResult.SetResult( KErrNone, KDescription ); |
|
2128 iLog->Log( KDescription ); |
|
2129 } |
|
2130 else |
|
2131 { |
|
2132 aResult.iResult = KErrGeneral; |
|
2133 _LIT( KDescription , "GetAppList Command with Invalid Arg3 handling Failed"); |
|
2134 aResult.SetResult( KErrNone, KDescription ); |
|
2135 iLog->Log( KDescription ); |
|
2136 } |
|
2137 delete iDiscoveryTestTimer; |
|
2138 iDiscoveryTestTimer = NULL; |
|
2139 delete iTestTimer; |
|
2140 iTestTimer = NULL; |
|
2141 REComSession::FinalClose(); |
|
2142 return KErrNone; |
|
2143 } |
|
2144 |
|
2145 TInt CTmServerTest::HandleGetAppListActionInvalidArg4L ( TTestResult& aResult ) |
|
2146 { |
|
2147 _LIT( KLogInfo, "Handle GetAppList Command with Invalid Arg4" ); |
|
2148 iLog->Log( KLogInfo ); |
|
2149 |
|
2150 iTmServerDeviceType = ETrue; |
|
2151 //Sets the information associated with the terminal mode server device |
|
2152 SetTmServerSettingsL(); |
|
2153 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
2154 |
|
2155 //Register all the desired applications |
|
2156 RegisterApplicationsL(*iTmServer); |
|
2157 |
|
2158 //Start the tmserver device and its services |
|
2159 iTmServer->StartL(); |
|
2160 |
|
2161 //Start the control point and search for device |
|
2162 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
2163 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
2164 iDiscoveryTestTimer->AfterDiscovery(15); |
|
2165 CActiveScheduler::Start(); |
|
2166 |
|
2167 if ( iDeviceVerified ) |
|
2168 { |
|
2169 _LIT8(KInvalidFilter4, "\"icon@mimetype\"*svg+xml*\"\""); |
|
2170 //Retrieve the list of applications by specifying invalid filter value |
|
2171 iSearchDevice->GetAppListActionL(KInvalidFilter4(),KProfileIdValue); |
|
2172 } |
|
2173 |
|
2174 iTestTimer = CTestTimer::NewL(*this); |
|
2175 iTestTimer->After(15); |
|
2176 CActiveScheduler::Start(); |
|
2177 if (iGetAppList) |
|
2178 { |
|
2179 _LIT( KDescription , "GetAppList Command with Invalid Arg4 handled successfully"); |
|
2180 aResult.SetResult( KErrNone, KDescription ); |
|
2181 iLog->Log( KDescription ); |
|
2182 } |
|
2183 else |
|
2184 { |
|
2185 aResult.iResult = KErrGeneral; |
|
2186 _LIT( KDescription , "GetAppList Command with Invalid Arg4 handling Failed"); |
|
2187 aResult.SetResult( KErrNone, KDescription ); |
|
2188 iLog->Log( KDescription ); |
|
2189 } |
|
2190 delete iDiscoveryTestTimer; |
|
2191 iDiscoveryTestTimer = NULL; |
|
2192 delete iTestTimer; |
|
2193 iTestTimer = NULL; |
|
2194 REComSession::FinalClose(); |
|
2195 return KErrNone; |
|
2196 } |
|
2197 |
|
2198 TInt CTmServerTest::HandleGetAppListActionInvalidArg5L ( TTestResult& aResult ) |
|
2199 { |
|
2200 _LIT( KLogInfo, "Handle GetAppList Command with Invalid Arg5" ); |
|
2201 iLog->Log( KLogInfo ); |
|
2202 |
|
2203 iTmServerDeviceType = ETrue; |
|
2204 //Sets the information associated with the terminal mode server device |
|
2205 SetTmServerSettingsL(); |
|
2206 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
2207 |
|
2208 //Register all the desired applications |
|
2209 RegisterApplicationsL(*iTmServer); |
|
2210 |
|
2211 //Start the tmserver device and its services |
|
2212 iTmServer->StartL(); |
|
2213 |
|
2214 //Start the control point and search for device |
|
2215 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
2216 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
2217 iDiscoveryTestTimer->AfterDiscovery(15); |
|
2218 CActiveScheduler::Start(); |
|
2219 |
|
2220 if ( iDeviceVerified ) |
|
2221 { |
|
2222 _LIT8(KInvalidFilter5, "\"name=\"*nav*\"appInfo@appCategory=\"*\"\""); |
|
2223 //Retrieve the list of applications by specifying invalid filter value |
|
2224 iSearchDevice->GetAppListActionL(KInvalidFilter5(),KProfileIdValue); |
|
2225 } |
|
2226 |
|
2227 iTestTimer = CTestTimer::NewL(*this); |
|
2228 iTestTimer->After(15); |
|
2229 CActiveScheduler::Start(); |
|
2230 if (iGetAppList) |
|
2231 { |
|
2232 _LIT( KDescription , "GetAppList Command with Invalid Arg5 handled successfully"); |
|
2233 aResult.SetResult( KErrNone, KDescription ); |
|
2234 iLog->Log( KDescription ); |
|
2235 } |
|
2236 else |
|
2237 { |
|
2238 aResult.iResult = KErrGeneral; |
|
2239 _LIT( KDescription , "GetAppList Command with Invalid Arg5 handling Failed"); |
|
2240 aResult.SetResult( KErrNone, KDescription ); |
|
2241 iLog->Log( KDescription ); |
|
2242 } |
|
2243 delete iDiscoveryTestTimer; |
|
2244 iDiscoveryTestTimer = NULL; |
|
2245 delete iTestTimer; |
|
2246 iTestTimer = NULL; |
|
2247 REComSession::FinalClose(); |
|
2248 return KErrNone; |
|
2249 } |
|
2250 |
|
2251 TInt CTmServerTest::HandleGetAppListActionNoFilterL ( TTestResult& aResult ) |
|
2252 { |
|
2253 _LIT( KLogInfo, "Handle GetAppList Command With No Filter" ); |
|
2254 iLog->Log( KLogInfo ); |
|
2255 |
|
2256 iTmServerDeviceType = ETrue; |
|
2257 |
|
2258 //Sets the information associated with the terminal mode server device |
|
2259 SetTmServerSettingsL(); |
|
2260 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
2261 |
|
2262 //Register all the desired applications |
|
2263 RegisterApplicationsL(*iTmServer); |
|
2264 |
|
2265 //Start the tmserver device and its services |
|
2266 iTmServer->StartL(); |
|
2267 |
|
2268 //Start the control point and search for device |
|
2269 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
2270 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
2271 iDiscoveryTestTimer->AfterDiscovery(15); |
|
2272 CActiveScheduler::Start(); |
|
2273 |
|
2274 if ( iDeviceVerified ) |
|
2275 { |
|
2276 //Retrieve the list of applications |
|
2277 iSearchDevice->GetAppListActionL( KWildCard(),KProfileIdValue); |
|
2278 } |
|
2279 |
|
2280 iTestTimer = CTestTimer::NewL(*this); |
|
2281 iTestTimer->After(15); |
|
2282 CActiveScheduler::Start(); |
|
2283 if (iGetAppList) |
|
2284 { |
|
2285 _LIT( KDescription , "GetAppList Command With No Filter handled successfully"); |
|
2286 aResult.SetResult( KErrNone, KDescription ); |
|
2287 iLog->Log( KDescription ); |
|
2288 } |
|
2289 else |
|
2290 { |
|
2291 aResult.iResult = KErrGeneral; |
|
2292 _LIT( KDescription , "GetAppList Command With No Filter handling Failed"); |
|
2293 aResult.SetResult( KErrNone, KDescription ); |
|
2294 iLog->Log( KDescription ); |
|
2295 } |
|
2296 delete iDiscoveryTestTimer; |
|
2297 iDiscoveryTestTimer = NULL; |
|
2298 delete iTestTimer; |
|
2299 iTestTimer = NULL; |
|
2300 REComSession::FinalClose(); |
|
2301 return KErrNone; |
|
2302 } |
|
2303 |
|
2304 TInt CTmServerTest::HandleInvalidProfileIdGetAppListActionL ( TTestResult& aResult ) |
|
2305 { |
|
2306 _LIT( KLogInfo, "Handle Invalid ProfileId GetAppList Command" ); |
|
2307 iLog->Log( KLogInfo ); |
|
2308 |
|
2309 iTmServerDeviceType = ETrue; |
|
2310 |
|
2311 //Sets the information associated with the terminal mode server device |
|
2312 SetTmServerSettingsL(); |
|
2313 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
2314 |
|
2315 //Register all the desired applications |
|
2316 RegisterApplicationsL(*iTmServer); |
|
2317 |
|
2318 //Start the tmserver device and its services |
|
2319 iTmServer->StartL(); |
|
2320 |
|
2321 //Start the control point and search for device |
|
2322 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
2323 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
2324 iDiscoveryTestTimer->AfterDiscovery(15); |
|
2325 CActiveScheduler::Start(); |
|
2326 |
|
2327 if ( iDeviceVerified ) |
|
2328 { |
|
2329 //Retrieve the list of applications by specifying invalid profileId |
|
2330 iSearchDevice->GetAppListActionL(KWildCard(),KInvalidProfileIdValue); |
|
2331 } |
|
2332 |
|
2333 iTestTimer = CTestTimer::NewL(*this); |
|
2334 iTestTimer->After(15); |
|
2335 CActiveScheduler::Start(); |
|
2336 if (iGetAppList) |
|
2337 { |
|
2338 _LIT( KDescription , "GetAppList Command with invalid ProfileId handled successfully"); |
|
2339 aResult.SetResult( KErrNone, KDescription ); |
|
2340 iLog->Log( KDescription ); |
|
2341 } |
|
2342 else |
|
2343 { |
|
2344 aResult.iResult = KErrGeneral; |
|
2345 _LIT( KDescription , "GetAppList Command with invalid ProfileId handling Failed"); |
|
2346 aResult.SetResult( KErrNone, KDescription ); |
|
2347 iLog->Log( KDescription ); |
|
2348 } |
|
2349 delete iDiscoveryTestTimer; |
|
2350 iDiscoveryTestTimer = NULL; |
|
2351 delete iTestTimer; |
|
2352 iTestTimer = NULL; |
|
2353 REComSession::FinalClose(); |
|
2354 return KErrNone; |
|
2355 } |
|
2356 |
|
2357 TInt CTmServerTest::HandleGetAppListActionOperationRejectedL ( TTestResult& aResult ) |
|
2358 { |
|
2359 _LIT( KLogInfo, "Handle Operation Rejected Condition For GetAppList Command" ); |
|
2360 iLog->Log( KLogInfo ); |
|
2361 |
|
2362 iTmServerDeviceType = ETrue; |
|
2363 |
|
2364 //Sets the information associated with the terminal mode server device |
|
2365 SetTmServerSettingsL(); |
|
2366 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
2367 |
|
2368 //Register all the desired applications |
|
2369 RegisterApplicationsL(*iTmServer); |
|
2370 |
|
2371 //Start the tmserver device and its services |
|
2372 iTmServer->StartL(); |
|
2373 iOperationRejected = ETrue; |
|
2374 //Start the control point and search for device |
|
2375 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
2376 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
2377 iDiscoveryTestTimer->AfterDiscovery(15); |
|
2378 CActiveScheduler::Start(); |
|
2379 |
|
2380 if ( iDeviceVerified ) |
|
2381 { |
|
2382 //Retrieve the list of applications by specifying profileId |
|
2383 iSearchDevice->GetAppListActionL(KAppListFilterValue1(),KProfileIdValue); |
|
2384 } |
|
2385 |
|
2386 iTestTimer = CTestTimer::NewL(*this); |
|
2387 iTestTimer->After(15); |
|
2388 CActiveScheduler::Start(); |
|
2389 if (iGetAppList) |
|
2390 { |
|
2391 _LIT( KDescription , "Handle Operation Rejected Condition For GetAppList Command handled successfully"); |
|
2392 aResult.SetResult( KErrNone, KDescription ); |
|
2393 iLog->Log( KDescription ); |
|
2394 } |
|
2395 else |
|
2396 { |
|
2397 aResult.iResult = KErrGeneral; |
|
2398 _LIT( KDescription , "Handle Operation Rejected Condition For GetAppList Command handling Failed"); |
|
2399 aResult.SetResult( KErrNone, KDescription ); |
|
2400 iLog->Log( KDescription ); |
|
2401 } |
|
2402 delete iDiscoveryTestTimer; |
|
2403 iDiscoveryTestTimer = NULL; |
|
2404 delete iTestTimer; |
|
2405 iTestTimer = NULL; |
|
2406 REComSession::FinalClose(); |
|
2407 return KErrNone; |
|
2408 } |
|
2409 |
|
2410 TInt CTmServerTest::HandleSetClientProfileActionL( TTestResult& aResult ) |
|
2411 { |
|
2412 _LIT( KLogInfo, "Handle SetClientProfile Command" ); |
|
2413 iLog->Log( KLogInfo ); |
|
2414 |
|
2415 iTmServerDeviceType = ETrue; |
|
2416 |
|
2417 //Sets the information associated with the terminal mode server device |
|
2418 SetTmServerSettingsL(); |
|
2419 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
2420 |
|
2421 //Register all the desired applications |
|
2422 RegisterApplicationsL(*iTmServer); |
|
2423 |
|
2424 //Start the tmserver device and its services |
|
2425 iTmServer->StartL(); |
|
2426 |
|
2427 //Start the control point and search for device |
|
2428 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
2429 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
2430 iDiscoveryTestTimer->AfterDiscovery(15); |
|
2431 CActiveScheduler::Start(); |
|
2432 |
|
2433 if ( iDeviceVerified ) |
|
2434 { |
|
2435 // Register the client profile |
|
2436 iSearchDevice->SetClientProfileActionL(KProfileIdValue, KClientProfileInfo); |
|
2437 } |
|
2438 |
|
2439 iTestTimer = CTestTimer::NewL(*this); |
|
2440 iTestTimer->After(15); |
|
2441 CActiveScheduler::Start(); |
|
2442 |
|
2443 if (iSetClientProfile) |
|
2444 { |
|
2445 _LIT( KDescription , "SetClientProfile Command handled successfully"); |
|
2446 aResult.SetResult( KErrNone, KDescription ); |
|
2447 iLog->Log( KDescription ); |
|
2448 } |
|
2449 else |
|
2450 { |
|
2451 aResult.iResult = KErrGeneral; |
|
2452 _LIT( KDescription , "SetClientProfile Command handling Failed"); |
|
2453 aResult.SetResult( KErrNone, KDescription ); |
|
2454 iLog->Log( KDescription ); |
|
2455 } |
|
2456 delete iDiscoveryTestTimer; |
|
2457 iDiscoveryTestTimer = NULL; |
|
2458 delete iTestTimer; |
|
2459 iTestTimer = NULL; |
|
2460 iClientIconPrefArray.ResetAndDestroy(); |
|
2461 iClientIconPrefArray.Close(); |
|
2462 REComSession::FinalClose(); |
|
2463 return KErrNone; |
|
2464 } |
|
2465 |
|
2466 TInt CTmServerTest::HandleInvalidProfileIdSetClientProfileActionL ( TTestResult& aResult ) |
|
2467 { |
|
2468 _LIT( KLogInfo, "Handle Invalid ProfileId SetClientProfile Command" ); |
|
2469 iLog->Log( KLogInfo ); |
|
2470 |
|
2471 iTmServerDeviceType = ETrue; |
|
2472 |
|
2473 //Sets the information associated with the terminal mode server device |
|
2474 SetTmServerSettingsL(); |
|
2475 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
2476 |
|
2477 //Register all the desired applications |
|
2478 RegisterApplicationsL(*iTmServer); |
|
2479 |
|
2480 //Start the tmserver device and its services |
|
2481 iTmServer->StartL(); |
|
2482 |
|
2483 //Start the control point and search for device |
|
2484 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
2485 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
2486 iDiscoveryTestTimer->AfterDiscovery(15); |
|
2487 CActiveScheduler::Start(); |
|
2488 |
|
2489 if ( iDeviceVerified ) |
|
2490 { |
|
2491 //Register the client profile with invalid profileId |
|
2492 iSearchDevice->SetClientProfileActionL(KInvalidProfileIdValue, KClientProfileInfo ); |
|
2493 } |
|
2494 |
|
2495 iTestTimer = CTestTimer::NewL(*this); |
|
2496 iTestTimer->After(15); |
|
2497 CActiveScheduler::Start(); |
|
2498 |
|
2499 if (iSetClientProfile) |
|
2500 { |
|
2501 _LIT( KDescription , "SetClientProfile Command with invalid ProfileId handled successfully"); |
|
2502 aResult.SetResult( KErrNone, KDescription ); |
|
2503 iLog->Log( KDescription ); |
|
2504 } |
|
2505 else |
|
2506 { |
|
2507 aResult.iResult = KErrGeneral; |
|
2508 _LIT( KDescription , "SetClientProfile Command with invalid ProfileId handling Failed"); |
|
2509 aResult.SetResult( KErrNone, KDescription ); |
|
2510 iLog->Log( KDescription ); |
|
2511 } |
|
2512 delete iDiscoveryTestTimer; |
|
2513 iDiscoveryTestTimer = NULL; |
|
2514 delete iTestTimer; |
|
2515 iTestTimer = NULL; |
|
2516 REComSession::FinalClose(); |
|
2517 return KErrNone; |
|
2518 } |
|
2519 |
|
2520 TInt CTmServerTest::HandleInvalidProfileSetClientProfileActionL ( TTestResult& aResult ) |
|
2521 { |
|
2522 _LIT( KLogInfo, "Handle Invalid Profile SetClientProfile Command" ); |
|
2523 iLog->Log( KLogInfo ); |
|
2524 |
|
2525 iTmServerDeviceType = ETrue; |
|
2526 |
|
2527 //Sets the information associated with the terminal mode server device |
|
2528 SetTmServerSettingsL(); |
|
2529 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
2530 |
|
2531 //Register all the desired applications |
|
2532 RegisterApplicationsL(*iTmServer); |
|
2533 |
|
2534 //Start the tmserver device and its services |
|
2535 iTmServer->StartL(); |
|
2536 |
|
2537 //Start the control point and search for device |
|
2538 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
2539 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
2540 iDiscoveryTestTimer->AfterDiscovery(15); |
|
2541 CActiveScheduler::Start(); |
|
2542 |
|
2543 if ( iDeviceVerified ) |
|
2544 { |
|
2545 _LIT8(KInvalidProfile,"<clientProfile"); |
|
2546 //Register the client profile with invalid profile |
|
2547 iSearchDevice->SetClientProfileActionL(KProfileIdValue, KInvalidProfile()); |
|
2548 } |
|
2549 |
|
2550 iTestTimer = CTestTimer::NewL(*this); |
|
2551 iTestTimer->After(15); |
|
2552 CActiveScheduler::Start(); |
|
2553 |
|
2554 if (iSetClientProfile) |
|
2555 { |
|
2556 _LIT( KDescription , "SetClientProfile Command with invalid Profile handled successfully"); |
|
2557 aResult.SetResult( KErrNone, KDescription ); |
|
2558 iLog->Log( KDescription ); |
|
2559 } |
|
2560 else |
|
2561 { |
|
2562 aResult.iResult = KErrGeneral; |
|
2563 _LIT( KDescription , "SetClientProfile Command with invalid Profile handling Failed"); |
|
2564 aResult.SetResult( KErrNone, KDescription ); |
|
2565 iLog->Log( KDescription ); |
|
2566 } |
|
2567 delete iDiscoveryTestTimer; |
|
2568 iDiscoveryTestTimer = NULL; |
|
2569 delete iTestTimer; |
|
2570 iTestTimer = NULL; |
|
2571 REComSession::FinalClose(); |
|
2572 return KErrNone; |
|
2573 } |
|
2574 |
|
2575 TInt CTmServerTest::HandleDeviceLockedSetClientProfileActionL ( TTestResult& aResult ) |
|
2576 { |
|
2577 _LIT( KLogInfo, "Handle Device Locked Condition For SetClientProfile Command" ); |
|
2578 iLog->Log( KLogInfo ); |
|
2579 |
|
2580 iTmServerDeviceType = ETrue; |
|
2581 |
|
2582 //Sets the information associated with the terminal mode server device |
|
2583 SetTmServerSettingsL(); |
|
2584 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
2585 |
|
2586 //Register all the desired applications |
|
2587 RegisterApplicationsL(*iTmServer); |
|
2588 |
|
2589 //Start the tmserver device and its services |
|
2590 iTmServer->StartL(); |
|
2591 |
|
2592 //Start the control point and search for device |
|
2593 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
2594 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
2595 iDiscoveryTestTimer->AfterDiscovery(15); |
|
2596 CActiveScheduler::Start(); |
|
2597 |
|
2598 if ( iDeviceVerified ) |
|
2599 { |
|
2600 //Register the client profile |
|
2601 iSearchDevice->SetClientProfileActionL(KProfileIdValue, KDeviceLockedClientProfile()); |
|
2602 } |
|
2603 |
|
2604 iTestTimer = CTestTimer::NewL(*this); |
|
2605 iTestTimer->After(15); |
|
2606 CActiveScheduler::Start(); |
|
2607 |
|
2608 if (iSetClientProfile) |
|
2609 { |
|
2610 _LIT( KDescription , "Device Locked Condition for SetClientProfile Command handled successfully"); |
|
2611 aResult.SetResult( KErrNone, KDescription ); |
|
2612 iLog->Log( KDescription ); |
|
2613 } |
|
2614 else |
|
2615 { |
|
2616 aResult.iResult = KErrGeneral; |
|
2617 _LIT( KDescription , "Device Locked Condition for SetClientProfile Command handling Failed"); |
|
2618 aResult.SetResult( KErrNone, KDescription ); |
|
2619 iLog->Log( KDescription ); |
|
2620 } |
|
2621 delete iDiscoveryTestTimer; |
|
2622 iDiscoveryTestTimer = NULL; |
|
2623 delete iTestTimer; |
|
2624 iTestTimer = NULL; |
|
2625 REComSession::FinalClose(); |
|
2626 return KErrNone; |
|
2627 } |
|
2628 |
|
2629 TInt CTmServerTest::HandleResourceBusySetClientProfileActionL ( TTestResult& aResult ) |
|
2630 { |
|
2631 _LIT( KLogInfo, "Handle Resource Busy Condition For SetClientProfile Command" ); |
|
2632 iLog->Log( KLogInfo ); |
|
2633 |
|
2634 iTmServerDeviceType = ETrue; |
|
2635 |
|
2636 //Sets the information associated with the terminal mode server device |
|
2637 SetTmServerSettingsL(); |
|
2638 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
2639 |
|
2640 //Register all the desired applications |
|
2641 RegisterApplicationsL(*iTmServer); |
|
2642 |
|
2643 //Start the tmserver device and its services |
|
2644 iTmServer->StartL(); |
|
2645 iResourceBusy = ETrue; |
|
2646 //Start the control point and search for device |
|
2647 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
2648 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
2649 iDiscoveryTestTimer->AfterDiscovery(15); |
|
2650 CActiveScheduler::Start(); |
|
2651 |
|
2652 if ( iDeviceVerified ) |
|
2653 { |
|
2654 //Register the client profile |
|
2655 iSearchDevice->SetClientProfileActionL(KProfileIdValue, KClientProfileInfo()); |
|
2656 } |
|
2657 |
|
2658 iTestTimer = CTestTimer::NewL(*this); |
|
2659 iTestTimer->After(15); |
|
2660 CActiveScheduler::Start(); |
|
2661 |
|
2662 if (iSetClientProfile) |
|
2663 { |
|
2664 _LIT( KDescription , "Resource Busy Condition for SetClientProfile Command handled successfully"); |
|
2665 aResult.SetResult( KErrNone, KDescription ); |
|
2666 iLog->Log( KDescription ); |
|
2667 } |
|
2668 else |
|
2669 { |
|
2670 aResult.iResult = KErrGeneral; |
|
2671 _LIT( KDescription , "Resource Busy Condition for SetClientProfile Command handling Failed"); |
|
2672 aResult.SetResult( KErrNone, KDescription ); |
|
2673 iLog->Log( KDescription ); |
|
2674 } |
|
2675 delete iDiscoveryTestTimer; |
|
2676 iDiscoveryTestTimer = NULL; |
|
2677 delete iTestTimer; |
|
2678 iTestTimer = NULL; |
|
2679 REComSession::FinalClose(); |
|
2680 return KErrNone; |
|
2681 } |
|
2682 |
|
2683 TInt CTmServerTest::HandleGetClientProfileActionL( TTestResult& aResult ) |
|
2684 { |
|
2685 _LIT( KLogInfo, "Handle GetClientProfile Command" ); |
|
2686 iLog->Log( KLogInfo ); |
|
2687 |
|
2688 iTmServerDeviceType = ETrue; |
|
2689 |
|
2690 //Sets the information associated with the terminal mode server device |
|
2691 SetTmServerSettingsL(); |
|
2692 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
2693 |
|
2694 //Register all the desired applications |
|
2695 RegisterApplicationsL(*iTmServer); |
|
2696 |
|
2697 //Start the tmserver device and its services |
|
2698 iTmServer->StartL(); |
|
2699 |
|
2700 //Start the control point and search for device |
|
2701 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
2702 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
2703 iDiscoveryTestTimer->AfterDiscovery(15); |
|
2704 CActiveScheduler::Start(); |
|
2705 |
|
2706 if ( iDeviceVerified ) |
|
2707 { |
|
2708 //Retrieve the contents of a client profile stored in the terminal mode device |
|
2709 iSearchDevice->GetClientProfileActionL(KProfileIdValue); |
|
2710 } |
|
2711 |
|
2712 iTestTimer = CTestTimer::NewL(*this); |
|
2713 iTestTimer->After(15); |
|
2714 CActiveScheduler::Start(); |
|
2715 |
|
2716 if (iGetClientProfile) |
|
2717 { |
|
2718 _LIT( KDescription , "GetClientProfile Command handled successfully"); |
|
2719 aResult.SetResult( KErrNone, KDescription ); |
|
2720 iLog->Log( KDescription ); |
|
2721 } |
|
2722 else |
|
2723 { |
|
2724 aResult.iResult = KErrGeneral; |
|
2725 _LIT( KDescription , "GetClientProfile Command handling Failed"); |
|
2726 aResult.SetResult( KErrNone, KDescription ); |
|
2727 iLog->Log( KDescription ); |
|
2728 } |
|
2729 delete iDiscoveryTestTimer; |
|
2730 iDiscoveryTestTimer = NULL; |
|
2731 delete iTestTimer; |
|
2732 iTestTimer = NULL; |
|
2733 REComSession::FinalClose(); |
|
2734 return KErrNone; |
|
2735 } |
|
2736 |
|
2737 TInt CTmServerTest::HandleInvalidProfileIdGetClientProfileActionL ( TTestResult& aResult ) |
|
2738 { |
|
2739 _LIT( KLogInfo, "Handle Invalid ProfileId GetClientProfile Command" ); |
|
2740 iLog->Log( KLogInfo ); |
|
2741 |
|
2742 iTmServerDeviceType = ETrue; |
|
2743 |
|
2744 //Sets the information associated with the terminal mode server device |
|
2745 SetTmServerSettingsL(); |
|
2746 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
2747 |
|
2748 //Register all the desired applications |
|
2749 RegisterApplicationsL(*iTmServer); |
|
2750 |
|
2751 //Start the control point and search for device |
|
2752 iTmServer->StartL(); |
|
2753 |
|
2754 //Start the control point and search for device |
|
2755 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
2756 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
2757 iDiscoveryTestTimer->AfterDiscovery(15); |
|
2758 CActiveScheduler::Start(); |
|
2759 |
|
2760 if ( iDeviceVerified ) |
|
2761 { |
|
2762 //Retrieve the contents of a client profile by specifying invalid profileId |
|
2763 iSearchDevice->GetClientProfileActionL(KInvalidProfileIdValue); |
|
2764 } |
|
2765 |
|
2766 iTestTimer = CTestTimer::NewL(*this); |
|
2767 iTestTimer->After(15); |
|
2768 CActiveScheduler::Start(); |
|
2769 |
|
2770 if (iGetClientProfile) |
|
2771 { |
|
2772 _LIT( KDescription , "GetClientProfile Command with invalid ProfileId handled successfully"); |
|
2773 aResult.SetResult( KErrNone, KDescription ); |
|
2774 iLog->Log( KDescription ); |
|
2775 } |
|
2776 else |
|
2777 { |
|
2778 aResult.iResult = KErrGeneral; |
|
2779 _LIT( KDescription , "GetClientProfile Command with invalid ProfileId handling Failed"); |
|
2780 aResult.SetResult( KErrNone, KDescription ); |
|
2781 iLog->Log( KDescription ); |
|
2782 } |
|
2783 delete iDiscoveryTestTimer; |
|
2784 iDiscoveryTestTimer = NULL; |
|
2785 delete iTestTimer; |
|
2786 iTestTimer = NULL; |
|
2787 REComSession::FinalClose(); |
|
2788 return KErrNone; |
|
2789 } |
|
2790 |
|
2791 |
|
2792 TInt CTmServerTest::HandleGetMaxNumProfilesActionL( TTestResult& aResult ) |
|
2793 { |
|
2794 _LIT( KLogInfo, "Handle GetMaxNumProfiles Command" ); |
|
2795 iLog->Log( KLogInfo ); |
|
2796 |
|
2797 iTmServerDeviceType = ETrue; |
|
2798 |
|
2799 //Sets the information associated with the terminal mode server device |
|
2800 SetTmServerSettingsL(); |
|
2801 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
2802 |
|
2803 //Register all the desired applications |
|
2804 RegisterApplicationsL(*iTmServer); |
|
2805 |
|
2806 //Start the control point and search for device |
|
2807 iTmServer->StartL(); |
|
2808 |
|
2809 //Start the control point and search for device |
|
2810 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
2811 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
2812 iDiscoveryTestTimer->AfterDiscovery(15); |
|
2813 CActiveScheduler::Start(); |
|
2814 |
|
2815 if ( iDeviceVerified ) |
|
2816 { |
|
2817 //Get the maximum number of client profiles supported |
|
2818 iSearchDevice->GetMaxNumProfilesActionL(); |
|
2819 } |
|
2820 |
|
2821 iTestTimer = CTestTimer::NewL(*this); |
|
2822 iTestTimer->After(15); |
|
2823 CActiveScheduler::Start(); |
|
2824 |
|
2825 if (iGetMaxNumProfiles) |
|
2826 { |
|
2827 _LIT( KDescription , "GetMaxNumProfiles Command handled successfully"); |
|
2828 aResult.SetResult( KErrNone, KDescription ); |
|
2829 iLog->Log( KDescription ); |
|
2830 } |
|
2831 else |
|
2832 { |
|
2833 aResult.iResult = KErrGeneral; |
|
2834 _LIT( KDescription , "GetMaxNumProfiles Command handling Failed"); |
|
2835 aResult.SetResult( KErrNone, KDescription ); |
|
2836 iLog->Log( KDescription ); |
|
2837 } |
|
2838 delete iDiscoveryTestTimer; |
|
2839 iDiscoveryTestTimer = NULL; |
|
2840 delete iTestTimer; |
|
2841 iTestTimer = NULL; |
|
2842 REComSession::FinalClose(); |
|
2843 return KErrNone; |
|
2844 } |
|
2845 |
|
2846 TInt CTmServerTest::HandleGetMaxNumProfilesOperationRejectedL( TTestResult& aResult ) |
|
2847 { |
|
2848 _LIT( KLogInfo, "Handle Operation Rejected Condition For GetMaxNumProfiles Command" ); |
|
2849 iLog->Log( KLogInfo ); |
|
2850 |
|
2851 iTmServerDeviceType = ETrue; |
|
2852 |
|
2853 //Sets the information associated with the terminal mode server device |
|
2854 SetTmServerSettingsL(); |
|
2855 iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); |
|
2856 |
|
2857 //Register all the desired applications |
|
2858 RegisterApplicationsL(*iTmServer); |
|
2859 |
|
2860 //Start the control point and search for device |
|
2861 iTmServer->StartL(); |
|
2862 iOperationRejected = ETrue; |
|
2863 //Start the control point and search for device |
|
2864 iSearchDevice = CDiscoverDevice::NewL(*this); |
|
2865 iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this); |
|
2866 iDiscoveryTestTimer->AfterDiscovery(15); |
|
2867 CActiveScheduler::Start(); |
|
2868 |
|
2869 if ( iDeviceVerified ) |
|
2870 { |
|
2871 //Get the maximum number of client profiles supported |
|
2872 iSearchDevice->GetMaxNumProfilesActionL(); |
|
2873 } |
|
2874 |
|
2875 iTestTimer = CTestTimer::NewL(*this); |
|
2876 iTestTimer->After(15); |
|
2877 CActiveScheduler::Start(); |
|
2878 |
|
2879 if (iGetMaxNumProfiles) |
|
2880 { |
|
2881 _LIT( KDescription , "Operation Rejected Condition For GetMaxNumProfiles Command handled successfully"); |
|
2882 aResult.SetResult( KErrNone, KDescription ); |
|
2883 iLog->Log( KDescription ); |
|
2884 } |
|
2885 else |
|
2886 { |
|
2887 aResult.iResult = KErrGeneral; |
|
2888 _LIT( KDescription , "Operation Rejected Condition For GetMaxNumProfiles Command handling Failed"); |
|
2889 aResult.SetResult( KErrNone, KDescription ); |
|
2890 iLog->Log( KDescription ); |
|
2891 } |
|
2892 delete iDiscoveryTestTimer; |
|
2893 iDiscoveryTestTimer = NULL; |
|
2894 delete iTestTimer; |
|
2895 iTestTimer = NULL; |
|
2896 REComSession::FinalClose(); |
|
2897 return KErrNone; |
|
2898 } |
|
2899 |
|
2900 // ======================================================================================================== |
|
2901 |
|
2902 void CTmServerTest::SetTmServerSettingsL() |
|
2903 { |
|
2904 iTmServerDeviceInfo = CUpnpTmServerDeviceInfo::NewL(CUpnpSettings::GetIapL()); |
|
2905 iTmServerDeviceInfo->SetDeviceInfoL( KDeviceInfo ); |
|
2906 iTmServerDeviceInfo->SetBtAddressL( KBtMacValue ); |
|
2907 iTmServerDeviceInfo->SetStartConn(ETrue); |
|
2908 iTmServerDeviceInfo->AddDeviceIconL(CUpnpTerminalModeIcon::NewL(KIconDevicePath, KIconWidth, KIconHeight, KIconDepth,KTestSvgMimeType)); |
|
2909 } |
|
2910 |
|
2911 void CTmServerTest::RegisterApplicationsL(CUpnpTmServer& aTmServer ) |
|
2912 { |
|
2913 RArray<TUint> allowedProfileIdList; |
|
2914 allowedProfileIdList.Append(0); |
|
2915 allowedProfileIdList.Append(1); |
|
2916 allowedProfileIdList.Append(2); |
|
2917 allowedProfileIdList.Append(2); |
|
2918 allowedProfileIdList.Append(3); |
|
2919 allowedProfileIdList.Append(4); |
|
2920 allowedProfileIdList.Append(5); |
|
2921 allowedProfileIdList.Append(6); |
|
2922 |
|
2923 _LIT8(KAppDesc, "Mobile Navigation Application"); |
|
2924 iRemotableApp = CUpnpRemotableApp::NewL( KAppIdValue ,_L8("Navigation")); |
|
2925 iRemotableApp->SetAppDescriptionL(KAppDesc()); |
|
2926 iRemotableApp->SetAllowedProfileIdListL(allowedProfileIdList); |
|
2927 CUpnpTmInfoElement& tmInfoElement = iRemotableApp->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo); |
|
2928 tmInfoElement.AddTmInfoElementL(_L8("protocolID"),_L8("VNC")); |
|
2929 |
|
2930 CUpnpTmInfoElement& tmInfoElement1 = iRemotableApp->CreateTmInfoElementL(CUpnpTmInfoElement::EAppInfo); |
|
2931 tmInfoElement1.AddTmInfoElementL(_L8("appCategory"),_L8("0x00010001")); |
|
2932 tmInfoElement1.AddTmInfoElementL(_L8("trustLevel"),_L8("0x80")); |
|
2933 |
|
2934 CUpnpTmInfoElement& tmInfoElement2 = iRemotableApp->CreateTmInfoElementL(CUpnpTmInfoElement::EDisplayInfo); |
|
2935 tmInfoElement2.AddTmInfoElementL(_L8("contentCategory"),_L8("0x0000001")); |
|
2936 tmInfoElement2.AddTmInfoElementL(_L8("contentRules"),_L8("0x00000FE")); |
|
2937 tmInfoElement2.AddTmInfoElementL(_L8("trustLevel"),_L8("0x00000001")); |
|
2938 iRemotableApp->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathMaps, KIconWidth1, KIconHeight1, KIconDepth,KTestSvgMimeType)); |
|
2939 aTmServer.RegisterAppL(iRemotableApp); |
|
2940 allowedProfileIdList.Close(); |
|
2941 |
|
2942 _LIT8(KAppDesc1, "RTP Audio Server"); |
|
2943 iRemotableApp1 = CUpnpRemotableApp::NewL( KAppId1Value ,_L8("RTP Server")); |
|
2944 iRemotableApp1->SetAppDescriptionL(KAppDesc1()); |
|
2945 |
|
2946 CUpnpTmInfoElement& tmInfoElement3 = iRemotableApp1->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo); |
|
2947 tmInfoElement3.AddTmInfoElementL(_L8("protocolID"),_L8("RTP")); |
|
2948 tmInfoElement3.AddTmInfoElementL(_L8("format"),_L8("99")); |
|
2949 tmInfoElement3.AddTmInfoElementL(_L8("direction"),_L8("out")); |
|
2950 |
|
2951 CUpnpTmInfoElement& tmInfoElement4 = iRemotableApp1->CreateTmInfoElementL(CUpnpTmInfoElement::EAppInfo); |
|
2952 tmInfoElement4.AddTmInfoElementL(_L8("appCategory"),_L8("0x0000002")); |
|
2953 tmInfoElement4.AddTmInfoElementL(_L8("trustLevel"),_L8("0x00000001")); |
|
2954 |
|
2955 CUpnpTmInfoElement& tmInfoElement5 = iRemotableApp1->CreateTmInfoElementL(CUpnpTmInfoElement::EAudioInfo); |
|
2956 tmInfoElement5.AddTmInfoElementL(_L8("audioType"),_L8("all")); |
|
2957 iRemotableApp1->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathMusicUnLaunched,KIconWidth, KIconHeight, KIconDepth,KTestSvgMimeType)); |
|
2958 iRemotableApp1->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathMusicLaunched,KIconWidth, KIconHeight, KIconDepth,KTestSvgMimeType)); |
|
2959 iRemotableApp1->SetResourceStatusL(_L8("free")); |
|
2960 |
|
2961 iRemotableAppArray.AppendL(iRemotableApp1); |
|
2962 |
|
2963 _LIT8(KAppDesc2, "Bluetooth A2DP Audio Server"); |
|
2964 iRemotableApp2 = CUpnpRemotableApp::NewL( KAppId2Value ,_L8("Bluetooth A2DP")); |
|
2965 iRemotableApp2->SetAppDescriptionL(KAppDesc2()); |
|
2966 |
|
2967 CUpnpTmInfoElement& tmInfoElement6 = iRemotableApp2->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo); |
|
2968 tmInfoElement6.AddTmInfoElementL(_L8("protocolID"),_L8("BTA2DP")); |
|
2969 tmInfoElement6.AddTmInfoElementL(_L8("direction"),_L8("out")); |
|
2970 |
|
2971 CUpnpTmInfoElement& tmInfoElement7 = iRemotableApp2->CreateTmInfoElementL(CUpnpTmInfoElement::EAppInfo); |
|
2972 tmInfoElement7.AddTmInfoElementL(_L8("appCategory"),_L8("0x0000003")); |
|
2973 tmInfoElement7.AddTmInfoElementL(_L8("trustLevel"),_L8("0x00000001")); |
|
2974 |
|
2975 iRemotableApp2->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathBtA2DpUnLaunched, KIconWidth2, KIconHeight2, KIconDepth1,KTestSvgMimeType)); |
|
2976 iRemotableApp2->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathBtA2DpLaunched,KIconWidth3, KIconHeight3, KIconDepth1,KTestSvgMimeType)); |
|
2977 iRemotableApp2->SetResourceStatusL(_L8("free")); |
|
2978 iRemotableAppArray.AppendL(iRemotableApp2); |
|
2979 |
|
2980 _LIT8(KAppDesc3, "Bluetooth HFP Audio"); |
|
2981 RArray<TUint> allowedProfileIdList1; |
|
2982 allowedProfileIdList1.Append(0); |
|
2983 iRemotableApp3 = CUpnpRemotableApp::NewL( KAppId3Value,_L8("Bluetooth HFP")); |
|
2984 iRemotableApp3->SetAppDescriptionL(KAppDesc3()); |
|
2985 iRemotableApp3->SetAllowedProfileIdListL(allowedProfileIdList1); |
|
2986 |
|
2987 CUpnpTmInfoElement& tmInfoElement8 = iRemotableApp3->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo); |
|
2988 tmInfoElement8.AddTmInfoElementL(_L8("protocolID"),_L8("BTHFP")); |
|
2989 tmInfoElement8.AddTmInfoElementL(_L8("direction"),_L8("bi")); |
|
2990 |
|
2991 CUpnpTmInfoElement& tmInfoElement9 = iRemotableApp3->CreateTmInfoElementL(CUpnpTmInfoElement::EAppInfo); |
|
2992 tmInfoElement9.AddTmInfoElementL(_L8("appCategory"),_L8("0x0000004")); |
|
2993 tmInfoElement9.AddTmInfoElementL(_L8("trustLevel"),_L8("0x00000001")); |
|
2994 |
|
2995 iRemotableApp3->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathBtHfp, KIconWidth, KIconHeight, KIconDepth,KTestSvgMimeType)); |
|
2996 iRemotableApp3->SetResourceStatusL(_L8("busy")); |
|
2997 iRemotableAppArray.AppendL(iRemotableApp3); |
|
2998 allowedProfileIdList1.Close(); |
|
2999 |
|
3000 _LIT8(KAppDesc4, "Device Attestation Protocol"); |
|
3001 iRemotableApp4 = CUpnpRemotableApp::NewL( KAppId4Value ,_L8("Device Attestation")); |
|
3002 iRemotableApp4->SetAppDescriptionL(KAppDesc4()); |
|
3003 |
|
3004 CUpnpTmInfoElement& tmInfoElement11 = iRemotableApp4->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo); |
|
3005 tmInfoElement11.AddTmInfoElementL(_L8("protocolID"),_L8("DAP")); |
|
3006 iRemotableAppArray.AppendL(iRemotableApp4); |
|
3007 |
|
3008 iRemotableApp5 = CUpnpRemotableApp::NewL( KAppId5Value ,_L8("Device Attestation")); |
|
3009 iRemotableApp5->SetAppDescriptionL(KAppDesc4()); |
|
3010 |
|
3011 RArray<TUint> allowedProfileIdList2; |
|
3012 allowedProfileIdList2.Append(1); |
|
3013 allowedProfileIdList2.Append(1); |
|
3014 iRemotableApp5->SetAllowedProfileIdListL(allowedProfileIdList2); |
|
3015 |
|
3016 CUpnpTmInfoElement& tmInfoElement12 = iRemotableApp5->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo); |
|
3017 tmInfoElement12.AddTmInfoElementL(_L8("protocolID"),_L8("DAP")); |
|
3018 iRemotableAppArray.AppendL(iRemotableApp5); |
|
3019 allowedProfileIdList2.Close(); |
|
3020 |
|
3021 aTmServer.SetXmlSignatureL(KXmlSignature); |
|
3022 aTmServer.RegisterAppsL(iRemotableAppArray); |
|
3023 iRemotableAppArray.Close(); |
|
3024 } |
|
3025 |
|
3026 void CTmServerTest::TestTimerTimedOutL() |
|
3027 { |
|
3028 iTmServer->StopL(); |
|
3029 delete iSearchDevice; |
|
3030 iSearchDevice = NULL; |
|
3031 delete iTmServer; |
|
3032 iTmServer = NULL; |
|
3033 delete iTmServerDeviceInfo; |
|
3034 iTmServerDeviceInfo = NULL; |
|
3035 CActiveScheduler::Stop(); |
|
3036 } |
|
3037 |
|
3038 void CTmServerTest::TestTimerDiscoveryTimedOut() |
|
3039 { |
|
3040 CActiveScheduler::Stop(); |
|
3041 } |
|
3042 |
|
3043 void CTmServerTest::DeviceVerified() |
|
3044 { |
|
3045 iDeviceVerified = ETrue; |
|
3046 } |
|
3047 |
|
3048 void CTmServerTest::DeviceLostVerified() |
|
3049 { |
|
3050 iDeviceLostVerified = ETrue; |
|
3051 } |
|
3052 |
|
3053 void CTmServerTest::ServiceVerified() |
|
3054 { |
|
3055 iServiceVerified = ETrue; |
|
3056 } |
|
3057 |
|
3058 CDiscoverDevice* CDiscoverDevice::NewL(CTmServerTest& aTmServerTest) |
|
3059 { |
|
3060 CDiscoverDevice* self = new (ELeave) CDiscoverDevice(aTmServerTest); |
|
3061 CleanupStack::PushL( self ); |
|
3062 self->ConstructL(); |
|
3063 CleanupStack::Pop( self ); |
|
3064 return self; |
|
3065 } |
|
3066 |
|
3067 CDiscoverDevice::CDiscoverDevice(CTmServerTest& aTmServerTest): |
|
3068 iTmServerTest(aTmServerTest) |
|
3069 { |
|
3070 |
|
3071 } |
|
3072 |
|
3073 void CDiscoverDevice::ConstructL() |
|
3074 { |
|
3075 CDesC8ArrayFlat* targetDeviceTypes = new (ELeave) CDesC8ArrayFlat( 1 ); |
|
3076 CleanupStack::PushL( targetDeviceTypes ); |
|
3077 targetDeviceTypes->AppendL( KTmServerDevice() ); |
|
3078 CUpnpControlPoint::ConstructL( *targetDeviceTypes ); |
|
3079 CleanupStack::Pop( targetDeviceTypes ); |
|
3080 targetDeviceTypes->Reset(); |
|
3081 delete targetDeviceTypes; |
|
3082 targetDeviceTypes = NULL; |
|
3083 |
|
3084 //SSDP search for Terminalmode server devices |
|
3085 if (iTmServerTest.iTmServerDeviceType) |
|
3086 { |
|
3087 SearchL( KTmServerDevice() ); |
|
3088 } |
|
3089 else if (iTmServerTest.iTmServerServiceType) |
|
3090 { |
|
3091 SearchL( KTmServerService() ); |
|
3092 } |
|
3093 } |
|
3094 |
|
3095 CDiscoverDevice::~CDiscoverDevice() |
|
3096 { |
|
3097 |
|
3098 } |
|
3099 |
|
3100 |
|
3101 void CDiscoverDevice::StateUpdatedL( CUpnpService* aService ) |
|
3102 { |
|
3103 CUpnpDevice& device = aService->Device(); |
|
3104 if (aService->ServiceType().Match( KTmServerServiceType ) != KErrNotFound ) |
|
3105 { |
|
3106 TInt err = TmServerStateUpdated( device, aService ); |
|
3107 } |
|
3108 else |
|
3109 { |
|
3110 User::Leave(KErrGeneral); |
|
3111 } |
|
3112 } |
|
3113 |
|
3114 TInt CDiscoverDevice::TmServerStateUpdated( CUpnpDevice& aDevice, |
|
3115 CUpnpService*& aService ) |
|
3116 { |
|
3117 CUpnpStateVariable* appStatusUpdate = aService->StateVariable( KArgTypeAppStatusUpdate ); |
|
3118 if( !appStatusUpdate ) |
|
3119 { |
|
3120 iTmServerTest.iStatusNotified = EFalse; |
|
3121 return KErrArgument; |
|
3122 } |
|
3123 else |
|
3124 { |
|
3125 const TDesC8& deviceUuid = aDevice.Uuid(); |
|
3126 const TDesC8& statusBuf = appStatusUpdate->Value(); |
|
3127 |
|
3128 iTmServerTest.iStatusNotified = ETrue; |
|
3129 } |
|
3130 return KErrNone; |
|
3131 } |
|
3132 |
|
3133 void CDiscoverDevice::DeviceDiscoveredL( CUpnpDevice* aDevice ) |
|
3134 { |
|
3135 if( iTmServerTest.iTmServerDeviceType) |
|
3136 { |
|
3137 if(aDevice->DeviceType().Compare(KTmServerDevice) == KErrNone ) |
|
3138 { |
|
3139 iTmServerTest.DeviceVerified(); |
|
3140 } |
|
3141 } |
|
3142 else if( iTmServerTest.iTmServerServiceType) |
|
3143 { |
|
3144 if(aDevice->ServiceDescriptionReceiveState()== CUpnpDevice::EAllServicesAdded) |
|
3145 { |
|
3146 iTmServerTest.ServiceVerified(); |
|
3147 } |
|
3148 } |
|
3149 } |
|
3150 |
|
3151 void CDiscoverDevice::DeviceDisappearedL( CUpnpDevice* /*aDevice */) |
|
3152 { |
|
3153 iTmServerTest.DeviceLostVerified(); |
|
3154 } |
|
3155 |
|
3156 void CDiscoverDevice::ActionResponseReceivedL( CUpnpAction* aAction ) |
|
3157 { |
|
3158 CUpnpService& service = aAction->Service(); |
|
3159 if( service.ServiceType().Length() <= 0 ) |
|
3160 { |
|
3161 User::Leave(KErrArgument); |
|
3162 } |
|
3163 if (aAction->Name().Compare(KGetApplicationList) == KErrNone) |
|
3164 { |
|
3165 aAction->ArgumentValue( KAppListing ); |
|
3166 iTmServerTest.iGetAppList = ETrue; |
|
3167 } |
|
3168 else if (aAction->Name().Compare(KLaunchApp) == KErrNone) |
|
3169 { |
|
3170 aAction->ArgumentValue( KAppLaunchStatus ); |
|
3171 iTmServerTest.iStartApp = ETrue; |
|
3172 } |
|
3173 else if (aAction->Name().Compare(KTerminateApp) == KErrNone) |
|
3174 { |
|
3175 aAction->ArgumentValue( KAppTerminateStatus ); |
|
3176 iTmServerTest.iStopApp = ETrue; |
|
3177 } |
|
3178 else if (aAction->Name().Compare(KGetAppStatus) == KErrNone) |
|
3179 { |
|
3180 aAction->ArgumentValue( KAppStatus ); |
|
3181 iTmServerTest.iGetAppStatus = ETrue; |
|
3182 } |
|
3183 else if (aAction->Name().Compare(KSetClientProfile) == KErrNone) |
|
3184 { |
|
3185 aAction->ArgumentValue( KResultProfile ); |
|
3186 iTmServerTest.iSetClientProfile = ETrue; |
|
3187 } |
|
3188 else if (aAction->Name().Compare(KGetClientProfile) == KErrNone) |
|
3189 { |
|
3190 aAction->ArgumentValue( KClientProfile ); |
|
3191 iTmServerTest.iGetClientProfile = ETrue; |
|
3192 } |
|
3193 else if (aAction->Name().Compare(KGetMaxNumProfiles) == KErrNone) |
|
3194 { |
|
3195 aAction->ArgumentValue( KNumProfilesAllowed ); |
|
3196 iTmServerTest.iGetMaxNumProfiles = ETrue; |
|
3197 } |
|
3198 } |
|
3199 |
|
3200 void CDiscoverDevice::HttpResponseReceivedL( CUpnpHttpMessage* /*aMessage*/ ) |
|
3201 { |
|
3202 |
|
3203 } |
|
3204 |
|
3205 |
|
3206 TInt CDiscoverDevice::GetAppListActionL( const TDesC8& aAppListFilter ,TInt aProfileId ) |
|
3207 { |
|
3208 const RPointerArray<CUpnpDevice>& deviceList = DeviceList(); |
|
3209 if( deviceList.Count() == KErrNone ) |
|
3210 { |
|
3211 return KErrBadHandle; |
|
3212 } |
|
3213 TInt i(0); |
|
3214 while ( deviceList[i]->DeviceType().Compare(KTmServerDevice()) != KErrNone ) |
|
3215 { |
|
3216 i++; |
|
3217 } |
|
3218 if( i == deviceList.Count()) |
|
3219 { |
|
3220 return KErrNotFound; |
|
3221 } |
|
3222 RPointerArray<CUpnpService>& services = const_cast<CUpnpDevice*>(deviceList[i])->ServiceList(); |
|
3223 |
|
3224 for( TInt i(0); i < services.Count(); i++ ) |
|
3225 { |
|
3226 if( services[i]->ServiceType().Match( KTmServerServiceType ) != KErrNotFound ) |
|
3227 { |
|
3228 CUpnpAction* action = services[i]->CreateActionLC( KGetApplicationList ); |
|
3229 if( action ) |
|
3230 { |
|
3231 TBuf8<8> buf; |
|
3232 buf.Num(aProfileId); |
|
3233 action->SetArgumentL(KAppFilter, aAppListFilter ); |
|
3234 action->SetArgumentL(KProfileId, buf ); |
|
3235 SendL( action ); |
|
3236 CleanupStack::Pop( action ); |
|
3237 return action->SessionId(); |
|
3238 } |
|
3239 else |
|
3240 { |
|
3241 return KErrGeneral; |
|
3242 } |
|
3243 } |
|
3244 } |
|
3245 return KErrNotFound; |
|
3246 } |
|
3247 |
|
3248 |
|
3249 |
|
3250 TInt CDiscoverDevice::LaunchAppActionL( TInt aAppId, TInt aProfileId ) |
|
3251 { |
|
3252 const RPointerArray<CUpnpDevice>& deviceList = DeviceList(); |
|
3253 if( deviceList.Count() == KErrNone ) |
|
3254 { |
|
3255 return KErrBadHandle; |
|
3256 } |
|
3257 TInt i(0); |
|
3258 while ( deviceList[i]->DeviceType().Compare(KTmServerDevice()) != KErrNone ) |
|
3259 { |
|
3260 i++; |
|
3261 } |
|
3262 if( i == deviceList.Count()) |
|
3263 { |
|
3264 return KErrNotFound; |
|
3265 } |
|
3266 RPointerArray<CUpnpService>& services = const_cast<CUpnpDevice*>(deviceList[i])->ServiceList(); |
|
3267 |
|
3268 for( TInt i(0); i < services.Count(); i++ ) |
|
3269 { |
|
3270 if( services[i]->ServiceType().Match( KTmServerServiceType ) != KErrNotFound ) |
|
3271 { |
|
3272 CUpnpAction* action = services[i]->CreateActionLC( KLaunchApp ); |
|
3273 if( action ) |
|
3274 { |
|
3275 TBuf8<8> buf; |
|
3276 buf.Num(aAppId); |
|
3277 action->SetArgumentL( KAppId, buf ); |
|
3278 buf.Zero(); |
|
3279 buf.Num(aProfileId); |
|
3280 action->SetArgumentL( KProfileId, buf ); |
|
3281 } |
|
3282 SendL( action ); |
|
3283 CleanupStack::Pop( action ); |
|
3284 return action->SessionId(); |
|
3285 } |
|
3286 else |
|
3287 { |
|
3288 return KErrGeneral; |
|
3289 } |
|
3290 } |
|
3291 return KErrNotFound; |
|
3292 } |
|
3293 |
|
3294 TInt CDiscoverDevice::TerminateAppActionL( TInt aAppId, TInt aProfileId ) |
|
3295 { |
|
3296 const RPointerArray<CUpnpDevice>& deviceList = DeviceList(); |
|
3297 if( deviceList.Count() == KErrNone ) |
|
3298 { |
|
3299 return KErrBadHandle; |
|
3300 } |
|
3301 TInt i(0); |
|
3302 while ( deviceList[i]->DeviceType().Compare(KTmServerDevice()) != KErrNone ) |
|
3303 { |
|
3304 i++; |
|
3305 } |
|
3306 if( i == deviceList.Count()) |
|
3307 { |
|
3308 return KErrNotFound; |
|
3309 } |
|
3310 RPointerArray<CUpnpService>& services = const_cast<CUpnpDevice*>(deviceList[i])->ServiceList(); |
|
3311 |
|
3312 for( TInt i(0); i < services.Count(); i++ ) |
|
3313 { |
|
3314 if( services[i]->ServiceType().Match( KTmServerServiceType ) != KErrNotFound ) |
|
3315 { |
|
3316 CUpnpAction* action = services[i]->CreateActionLC( KTerminateApp ); |
|
3317 if( action ) |
|
3318 { |
|
3319 TBuf8<8> buf; |
|
3320 buf.Num(aAppId); |
|
3321 action->SetArgumentL( KAppId, buf ); |
|
3322 buf.Zero(); |
|
3323 buf.Num(aProfileId); |
|
3324 action->SetArgumentL( KProfileId, buf ); |
|
3325 } |
|
3326 |
|
3327 SendL( action ); |
|
3328 CleanupStack::Pop( action ); |
|
3329 return action->SessionId(); |
|
3330 } |
|
3331 else |
|
3332 { |
|
3333 return KErrGeneral; |
|
3334 } |
|
3335 } |
|
3336 return KErrNotFound; |
|
3337 } |
|
3338 |
|
3339 TInt CDiscoverDevice::GetAppStatusActionL( TInt aAppId ) |
|
3340 { |
|
3341 const RPointerArray<CUpnpDevice>& deviceList = DeviceList(); |
|
3342 if( deviceList.Count() == KErrNone ) |
|
3343 { |
|
3344 return KErrBadHandle; |
|
3345 } |
|
3346 TInt i(0); |
|
3347 while ( deviceList[i]->DeviceType().Compare(KTmServerDevice()) != KErrNone ) |
|
3348 { |
|
3349 i++; |
|
3350 } |
|
3351 if( i == deviceList.Count()) |
|
3352 { |
|
3353 return KErrNotFound; |
|
3354 } |
|
3355 RPointerArray<CUpnpService>& services = const_cast<CUpnpDevice*>(deviceList[i])->ServiceList(); |
|
3356 |
|
3357 for( TInt i(0); i < services.Count(); i++ ) |
|
3358 { |
|
3359 if( services[i]->ServiceType().Match( KTmServerServiceType ) != KErrNotFound ) |
|
3360 { |
|
3361 CUpnpAction* action = services[i]->CreateActionLC( KGetAppStatus ); |
|
3362 if( action ) |
|
3363 { |
|
3364 TBuf8<8> buf; |
|
3365 buf.Num(aAppId); |
|
3366 if ( aAppId == KAppId1Value || aAppId == KNonExistentAppIdValue ) |
|
3367 { |
|
3368 action->SetArgumentL( KAppId, buf ); |
|
3369 } |
|
3370 else if( aAppId == KAppId5Value ) |
|
3371 { |
|
3372 _LIT8(KWildCard, "*"); |
|
3373 action->SetArgumentL( KAppId, KWildCard()); |
|
3374 } |
|
3375 else |
|
3376 { |
|
3377 action->SetArgumentL( KAppId, KNullDesC8()); |
|
3378 } |
|
3379 SendL( action ); |
|
3380 CleanupStack::Pop( action ); |
|
3381 return action->SessionId(); |
|
3382 } |
|
3383 else |
|
3384 { |
|
3385 return KErrGeneral; |
|
3386 } |
|
3387 } |
|
3388 } |
|
3389 return KErrNotFound; |
|
3390 } |
|
3391 |
|
3392 TInt CDiscoverDevice::SetClientProfileActionL(TInt aProfileId, const TDesC8& aClientInfoValue ) |
|
3393 { |
|
3394 const RPointerArray<CUpnpDevice>& deviceList = DeviceList(); |
|
3395 if( deviceList.Count() == KErrNone ) |
|
3396 { |
|
3397 return KErrBadHandle; |
|
3398 } |
|
3399 TInt i(0); |
|
3400 while ( deviceList[i]->DeviceType().Compare(KTmServerDevice()) != KErrNone ) |
|
3401 { |
|
3402 i++; |
|
3403 } |
|
3404 if( i == deviceList.Count()) |
|
3405 { |
|
3406 return KErrNotFound; |
|
3407 } |
|
3408 RPointerArray<CUpnpService>& services = const_cast<CUpnpDevice*>(deviceList[i])->ServiceList(); |
|
3409 |
|
3410 for( TInt i(0); i < services.Count(); i++ ) |
|
3411 { |
|
3412 if( services[i]->ServiceType().Match( KTmServerServiceType1 ) != KErrNotFound ) |
|
3413 { |
|
3414 CUpnpAction* action = services[i]->CreateActionLC( KSetClientProfile); |
|
3415 if( action ) |
|
3416 { |
|
3417 TBuf8<8> buf; |
|
3418 buf.Num(aProfileId); |
|
3419 action->SetArgumentL(KProfileId1, buf ); |
|
3420 action->SetArgumentL(KClientProfile, aClientInfoValue ); |
|
3421 SendL( action ); |
|
3422 CleanupStack::Pop( action ); |
|
3423 return action->SessionId(); |
|
3424 } |
|
3425 else |
|
3426 { |
|
3427 return KErrGeneral; |
|
3428 } |
|
3429 } |
|
3430 } |
|
3431 return KErrNotFound; |
|
3432 } |
|
3433 |
|
3434 TInt CDiscoverDevice::GetClientProfileActionL(TInt aProfileId ) |
|
3435 { |
|
3436 const RPointerArray<CUpnpDevice>& deviceList = DeviceList(); |
|
3437 if( deviceList.Count() == KErrNone ) |
|
3438 { |
|
3439 return KErrBadHandle; |
|
3440 } |
|
3441 TInt i(0); |
|
3442 while ( deviceList[i]->DeviceType().Compare(KTmServerDevice()) != KErrNone ) |
|
3443 { |
|
3444 i++; |
|
3445 } |
|
3446 if( i == deviceList.Count()) |
|
3447 { |
|
3448 return KErrNotFound; |
|
3449 } |
|
3450 RPointerArray<CUpnpService>& services = const_cast<CUpnpDevice*>(deviceList[i])->ServiceList(); |
|
3451 |
|
3452 for( TInt i(0); i < services.Count(); i++ ) |
|
3453 { |
|
3454 if( services[i]->ServiceType().Match( KTmServerServiceType1 ) != KErrNotFound ) |
|
3455 { |
|
3456 CUpnpAction* action = services[i]->CreateActionLC( KGetClientProfile); |
|
3457 if( action ) |
|
3458 { |
|
3459 TBuf8<8> buf; |
|
3460 buf.Num(aProfileId); |
|
3461 action->SetArgumentL(KProfileId1, buf ); |
|
3462 SendL( action ); |
|
3463 CleanupStack::Pop( action ); |
|
3464 return action->SessionId(); |
|
3465 } |
|
3466 else |
|
3467 { |
|
3468 return KErrGeneral; |
|
3469 } |
|
3470 } |
|
3471 } |
|
3472 return KErrNotFound; |
|
3473 } |
|
3474 |
|
3475 TInt CDiscoverDevice::GetMaxNumProfilesActionL( ) |
|
3476 { |
|
3477 const RPointerArray<CUpnpDevice>& deviceList = DeviceList(); |
|
3478 if( deviceList.Count() == KErrNone ) |
|
3479 { |
|
3480 return KErrBadHandle; |
|
3481 } |
|
3482 TInt i(0); |
|
3483 while ( deviceList[i]->DeviceType().Compare(KTmServerDevice()) != KErrNone ) |
|
3484 { |
|
3485 i++; |
|
3486 } |
|
3487 if( i == deviceList.Count()) |
|
3488 { |
|
3489 return KErrNotFound; |
|
3490 } |
|
3491 RPointerArray<CUpnpService>& services = const_cast<CUpnpDevice*>(deviceList[i])->ServiceList(); |
|
3492 |
|
3493 for( TInt i(0); i < services.Count(); i++ ) |
|
3494 { |
|
3495 if( services[i]->ServiceType().Match( KTmServerServiceType1 ) != KErrNotFound ) |
|
3496 { |
|
3497 CUpnpAction* action = services[i]->CreateActionLC( KGetMaxNumProfiles); |
|
3498 if( action ) |
|
3499 { |
|
3500 SendL( action ); |
|
3501 CleanupStack::Pop( action ); |
|
3502 return action->SessionId(); |
|
3503 } |
|
3504 else |
|
3505 { |
|
3506 return KErrGeneral; |
|
3507 } |
|
3508 } |
|
3509 } |
|
3510 return KErrNotFound; |
|
3511 } |
|
3512 |
|
3513 void CDiscoverDevice::SubscribeToServiceL() |
|
3514 { |
|
3515 const RPointerArray<CUpnpDevice>& deviceList = DeviceList(); |
|
3516 if( deviceList.Count() == KErrNone ) |
|
3517 { |
|
3518 User::Leave( KErrBadHandle ); |
|
3519 } |
|
3520 TInt i(0); |
|
3521 while ( deviceList[i]->DeviceType().Compare(KTmServerDevice()) != KErrNone ) |
|
3522 { |
|
3523 i++; |
|
3524 } |
|
3525 if( i == deviceList.Count()) |
|
3526 { |
|
3527 User::Leave ( KErrNotFound ); |
|
3528 } |
|
3529 RPointerArray<CUpnpService>& services = const_cast<CUpnpDevice*>(deviceList[i])->ServiceList(); |
|
3530 |
|
3531 for( TInt i(0); i < services.Count(); i++ ) |
|
3532 { |
|
3533 if( services[i]->ServiceType().Match( KTmServerServiceType ) != KErrNotFound ) |
|
3534 { |
|
3535 SubscribeL( services[i] ); |
|
3536 } |
|
3537 } |
|
3538 } |
|
3539 |
|
3540 TTerminalModeErrorCode CTmServerTest::OnGetApplicationList(TUint aProfileId ) |
|
3541 { |
|
3542 if(iOperationRejected ) |
|
3543 { |
|
3544 return ETerminalModeOperationRejected; |
|
3545 } |
|
3546 else if ( ( aProfileId == 0 ) || ( aProfileId == 1 ) || ( aProfileId == 2) || ( aProfileId == 3 ) |
|
3547 || ( aProfileId == 4 ) || ( aProfileId == 5 ) || ( aProfileId == 6 ) ) |
|
3548 { |
|
3549 return ETerminalModeSuccess; |
|
3550 } |
|
3551 return ETerminalModeInvalidProfileId; |
|
3552 } |
|
3553 |
|
3554 TTerminalModeErrorCode CTmServerTest::OnLaunchApp( TUint aAppId, RBuf8& aUrl, TUint aProfileId ) |
|
3555 { |
|
3556 if ( ( aProfileId != 0 ) && ( aProfileId != 1 ) && ( aProfileId != 2) && ( aProfileId != 3 ) |
|
3557 && ( aProfileId != 4 ) && ( aProfileId != 5 ) && ( aProfileId != 6 ) ) |
|
3558 { |
|
3559 return ETerminalModeInvalidProfileId; |
|
3560 } |
|
3561 aUrl.Close(); |
|
3562 if ( aAppId == KAppIdValue ) |
|
3563 { |
|
3564 _LIT8(KUrl, "VNC://192.168.4.1:5900"); |
|
3565 aUrl.Create(KUrl()); |
|
3566 } |
|
3567 else if ( aAppId == KAppId1Value ) |
|
3568 { |
|
3569 _LIT8(KUrl, "RTP://192.168.2.1:5900"); |
|
3570 aUrl.Create(KUrl()); |
|
3571 } |
|
3572 else if ( aAppId == KAppId2Value ) |
|
3573 { |
|
3574 _LIT8(KUrl, "BTA2DP://192.168.2.1:5900"); |
|
3575 aUrl.Create(KUrl()); |
|
3576 } |
|
3577 else if ( aAppId == KAppId3Value) |
|
3578 { |
|
3579 _LIT8(KUrl, "BTHFP://192.168.2.1:5900"); |
|
3580 aUrl.Create(KUrl()); |
|
3581 } |
|
3582 else if ( aAppId == KAppId4Value) |
|
3583 { |
|
3584 return ETerminalModeDeviceLocked; |
|
3585 } |
|
3586 else |
|
3587 { |
|
3588 return ETerminalModeUnauthorizedApp; |
|
3589 } |
|
3590 return ETerminalModeSuccess; |
|
3591 } |
|
3592 |
|
3593 TTerminalModeErrorCode CTmServerTest::OnTerminateApp( TUint aAppId, TUint aProfileId ) |
|
3594 { |
|
3595 if ( ( aProfileId != 0 ) && ( aProfileId != 1 ) && ( aProfileId != 2) && ( aProfileId != 3 ) |
|
3596 && ( aProfileId != 4 ) && ( aProfileId != 5 ) && ( aProfileId != 6 ) ) |
|
3597 { |
|
3598 return ETerminalModeInvalidProfileId; |
|
3599 } |
|
3600 if ( aAppId == KAppIdValue|| aAppId == KAppId1Value || aAppId == KAppId2Value || aAppId == KAppId3Value) |
|
3601 { |
|
3602 return ETerminalModeSuccess; |
|
3603 } |
|
3604 else if ( aAppId == KAppId4Value) |
|
3605 { |
|
3606 return ETerminalModeDeviceLocked; |
|
3607 } |
|
3608 else |
|
3609 { |
|
3610 return ETerminalModeUnauthorizedApp; |
|
3611 } |
|
3612 } |
|
3613 |
|
3614 TTerminalModeErrorCode CTmServerTest::OnGetAppStatus( TUint aAppId, TUint& aProfileId ,RBuf8& aStatusType ) |
|
3615 { |
|
3616 aProfileId = KErrNone; |
|
3617 aStatusType.Close(); |
|
3618 if ( aAppId == KAppIdValue ) |
|
3619 { |
|
3620 aStatusType.Create(KBackground()); |
|
3621 } |
|
3622 else if ( aAppId == KAppId1Value ) |
|
3623 { |
|
3624 aStatusType.Create(KForeground()); |
|
3625 } |
|
3626 else if ( aAppId == KAppId2Value ) |
|
3627 { |
|
3628 aStatusType.Create(KBackground()); |
|
3629 } |
|
3630 else if ( aAppId == KAppId3Value ) |
|
3631 { |
|
3632 aStatusType.Create(KForeground()); |
|
3633 } |
|
3634 else |
|
3635 { |
|
3636 aStatusType.Create(KBackground()); |
|
3637 } |
|
3638 return ETerminalModeSuccess; |
|
3639 } |
|
3640 |
|
3641 TTerminalModeErrorCode CTmServerTest::OnGetMaxNumProfiles( TUint& aProfileIdCount ) |
|
3642 { |
|
3643 if (iOperationRejected ) |
|
3644 { |
|
3645 return ETerminalModeOperationRejected; |
|
3646 } |
|
3647 else |
|
3648 { |
|
3649 aProfileIdCount = 9; |
|
3650 return ETerminalModeSuccess; |
|
3651 } |
|
3652 } |
|
3653 |
|
3654 TTerminalModeErrorCode CTmServerTest::OnSetClientProfile(TUint aProfileId, const TDesC8& aClientProfile,RBuf8& aResultProfile ) |
|
3655 { |
|
3656 _LIT8(KClientInfo,"<clientProfile><clientID>Cl_2</clientID></clientProfile>"); |
|
3657 if(iResourceBusy) |
|
3658 { |
|
3659 return ETerminalModeResourceBusy; |
|
3660 } |
|
3661 else if(aClientProfile.Compare(KClientInfo()) == KErrNone ) |
|
3662 { |
|
3663 return ETerminalModeDeviceLocked; |
|
3664 } |
|
3665 else if ( ( aClientProfile.Find(_L8("<clientProfile><")) == KErrNotFound ) && |
|
3666 ( aClientProfile.Find(_L8("<clientProfile><")) == KErrNotFound )) |
|
3667 { |
|
3668 return ETerminalModeInvalidProfile; |
|
3669 } |
|
3670 CUpnpTmClientIconPref* clientIconPref = NULL; |
|
3671 if ( aProfileId == 0 ) |
|
3672 { |
|
3673 // different mime type but same dimension |
|
3674 clientIconPref = CUpnpTmClientIconPref::NewL(0); |
|
3675 clientIconPref->SetWidth(88); |
|
3676 clientIconPref->SetHeight(88); |
|
3677 } |
|
3678 else if ( aProfileId == 1 ) |
|
3679 { |
|
3680 // different mime type and different dimension |
|
3681 clientIconPref = CUpnpTmClientIconPref::NewL(1); |
|
3682 clientIconPref->SetMimeTypeL(_L8("image/bmp")); |
|
3683 clientIconPref->SetWidth(60); |
|
3684 clientIconPref->SetHeight(60); |
|
3685 } |
|
3686 else if ( aProfileId == 2 ) |
|
3687 { |
|
3688 // different mime type and no dimension specified by the client |
|
3689 clientIconPref = CUpnpTmClientIconPref::NewL(2); |
|
3690 clientIconPref->SetMimeTypeL(_L8("image/bmp")); |
|
3691 } |
|
3692 else if ( aProfileId == 3 ) |
|
3693 { |
|
3694 // same mime type but different dimension |
|
3695 clientIconPref = CUpnpTmClientIconPref::NewL(3); |
|
3696 clientIconPref->SetMimeTypeL(_L8("image/svg+xml")); |
|
3697 clientIconPref->SetWidth(36); |
|
3698 clientIconPref->SetHeight(44); |
|
3699 } |
|
3700 else if ( aProfileId == 4 ) |
|
3701 { |
|
3702 // same mime type but no dimension specified by the client |
|
3703 clientIconPref = CUpnpTmClientIconPref::NewL(4); |
|
3704 clientIconPref->SetMimeTypeL(_L8("image/svg+xml")); |
|
3705 } |
|
3706 else if ( aProfileId == 5 ) |
|
3707 { |
|
3708 // same mime type and same dimension |
|
3709 clientIconPref = CUpnpTmClientIconPref::NewL(5); |
|
3710 clientIconPref->SetMimeTypeL(_L8("image/svg+xml")); |
|
3711 clientIconPref->SetWidth(88); |
|
3712 clientIconPref->SetHeight(88); |
|
3713 } |
|
3714 else if ( aProfileId == 6 ) |
|
3715 { |
|
3716 // different mime type(jpeg) and different dimensions |
|
3717 clientIconPref = CUpnpTmClientIconPref::NewL(6); |
|
3718 clientIconPref->SetMimeTypeL(_L8("image/jpeg")); |
|
3719 clientIconPref->SetWidth(36); |
|
3720 clientIconPref->SetHeight(44); |
|
3721 } |
|
3722 else |
|
3723 { |
|
3724 return ETerminalModeInvalidProfileId; |
|
3725 } |
|
3726 iClientIconPrefArray.AppendL(clientIconPref); |
|
3727 RBuf8 clientProfile; |
|
3728 clientProfile.Create(aClientProfile); |
|
3729 aResultProfile.Close(); |
|
3730 aResultProfile.Create(clientProfile); |
|
3731 clientProfile.Close(); |
|
3732 return ETerminalModeSuccess; |
|
3733 } |
|
3734 |
|
3735 TTerminalModeErrorCode CTmServerTest::OnGetClientProfile( TUint aProfileId, RBuf8& aClientProfile) |
|
3736 { |
|
3737 if ( ( aProfileId == 0 ) || ( aProfileId == 1 ) || ( aProfileId == 2) || ( aProfileId == 3 ) |
|
3738 || ( aProfileId == 4 ) || ( aProfileId == 5 ) || ( aProfileId == 6 ) ) |
|
3739 { |
|
3740 aClientProfile.Close(); |
|
3741 aClientProfile.Create(KClientProfile()); |
|
3742 return ETerminalModeSuccess; |
|
3743 } |
|
3744 return ETerminalModeInvalidProfileId; |
|
3745 } |
|
3746 |
|
3747 const CUpnpTmClientIconPref& CTmServerTest::GetClientIconPrefsL( TUint aProfileId ) |
|
3748 { |
|
3749 CUpnpTmClientIconPref* clientIconPref = NULL; |
|
3750 for ( TInt i(0); i < iClientIconPrefArray.Count(); i++ ) |
|
3751 { |
|
3752 if ( iClientIconPrefArray[i]->ClientProfileId() == aProfileId ) |
|
3753 { |
|
3754 clientIconPref = iClientIconPrefArray[i]; |
|
3755 break; |
|
3756 } |
|
3757 } |
|
3758 return *clientIconPref; |
|
3759 } |
|
3760 |