|
1 /* |
|
2 * Copyright (c) 2002 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: Stores processed SIM imsis to the a database |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CWPIMSIDBHANDLER_H |
|
21 #define CWPIMSIDBHANDLER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <f32file.h> |
|
26 #include <d32dbms.h> |
|
27 |
|
28 |
|
29 /** |
|
30 * CWPImsiDbHandler manages the storage of the imsi numbers |
|
31 * of processed SIM cards. |
|
32 * @since 2.5 |
|
33 */ |
|
34 class CWPImsiDbHandler : public CBase |
|
35 { |
|
36 public: // Constructors and destructor |
|
37 |
|
38 /** |
|
39 * Two-phased constructor. |
|
40 */ |
|
41 static CWPImsiDbHandler* NewL(); |
|
42 |
|
43 /** |
|
44 * Two-phased constructor. |
|
45 */ |
|
46 static CWPImsiDbHandler* NewLC(); |
|
47 |
|
48 /** |
|
49 * Destructor. |
|
50 */ |
|
51 virtual ~CWPImsiDbHandler(); |
|
52 |
|
53 public: // New functions |
|
54 |
|
55 /** |
|
56 * Initialize storage, create new if corrupt |
|
57 * or not existing |
|
58 * @since 2.5 |
|
59 */ |
|
60 void InitializeStorageL(); |
|
61 |
|
62 /** |
|
63 * Is the sim imsi new to the device? |
|
64 * @since 2.5 |
|
65 * @param aPhoneImsi the key |
|
66 * @return ETrue if current exists |
|
67 */ |
|
68 TBool ImsiExistsL( const TDesC& aPhoneImsi ); |
|
69 |
|
70 /** |
|
71 * Store a given IMSI to the database |
|
72 * @since 2.5 |
|
73 * @param aPhoneImsi the key |
|
74 * @return ETrue if current exists |
|
75 */ |
|
76 void StoreImsiL( const TDesC& aPhoneImsi ); |
|
77 |
|
78 private: |
|
79 |
|
80 /** |
|
81 * C++ default constructor. |
|
82 */ |
|
83 CWPImsiDbHandler(); |
|
84 |
|
85 /** |
|
86 * By default Symbian 2nd phase constructor is private. |
|
87 */ |
|
88 void ConstructL(); |
|
89 |
|
90 /** |
|
91 * Creates a database for storing imsi numbers |
|
92 * @since 2.5 |
|
93 */ |
|
94 void CreateDatabaseL(); |
|
95 /** |
|
96 * Creates a database for storing imsi numbers |
|
97 * @since 2.5 |
|
98 */ |
|
99 void CreateTableL(); |
|
100 /** |
|
101 * Creates a database for storing imsi numbers |
|
102 * @since 2.5 |
|
103 */ |
|
104 void CreateIndexL(); |
|
105 /** |
|
106 * Cancels the current database transaction |
|
107 * @since 2.5 |
|
108 */ |
|
109 static void CleanupRollback( TAny* aAny ); |
|
110 /** |
|
111 * Cleanup item. Cancels table update. |
|
112 * @param aAny The RDbTable pointer |
|
113 */ |
|
114 static void CleanupCancel( TAny* aAny ); |
|
115 |
|
116 private: // Data |
|
117 |
|
118 // File handle for database |
|
119 RFs iFs; |
|
120 // Database for imsi numbers |
|
121 RDbNamedDatabase iDb; |
|
122 // Table to store imsi numbers |
|
123 RDbTable iImsiTable; |
|
124 TFileName iDataBasePath; |
|
125 }; |
|
126 |
|
127 #endif // CWPImsiDbHandler_H |
|
128 |
|
129 // End of File |