88 iConnMethodId( aConnMethodId ) |
88 iConnMethodId( aConnMethodId ) |
89 { |
89 { |
90 OstTraceFunctionEntry0( DUP1_CCMMCONNMETHODSTRUCT_CCMMCONNMETHODSTRUCT_ENTRY ); |
90 OstTraceFunctionEntry0( DUP1_CCMMCONNMETHODSTRUCT_CCMMCONNMETHODSTRUCT_ENTRY ); |
91 |
91 |
92 iConnMethodPlugin = NULL; |
92 iConnMethodPlugin = NULL; |
|
93 iReferenceCounter = 0; |
93 iBearerType = 0; |
94 iBearerType = 0; |
94 iStatus = ECmmConnMethodStatusNotSaved; |
95 iStatus = ECmmConnMethodStatusNotSaved; |
95 iReferenceCounter = 0; |
96 iRecordStatus = ECmmRecordStatusBlank; |
96 |
97 |
97 OstTraceFunctionExit0( DUP1_CCMMCONNMETHODSTRUCT_CCMMCONNMETHODSTRUCT_EXIT ); |
98 OstTraceFunctionExit0( DUP1_CCMMCONNMETHODSTRUCT_CCMMCONNMETHODSTRUCT_EXIT ); |
98 } |
99 } |
99 |
100 |
100 // --------------------------------------------------------------------------- |
101 // --------------------------------------------------------------------------- |
170 { |
171 { |
171 iStatus = aStatus; |
172 iStatus = aStatus; |
172 } |
173 } |
173 |
174 |
174 // --------------------------------------------------------------------------- |
175 // --------------------------------------------------------------------------- |
175 // Refresh the connection method data in this cache side object to be in synch |
176 // Reload the connection method data in this cache side object to be in synch |
176 // with the database and copy that data back to the session side connection |
177 // with the database(only if needed). |
177 // method instance given as parameter. |
178 // --------------------------------------------------------------------------- |
178 // --------------------------------------------------------------------------- |
179 // |
179 // |
180 void CCmmConnMethodStruct::ReloadPluginDataIfNeededL() |
180 void CCmmConnMethodStruct::RefreshConnMethodInstanceL( |
|
181 CCmmConnMethodInstance& aConnMethodInstance ) |
|
182 { |
181 { |
183 OstTraceFunctionEntry0( CCMMCONNMETHODSTRUCT_REFRESHCONNMETHODINSTANCEL_ENTRY ); |
182 OstTraceFunctionEntry0( CCMMCONNMETHODSTRUCT_REFRESHCONNMETHODINSTANCEL_ENTRY ); |
184 |
183 |
185 if ( !iConnMethodPlugin ) |
184 if ( !iConnMethodPlugin ) |
186 { |
185 { |
190 switch ( iStatus ) |
189 switch ( iStatus ) |
191 { |
190 { |
192 case ECmmConnMethodStatusValid: |
191 case ECmmConnMethodStatusValid: |
193 case ECmmConnMethodStatusToBeDeleted: |
192 case ECmmConnMethodStatusToBeDeleted: |
194 { |
193 { |
195 //TODO, add record status check later and only call Reload() if necessary. TCmmRecordStatus |
194 if ( iRecordStatus == ECmmRecordStatusExpired ) |
196 //if ( !aConnMethodStruct->UpToDate() ) |
195 { |
197 // { |
|
198 iConnMethodPlugin->ReLoadL(); |
196 iConnMethodPlugin->ReLoadL(); |
199 // } |
197 SetRecordStatus( ECmmRecordStatusLoaded ); |
200 iConnMethodPlugin->GetPluginDataL( aConnMethodInstance.GetPluginDataInstance() ); |
198 } |
201 } |
199 } |
202 break; |
200 break; |
203 case ECmmConnMethodStatusNotSaved: // This is checked before. |
201 case ECmmConnMethodStatusNotSaved: // This is checked before. |
204 case ECmmConnMethodStatusChanged: |
202 case ECmmConnMethodStatusChanged: |
205 default: |
203 default: |
206 User::Leave( KErrCorrupt ); // Error, invalid status. |
204 User::Leave( KErrCorrupt ); // Error, invalid status. |
207 break; |
205 break; |
208 } |
206 } |
209 |
207 |
210 // Internal state need to be set to the same state as after a successfull update. |
|
211 aConnMethodInstance.UpdateSuccessful(); |
|
212 |
|
213 OstTraceFunctionExit0( CCMMCONNMETHODSTRUCT_REFRESHCONNMETHODINSTANCEL_EXIT ); |
208 OstTraceFunctionExit0( CCMMCONNMETHODSTRUCT_REFRESHCONNMETHODINSTANCEL_EXIT ); |
214 } |
209 } |
215 |
210 |
216 // --------------------------------------------------------------------------- |
211 // --------------------------------------------------------------------------- |
217 // Decrease the reference counter by one. Return the remaining number of |
212 // Decrease the reference counter by one. Return the remaining number of |
254 iConnMethodPlugin = aPlugin; |
249 iConnMethodPlugin = aPlugin; |
255 iBearerType = aBearerType; |
250 iBearerType = aBearerType; |
256 |
251 |
257 switch ( aStatus ) |
252 switch ( aStatus ) |
258 { |
253 { |
259 // Fallthrough intended |
|
260 case ECmmConnMethodStatusNotSaved: |
254 case ECmmConnMethodStatusNotSaved: |
|
255 { |
|
256 iStatus = aStatus; |
|
257 iRecordStatus = ECmmRecordStatusUnsaved; |
|
258 } |
|
259 break; |
261 case ECmmConnMethodStatusValid: |
260 case ECmmConnMethodStatusValid: |
|
261 { |
262 iStatus = aStatus; |
262 iStatus = aStatus; |
|
263 iRecordStatus = ECmmRecordStatusLoaded; |
|
264 } |
263 break; |
265 break; |
264 case ECmmConnMethodStatusChanged: |
266 case ECmmConnMethodStatusChanged: |
265 case ECmmConnMethodStatusToBeDeleted: |
267 case ECmmConnMethodStatusToBeDeleted: |
|
268 // Fallthrough intended. |
266 default: |
269 default: |
|
270 { |
267 iStatus = ECmmConnMethodStatusChanged; |
271 iStatus = ECmmConnMethodStatusChanged; |
268 ASSERT( 0 ); // Error, invalid status as argument. |
272 ASSERT( 0 ); // Error, invalid status as argument. |
|
273 } |
269 break; |
274 break; |
270 } |
275 } |
271 |
276 |
272 OstTraceFunctionExit0( CCMMCONNMETHODSTRUCT_SETPLUGIN_EXIT ); |
277 OstTraceFunctionExit0( CCMMCONNMETHODSTRUCT_SETPLUGIN_EXIT ); |
273 } |
278 } |
305 // |
310 // |
306 void CCmmConnMethodStruct::UpdateSuccessful() |
311 void CCmmConnMethodStruct::UpdateSuccessful() |
307 { |
312 { |
308 OstTraceFunctionEntry0( CCMMCONNMETHODSTRUCT_UPDATESUCCESSFUL_ENTRY ); |
313 OstTraceFunctionEntry0( CCMMCONNMETHODSTRUCT_UPDATESUCCESSFUL_ENTRY ); |
309 iStatus = ECmmConnMethodStatusValid; |
314 iStatus = ECmmConnMethodStatusValid; |
|
315 SetRecordStatus( ECmmRecordStatusLoaded ); |
|
316 |
310 OstTraceFunctionExit0( CCMMCONNMETHODSTRUCT_UPDATESUCCESSFUL_EXIT ); |
317 OstTraceFunctionExit0( CCMMCONNMETHODSTRUCT_UPDATESUCCESSFUL_EXIT ); |
311 } |
318 } |
312 |
319 |
|
320 // --------------------------------------------------------------------------- |
|
321 // Set the record status. |
|
322 // --------------------------------------------------------------------------- |
|
323 // |
|
324 void CCmmConnMethodStruct::SetRecordStatus( const TCmmRecordStatus aStatus ) |
|
325 { |
|
326 iRecordStatus = aStatus; |
|
327 } |
|
328 |
|
329 // --------------------------------------------------------------------------- |
|
330 // Notify about a possible change in database on specified record table. |
|
331 // --------------------------------------------------------------------------- |
|
332 // |
|
333 void CCmmConnMethodStruct::NotifyRecordChange( const TUint32 /*aRecordType*/ ) |
|
334 { |
|
335 // Only change status if it is currently ECmmRecordStatusLoaded. |
|
336 if ( iRecordStatus == ECmmRecordStatusLoaded ) |
|
337 { |
|
338 iRecordStatus = ECmmRecordStatusExpired; |
|
339 } |
|
340 } |
|
341 |
|
342 // --------------------------------------------------------------------------- |
|
343 // Return the status of the records. |
|
344 // --------------------------------------------------------------------------- |
|
345 // |
|
346 TCmmRecordStatus CCmmConnMethodStruct::GetRecordStatus() const |
|
347 { |
|
348 return iRecordStatus; |
|
349 } |
|
350 |
313 // End of file |
351 // End of file |