|
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_CPosTp80.h" |
|
23 #include "FT_LandmarkConstants.h" |
|
24 #include <EPos_CPosLandmarkDatabase.h> |
|
25 #include <EPos_CPosLmDatabaseManager.h> |
|
26 |
|
27 // ================= CONSTANTS======================= |
|
28 _LIT(KLongFileName, "01234567890123456789012345678901234567890123456789012345678901234567890123456789_COMPOSITEEPOSLM.LDB"); |
|
29 |
|
30 // ================= MEMBER FUNCTIONS ======================= |
|
31 |
|
32 // --------------------------------------------------------- |
|
33 // CPosTp80::GetName |
|
34 // |
|
35 // (other items were commented in a header). |
|
36 // --------------------------------------------------------- |
|
37 // |
|
38 void CPosTp80::GetName(TDes& aName) const |
|
39 { |
|
40 _LIT(KTestName, "Tp80 - Landmarks DB Long File Name"); |
|
41 aName = KTestName; |
|
42 } |
|
43 |
|
44 // --------------------------------------------------------- |
|
45 // CPosTp80::CloseTest |
|
46 // |
|
47 // (other items were commented in a header). |
|
48 // --------------------------------------------------------- |
|
49 // |
|
50 void CPosTp80::CloseTest() |
|
51 { |
|
52 iLog->Put(_L("CloseTest")); |
|
53 |
|
54 TRAPD(err, DeleteTestDbL()); |
|
55 if (err != KErrNone) iLog->Put(_L("Error when DeleteTestDbL")); |
|
56 |
|
57 TRAP(err, RemoveAllLmDatabasesL()); |
|
58 if (err != KErrNone) iLog->Put(_L("Error when RemoveAllLmDatabasesL")); |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------- |
|
62 // CPosTp80::StartL |
|
63 // |
|
64 // (other items were commented in a header). |
|
65 // --------------------------------------------------------- |
|
66 // |
|
67 void CPosTp80::StartL() |
|
68 { |
|
69 // Init test part |
|
70 iLog->Put(_L("DeleteTestDbL")); |
|
71 DeleteTestDbL(); |
|
72 iLog->Put(_L("RemoveAllLmDatabasesL")); |
|
73 RemoveAllLmDatabasesL(); |
|
74 |
|
75 iLog->Put(_L("CopyTestDbFileL(KLongFileName)")); |
|
76 CopyTestDbFileL(KLongFileName); |
|
77 iLog->Put(_L("After CopyTestDbFileL(KLongFileName)")); |
|
78 |
|
79 CPosLmDatabaseManager* manager = CPosLmDatabaseManager::NewL(); |
|
80 CleanupStack::PushL(manager); |
|
81 // Hangs here |
|
82 iLog->Put(_L("Before DatabaseExistsL")); |
|
83 TBool exist = manager->DatabaseExistsL(KLongFileName); |
|
84 iLog->Put(_L("After DatabaseExistsL")); |
|
85 |
|
86 // if it exists, try to open it |
|
87 if (exist) |
|
88 { |
|
89 CPosLandmarkDatabase* lmd = CPosLandmarkDatabase::OpenL(KLongFileName); |
|
90 CleanupStack::PushL(lmd); |
|
91 CleanupStack::PopAndDestroy(lmd); |
|
92 } |
|
93 else iLog->Put(_L("DatabaseExistsL correctly returns EFalse")); |
|
94 |
|
95 CleanupStack::PopAndDestroy(manager); |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------- |
|
99 // CPosTp80::DeleteTestDbL |
|
100 // |
|
101 // (other items were commented in a header). |
|
102 // --------------------------------------------------------- |
|
103 // |
|
104 void CPosTp80::DeleteTestDbL() |
|
105 { |
|
106 iLog->Put(_L("DeleteTestDbL")); |
|
107 RFs fs; |
|
108 User::LeaveIfError(fs.Connect()); |
|
109 CleanupClosePushL(fs); |
|
110 |
|
111 CFileMan* fileMan = CFileMan::NewL(fs); |
|
112 CleanupStack::PushL(fileMan); |
|
113 |
|
114 TBuf<150> path; |
|
115 |
|
116 path.Append(KLmDbPath); |
|
117 path.Append(KLongFileName); |
|
118 |
|
119 TInt err = fileMan->Delete(path); |
|
120 if (err != KErrNone) |
|
121 { |
|
122 TBuf<100> buf; |
|
123 buf.Format(_L("Error %d when deleting file"), err); |
|
124 iLog->Put(buf); |
|
125 } |
|
126 |
|
127 CleanupStack::PopAndDestroy(2, &fs); |
|
128 } |
|
129 |
|
130 // End of File |