|
1 |
1 /**************************************************************************** |
2 /**************************************************************************** |
2 ** |
3 ** |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
5 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** Contact: Nokia Corporation (qt-info@nokia.com) |
49 #include <etelmm.h> |
50 #include <etelmm.h> |
50 #endif |
51 #endif |
51 #include <qcontact.h> |
52 #include <qcontact.h> |
52 |
53 |
53 #include "cntsymbiansimengine.h" |
54 #include "cntsymbiansimengine.h" |
|
55 #include "cntsimstore.h" |
54 |
56 |
55 QTM_USE_NAMESPACE |
57 QTM_USE_NAMESPACE |
56 |
58 |
57 class CntSimStore; |
59 class CntSimStore; |
58 class CntSymbianSimEngine; |
60 class CntSymbianSimEngine; |
|
61 class CntSimStoreEventListener; |
59 |
62 |
60 class CntSimStorePrivate : public CActive |
63 class CntSimStorePrivate : public CActive |
61 { |
64 { |
62 public: |
65 public: |
63 enum State { |
66 enum State { |
64 InactiveState, |
67 InactiveState, |
65 GetInfoState, |
|
66 ReadState, |
68 ReadState, |
67 WriteState, |
69 WriteState, |
68 DeleteState |
70 DeleteState, |
|
71 ReadReservedSlotsState |
69 }; |
72 }; |
70 static CntSimStorePrivate* NewL(CntSymbianSimEngine &engine, CntSimStore &simStore, const QString &storeName); |
73 static CntSimStorePrivate* NewL(CntSymbianSimEngine &engine, CntSimStore &simStore, const QString &storeName); |
71 ~CntSimStorePrivate(); |
74 ~CntSimStorePrivate(); |
72 |
75 |
73 QString storeName() { return m_storeName; } |
76 QString storeName() { return m_storeName; } |
74 RMobilePhoneBookStore::TMobilePhoneBookInfoV5 storeInfo() { return m_storeInfo; } |
77 TSimStoreInfo storeInfo() { return m_storeInfo; } |
75 |
78 |
76 QContactManager::Error getInfo(); |
79 bool read(int index, int numSlots, QContactManager::Error *error); |
77 QContactManager::Error read(int index, int numSlots); |
80 bool write(const QContact &contact, QContactManager::Error *error); |
78 QContactManager::Error write(const QContact &contact); |
81 bool remove(int index, QContactManager::Error *error); |
79 QContactManager::Error remove(int index); |
82 bool getReservedSlots(QContactManager::Error *error); |
|
83 |
|
84 TInt lastAsyncError() { return m_asyncError; } |
80 |
85 |
81 private: |
86 private: |
82 // from CActive |
87 // from CActive |
83 void RunL(); |
88 void RunL(); |
84 void DoCancel(); |
89 void DoCancel(); |
87 private: |
92 private: |
88 CntSimStorePrivate(CntSymbianSimEngine &engine, CntSimStore &simStore, const QString &storeName); |
93 CntSimStorePrivate(CntSymbianSimEngine &engine, CntSimStore &simStore, const QString &storeName); |
89 void ConstructL(); |
94 void ConstructL(); |
90 void convertStoreNameL(TDes &storeName); |
95 void convertStoreNameL(TDes &storeName); |
91 QList<QContact> decodeSimContactsL(TDes8& rawData) const; |
96 QList<QContact> decodeSimContactsL(TDes8& rawData) const; |
92 QContact encodeSimContactL(const QContact* contact, TDes8& rawData) const; |
97 void encodeSimContactL(QContact* contact, TDes8& rawData) const; |
|
98 void putTagAndValueL(CPhoneBookBuffer* pbBuffer, TUint8 tag, QString data) const; |
|
99 QList<int> decodeReservedSlotsL(TDes8& rawData) const; |
93 |
100 |
94 private: |
101 private: |
95 State m_state; |
102 State m_state; |
96 CntSymbianSimEngine &m_engine; |
103 CntSymbianSimEngine &m_engine; |
97 QString m_managerUri; |
104 QString m_managerUri; |
98 CntSimStore &m_simStore; |
105 CntSimStore &m_simStore; |
99 RTelServer m_etelServer; |
106 RTelServer m_etelServer; |
100 RMobilePhone m_etelPhone; |
107 RMobilePhone m_etelPhone; |
101 RMobilePhoneBookStore m_etelStore; |
108 RMobilePhoneBookStore m_etelStore; |
102 QString m_storeName; |
109 QString m_storeName; |
103 RMobilePhoneBookStore::TMobilePhoneBookInfoV5 m_storeInfo; |
110 bool m_readOnlyAccess; |
104 RMobilePhoneBookStore::TMobilePhoneBookInfoV5Pckg m_storeInfoPckg; |
111 TSimStoreInfo m_storeInfo; |
|
112 TSimStoreInfoPckg m_storeInfoPckg; |
105 RBuf8 m_buffer; |
113 RBuf8 m_buffer; |
106 QContact m_convertedContact; |
114 QContact m_convertedContact; |
107 int m_writeIndex; |
115 int m_writeIndex; |
|
116 CntSimStoreEventListener* m_listener; |
|
117 TInt m_asyncError; |
108 }; |
118 }; |
109 |
119 |
110 #endif // CNTSIMSTOREPRIVATE_H_ |
120 #endif // CNTSIMSTOREPRIVATE_H_ |