|
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 __SIMSMSSTORE_H_ |
|
17 #define __SIMSMSSTORE_H_ |
|
18 |
|
19 /** |
|
20 * @file |
|
21 * @internalAll |
|
22 * Contains the class definitions required for the SMS Store. |
|
23 */ |
|
24 |
|
25 #include <etelmm.h> |
|
26 #include <et_phone.h> |
|
27 #include "csimtimer.h" |
|
28 #include <mmretrieve.h> |
|
29 |
|
30 /** |
|
31 * This class is used to hold the details of batch read requests between the first and |
|
32 * second phases of a "two phase read". During the first phase, an instance of this class |
|
33 * is created containing a unique identifier to the request and the resulting information. |
|
34 * Once the second phase operation has identified this instance from a list and completed |
|
35 * the client request, this instance will be deleted. |
|
36 */ |
|
37 class CListReadAllAttempt : public CBase |
|
38 { |
|
39 public: |
|
40 static CListReadAllAttempt* NewL(RMobilePhone::TClientId& aId, TTsyReqHandle aReqHandle); |
|
41 ~CListReadAllAttempt(); |
|
42 |
|
43 protected: |
|
44 CListReadAllAttempt(RMobilePhone::TClientId& aId, TTsyReqHandle aReqHandle); |
|
45 |
|
46 private: |
|
47 void ConstructL(); |
|
48 |
|
49 public: |
|
50 CBufBase* iListBuf; // < The result of the read operation. |
|
51 RMobilePhone::TClientId iClient; // < A unique identifier of the read request. |
|
52 TTsyReqHandle iReqHandle; // < The first phase request handle. |
|
53 }; |
|
54 |
|
55 /** |
|
56 * The main SMS Store class which simulates an SMS Store. |
|
57 */ |
|
58 class CSimSmsMessaging; |
|
59 class CTestConfigSection; |
|
60 class CSimSmsStore : public CSubSessionExtBase, public MTimerCallBack |
|
61 { |
|
62 public: |
|
63 static CSimSmsStore* NewL(CSimSmsMessaging* aSimSmsMess, const TDesC8& aName, TInt aMaxNumSlots, CSimPhone* aPhone); |
|
64 CSimSmsStore(CSimSmsMessaging* aSimSmsMess, CSimPhone* aPhone); |
|
65 ~CSimSmsStore(); |
|
66 |
|
67 static void ClosePhone(TAny* aObj); |
|
68 virtual CTelObject::TReqMode ReqModeL(const TInt aIpc); |
|
69 // MTelObjectTSY pure virtual |
|
70 virtual TInt RegisterNotification(const TInt aIpc); |
|
71 virtual TInt DeregisterNotification(const TInt aIpc); |
|
72 virtual void Init(); |
|
73 virtual CTelObject* OpenNewObjectByNameL(const TDesC& aName); |
|
74 virtual CTelObject* OpenNewObjectL(TDes& aNewName); |
|
75 virtual TInt NumberOfSlotsL(const TInt aIpc); |
|
76 virtual TInt CancelService(const TInt aIpc,const TTsyReqHandle aTsyReqHandle); |
|
77 void DeleteAllCancel(); |
|
78 void ReadAllCancel(); |
|
79 |
|
80 // MSubSessionExtBaseTSY pure virtual |
|
81 virtual TInt ExtFunc(const TTsyReqHandle aTsyReqHandle,const TInt aIpc,const TDataPackage& aPackage); |
|
82 |
|
83 // Other public functions. |
|
84 void PopulateStoreFromConfigFile(); |
|
85 TPtrC8 Name(); |
|
86 TInt UsedEntries(); |
|
87 TInt MaxSlots(); |
|
88 TUint StoreCaps(); |
|
89 TInt StoreIncomingMessage(RMobileSmsStore::TMobileGsmSmsEntryV1* aSms); |
|
90 |
|
91 |
|
92 protected: |
|
93 void ConstructL(const TDesC8& aName, TInt aMaxNumSlots); |
|
94 |
|
95 private: |
|
96 TInt GetInfo(TTsyReqHandle aReqHandle, TDes8* aPckg); |
|
97 TInt Read(TTsyReqHandle aReqHandle, TDes8* aPckg); |
|
98 TInt Write(TTsyReqHandle aReqHandle,TDes8* aPckg); |
|
99 TInt Delete(TTsyReqHandle aReqHandle,TDes8* aPckg); |
|
100 TInt ReadAllPhase1(TTsyReqHandle aReqHandle,TDes8* aPckg1,TDes8* aPckg2); |
|
101 void ReadAllPhase1L(TTsyReqHandle aReqHandle,CRetrieveMobilePhoneSmsList::TBatchRequestData& aClientId,TInt& aBufSize); |
|
102 |
|
103 |
|
104 TInt ReadAllPhase2(TTsyReqHandle aReqHandle,TDes8* aPckg1,TDes8* aBuffer); |
|
105 TInt DeleteAll(TTsyReqHandle aReqHandle); |
|
106 TInt NotifyStoreEvent(TTsyReqHandle aReqHandle,TDes8* aPckg1,TDes8* aPckg2); |
|
107 void NotifyStoreEventCancel(); |
|
108 |
|
109 enum TStoreEvent // < Store event identifier. |
|
110 { |
|
111 EStoreEventNoEvent, |
|
112 EStoreEventAdded, |
|
113 EStoreEventDeleted, |
|
114 EStoreEventChanged |
|
115 }; |
|
116 |
|
117 void StoreEvent(TStoreEvent aEvent,TInt aIndex); |
|
118 void DelayCompletion(TInt aDelayDuration,TTsyReqHandle aReqHandle); |
|
119 void DelayCompletion(TInt aDelayDuration,TTsyReqHandle aReqHandle,TStoreEvent aEvent,TInt aIndex); |
|
120 void TimerCallBack(TInt aId); |
|
121 const CTestConfigSection* CfgFileSection(); |
|
122 void RecordSca(const TDesC8& aAsciiScaAddr, TInt aIndex); |
|
123 void LogRequest(TBool aEntering, TInt aIpc, TInt aError); |
|
124 |
|
125 private: |
|
126 CSimSmsMessaging* iSmsMessaging; // < A pointer to the "owner" SMS messaging class. |
|
127 CSimTimer* iTimer; // < The timer used to delay request completions. |
|
128 CSimTimer* iIncomingTimer; // < The timer used to delay the storage of incoming messages |
|
129 |
|
130 TInt iSmsMaxNumSlots; // < The maximum number of slots in this SMS store. |
|
131 |
|
132 RMobileSmsStore::TMobileGsmSmsEntryV1* iGsmSmsStoreEntries; // Array for GSM SMS entries |
|
133 |
|
134 |
|
135 TBuf8<KMaxName> iSmsStoreName; // < The name of the SMS Store. |
|
136 |
|
137 CArrayPtrFlat<CListReadAllAttempt>* iSmsReadAll; // < A list of the oustanding two phase batch read requests. |
|
138 |
|
139 TBool iEvOutstandingReq; // < A flag indicating an outstanding SMS Store notification request. |
|
140 TTsyReqHandle iEvReqHandle; // < The TSY request handle associated with an outstanding SMS Store notification request. |
|
141 TUint32* iEvEvent; // < The event flags associated with an outstanding SMS Store notification request. |
|
142 TInt* iEvIndex; // < The index value associated with an outstanding SMS Store notification request. |
|
143 |
|
144 TInt iSmsIndividualPause; // < The pause value used to delay the completion of an individual SMS Store manipulation request. |
|
145 TInt iSmsBatchPause; // < The pause value used to delay the completion of a batch SMS Store manipulation request. |
|
146 |
|
147 TUint iSmsStoreCaps; |
|
148 |
|
149 TTsyReqHandle iPendingReqCompletion; // < The TSY request handle for the request that is awaiting a timer event before completion. |
|
150 TStoreEvent iPendingEvent; // < The type of store event related to the request that is awaiting a timer event before completion. |
|
151 TInt iPendingIndex; // < The index related to the request that is awaiting a timer event before completion. |
|
152 |
|
153 CSimPhone* iPhone; |
|
154 }; |
|
155 |
|
156 #endif |