24
|
1 |
// Copyright (c) 2006-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 |
|
|
18 |
// INCLUDE FILES
|
|
19 |
#include <e32std.h>
|
|
20 |
#include "cmmtsyreqhandlestore.h"
|
|
21 |
#include "cmmphonetsy.h"
|
|
22 |
#include "CResponseTimerStore.h"
|
|
23 |
|
|
24 |
// ======== MEMBER FUNCTIONS ========
|
|
25 |
|
|
26 |
CMmTsyReqHandleStore::~CMmTsyReqHandleStore()
|
|
27 |
{
|
|
28 |
#ifdef REQHANDLE_TIMER
|
|
29 |
|
|
30 |
//Check if this handle store is using the timer
|
|
31 |
if ( NULL != iPhone )
|
|
32 |
{
|
|
33 |
//delete the possible entries in the time stamp table
|
|
34 |
iPhone->GetTimeStampStore()->DeleteByHandleStoreAllEntries( this );
|
|
35 |
}
|
|
36 |
|
|
37 |
#endif
|
|
38 |
}
|
|
39 |
|
|
40 |
CMmTsyReqHandleStore* CMmTsyReqHandleStore::NewL(
|
|
41 |
TInt aNumberOfRequests, //number of requests
|
|
42 |
TTsyReqHandle* aFirstElement ) //pointer to the first element
|
|
43 |
{
|
|
44 |
TFLOGSTRING3("TSY:CMmTsyReqHandleStore::NewL aNumberOfRequests=%d aFirstElement=%x",aNumberOfRequests,aFirstElement);
|
|
45 |
|
|
46 |
CMmTsyReqHandleStore* tsyReqHandleStore
|
|
47 |
= new ( ELeave ) CMmTsyReqHandleStore();
|
|
48 |
|
|
49 |
CleanupStack::PushL( tsyReqHandleStore );
|
|
50 |
|
|
51 |
tsyReqHandleStore->iNumOfRequests = aNumberOfRequests;
|
|
52 |
tsyReqHandleStore->iReqHandles = aFirstElement;
|
|
53 |
|
|
54 |
//check that array is really initialised and reset it at the same time
|
|
55 |
for( TInt i = 0; i < aNumberOfRequests; i++ )
|
|
56 |
*( tsyReqHandleStore->iReqHandles + i ) = 0;
|
|
57 |
|
|
58 |
CleanupStack::Pop();
|
|
59 |
TFLOGSTRING2("TSY:CMmTsyReqHandleStore::NewL returns tsyReqHandleStore=%x",tsyReqHandleStore);
|
|
60 |
return tsyReqHandleStore;
|
|
61 |
}
|
|
62 |
|
|
63 |
#ifdef REQHANDLE_TIMER
|
|
64 |
|
|
65 |
CMmTsyReqHandleStore* CMmTsyReqHandleStore::NewL(
|
|
66 |
CTelObject * aCTelObject,
|
|
67 |
CMmPhoneTsy *aPhone,
|
|
68 |
TInt aNumberOfRequests,
|
|
69 |
TTsyReqHandle* aFirstElement )
|
|
70 |
{
|
|
71 |
TFLOGSTRING3("TSY:CMmTsyReqHandleStore::NewL aCTelObject=%x aPhone=%x",aCTelObject,aPhone);
|
|
72 |
TFLOGSTRING3("TSY:CMmTsyReqHandleStore::NewL aNumberOfRequests=%d aFirstElement=%x",aNumberOfRequests,aFirstElement);
|
|
73 |
CMmTsyReqHandleStore* tsyReqHandleStore
|
|
74 |
= new ( ELeave ) CMmTsyReqHandleStore();
|
|
75 |
|
|
76 |
CleanupStack::PushL( tsyReqHandleStore );
|
|
77 |
|
|
78 |
tsyReqHandleStore->iNumOfRequests = aNumberOfRequests;
|
|
79 |
tsyReqHandleStore->iReqHandles = aFirstElement;
|
|
80 |
tsyReqHandleStore->iCTelObject = aCTelObject;
|
|
81 |
tsyReqHandleStore->iPhone = aPhone;
|
|
82 |
|
|
83 |
for( TInt i = 0; i < aNumberOfRequests; i++ )
|
|
84 |
*( tsyReqHandleStore->iReqHandles + i ) = 0;
|
|
85 |
|
|
86 |
CleanupStack::Pop();
|
|
87 |
|
|
88 |
return tsyReqHandleStore;
|
|
89 |
}
|
|
90 |
|
|
91 |
#endif
|
|
92 |
|
|
93 |
// ---------------------------------------------------------------------------
|
|
94 |
// CMmTsyReqHandleStore::GetTsyReqHandle
|
|
95 |
// Returns TSY request handle for given index.
|
|
96 |
// (other items were commented in a header).
|
|
97 |
// ---------------------------------------------------------------------------
|
|
98 |
//
|
|
99 |
TTsyReqHandle CMmTsyReqHandleStore::GetTsyReqHandle(
|
|
100 |
const TInt aIndex )
|
|
101 |
{
|
|
102 |
TFLOGSTRING2("TSY:CMmTsyReqHandleStore::GetTsyReqHandle aIndex=%d", aIndex);
|
|
103 |
TTsyReqHandle ret( NULL );
|
|
104 |
|
|
105 |
//check the bounds
|
|
106 |
if ( aIndex >= 0 && aIndex < iNumOfRequests )
|
|
107 |
{
|
|
108 |
ret = *( iReqHandles + aIndex );
|
|
109 |
}
|
|
110 |
|
|
111 |
return ret;
|
|
112 |
}
|
|
113 |
|
|
114 |
// ---------------------------------------------------------------------------
|
|
115 |
// CMmTsyReqHandleStore::SetTsyReqHandle
|
|
116 |
// Sets TSY request handle for given index.
|
|
117 |
// (other items were commented in a header).
|
|
118 |
// ---------------------------------------------------------------------------
|
|
119 |
//
|
|
120 |
void CMmTsyReqHandleStore::SetTsyReqHandle(
|
|
121 |
const TInt aIndex,
|
|
122 |
const TTsyReqHandle aTsyReqHandle )
|
|
123 |
{
|
|
124 |
TFLOGSTRING3("TSY:CMmTsyReqHandleStore::SetTsyReqHandle aIndex=%d aTsyReqHandle=%d ", aIndex, aTsyReqHandle);
|
|
125 |
if ( aIndex >= 0 && aIndex < iNumOfRequests )
|
|
126 |
{
|
|
127 |
*( iReqHandles + aIndex ) = aTsyReqHandle;
|
|
128 |
}
|
|
129 |
|
|
130 |
}
|
|
131 |
|
|
132 |
#ifdef REQHANDLE_TIMER
|
|
133 |
|
|
134 |
// ---------------------------------------------------------------------------
|
|
135 |
// CMmTsyReqHandleStore::SetTsyReqHandle
|
|
136 |
// Sets TSY request handle for given index. Adds an entry
|
|
137 |
// in the time table for automatic response when timeout.
|
|
138 |
// (other items were commented in a header).
|
|
139 |
// ---------------------------------------------------------------------------
|
|
140 |
//
|
|
141 |
void CMmTsyReqHandleStore::SetTsyReqHandle(
|
|
142 |
const TInt aIndex,
|
|
143 |
const TTsyReqHandle aTsyReqHandle,
|
|
144 |
TInt aTimeout,
|
|
145 |
TInt aIPC )
|
|
146 |
{
|
|
147 |
TFLOGSTRING3("TSY:CMmTsyReqHandleStore::SetTsyReqHandle aIndex=%d, aTsyReqHandle=%d",aIndex,aTsyReqHandle);
|
|
148 |
TFLOGSTRING3("TSY:CMmTsyReqHandleStore::SetTsyReqHandle aTimeout=%d IPC=%d", aTimeout, aIPC);
|
|
149 |
|
|
150 |
if ( aIndex >= 0 && aIndex < iNumOfRequests )
|
|
151 |
{
|
|
152 |
*( iReqHandles + aIndex ) = aTsyReqHandle;
|
|
153 |
|
|
154 |
#ifdef __WINS__
|
|
155 |
//increase the timeout to help wins debugging
|
|
156 |
aTimeout = aTimeout + KMultimodeTsyWinsTimeoutIncreasing;
|
|
157 |
#endif
|
|
158 |
//add a entry for triggering the automatic response
|
|
159 |
iPhone->GetTimeStampStore()->AddTimeEntry( aIndex,
|
|
160 |
this,
|
|
161 |
iCTelObject,
|
|
162 |
aTimeout,
|
|
163 |
aIPC );
|
|
164 |
}
|
|
165 |
}
|
|
166 |
|
|
167 |
#endif
|
|
168 |
|
|
169 |
// ---------------------------------------------------------------------------
|
|
170 |
// CMmTsyReqHandleStore::ResetTsyReqHandle
|
|
171 |
// Resets TSY req handle of given index and also returns it.
|
|
172 |
// If automatic response is in use it deletes the entry for the given index
|
|
173 |
// in the CResponseTimerStore.
|
|
174 |
// (other items were commented in a header).
|
|
175 |
// ---------------------------------------------------------------------------
|
|
176 |
//
|
|
177 |
TTsyReqHandle CMmTsyReqHandleStore::ResetTsyReqHandle(
|
|
178 |
const TInt aIndex )
|
|
179 |
{
|
|
180 |
TFLOGSTRING2("TSY:CMmTsyReqHandleStore::ResetTsyReqHandle aIndex=%d", aIndex);
|
|
181 |
//req handle was not used.
|
|
182 |
TInt ret = 0;
|
|
183 |
|
|
184 |
#ifdef REQHANDLE_TIMER
|
|
185 |
|
|
186 |
// check if this HandleStore is using the automatic response
|
|
187 |
// in such case the iPhone internal attribute will be not NULL
|
|
188 |
if( NULL != iPhone )
|
|
189 |
{
|
|
190 |
//check if a time Entry is set for this index
|
|
191 |
if (iPhone->GetTimeStampStore()->CheckEntry( aIndex, this ) )
|
|
192 |
{
|
|
193 |
//delete the entry cause the response is completed
|
|
194 |
iPhone->GetTimeStampStore()->DeleteEntryByHandle( aIndex, this );
|
|
195 |
}
|
|
196 |
}
|
|
197 |
#endif
|
|
198 |
|
|
199 |
if ( aIndex >= 0 && aIndex < iNumOfRequests )
|
|
200 |
{
|
|
201 |
//if req handle is currently used
|
|
202 |
if( *( iReqHandles + aIndex ) != 0 )
|
|
203 |
{
|
|
204 |
//return deleted req handle
|
|
205 |
ret = *( iReqHandles + aIndex );
|
|
206 |
|
|
207 |
//reset req handle
|
|
208 |
*( iReqHandles + aIndex ) = 0;
|
|
209 |
|
|
210 |
}
|
|
211 |
}
|
|
212 |
TFLOGSTRING3("TSY:CMmTsyReqHandleStore::ResetTsyReqHandle aIndex=%d, ret=%d", aIndex, ret);
|
|
213 |
return ret;
|
|
214 |
}
|
|
215 |
|
|
216 |
#ifdef REQHANDLE_TIMER
|
|
217 |
|
|
218 |
// ---------------------------------------------------------------------------
|
|
219 |
// CMmTsyReqHandleStore::PostponeTimeout
|
|
220 |
// Sets a new Timeout for the given handle
|
|
221 |
// (other items were commented in a header).
|
|
222 |
// ---------------------------------------------------------------------------
|
|
223 |
//
|
|
224 |
void CMmTsyReqHandleStore::PostponeTimeout(
|
|
225 |
const TInt aHandle,
|
|
226 |
const TInt aTimeout )
|
|
227 |
{
|
|
228 |
TFLOGSTRING3("TSY:CMmTsyReqHandleStore::PostponeTimeout aHandle=%d, aTimeout=%d",aHandle,aTimeout);
|
|
229 |
// call ResetEntryTimeout
|
|
230 |
iPhone->GetTimeStampStore()->ResetEntryTimeout( aHandle,
|
|
231 |
this,
|
|
232 |
iCTelObject,
|
|
233 |
aTimeout );
|
|
234 |
}
|
|
235 |
|
|
236 |
// ---------------------------------------------------------------------------
|
|
237 |
// CMmTsyReqHandleStore::StopTimeout
|
|
238 |
// Stops the timeout for the given handle. The entry for the
|
|
239 |
// given handle is deleted from the ResponseTimerStore.
|
|
240 |
// (other items were commented in a header).
|
|
241 |
// ---------------------------------------------------------------------------
|
|
242 |
//
|
|
243 |
void CMmTsyReqHandleStore::StopTimeout(
|
|
244 |
const TInt aHandle )
|
|
245 |
{
|
|
246 |
TFLOGSTRING2("TSY:CMmTsyReqHandleStore::StopTimeout aHandle=%d",aHandle);
|
|
247 |
iPhone->GetTimeStampStore()->DeleteEntryByHandle( aHandle, this );
|
|
248 |
}
|
|
249 |
|
|
250 |
#endif
|
|
251 |
|
|
252 |
// End of File
|
|
253 |
|
|
254 |
|
|
255 |
|
|
256 |
|