|
1 /* |
|
2 * Copyright (c) 2005 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 * ?description_line |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDES |
|
21 |
|
22 #include "FT_CPosTp2.h" |
|
23 #include <EPos_CPosLandmarkDatabase.h> |
|
24 #include <ecom.h> |
|
25 |
|
26 // ================= MEMBER FUNCTIONS ======================= |
|
27 |
|
28 |
|
29 // --------------------------------------------------------- |
|
30 // CPosTp2::StartL |
|
31 // |
|
32 // (other items were commented in a header). |
|
33 // --------------------------------------------------------- |
|
34 // |
|
35 void CPosTp2::StartL() |
|
36 { |
|
37 _LIT(KMoveDllErr, "Move of the Local Acces Provider dll failed with %d"); |
|
38 _LIT(KMoveRscErr, "Move of the Local Acces Provider rsc failed with %d"); |
|
39 _LIT(KLeaveErr, "CPosLandmarkDatabase::OpenL() doesn't leave with KErrNotSupported"); |
|
40 _LIT(KOpenErr, "CPosLandmarkDatabase::OpenL() failed with %d"); |
|
41 |
|
42 _LIT(KMoveToPath, "c:\\system\\test\\"); |
|
43 _LIT(KPluginMovedToPathDll, "c:\\system\\test\\eposlmlocalaccessprovider.dll"); |
|
44 _LIT(KPluginMovedToPathRsc, "c:\\system\\test\\eposlmlocalaccessprovider.RSC"); |
|
45 |
|
46 /* |
|
47 // Before |
|
48 //_LIT(KPluginMovedToPathRsc, "c:\\system\\test\\101FDF89.RSC"); |
|
49 |
|
50 _LIT(KPluginsPath, "c:\\system\\libs\\plugins\\"); |
|
51 _LIT(KDll, "c:\\system\\libs\\plugins\\eposlmlocalaccessprovider.dll"); |
|
52 _LIT(KRsc,"c:\\system\\libs\\plugins\\101FDF89.RSC"); |
|
53 */ |
|
54 |
|
55 _LIT(KPluginsPath, "c:\\sys\\bin\\"); |
|
56 _LIT(KPluginsResourcePath, "c:\\resource\\plugins\\"); |
|
57 _LIT(KDll, "c:\\sys\\bin\\eposlmlocalaccessprovider.dll"); |
|
58 _LIT(KRsc,"c:\\resource\\plugins\\eposlmlocalaccessprovider.RSC"); |
|
59 |
|
60 //#ifdef __WINS__ |
|
61 // _LIT(KCanceledErr, "Test canceled"); |
|
62 // _LIT(KMoveDll, "Move Epoc32\\release\\winscw\\udeb\\eposlmlocalaccessprovider.dll to c:\\sys\\bin\\ \ |
|
63 // and z:\\resource\\plugins\\eposlmlocalaccessprovider.rsc to c:\\resource\\plugins, press OK when done."); |
|
64 // TUtfwUserAnswer answer; |
|
65 // answer = iUserInfo->ShowDialog(KMoveDll, EUtfwDialogTypeOkCancel, EFalse); |
|
66 // AssertTrueSecL(answer == EUtfwUserAnswerOk, KCanceledErr, KErrCancel); |
|
67 //#endif |
|
68 |
|
69 CPosLandmarkDatabase* lmd=CPosLandmarkDatabase::OpenL(); |
|
70 delete lmd; |
|
71 |
|
72 RFs fs; |
|
73 User::LeaveIfError(fs.Connect()); |
|
74 CleanupClosePushL(fs); |
|
75 CFileMan* fileMan = CFileMan::NewL(fs); |
|
76 CleanupStack::PushL(fileMan); |
|
77 |
|
78 REComSession ecom = REComSession::OpenL(); |
|
79 CleanupClosePushL(ecom); |
|
80 |
|
81 TRequestStatus status; |
|
82 |
|
83 TInt err; |
|
84 err = fileMan->Move(KDll, KMoveToPath, CFileMan::EOverWrite); |
|
85 AssertTrueSecL(err == KErrNone, KMoveDllErr, err); |
|
86 err = fileMan->Move(KRsc, KMoveToPath, CFileMan::EOverWrite); |
|
87 AssertTrueSecL(err == KErrNone, KMoveRscErr, err); |
|
88 |
|
89 ecom.NotifyOnChange(status); |
|
90 User::WaitForRequest(status); // Wait for Ecom |
|
91 |
|
92 CPosLandmarkDatabase* lmd2=NULL; |
|
93 TRAP(err, lmd2=CPosLandmarkDatabase::OpenL()); |
|
94 delete lmd2; |
|
95 if (err) |
|
96 { |
|
97 AssertTrueSecL(err == KErrNotFound || err == KErrNotSupported, KLeaveErr, err); |
|
98 } |
|
99 else |
|
100 { |
|
101 AssertTrueSecL(err == KErrNotFound || err == KErrNotSupported, KLeaveErr); |
|
102 } |
|
103 |
|
104 err = fileMan->Move(KPluginMovedToPathDll, KPluginsPath, CFileMan::EOverWrite); |
|
105 AssertTrueSecL(err == KErrNone, KMoveDllErr, err); |
|
106 err = fileMan->Move(KPluginMovedToPathRsc, KPluginsResourcePath, CFileMan::EOverWrite); |
|
107 AssertTrueSecL(err == KErrNone, KMoveRscErr, err); |
|
108 |
|
109 ecom.NotifyOnChange(status); |
|
110 User::WaitForRequest(status); // Wait for Ecom |
|
111 |
|
112 CPosLandmarkDatabase* lmd3=NULL; |
|
113 TRAP(err, lmd3 = CPosLandmarkDatabase::OpenL()); |
|
114 delete lmd3; |
|
115 AssertTrueSecL(err == KErrNone, KOpenErr, err); |
|
116 |
|
117 CleanupStack::PopAndDestroy(3, &fs); |
|
118 |
|
119 // #ifdef __WINS__ |
|
120 // _LIT(KRestoreTest, "Restore c:\\sys\\bin\\eposlmlocalaccessprovider.dll to Epoc32\\release\\winscw\\udeb\\ and \ |
|
121 // c:\\resource\\plugins\\eposlmlocalaccessprovider.rsc to z:\\resource\\plugins "); |
|
122 // answer = iUserInfo->ShowDialog(KRestoreTest, EUtfwDialogTypeOk, EFalse); |
|
123 // #endif |
|
124 |
|
125 } |
|
126 |
|
127 // --------------------------------------------------------- |
|
128 // CPosTp2::WaitForEcomL |
|
129 // |
|
130 // (other items were commented in a header). |
|
131 // --------------------------------------------------------- |
|
132 // |
|
133 void CPosTp2::WaitForEcomL() |
|
134 { |
|
135 REComSession ecom = REComSession::OpenL(); |
|
136 CleanupClosePushL(ecom); |
|
137 TRequestStatus status; |
|
138 ecom.NotifyOnChange(status); |
|
139 User::WaitForRequest(status); |
|
140 CleanupStack::PopAndDestroy(&ecom); |
|
141 } |
|
142 |
|
143 // End of File |