|
1 |
|
2 /**************************************************************************** |
|
3 ** |
|
4 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
5 ** All rights reserved. |
|
6 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
7 ** |
|
8 ** This file is part of the Qt Mobility Components. |
|
9 ** |
|
10 ** $QT_BEGIN_LICENSE:LGPL$ |
|
11 ** No Commercial Usage |
|
12 ** This file contains pre-release code and may not be distributed. |
|
13 ** You may use this file in accordance with the terms and conditions |
|
14 ** contained in the Technology Preview License Agreement accompanying |
|
15 ** this package. |
|
16 ** |
|
17 ** GNU Lesser General Public License Usage |
|
18 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
19 ** General Public License version 2.1 as published by the Free Software |
|
20 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
21 ** packaging of this file. Please review the following information to |
|
22 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
24 ** |
|
25 ** In addition, as a special exception, Nokia gives you certain additional |
|
26 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
28 ** |
|
29 ** If you have questions regarding the use of this file, please contact |
|
30 ** Nokia at qt-info@nokia.com. |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** |
|
39 ** $QT_END_LICENSE$ |
|
40 ** |
|
41 ****************************************************************************/ |
|
42 |
|
43 #ifndef CNTSIMSTOREPRIVATE_H_ |
|
44 #define CNTSIMSTOREPRIVATE_H_ |
|
45 |
|
46 #include <e32base.h> |
|
47 #ifdef SYMBIANSIM_BACKEND_USE_ETEL_TESTSERVER |
|
48 #include <etelmm_etel_test_server.h> |
|
49 #else |
|
50 #include <etelmm.h> |
|
51 #endif |
|
52 #include <qcontact.h> |
|
53 |
|
54 #include "cntsymbiansimengine.h" |
|
55 #include "cntsimstore.h" |
|
56 |
|
57 QTM_USE_NAMESPACE |
|
58 |
|
59 class CntSimStore; |
|
60 class CntSymbianSimEngine; |
|
61 class CntSimStoreEventListener; |
|
62 |
|
63 class CntSimStorePrivate : public CActive |
|
64 { |
|
65 public: |
|
66 enum State { |
|
67 InactiveState, |
|
68 ReadState, |
|
69 WriteState, |
|
70 DeleteState, |
|
71 ReadReservedSlotsState |
|
72 }; |
|
73 static CntSimStorePrivate* NewL(CntSymbianSimEngine &engine, CntSimStore &simStore, const QString &storeName); |
|
74 ~CntSimStorePrivate(); |
|
75 |
|
76 SimStoreInfo storeInfo() { return m_storeInfo; } |
|
77 bool read(int index, int numSlots, QContactManager::Error *error); |
|
78 bool write(const QContact &contact, QContactManager::Error *error); |
|
79 bool remove(int index, QContactManager::Error *error); |
|
80 bool getReservedSlots(QContactManager::Error *error); |
|
81 TInt lastAsyncError() { return m_asyncError; } |
|
82 |
|
83 private: |
|
84 // from CActive |
|
85 void RunL(); |
|
86 void DoCancel(); |
|
87 TInt RunError(TInt aError); |
|
88 |
|
89 private: |
|
90 CntSimStorePrivate(CntSymbianSimEngine &engine, CntSimStore &simStore, const QString &storeName); |
|
91 void ConstructL(); |
|
92 void convertStoreNameL(TDes &storeName); |
|
93 QList<QContact> decodeSimContactsL(TDes8& rawData) const; |
|
94 void encodeSimContactL(QContact* contact, TDes8& rawData) const; |
|
95 void putTagAndValueL(CPhoneBookBuffer* pbBuffer, TUint8 tag, QString data) const; |
|
96 QList<int> decodeReservedSlotsL(TDes8& rawData) const; |
|
97 void writeL(QContact *contact); |
|
98 void removeL(int index); |
|
99 void updateStoreInfoL(); |
|
100 |
|
101 private: |
|
102 State m_state; |
|
103 CntSymbianSimEngine &m_engine; |
|
104 QString m_managerUri; |
|
105 CntSimStore &m_simStore; |
|
106 RTelServer m_etelServer; |
|
107 RMobilePhone m_etelPhone; |
|
108 RMobilePhoneBookStore m_etelStore; |
|
109 SimStoreInfo m_storeInfo; |
|
110 RBuf8 m_buffer; |
|
111 QContact m_convertedContact; |
|
112 int m_writeIndex; |
|
113 CntSimStoreEventListener* m_listener; |
|
114 TInt m_asyncError; |
|
115 bool m_extraDetailsChecked; |
|
116 }; |
|
117 |
|
118 #endif // CNTSIMSTOREPRIVATE_H_ |