|
1 // Copyright (c) 2001-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 #ifndef __SIMPHBKUSIMSTORE_H_ |
|
17 #define __SIMPHBKUSIMSTORE_H_ |
|
18 |
|
19 /** |
|
20 * @file |
|
21 * |
|
22 * Contains the class definitions required for the Phonebook Store. |
|
23 * @internalAll |
|
24 */ |
|
25 |
|
26 #include <etelmm.h> |
|
27 #include <et_phone.h> |
|
28 #include <mpbutil.h> |
|
29 #include "csimtimer.h" |
|
30 #include "CSimPhone.h" |
|
31 #include "CSimPhoneSecurity.h" |
|
32 #include "CSimPhBkStore.h" |
|
33 |
|
34 /** |
|
35 * The main Phonebook Store class which simulates a Phonebook Store. |
|
36 */ |
|
37 class CSimPhone; |
|
38 class CTestConfigSection; |
|
39 class CTestConfigItem; |
|
40 class CSimPhBkUSimStore : public CSimPhone, public MTimerCallBack |
|
41 { |
|
42 public: |
|
43 |
|
44 static CSimPhBkUSimStore* NewL(CSimPhone* aPhone, const TDesC8& aStore, const TDesC8& aName, TInt aMaxNumSlots, TInt aMaxNumLen, TInt aMaxTextLen, TInt aMaxAdditional, TInt aMaxEmail, TInt aMaxAdditionalTelNumLen, TInt aMaxAdditionalTextLen); |
|
45 CSimPhBkUSimStore(CSimPhone* aPhone); |
|
46 ~CSimPhBkUSimStore(); |
|
47 |
|
48 static void ClosePhone(TAny* aObj); |
|
49 virtual CTelObject::TReqMode ReqModeL(const TInt aIpc); |
|
50 // MTelObjectTSY pure virtual |
|
51 virtual TInt RegisterNotification(const TInt aIpc); |
|
52 virtual TInt DeregisterNotification(const TInt aIpc); |
|
53 virtual void Init(); |
|
54 virtual CTelObject* OpenNewObjectByNameL(const TDesC& aName); |
|
55 virtual CTelObject* OpenNewObjectL(TDes& aNewName); |
|
56 virtual TInt NumberOfSlotsL(const TInt aIpc); |
|
57 virtual TInt CancelService(const TInt aIpc,const TTsyReqHandle aTsyReqHandle); |
|
58 |
|
59 // MSubSessionExtBaseTSY pure virtual |
|
60 virtual TInt ExtFunc(const TTsyReqHandle aTsyReqHandle,const TInt aIpc,const TDataPackage& aPackage); |
|
61 |
|
62 // Other public functions. |
|
63 void PopulateStoreFromConfigFileL(); |
|
64 void PopulatePhBkStoreInfo(RMobilePhoneStore::TMobilePhoneStoreInfoV1* aStoreInfo); |
|
65 |
|
66 //coverity[bad_override] |
|
67 TPtrC8 Name(); |
|
68 TPtrC8 PhBkStore(); |
|
69 TPtrC8 AID(); |
|
70 TInt UsedEntries(); |
|
71 TInt MaxSlots(); |
|
72 TInt CheckAndSwitchUSimApps(); |
|
73 |
|
74 protected: |
|
75 void ConstructL(const TDesC8& aStore, const TDesC8& aName, TInt aMaxNumSlots, TInt aMaxNumLen, TInt aMaxTextLen, TInt aAdditional, TInt aMaxEmail, TInt aMaxAdditionalTelNumLen, TInt aMaxAdditionalTextLen); |
|
76 |
|
77 private: |
|
78 TInt GetInfo(TTsyReqHandle aReqHandle, TDes8* aPckg); |
|
79 TInt Read(TTsyReqHandle aReqHandle, TDes8* aPckg1, TDes8* aPckg2); |
|
80 TInt Write(TTsyReqHandle aReqHandle,TDes8* aPckg1, TDes8* aPckg2); |
|
81 TInt Delete(TTsyReqHandle aReqHandle,TDes8* aPckg); |
|
82 TInt DeleteAll(TTsyReqHandle aReqHandle); |
|
83 TInt NotifyStoreEvent(TTsyReqHandle aReqHandle,TDes8* aPckg1,TDes8* aPckg2); |
|
84 void NotifyStoreEventCancel(); |
|
85 |
|
86 enum TStoreEvent // < Store event identifier. |
|
87 { |
|
88 EStoreEventNoEvent, |
|
89 EStoreEventAdded, |
|
90 EStoreEventDeleted, |
|
91 EStoreEventChanged |
|
92 }; |
|
93 |
|
94 void StoreEvent(TStoreEvent aEvent,TInt aIndex); |
|
95 void DelayCompletion(TInt aDelayDuration,TTsyReqHandle aReqHandle); |
|
96 void DelayCompletion(TInt aDelayDuration,TTsyReqHandle aReqHandle,TStoreEvent aEvent,TInt aIndex); |
|
97 void TimerCallBack(TInt aId); |
|
98 TBool FindIpcErrorMatch(TInt& aError); |
|
99 const CTestConfigSection* CfgFile(); |
|
100 |
|
101 TInt GetPhBkAdditionalEntry(TPtrC8& aEntry, TInt& aItemIndex, |
|
102 TPtrC8& aTelNum, TPtrC8& aAlphaTag, TUint8& aNpiTon); |
|
103 |
|
104 TInt GetPhBkUSimEntry(const CTestConfigItem* aItem, TInt& aItemIndex, |
|
105 TPtrC8& aPhonebookStore, TPtrC8& aPhonebookName, |
|
106 TPtrC8& aAid,TInt& aIndex, TPtrC8& aTelNum, |
|
107 TPtrC8& aAlphaTag, TUint8& aNpiTon, |
|
108 TPtrC8& aAlphaTag2); |
|
109 void PopulateOOBWrite(); |
|
110 void PopulateOOBDelete(); |
|
111 |
|
112 private: |
|
113 CPhoneBase* iDummyPhoneBaseRef; |
|
114 |
|
115 CSimPhone* iPhone; // < A pointer to the "owner" phone class. |
|
116 CSimTimer* iReqTimer; // < The timer used to delay request completions. |
|
117 CSimTimer* iOOBWriteTimer; // < The timer used to time an OOB store event. |
|
118 CSimTimer* iOOBDeleteTimer; // < The timer used to time an OOB delete event. |
|
119 |
|
120 TInt iPhBkMaxNumSlots; // < The maximum number of slots in this Phonebook store. |
|
121 TInt iPhBkMaxTelNumLen; // < The maximum size of a telephone number that can be stored in this Phonebook. |
|
122 TInt iPhBkMaxTextLen; // < The maximum size of an alpha tag that can be stored in this Phonebook. |
|
123 TInt iPhBkAdditional; // < The maximum number of additional numbers that can be stored in this Phonebook per entry. |
|
124 TInt iPhBkMaxEmail; // < The maximum number of emails that can be stored in this Phonebook per entry. |
|
125 |
|
126 TInt iPhBkMaxAdditionalTelNumLen; // < The maximum size of an additional telephone number that can be stored in this Phonebook. |
|
127 TInt iPhBkMaxAdditionalTextLen; // < The maximum size of an additional alpha tag that can be stored in this Phonebook. |
|
128 |
|
129 struct TPhBkStoreEntry |
|
130 { |
|
131 TBuf<KPhBkMaxAlphaTagSize> iAlphaTag; // < The phonebook entry's alpha tag. |
|
132 TUint8 iTonNpi; // < The phonebook entry's Type of Number and Number Plan Identifier. |
|
133 TBuf<KPhBkMaxTelNumSize> iTelNum; // < The phonebook entry's telephone number. |
|
134 }; |
|
135 |
|
136 typedef TBuf<KPhBkMaxAlphaTagSize> TPhBkUSimEmail; |
|
137 typedef TBuf<KPhBkMaxAlphaTagSize> TPhBkUSimGroup; |
|
138 |
|
139 class TPhBkUSimStoreEntry |
|
140 { |
|
141 public: |
|
142 TBuf<KPhBkMaxAlphaTagSize> iAlphaTag; // < The phonebook entry's alpha tag. |
|
143 TUint8 iTonNpi; // < The phonebook entry's Type of Number and Number Plan Identifier. |
|
144 TBuf<KPhBkMaxTelNumSize> iTelNum; // < The phonebook entry's telephone number. |
|
145 TBuf<KPhBkMaxAlphaTagSize> iAlphaTag2; // < The phonebook entry's name2 alpha tag. |
|
146 CArrayFixFlat<TPhBkStoreEntry>* iAdditional; //< The phonebook entry's additional numbers |
|
147 CArrayFixFlat<TPhBkUSimEmail>* iEmails; //< The phonebook entry's list of email addresses |
|
148 CArrayFixFlat<TPhBkUSimGroup>* iGroups; //< The phonebook entry's list groups definition |
|
149 TBool iHiddenEntry; |
|
150 }; |
|
151 |
|
152 TPhBkUSimStoreEntry* iPhBkUSimStoreEntries; // < Gsm Phonebook only |
|
153 TPhBkUSimStoreEntry* iPhBkUSim1StoreEntries; // < USim PhoneBook1 |
|
154 TPhBkUSimStoreEntry* iPhBkUSim2StoreEntries; // < USim PhoneBook2 |
|
155 |
|
156 struct TPhBkError |
|
157 { |
|
158 TInt iCount; // < The IPC count of the request that is to be errored. |
|
159 TInt iError; // < The error number that must be used with that request. |
|
160 }; |
|
161 CArrayFixFlat<TPhBkError>* iPhBkError; // < Array of indicating where to simulate phonebook request errors. |
|
162 TInt iIpcCnt; // < The current count of IPC client requests. |
|
163 |
|
164 TBuf8<KMaxName> iPhBkStore; // < The Phonebook Store. |
|
165 TBuf8<KMaxName> iPhBkStoreName; // < The name of the Phonebook Store. |
|
166 TInt iPhBkUSimCounter; |
|
167 RMobilePhone::TAID iPhBkAid; |
|
168 RMobilePhone::TAID iPhBkAidUSim1; |
|
169 RMobilePhone::TAID iPhBkAidUSim2; |
|
170 |
|
171 TUint iPhBkStoreCaps; // < The phone level caps of the PhBk Store |
|
172 |
|
173 CPhoneBookBuffer* iPhBkRwBuffer; // < The Phonebook read/write "streaming" class. |
|
174 |
|
175 TBool iEvOutstandingReq; // < A flag indicating an outstanding Phonebook Store notification request. |
|
176 TTsyReqHandle iEvReqHandle; // < The TSY request handle associated with an outstanding Phonebook Store notification request. |
|
177 TUint32* iEvEvent; // < The event flags associated with an outstanding Phonebook Store notification request. |
|
178 TInt* iEvIndex; // < The index value associated with an outstanding Phonebook Store notification request. |
|
179 |
|
180 TInt iPhBkIndividualPause; // < The pause value used to delay the completion of an individual Phonebook Store manipulation request. |
|
181 TInt iPhBkBatchPause; // < The pause value used to delay the completion of a batch Phonebook Store manipulation request. |
|
182 |
|
183 TTsyReqHandle iPendingReqCompletion; // < The TSY request handle for the request that is awaiting a timer event before completion. |
|
184 TStoreEvent iPendingEvent; // < The type of store event related to the request that is awaiting a timer event before completion. |
|
185 TInt iPendingIndex; // < The index related to the request that is awaiting a timer event before completion. |
|
186 |
|
187 TInt iPhBkOOBWriteDuration; // < The pause before the "out of band" write will be executed. |
|
188 TInt iPhBkOOBWriteIndex; // < The index number associated with the "out of band" write. |
|
189 TPhBkUSimStoreEntry iPhBkOOBWrite; // < The phonebook entry to be written in the "out of band" write. |
|
190 |
|
191 TInt iPhBkOOBDeleteDuration; // < The pause before the "out of band" delete. |
|
192 TInt iPhBkOOBDeleteIndex; // < The inex number associated with the "out of band" delete. |
|
193 |
|
194 struct TTriggerEventIPC |
|
195 { |
|
196 TInt iIPC; |
|
197 TInt iIPCCnt; |
|
198 RMobilePhone::TMobilePhoneSecurityEvent iEvent; |
|
199 }; |
|
200 TTriggerEventIPC iTriggerEventIPC; // < If .iIPC is called .iIpcCnt times, .iEvent is triggered |
|
201 TInt iTriggerCnt; // < the counter used to count the number of times iTriggerEventIPC.iIpc has been called |
|
202 |
|
203 }; |
|
204 |
|
205 #endif |