|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalAll |
|
19 */ |
|
20 |
|
21 #ifndef __CPHONEBOOKDISPATCHER_H_ |
|
22 #define __CPHONEBOOKDISPATCHER_H_ |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32std.h> |
|
26 #include <e32base.h> |
|
27 #include <e32def.h> |
|
28 #include <etelmm.h> |
|
29 |
|
30 #include <ctsy/ltsy/mltsydispatchfactory.h> |
|
31 |
|
32 #include "requestqueueoneshot.h" |
|
33 #include <ctsy/ltsy/ltsylogger.h> |
|
34 #include "mdispatchercallback.h" |
|
35 |
|
36 #include <ctsy/ltsy/mltsydispatchphonebookinterface.h> |
|
37 |
|
38 // FORWARD DECLARATIONS |
|
39 class CMmDataPackage; |
|
40 class MmMessageManagerCallback; |
|
41 class TDispatcherHolder; |
|
42 class CPhoneBookEntry; |
|
43 class CPhoneBookBuffer; |
|
44 class CPhoneBookStoreEntry; |
|
45 class CStorageInfoData; |
|
46 class TPhonebookInfoV1; |
|
47 class DispatcherPhonebook::TPhonebookStoreInfoV1; |
|
48 |
|
49 class MLtsyDispatchPhonebookStoreReadEntry; |
|
50 class MLtsyDispatchPhonebookStoreDeleteEntry; |
|
51 class MLtsyDispatchPhonebookStoreCache; |
|
52 class MLtsyDispatchPhonebookStoreGetPhonebookInfo; |
|
53 class MLtsyDispatchPhonebookStoreInitialise; |
|
54 class MLtsyDispatchPhonebookStoreDeleteAll; |
|
55 class MLtsyDispatchPhonebookSmsStoreReadAll; |
|
56 class MLtsyDispatchPhonebookStoreWriteEntry; |
|
57 class MLtsyDispatchPhonebookGetPhoneStoreInfo; |
|
58 class MLtsyDispatchPhonebookSmsStoreDeleteEntry; |
|
59 class MLtsyDispatchPhonebookSmsStoreDeleteAll; |
|
60 class MLtsyDispatchPhonebookSmsStoreGetInfo; |
|
61 class MLtsyDispatchPhonebookSmsStoreReadEntry; |
|
62 class MLtsyDispatchPhonebookSmsStoreWriteEntry; |
|
63 class MLtsyDispatchPhonebookStoreCacheCancel; |
|
64 |
|
65 |
|
66 |
|
67 // CLASS DECLARATION |
|
68 |
|
69 /** |
|
70 * This class is responsible for packing and unpacking data belonging |
|
71 * to Phonebook related requests to the Licensee LTSY. |
|
72 */ |
|
73 class CPhonebookDispatcher : public CBase, public MDispatcherCallback |
|
74 { |
|
75 public: |
|
76 |
|
77 virtual ~CPhonebookDispatcher(); |
|
78 |
|
79 static CPhonebookDispatcher* NewL( |
|
80 MLtsyDispatchFactoryV1& aLtsyFactory, |
|
81 MmMessageManagerCallback& aMessageManagerCallback, |
|
82 CRequestQueueOneShot& aRequestAsyncOneShot); |
|
83 |
|
84 static CPhonebookDispatcher* NewLC( |
|
85 MLtsyDispatchFactoryV1& aLtsyFactory, |
|
86 MmMessageManagerCallback& aMessageManagerCallback, |
|
87 CRequestQueueOneShot& aRequestAsyncOneShot); |
|
88 |
|
89 // Dispatcher functions for dispatching requests DOWN to the Licensee LTSY |
|
90 |
|
91 TInt DispatchStoreReadEntryL(const CMmDataPackage* aDataPackage); |
|
92 TInt DispatchStoreDeleteEntryL(const CMmDataPackage* aDataPackage); |
|
93 TInt DispatchStoreCacheL(const CMmDataPackage* aDataPackage); |
|
94 TInt DispatchStoreGetInfoL(const CMmDataPackage* aDataPackage); |
|
95 TInt DispatchStoreInitialiseL(const CMmDataPackage* aDataPackage); |
|
96 TInt DispatchStoreDeleteAllL(const CMmDataPackage* aDataPackage); |
|
97 TInt DispatchSmsStoreReadAllL(); |
|
98 TInt DispatchStoreWriteEntryL(const CMmDataPackage* aDataPackage); |
|
99 TInt DispatchGetPhoneStoreInfoL(const CMmDataPackage* aDataPackage); |
|
100 TInt DispatchSmsStoreDeleteEntryL(const CMmDataPackage* aDataPackage); |
|
101 TInt DispatchSmsStoreDeleteAllL(); |
|
102 TInt DispatchSmsStoreGetInfoL(); |
|
103 TInt DispatchSmsStoreReadEntryL(const CMmDataPackage* aDataPackage); |
|
104 TInt DispatchSmsStoreWriteEntryL(const CMmDataPackage* aDataPackage); |
|
105 TInt DispatchStoreCacheCancelL(const CMmDataPackage* aDataPackage); |
|
106 |
|
107 |
|
108 // Complete functions for receiving completions UP from the Licensee LTSY |
|
109 // via the CCtsyDispatcherCallback object. |
|
110 |
|
111 void CallbackStoreResetCache(TInt aError, DispatcherPhonebook::TPhonebook aPhonebook); |
|
112 void CallbackStoreSetFdnPhonebookInfoInd(TInt aError, TInt aTotalEntries , TInt aMaxTextLength , TInt aMaxNumberLength); |
|
113 void CallbackStoreReadEntry(TInt aError, DispatcherPhonebook::TPhonebook aPhonebook, const TDesC8& aPhonebookEntries); |
|
114 void CallbackStoreDeleteEntry(TInt aError, DispatcherPhonebook::TPhonebook aPhonebook, TInt aMaxNumberLength); |
|
115 void CallbackStoreCache(TInt aError, DispatcherPhonebook::TPhonebook aPhonebook, const TDesC8& aPhonebookEntries); |
|
116 void CallbackStoreGetPhonebookInfo(TInt aError, DispatcherPhonebook::TPhonebook aPhonebook, TInt aUsedEntries); |
|
117 void CallbackStoreInitialise(TInt aError, const DispatcherPhonebook::TPhonebookStoreInfoV1& aPhonebookStoreInfo); |
|
118 void CallbackStoreDeleteAll(TInt aError, DispatcherPhonebook::TPhonebook aPhonebook, TInt aMaxNumberLength); |
|
119 void CallbackStoreWriteEntry(TInt aError, DispatcherPhonebook::TPhonebook aPhonebook, TUint16 aIndex, TInt aMaxNumberLength); |
|
120 void CallbackGetPhoneStoreInfo(TInt aError, const RMobilePhoneStore::TMobilePhoneStoreInfoV1& aPhoneStoreInfo); |
|
121 void CallbackSmsStoreReadAll(TInt aError, const DispatcherPhonebook::TSmsData& aSmsData, TInt aIndex, TBool aMoreToCome, TBool aReceivedClass2ToBeResent); |
|
122 void CallbackSmsStoreDeleteEntry(TInt aError); |
|
123 void CallbackSmsStoreDeleteAll(TInt aError); |
|
124 void CallbackSmsStoreGetInfo(TInt aError, TInt aTotalEntries, TInt aUsedEntries); |
|
125 void CallbackSmsStoreReadEntry(TInt aError, const DispatcherPhonebook::TSmsData& aSmsData); |
|
126 void CallbackSmsStoreWriteEntry(TInt aError, TInt aLocation, TBool aReceivedClass2ToBeResent); |
|
127 |
|
128 |
|
129 // From MDispatcherCallback |
|
130 void CallbackSync(CRequestQueueOneShot::TIpcDataPackage& aIpcDataPackage); |
|
131 |
|
132 // Other public functions |
|
133 void SetDispatcherHolder(TDispatcherHolder& aDispatcherHolder); |
|
134 |
|
135 private: |
|
136 |
|
137 static const TInt KPhonebookTypes = DispatcherPhonebook::EUnknown; |
|
138 |
|
139 static const TInt KMaxTotalEntries = 255; |
|
140 |
|
141 private: |
|
142 |
|
143 CPhonebookDispatcher(MLtsyDispatchFactoryV1& aLtsyFactory, |
|
144 MmMessageManagerCallback& aMessageManagerCallback, |
|
145 CRequestQueueOneShot& aRequestAsyncOneShot); |
|
146 |
|
147 void ConstructL(); |
|
148 |
|
149 //helper functions |
|
150 CPhoneBookStoreEntry* CreatePhoneBookStoreEntryLC(const CPhoneBookEntry& aPhoneBookEntry) const; |
|
151 TInt FillPhoneBookEntry(const CPhoneBookStoreEntry& aPhoneBookStoreEntry, CPhoneBookEntry& aPhoneBookEntry) const; |
|
152 void FillCtsyPhoneBookStoreL(const TDesC8& aPhonebookEntries, CArrayPtrSeg<CPhoneBookStoreEntry>& aCtsyPhoneBook); |
|
153 const TDesC& PhonebookName(DispatcherPhonebook::TPhonebook aPhonebookType) const; |
|
154 DispatcherPhonebook::TPhonebook Phonebook(const TDesC& aPhonebookName) const; |
|
155 void PhonebookStoreToStorageInfo(const DispatcherPhonebook::TPhonebookStoreInfoV1& aPhonebookStoreInfo, CStorageInfoData& aStorageInfoData) const; |
|
156 |
|
157 void FillSmsStoreListL(const DispatcherPhonebook::TSmsData& aSmsData, TInt aIndex, CArrayPtrFlat< TSmsMsg >& aSmsListArray); |
|
158 |
|
159 private: // Not owned |
|
160 |
|
161 |
|
162 MLtsyDispatchFactoryV1& iLtsyFactoryV1; |
|
163 MmMessageManagerCallback& iMessageManagerCallback; |
|
164 CRequestQueueOneShot& iRequestAsyncOneShot; |
|
165 TDispatcherHolder* iDispatcherHolder; |
|
166 |
|
167 // Interfaces in the Licensee LTSY, not owned by this object |
|
168 |
|
169 MLtsyDispatchPhonebookStoreReadEntry* iLtsyDispatchPhonebookStoreReadEntry; |
|
170 MLtsyDispatchPhonebookStoreDeleteEntry* iLtsyDispatchPhonebookStoreDeleteEntry; |
|
171 MLtsyDispatchPhonebookStoreCache* iLtsyDispatchPhonebookStoreCache; |
|
172 MLtsyDispatchPhonebookStoreGetPhonebookInfo* iLtsyDispatchPhonebookStoreGetPhonebookInfo; |
|
173 MLtsyDispatchPhonebookStoreInitialise* iLtsyDispatchPhonebookStoreInitialise; |
|
174 MLtsyDispatchPhonebookStoreDeleteAll* iLtsyDispatchPhonebookStoreDeleteAll; |
|
175 MLtsyDispatchPhonebookSmsStoreReadAll* iLtsyDispatchPhonebookSmsStoreReadAll; |
|
176 MLtsyDispatchPhonebookStoreWriteEntry* iLtsyDispatchPhonebookStoreWriteEntry; |
|
177 MLtsyDispatchPhonebookGetPhoneStoreInfo* iLtsyDispatchPhonebookGetPhoneStoreInfo; |
|
178 MLtsyDispatchPhonebookSmsStoreDeleteEntry* iLtsyDispatchPhonebookSmsStoreDeleteEntry; |
|
179 MLtsyDispatchPhonebookSmsStoreDeleteAll* iLtsyDispatchPhonebookSmsStoreDeleteAll; |
|
180 MLtsyDispatchPhonebookSmsStoreGetInfo* iLtsyDispatchPhonebookSmsStoreGetInfo; |
|
181 MLtsyDispatchPhonebookSmsStoreReadEntry* iLtsyDispatchPhonebookSmsStoreReadEntry; |
|
182 MLtsyDispatchPhonebookSmsStoreWriteEntry* iLtsyDispatchPhonebookSmsStoreWriteEntry; |
|
183 MLtsyDispatchPhonebookStoreCacheCancel* iLtsyDispatchPhonebookStoreCacheCancel; |
|
184 |
|
185 |
|
186 //stored pointers sent from the CTSY between Req Comp calls |
|
187 RPointerArray<CArrayPtrSeg<CPhoneBookStoreEntry> > iPhonebookCachePtrs; |
|
188 RPointerArray<CArrayPtrSeg<CPhoneBookStoreEntry> > iPhonebookReadPtrs; |
|
189 CArrayPtrFlat< TSmsMsg >* iSmsListArray; |
|
190 DispatcherPhonebook::TPhonebook iInitialisePhonebook; |
|
191 }; // class CPhonebookDispatcher |
|
192 |
|
193 #endif // __CPHONEBOOKDISPATCHER_H_ |
|
194 |