152 // relevant data to the session instance. Checks that destination ID is valid. |
152 // relevant data to the session instance. Checks that destination ID is valid. |
153 // --------------------------------------------------------------------------- |
153 // --------------------------------------------------------------------------- |
154 // |
154 // |
155 void CCmmCache::OpenDestinationL( |
155 void CCmmCache::OpenDestinationL( |
156 CCmmDestinationInstance& aDestinationInstance, |
156 CCmmDestinationInstance& aDestinationInstance, |
157 const TUint32& aDestinationId ) |
157 const TUint32 aDestinationId ) |
158 { |
158 { |
159 OstTraceFunctionEntry0( CCMMCACHE_OPENDESTINATIONL_ENTRY ); |
159 OstTraceFunctionEntry0( CCMMCACHE_OPENDESTINATIONL_ENTRY ); |
160 |
160 |
161 if ( !iInstanceMapping->ValidDestinationId( aDestinationId ) ) |
161 if ( !iInstanceMapping->ValidDestinationId( aDestinationId ) ) |
162 { |
162 { |
173 iTrans, |
173 iTrans, |
174 aDestinationId ); |
174 aDestinationId ); |
175 |
175 |
176 // Now that cache has a handle on this destination, copy the relevant |
176 // Now that cache has a handle on this destination, copy the relevant |
177 // data to the session instance. |
177 // data to the session instance. |
178 destination->CreateSessionInstanceL( aDestinationInstance ); |
178 destination->CreateDestinationInstanceL( aDestinationInstance ); |
179 |
179 |
180 iDestinationArray.AppendL( destination ); |
180 iDestinationArray.AppendL( destination ); |
181 CleanupStack::Pop( destination ); |
181 CleanupStack::Pop( destination ); |
182 } |
182 } |
183 else |
183 else |
184 { |
184 { |
185 // Cache already has a handle on this destination. Copy the relevant |
185 // Cache already has a handle on this destination. Copy the relevant |
186 // data to the session instance. |
186 // data to the session instance. |
187 iDestinationArray[index]->CreateSessionInstanceL( aDestinationInstance ); |
187 iDestinationArray[index]->CreateDestinationInstanceL( aDestinationInstance ); |
188 } |
188 } |
189 |
189 |
190 // Add list of currently contained connection methods. |
190 // Add list of currently contained connection methods. |
191 iInstanceMapping->GetConnMethodsFromDestinationL( |
191 iInstanceMapping->GetConnMethodsFromDestinationL( |
192 aDestinationId, |
192 aDestinationId, |
234 // --------------------------------------------------------------------------- |
234 // --------------------------------------------------------------------------- |
235 // |
235 // |
236 void CCmmCache::CreateDestinationL( |
236 void CCmmCache::CreateDestinationL( |
237 CCmmDestinationInstance& aDestinationInstance, |
237 CCmmDestinationInstance& aDestinationInstance, |
238 const TDesC& aName, |
238 const TDesC& aName, |
239 const TUint32& aId ) |
239 const TUint32 aId ) |
240 { |
240 { |
241 OstTraceFunctionEntry0( CCMMCACHE_CREATEDESTINATIONL_ENTRY ); |
241 OstTraceFunctionEntry0( CCMMCACHE_CREATEDESTINATIONL_ENTRY ); |
242 |
242 |
243 // Create a new destination with given name. |
243 // Create a new destination with given name. |
244 CCmmDestinationStruct* destination = CCmmDestinationStruct::NewLC( this, iTrans, aName, aId ); |
244 CCmmDestinationStruct* destination = CCmmDestinationStruct::NewLC( this, iTrans, aName, aId ); |
245 |
245 |
246 destination->CreateSessionInstanceL( aDestinationInstance ); |
246 destination->CreateDestinationInstanceL( aDestinationInstance ); |
247 |
247 |
248 iDestinationArray.AppendL( destination ); |
248 iDestinationArray.AppendL( destination ); |
249 CleanupStack::Pop( destination ); |
249 CleanupStack::Pop( destination ); |
250 |
250 |
251 OstTraceFunctionExit0( CCMMCACHE_CREATEDESTINATIONL_EXIT ); |
251 OstTraceFunctionExit0( CCMMCACHE_CREATEDESTINATIONL_EXIT ); |
259 // --------------------------------------------------------------------------- |
259 // --------------------------------------------------------------------------- |
260 // |
260 // |
261 void CCmmCache::OpenConnMethodL( |
261 void CCmmCache::OpenConnMethodL( |
262 CCmmConnMethodInstance& aConnMethodInstance, |
262 CCmmConnMethodInstance& aConnMethodInstance, |
263 CCmmDestinationInstance* aDestinationInstance, |
263 CCmmDestinationInstance* aDestinationInstance, |
264 const TUint32& aConnMethodId ) |
264 const TUint32 aConnMethodId ) |
265 { |
265 { |
266 OstTraceFunctionEntry0( CCMMCACHE_OPENCONNMETHODL_ENTRY ); |
266 OstTraceFunctionEntry0( CCMMCACHE_OPENCONNMETHODL_ENTRY ); |
267 |
267 |
268 // Check connection method ID. |
268 // Check connection method ID. |
269 TBool validAttributes( EFalse ); |
269 TBool validAttributes( EFalse ); |
317 // |
317 // |
318 void CCmmCache::RefreshConnMethodL( CCmmConnMethodInstance& aConnMethodInstance ) |
318 void CCmmCache::RefreshConnMethodL( CCmmConnMethodInstance& aConnMethodInstance ) |
319 { |
319 { |
320 OstTraceFunctionEntry0( CCMMCACHE_REFRESHCONNMETHODL_ENTRY ); |
320 OstTraceFunctionEntry0( CCMMCACHE_REFRESHCONNMETHODL_ENTRY ); |
321 |
321 |
322 //TODO, what to do with embedded? |
322 // If embedded destination --> refresh through destination API. |
|
323 if ( aConnMethodInstance.IsEmbeddedDestination() ) |
|
324 { |
|
325 return; |
|
326 } |
323 |
327 |
324 TInt index = FindConnMethodFromCache( aConnMethodInstance.GetId() ); |
328 TInt index = FindConnMethodFromCache( aConnMethodInstance.GetId() ); |
325 if ( index == KErrNotFound ) |
329 if ( index == KErrNotFound ) |
326 { |
330 { |
327 User::Leave( KErrNotFound ); |
331 User::Leave( KErrNotFound ); |
350 // --------------------------------------------------------------------------- |
354 // --------------------------------------------------------------------------- |
351 // |
355 // |
352 void CCmmCache::CreateConnMethodL( |
356 void CCmmCache::CreateConnMethodL( |
353 CCmmConnMethodInstance& aConnMethodInstance, |
357 CCmmConnMethodInstance& aConnMethodInstance, |
354 CCmmDestinationInstance* aDestinationInstance, |
358 CCmmDestinationInstance* aDestinationInstance, |
355 const TUint32& aBearerType, |
359 const TUint32 aBearerType, |
356 const TUint32& aConnMethodId ) |
360 const TUint32 aConnMethodId ) |
357 { |
361 { |
358 OstTraceFunctionEntry0( CCMMCACHE_CREATECONNMETHODL_ENTRY ); |
362 OstTraceFunctionEntry0( CCMMCACHE_CREATECONNMETHODL_ENTRY ); |
359 |
363 |
360 // Check that the bearer type is not embedded destination. |
364 // Check that the bearer type is not embedded destination. |
361 if ( aBearerType == KUidEmbeddedDestination ) |
365 if ( aBearerType == KUidEmbeddedDestination ) |
399 User::Leave( KErrArgument ); |
403 User::Leave( KErrArgument ); |
400 } |
404 } |
401 |
405 |
402 |
406 |
403 // Store the connection method into cache. |
407 // Store the connection method into cache. |
404 CCmmConnMethodStruct* connMethodStruct = CCmmConnMethodStruct::NewLC( connMethodId ); // Use connMethodId here, so ID is either a real ID or a temporary ID. |
408 // Use connMethodId here, so ID is either a real ID or a temporary ID. |
|
409 CCmmConnMethodStruct* connMethodStruct = CCmmConnMethodStruct::NewL( connMethodId ); |
405 connMethodStruct->SetPlugin( plugin, aBearerType, ECmmConnMethodStatusNotSaved ); |
410 connMethodStruct->SetPlugin( plugin, aBearerType, ECmmConnMethodStatusNotSaved ); |
|
411 CleanupStack::Pop( plugin ); |
|
412 CleanupStack::PushL( connMethodStruct ); |
406 iConnMethodArray.AppendL( connMethodStruct ); |
413 iConnMethodArray.AppendL( connMethodStruct ); |
407 CleanupStack::Pop( connMethodStruct ); |
414 CleanupStack::Pop( connMethodStruct ); |
408 CleanupStack::Pop( plugin ); //TODO, pop after SetPlugin()-call? |
|
409 |
415 |
410 // Copy the connection method data to session instance. |
416 // Copy the connection method data to session instance. |
411 aConnMethodInstance.CopyDataL( connMethodStruct ); // Will increase reference counter. |
417 aConnMethodInstance.CopyDataL( connMethodStruct ); // Will increase reference counter. |
412 |
418 |
413 |
419 |
414 if ( aDestinationInstance ) |
420 if ( aDestinationInstance ) |
415 { |
421 { |
416 // Add connection method to destination. |
422 // Add connection method to destination. |
417 aDestinationInstance->AddConnMethodL( aConnMethodInstance ); |
423 aDestinationInstance->AddConnMethodL( aConnMethodInstance ); |
418 } |
424 } |
|
425 |
419 OstTraceFunctionExit0( CCMMCACHE_CREATECONNMETHODL_EXIT ); |
426 OstTraceFunctionExit0( CCMMCACHE_CREATECONNMETHODL_EXIT ); |
420 } |
427 } |
421 |
428 |
422 // --------------------------------------------------------------------------- |
429 // --------------------------------------------------------------------------- |
423 // Creates a new connection method into cache as a copy of an existing |
430 // Creates a new connection method into cache as a copy of an existing |
443 if ( !plugin ) |
450 if ( !plugin ) |
444 { |
451 { |
445 User::Leave( KErrNotFound ); |
452 User::Leave( KErrNotFound ); |
446 } |
453 } |
447 |
454 |
448 CCmPluginBaseEng* pluginCopy = plugin->CreateCopyL( aConnMethodInstance.GetPluginDataInstance() ); |
455 CCmPluginBaseEng* pluginCopy = |
|
456 plugin->CreateCopyL( aConnMethodInstance.GetPluginDataInstance() ); |
449 CleanupStack::PushL( pluginCopy ); |
457 CleanupStack::PushL( pluginCopy ); |
450 |
458 |
451 // Store the connection method into cache. |
459 // Store the connection method into cache. |
452 CCmmConnMethodStruct* connMethodStruct = CCmmConnMethodStruct::NewLC( NextFreeTemporaryId() ); |
460 CCmmConnMethodStruct* connMethodStruct = |
453 connMethodStruct->SetPlugin( pluginCopy, aConnMethodInstance.GetBearerType(), ECmmConnMethodStatusNotSaved ); |
461 CCmmConnMethodStruct::NewL( NextFreeTemporaryId() ); |
|
462 connMethodStruct->SetPlugin( |
|
463 pluginCopy, |
|
464 aConnMethodInstance.GetBearerType(), |
|
465 ECmmConnMethodStatusNotSaved ); |
|
466 CleanupStack::Pop( pluginCopy ); |
|
467 CleanupStack::PushL( connMethodStruct ); |
454 iConnMethodArray.AppendL( connMethodStruct ); |
468 iConnMethodArray.AppendL( connMethodStruct ); |
455 CleanupStack::Pop( connMethodStruct ); |
469 CleanupStack::Pop( connMethodStruct ); |
456 CleanupStack::Pop( pluginCopy ); //TODO, pop after SetPlugin()-call? |
|
457 |
470 |
458 // Copy the connection method data to session instance. |
471 // Copy the connection method data to session instance. |
459 aNewConnMethodInstance.CopyDataL( connMethodStruct ); // Will increase reference counter. |
472 aNewConnMethodInstance.CopyDataL( connMethodStruct ); // Will increase reference counter. |
460 |
473 |
461 OstTraceFunctionExit0( CCMMCACHE_CREATECOPYOFCONNMETHODL_EXIT ); |
474 OstTraceFunctionExit0( CCMMCACHE_CREATECOPYOFCONNMETHODL_EXIT ); |
528 |
541 |
529 // Remove connection method from delete list if ID is not valid or if |
542 // Remove connection method from delete list if ID is not valid or if |
530 // referenced from any other destination (in database or in any other |
543 // referenced from any other destination (in database or in any other |
531 // client-side destination handles). |
544 // client-side destination handles). |
532 if ( !iInstanceMapping->ValidConnMethodId( id ) || |
545 if ( !iInstanceMapping->ValidConnMethodId( id ) || |
533 iInstanceMapping->ConnMethodInOtherDestination( id, aDestinationInstance.GetId() ) || |
546 iInstanceMapping->ConnMethodInOtherDestination( |
|
547 id, |
|
548 aDestinationInstance.GetId() ) || |
534 aDestinationInstance.ConnMethodInOtherDestinationInSession( id, 0 ) ) |
549 aDestinationInstance.ConnMethodInOtherDestinationInSession( id, 0 ) ) |
535 { |
550 { |
536 aDestinationInstance.iConnMethodsToBeDeleted.Remove( i ); |
551 aDestinationInstance.iConnMethodsToBeDeleted.Remove( i ); |
537 i--; // Adjust array index counter. |
552 i--; // Adjust array index counter. |
538 } |
553 } |
554 } |
569 } |
555 |
570 |
556 // Update the connection methods inside this destination. |
571 // Update the connection methods inside this destination. |
557 for ( TInt i = 0; i < aDestinationInstance.iConnMethodItemArray.Count(); i++ ) |
572 for ( TInt i = 0; i < aDestinationInstance.iConnMethodItemArray.Count(); i++ ) |
558 { |
573 { |
559 if ( aDestinationInstance.iConnMethodItemArray[i].iBearerType == KUidEmbeddedDestination ) |
574 if ( aDestinationInstance.iConnMethodItemArray[i].IsEmbedded() ) |
560 { |
575 { |
561 // Embedded destination. |
576 // Embedded destination. |
562 |
577 |
563 //TODO, Maybe check other restrictions on embedded destination. |
578 //TODO, Maybe check other restrictions on embedded destination. |
564 // - Only one embedded destination per destination. Check. |
579 // - Only one embedded destination per destination. Check. |
579 // client has an open handle to any of the embedded |
594 // client has an open handle to any of the embedded |
580 // destinations connection methods. |
595 // destinations connection methods. |
581 // |
596 // |
582 // Skip update since client doesn't have an open handle to this |
597 // Skip update since client doesn't have an open handle to this |
583 // destination. |
598 // destination. |
584 if ( id >= KTemporaryIdCounterStart || !iInstanceMapping->ValidDestinationId( id ) ) |
599 if ( id >= KTemporaryIdCounterStart || |
|
600 !iInstanceMapping->ValidDestinationId( id ) ) |
585 { |
601 { |
586 // Remove destination item from array if: |
602 // Remove destination item from array if: |
587 // - New destination, but client has already closed the handle for it. |
603 // - New destination, but client has already closed the handle for it. |
588 // - Destination ID was valid before, but it does not exist anymore. |
604 // - Destination ID was valid before, but it does not exist anymore. |
589 aDestinationInstance.iConnMethodItemArray.Remove( i ); |
605 aDestinationInstance.iConnMethodItemArray.Remove( i ); |
616 } |
632 } |
617 |
633 |
618 if ( aDestinationInstance.ProtectionChanged() ) |
634 if ( aDestinationInstance.ProtectionChanged() ) |
619 { |
635 { |
620 // Check if the connection method protection level needs to be set. |
636 // Check if the connection method protection level needs to be set. |
621 switch ( aDestinationInstance.CurrentProtectionLevel() ) |
637 switch ( aDestinationInstance.CurrentProtectionLevelL() ) |
622 { |
638 { |
623 case CMManager::EProtLevel0: |
639 case CMManager::EProtLevel0: |
624 case CMManager::EProtLevel2: |
640 case CMManager::EProtLevel2: |
625 { |
641 { |
626 if ( aDestinationInstance.LastProtectionLevel() == CMManager::EProtLevel1 || |
642 if ( aDestinationInstance.LastProtectionLevel() == |
627 aDestinationInstance.LastProtectionLevel() == CMManager::EProtLevel3 ) |
643 CMManager::EProtLevel1 || |
|
644 aDestinationInstance.LastProtectionLevel() == |
|
645 CMManager::EProtLevel3 ) |
628 { |
646 { |
629 connMethodProtectionMustBeSet = ETrue; |
647 connMethodProtectionMustBeSet = ETrue; |
630 cmProtected = EFalse; |
648 cmProtected = EFalse; |
631 } |
649 } |
632 } |
650 } |
764 CCmmConnMethodInstance& aConnMethodInstance, |
782 CCmmConnMethodInstance& aConnMethodInstance, |
765 TBool aTemporaryHandle ) |
783 TBool aTemporaryHandle ) |
766 { |
784 { |
767 OstTraceFunctionEntry0( CCMMCACHE_UPDATECONNMETHODL_ENTRY ); |
785 OstTraceFunctionEntry0( CCMMCACHE_UPDATECONNMETHODL_ENTRY ); |
768 |
786 |
|
787 // Embedded destinatios cannot be updated as connection methods. |
|
788 if ( aConnMethodInstance.IsEmbeddedDestination() ) |
|
789 { |
|
790 User::Leave( KErrNotSupported ); |
|
791 } |
|
792 |
769 // Find connection method from cache. |
793 // Find connection method from cache. |
770 TUint32 connMethodId( aConnMethodInstance.GetId() ); |
794 TUint32 connMethodId( aConnMethodInstance.GetId() ); |
771 TInt index = FindConnMethodFromCache( connMethodId ); |
795 TInt index = FindConnMethodFromCache( connMethodId ); |
772 if ( index < 0 ) |
796 if ( index < 0 ) |
773 { |
797 { |
817 // is updated to deleted state, but it is not yet removed from database. |
841 // is updated to deleted state, but it is not yet removed from database. |
818 // (ID must be kept reserved in commsdat until all handles are closed). The |
842 // (ID must be kept reserved in commsdat until all handles are closed). The |
819 // same is done for the connection methods inside this destination. |
843 // same is done for the connection methods inside this destination. |
820 // --------------------------------------------------------------------------- |
844 // --------------------------------------------------------------------------- |
821 // |
845 // |
822 void CCmmCache::DeleteDestinationL( CCmmDestinationInstance& aDestinationInstance, TBool aForced ) |
846 void CCmmCache::DeleteDestinationL( |
|
847 CCmmDestinationInstance& aDestinationInstance, |
|
848 TBool aForced ) //TODO, comment on aForced param? |
823 { |
849 { |
824 OstTraceFunctionEntry0( CCMMCACHE_DELETEDESTINATIONL_ENTRY ); |
850 OstTraceFunctionEntry0( CCMMCACHE_DELETEDESTINATIONL_ENTRY ); |
825 |
851 |
826 TUint32 destinationId( aDestinationInstance.GetId() ); |
852 TUint32 destinationId( aDestinationInstance.GetId() ); |
827 |
853 |
868 |
894 |
869 // Remove embedded destination from list if found. |
895 // Remove embedded destination from list if found. |
870 TInt count( connMethodArray.Count() ); |
896 TInt count( connMethodArray.Count() ); |
871 if ( count ) |
897 if ( count ) |
872 { |
898 { |
873 if ( connMethodArray[count - 1].iBearerType == KUidEmbeddedDestination ) |
899 if ( connMethodArray[count - 1].IsEmbedded() ) |
874 { |
900 { |
875 connMethodArray.Remove( count - 1 ); |
901 connMethodArray.Remove( count - 1 ); |
876 } |
902 } |
877 } |
903 } |
878 // Remove any connection method that belongs to any other destination. |
904 // Remove any connection method that belongs to any other destination. |
879 for ( TInt i = 0; i < connMethodArray.Count(); i++ ) |
905 for ( TInt i = 0; i < connMethodArray.Count(); i++ ) |
880 { |
906 { |
881 if ( iInstanceMapping->ConnMethodInOtherDestination( connMethodArray[i].iId, destinationId ) ) |
907 if ( iInstanceMapping->ConnMethodInOtherDestination( |
|
908 connMethodArray[i].iId, |
|
909 destinationId ) ) |
882 { |
910 { |
883 connMethodArray.Remove( i ); |
911 connMethodArray.Remove( i ); |
884 i--; |
912 i--; |
885 } |
913 } |
886 } |
914 } |
967 // connection method is marked as deleted, but the actual database removal will |
995 // connection method is marked as deleted, but the actual database removal will |
968 // be done after the last handle is closed. Updating a connection method marked |
996 // be done after the last handle is closed. Updating a connection method marked |
969 // as deleted (through an already open handle) will restore it. |
997 // as deleted (through an already open handle) will restore it. |
970 // --------------------------------------------------------------------------- |
998 // --------------------------------------------------------------------------- |
971 // |
999 // |
972 void CCmmCache::DeleteConnMethodAsPartOfDestinationDeleteL( const TUint32& aConnMethodId ) |
1000 void CCmmCache::DeleteConnMethodAsPartOfDestinationDeleteL( const TUint32 aConnMethodId ) |
973 { |
1001 { |
974 OstTraceFunctionEntry0( CCMMCACHE_DELETECONNMETHODASPARTOFDESTINATIONDELETEL_ENTRY ); |
1002 OstTraceFunctionEntry0( CCMMCACHE_DELETECONNMETHODASPARTOFDESTINATIONDELETEL_ENTRY ); |
975 |
1003 |
976 // Find connection method from cache side. |
1004 // Find connection method from cache side. |
977 TInt index = FindConnMethodFromCache( aConnMethodId ); |
1005 TInt index = FindConnMethodFromCache( aConnMethodId ); |
1043 case ECmmConnMethodStatusValid: |
1071 case ECmmConnMethodStatusValid: |
1044 // Proceed. |
1072 // Proceed. |
1045 break; |
1073 break; |
1046 case ECmmConnMethodStatusToBeDeleted: |
1074 case ECmmConnMethodStatusToBeDeleted: |
1047 // Connection method has already been deleted. |
1075 // Connection method has already been deleted. |
|
1076 OstTraceFunctionExit0( DUP2_CCMMCACHE_DELETECONNMETHODASPARTOFDESTINATIONDELETEL_EXIT ); |
1048 return; |
1077 return; |
1049 case ECmmConnMethodStatusChanged: |
1078 case ECmmConnMethodStatusChanged: |
1050 default: |
1079 default: |
1051 { |
1080 { |
1052 ASSERT( 0 ); // Error, illegal status. |
1081 ASSERT( 0 ); // Error, illegal status. |
1059 // Add connection method ID to temporary array so it's status information |
1088 // Add connection method ID to temporary array so it's status information |
1060 // can be updated after successful commit to database. |
1089 // can be updated after successful commit to database. |
1061 TCmmIdStruct idStruct( aConnMethodId, 0 ); |
1090 TCmmIdStruct idStruct( aConnMethodId, 0 ); |
1062 iDeletedConnMethods.AppendL( idStruct ); |
1091 iDeletedConnMethods.AppendL( idStruct ); |
1063 |
1092 |
1064 OstTraceFunctionExit0( DUP2_CCMMCACHE_DELETECONNMETHODASPARTOFDESTINATIONDELETEL_EXIT ); |
1093 OstTraceFunctionExit0( DUP3_CCMMCACHE_DELETECONNMETHODASPARTOFDESTINATIONDELETEL_EXIT ); |
1065 } |
1094 } |
1066 |
1095 |
1067 // --------------------------------------------------------------------------- |
1096 // --------------------------------------------------------------------------- |
1068 // Deletes a connection method as part of destination update operation. It is |
1097 // Deletes a connection method as part of destination update operation. It is |
1069 // already checked that the connection method given as parameter can be deleted |
1098 // already checked that the connection method given as parameter can be deleted |
1073 // be done after the last handle is closed. Updating a connection method marked |
1102 // be done after the last handle is closed. Updating a connection method marked |
1074 // as deleted (through an already open handle) will restore it. |
1103 // as deleted (through an already open handle) will restore it. |
1075 // --------------------------------------------------------------------------- |
1104 // --------------------------------------------------------------------------- |
1076 // |
1105 // |
1077 void CCmmCache::DeleteConnMethodAsPartOfDestinationUpdateL( |
1106 void CCmmCache::DeleteConnMethodAsPartOfDestinationUpdateL( |
1078 const TUint32& aConnMethodId ) |
1107 const TUint32 aConnMethodId ) |
1079 { |
1108 { |
1080 OstTraceFunctionEntry0( CCMMCACHE_DELETECONNMETHODASPARTOFDESTINATIONUPDATEL_ENTRY ); |
1109 OstTraceFunctionEntry0( CCMMCACHE_DELETECONNMETHODASPARTOFDESTINATIONUPDATEL_ENTRY ); |
1081 |
1110 |
1082 // Find connection method from cache side. If not found, open a temporary handle. |
1111 // Find connection method from cache side. If not found, open a temporary handle. |
1083 TInt index = FindConnMethodFromCache( aConnMethodId ); |
1112 TInt index = FindConnMethodFromCache( aConnMethodId ); |
1152 case ECmmConnMethodStatusValid: |
1181 case ECmmConnMethodStatusValid: |
1153 // Proceed. |
1182 // Proceed. |
1154 break; |
1183 break; |
1155 case ECmmConnMethodStatusToBeDeleted: |
1184 case ECmmConnMethodStatusToBeDeleted: |
1156 // Connection method has already been deleted. |
1185 // Connection method has already been deleted. |
|
1186 OstTraceFunctionExit0( DUP2_CCMMCACHE_DELETECONNMETHODASPARTOFDESTINATIONUPDATEL_EXIT ); |
1157 return; |
1187 return; |
1158 case ECmmConnMethodStatusChanged: |
1188 case ECmmConnMethodStatusChanged: |
1159 default: |
1189 default: |
1160 { |
1190 { |
1161 ASSERT( 0 ); // Error, illegal status. |
1191 ASSERT( 0 ); // Error, illegal status. |
1167 // information can be updated after successful commit to database. |
1197 // information can be updated after successful commit to database. |
1168 TCmmIdStruct idStruct( aConnMethodId, 0 ); |
1198 TCmmIdStruct idStruct( aConnMethodId, 0 ); |
1169 iDeletedConnMethods.AppendL( idStruct ); |
1199 iDeletedConnMethods.AppendL( idStruct ); |
1170 } |
1200 } |
1171 |
1201 |
1172 OstTraceFunctionExit0( DUP2_CCMMCACHE_DELETECONNMETHODASPARTOFDESTINATIONUPDATEL_EXIT ); |
1202 OstTraceFunctionExit0( DUP3_CCMMCACHE_DELETECONNMETHODASPARTOFDESTINATIONUPDATEL_EXIT ); |
1173 } |
1203 } |
1174 |
1204 |
1175 // --------------------------------------------------------------------------- |
1205 // --------------------------------------------------------------------------- |
1176 // Basic connection method delete. Removes a connection method from any |
1206 // Basic connection method delete. Removes a connection method from any |
1177 // destination it might belong to, and then deletes it. |
1207 // destination it might belong to, and then deletes it. |
1245 // --------------------------------------------------------------------------- |
1275 // --------------------------------------------------------------------------- |
1246 // Check if the given ID belongs to a valid existing destination. Attribute |
1276 // Check if the given ID belongs to a valid existing destination. Attribute |
1247 // aId needs to be in the current valid range (0x1001 - 0x10FF atm). |
1277 // aId needs to be in the current valid range (0x1001 - 0x10FF atm). |
1248 // --------------------------------------------------------------------------- |
1278 // --------------------------------------------------------------------------- |
1249 // |
1279 // |
1250 TBool CCmmCache::DestinationExistsWithId( const TUint32& aId ) |
1280 TBool CCmmCache::DestinationExistsWithId( const TUint32 aId ) |
1251 { |
1281 { |
1252 OstTraceFunctionEntry0( CCMMCACHE_DESTINATIONEXISTSWITHID_ENTRY ); |
1282 OstTraceFunctionEntry0( CCMMCACHE_DESTINATIONEXISTSWITHID_ENTRY ); |
1253 |
1283 |
1254 TBool exists = iInstanceMapping->ValidDestinationId( aId ); |
1284 TBool exists = iInstanceMapping->ValidDestinationId( aId ); |
1255 |
1285 |
1260 // --------------------------------------------------------------------------- |
1290 // --------------------------------------------------------------------------- |
1261 // Check if the given name belongs to an existing destination. |
1291 // Check if the given name belongs to an existing destination. |
1262 // If a destination ID is given, that destination is skipped. |
1292 // If a destination ID is given, that destination is skipped. |
1263 // --------------------------------------------------------------------------- |
1293 // --------------------------------------------------------------------------- |
1264 // |
1294 // |
1265 TBool CCmmCache::DestinationExistsWithNameL( const TDesC& aName, const TUint32& aDestinationId ) |
1295 TBool CCmmCache::DestinationExistsWithNameL( const TDesC& aName, const TUint32 aDestinationId ) |
1266 { |
1296 { |
1267 OstTraceFunctionEntry0( CCMMCACHE_DESTINATIONEXISTSWITHNAMEL_ENTRY ); |
1297 OstTraceFunctionEntry0( CCMMCACHE_DESTINATIONEXISTSWITHNAMEL_ENTRY ); |
1268 |
1298 |
1269 TBool found( EFalse ); |
1299 TBool found( EFalse ); |
1270 |
1300 |
1329 // are not yet saved to database. |
1358 // are not yet saved to database. |
1330 // With this check, we can prevent two clients from creating a new destination |
1359 // With this check, we can prevent two clients from creating a new destination |
1331 // with the same ID (The UpdateL() operation would fail for one of them anyway). |
1360 // with the same ID (The UpdateL() operation would fail for one of them anyway). |
1332 // --------------------------------------------------------------------------- |
1361 // --------------------------------------------------------------------------- |
1333 // |
1362 // |
1334 TBool CCmmCache::DestinationOpenWithId( const TUint32& aId ) |
1363 TBool CCmmCache::DestinationOpenWithId( const TUint32 aId ) |
1335 { |
1364 { |
1336 OstTraceFunctionEntry0( CCMMCACHE_DESTINATIONOPENWITHID_ENTRY ); |
1365 OstTraceFunctionEntry0( CCMMCACHE_DESTINATIONOPENWITHID_ENTRY ); |
1337 |
1366 |
1338 TBool result( EFalse ); |
1367 TBool result( EFalse ); |
1339 TInt index = FindDestinationFromCache( aId ); |
1368 TInt index = FindDestinationFromCache( aId ); |
1340 if ( index != KErrNotFound ) |
1369 if ( index != KErrNotFound ) |
1341 { |
1370 { |
1342 result = ETrue; |
1371 result = ETrue; |
1343 } |
1372 } |
|
1373 |
1344 OstTraceFunctionExit0( CCMMCACHE_DESTINATIONOPENWITHID_EXIT ); |
1374 OstTraceFunctionExit0( CCMMCACHE_DESTINATIONOPENWITHID_EXIT ); |
1345 |
|
1346 return result; |
1375 return result; |
1347 } |
1376 } |
1348 |
1377 |
1349 // --------------------------------------------------------------------------- |
1378 // --------------------------------------------------------------------------- |
1350 // Check if the given name belongs to any new unsaved destinations in the |
1379 // Check if the given name belongs to any new unsaved destinations in the |
1357 // anyway). |
1386 // anyway). |
1358 // --------------------------------------------------------------------------- |
1387 // --------------------------------------------------------------------------- |
1359 // |
1388 // |
1360 TBool CCmmCache::NotSavedDestinationOpenWithNameL( |
1389 TBool CCmmCache::NotSavedDestinationOpenWithNameL( |
1361 const TDesC& aName, |
1390 const TDesC& aName, |
1362 const TUint32& aDestinationId ) |
1391 const TUint32 aDestinationId ) |
1363 { |
1392 { |
1364 OstTraceFunctionEntry0( CCMMCACHE_NOTSAVEDDESTINATIONOPENWITHNAMEL_ENTRY ); |
1393 OstTraceFunctionEntry0( CCMMCACHE_NOTSAVEDDESTINATIONOPENWITHNAMEL_ENTRY ); |
1365 |
1394 |
1366 TBool res( EFalse ); |
1395 TBool res( EFalse ); |
1367 TInt index = FindNotSavedDestinationFromCacheL( aName, aDestinationId ); |
1396 TInt index = FindNotSavedDestinationFromCacheL( aName, aDestinationId ); |
1368 if ( index != KErrNotFound ) |
1397 if ( index != KErrNotFound ) |
1369 { |
1398 { |
1370 res = ETrue; |
1399 res = ETrue; |
1371 } |
1400 } |
|
1401 |
1372 OstTraceFunctionExit0( CCMMCACHE_NOTSAVEDDESTINATIONOPENWITHNAMEL_EXIT ); |
1402 OstTraceFunctionExit0( CCMMCACHE_NOTSAVEDDESTINATIONOPENWITHNAMEL_EXIT ); |
1373 |
|
1374 return res; |
1403 return res; |
1375 } |
1404 } |
1376 |
1405 |
1377 // --------------------------------------------------------------------------- |
1406 // --------------------------------------------------------------------------- |
1378 // Check if the given ID belongs to a valid existing connection method. |
1407 // Check if the given ID belongs to a valid existing connection method. |
1379 // --------------------------------------------------------------------------- |
1408 // --------------------------------------------------------------------------- |
1380 // |
1409 // |
1381 TBool CCmmCache::ConnMethodExistsWithId( const TUint32& aConnMethodId ) |
1410 TBool CCmmCache::ConnMethodExistsWithId( const TUint32 aConnMethodId ) |
1382 { |
1411 { |
1383 OstTraceFunctionEntry0( CCMMCACHE_CONNMETHODEXISTSWITHID_ENTRY ); |
1412 OstTraceFunctionEntry0( CCMMCACHE_CONNMETHODEXISTSWITHID_ENTRY ); |
1384 |
1413 |
1385 TBool exists = iInstanceMapping->ValidConnMethodId( aConnMethodId ); |
1414 TBool exists = iInstanceMapping->ValidConnMethodId( aConnMethodId ); |
1386 |
1415 |
1387 OstTraceFunctionExit0( CCMMCACHE_CONNMETHODEXISTSWITHID_EXIT ); |
1416 OstTraceFunctionExit0( CCMMCACHE_CONNMETHODEXISTSWITHID_EXIT ); |
1388 |
|
1389 return exists; |
1417 return exists; |
1390 } |
1418 } |
1391 |
1419 |
1392 // --------------------------------------------------------------------------- |
1420 // --------------------------------------------------------------------------- |
1393 // Check if the given ID belongs to a connection method that the cache has an |
1421 // Check if the given ID belongs to a connection method that the cache has an |
1396 // With this check, we can prevent two clients from creating a new connection |
1424 // With this check, we can prevent two clients from creating a new connection |
1397 // method with the same ID (The UpdateL() operation would fail for one of them |
1425 // method with the same ID (The UpdateL() operation would fail for one of them |
1398 // anyway). |
1426 // anyway). |
1399 // --------------------------------------------------------------------------- |
1427 // --------------------------------------------------------------------------- |
1400 // |
1428 // |
1401 TBool CCmmCache::ConnMethodOpenWithId( const TUint32& aConnMethodId ) |
1429 TBool CCmmCache::ConnMethodOpenWithId( const TUint32 aConnMethodId ) |
1402 { |
1430 { |
1403 OstTraceFunctionEntry0( CCMMCACHE_CONNMETHODOPENWITHID_ENTRY ); |
1431 OstTraceFunctionEntry0( CCMMCACHE_CONNMETHODOPENWITHID_ENTRY ); |
1404 |
1432 |
1405 TBool result( EFalse ); |
1433 TBool result( EFalse ); |
1406 TInt index = FindConnMethodFromCache( aConnMethodId ); |
1434 TInt index = FindConnMethodFromCache( aConnMethodId ); |
1407 if ( index != KErrNotFound ) |
1435 if ( index != KErrNotFound ) |
1408 { |
1436 { |
1409 result = ETrue; |
1437 result = ETrue; |
1410 } |
1438 } |
|
1439 |
1411 OstTraceFunctionExit0( CCMMCACHE_CONNMETHODOPENWITHID_EXIT ); |
1440 OstTraceFunctionExit0( CCMMCACHE_CONNMETHODOPENWITHID_EXIT ); |
1412 |
|
1413 return result; |
1441 return result; |
1414 } |
1442 } |
1415 |
1443 |
1416 // --------------------------------------------------------------------------- |
1444 // --------------------------------------------------------------------------- |
1417 // Checks if there are any destinations with metadata localization |
1445 // Checks if there are any destinations with metadata localization |
1420 // The destination connected to parameter aDestinationInstance is skipped. |
1448 // The destination connected to parameter aDestinationInstance is skipped. |
1421 // --------------------------------------------------------------------------- |
1449 // --------------------------------------------------------------------------- |
1422 // |
1450 // |
1423 TBool CCmmCache::DestinationExistsWithMetadataLocalizedL( |
1451 TBool CCmmCache::DestinationExistsWithMetadataLocalizedL( |
1424 CCmmDestinationInstance& aDestinationInstance, |
1452 CCmmDestinationInstance& aDestinationInstance, |
1425 const TUint32& aValue ) |
1453 const TUint32 aValue ) |
1426 { |
1454 { |
1427 OstTraceFunctionEntry0( CCMMCACHE_DESTINATIONEXISTSWITHMETADATALOCALIZEDL_ENTRY ); |
1455 OstTraceFunctionEntry0( CCMMCACHE_DESTINATIONEXISTSWITHMETADATALOCALIZEDL_ENTRY ); |
1428 |
1456 |
1429 TBool result( EFalse ); |
1457 TBool result( EFalse ); |
1430 |
1458 |
1505 // The destination connected to parameter aDestinationInstance is skipped. |
1533 // The destination connected to parameter aDestinationInstance is skipped. |
1506 // --------------------------------------------------------------------------- |
1534 // --------------------------------------------------------------------------- |
1507 // |
1535 // |
1508 TBool CCmmCache::DestinationExistsWithMetadataPurposeL( |
1536 TBool CCmmCache::DestinationExistsWithMetadataPurposeL( |
1509 CCmmDestinationInstance& aDestinationInstance, |
1537 CCmmDestinationInstance& aDestinationInstance, |
1510 const TUint32& aValue ) |
1538 const TUint32 aValue ) |
1511 { |
1539 { |
1512 OstTraceFunctionEntry0( CCMMCACHE_DESTINATIONEXISTSWITHMETADATAPURPOSEL_ENTRY ); |
1540 OstTraceFunctionEntry0( CCMMCACHE_DESTINATIONEXISTSWITHMETADATAPURPOSEL_ENTRY ); |
1513 |
1541 |
1514 TBool result( EFalse ); |
1542 TBool result( EFalse ); |
1515 |
1543 |
1576 } |
1604 } |
1577 } |
1605 } |
1578 } |
1606 } |
1579 CleanupStack::PopAndDestroy( metaSet ); |
1607 CleanupStack::PopAndDestroy( metaSet ); |
1580 } |
1608 } |
|
1609 |
1581 OstTraceFunctionExit0( CCMMCACHE_DESTINATIONEXISTSWITHMETADATAPURPOSEL_EXIT ); |
1610 OstTraceFunctionExit0( CCMMCACHE_DESTINATIONEXISTSWITHMETADATAPURPOSEL_EXIT ); |
1582 |
|
1583 return result; |
1611 return result; |
1584 } |
1612 } |
1585 |
1613 |
1586 // --------------------------------------------------------------------------- |
1614 // --------------------------------------------------------------------------- |
1587 // Tells the cache that a database table has changed. If the SNAP/IAP structure |
1615 // Tells the cache that a database table has changed. If the SNAP/IAP structure |
1588 // has possibly changed, the cache will refresh that information immediately. |
1616 // has possibly changed, the cache will refresh that information immediately. |
1589 // For other database tables, the tables are flagged and will be refreshed when |
1617 // For other database tables, the tables are flagged and will be refreshed when |
1590 // needed. |
1618 // needed. |
1591 // --------------------------------------------------------------------------- |
1619 // --------------------------------------------------------------------------- |
1592 // |
1620 // |
1593 void CCmmCache::DbChangeDetected( const TUint32& aTableId ) |
1621 void CCmmCache::DbChangeDetected( const TUint32 aTableId ) |
1594 { |
1622 { |
1595 OstTraceFunctionEntry0( CCMMCACHE_DBCHANGEDETECTED_ENTRY ); |
1623 OstTraceFunctionEntry0( CCMMCACHE_DBCHANGEDETECTED_ENTRY ); |
1596 |
1624 |
1597 (void)aTableId; //TODO |
1625 (void)aTableId; //TODO |
1598 // Flag the table as: currently not up-to-date |
1626 // Flag the table as: currently not up-to-date |
1603 // Tells the cache that an error has occured with a database listener. Any |
1631 // Tells the cache that an error has occured with a database listener. Any |
1604 // reads to this table need go through the database, since cache can't know if |
1632 // reads to this table need go through the database, since cache can't know if |
1605 // it has up-to-date information. |
1633 // it has up-to-date information. |
1606 // --------------------------------------------------------------------------- |
1634 // --------------------------------------------------------------------------- |
1607 // |
1635 // |
1608 void CCmmCache::DbChangeError( const TUint32& aTableId ) |
1636 void CCmmCache::DbChangeError( const TUint32 aTableId ) |
1609 { |
1637 { |
1610 OstTraceFunctionEntry0( CCMMCACHE_DBCHANGEERROR_ENTRY ); |
1638 OstTraceFunctionEntry0( CCMMCACHE_DBCHANGEERROR_ENTRY ); |
1611 |
1639 |
1612 (void)aTableId; //TODO |
1640 (void)aTableId; //TODO |
1613 // Flag the table as: permanently not up-to-date |
1641 // Flag the table as: permanently not up-to-date |
1627 |
1655 |
1628 TInt index = FindDestinationFromCache( aDestinationInstance.GetId() ); |
1656 TInt index = FindDestinationFromCache( aDestinationInstance.GetId() ); |
1629 |
1657 |
1630 if ( index >= 0 ) |
1658 if ( index >= 0 ) |
1631 { |
1659 { |
1632 TInt remainingSessionInstances = iDestinationArray[index]->SessionInstanceClosed(); |
1660 TInt remainingSessionInstances = iDestinationArray[index]->DestinationInstanceClosed(); |
1633 if ( remainingSessionInstances <= 0) |
1661 if ( remainingSessionInstances <= 0) |
1634 { |
1662 { |
1635 // If status is 'to be deleted', then the last handle keeping this |
1663 // If status is 'to be deleted', then the last handle keeping this |
1636 // destination 'alive' was closed and it can now be deleted from |
1664 // destination 'alive' was closed and it can now be deleted from |
1637 // database. |
1665 // database. |
1668 |
1696 |
1669 TInt index = FindConnMethodFromCache( aConnMethodInstance.GetId() ); |
1697 TInt index = FindConnMethodFromCache( aConnMethodInstance.GetId() ); |
1670 |
1698 |
1671 if ( index >= 0 ) |
1699 if ( index >= 0 ) |
1672 { |
1700 { |
1673 TInt remainingSessionInstances = iConnMethodArray[index]->SessionInstanceClosed(); |
1701 TInt remainingSessionInstances = iConnMethodArray[index]->ConnMethodInstanceClosed(); |
1674 if ( remainingSessionInstances <= 0 ) |
1702 if ( remainingSessionInstances <= 0 ) |
1675 { |
1703 { |
1676 // If status is 'to be deleted', then the last handle keeping this |
1704 // If status is 'to be deleted', then the last handle keeping this |
1677 // connection method 'alive' was closed and it can now be deleted |
1705 // connection method 'alive' was closed and it can now be deleted |
1678 // from database. |
1706 // from database. |
1703 // Returns a reference to the CommsDat session. |
1731 // Returns a reference to the CommsDat session. |
1704 //----------------------------------------------------------------------------- |
1732 //----------------------------------------------------------------------------- |
1705 // |
1733 // |
1706 CommsDat::CMDBSession& CCmmCache::Session() const |
1734 CommsDat::CMDBSession& CCmmCache::Session() const |
1707 { |
1735 { |
1708 OstTraceFunctionEntry0( CCMMCACHE_SESSION_ENTRY ); |
1736 // No traces. |
1709 |
|
1710 return iTrans->Session(); |
1737 return iTrans->Session(); |
1711 } |
1738 } |
1712 |
1739 |
1713 //----------------------------------------------------------------------------- |
1740 //----------------------------------------------------------------------------- |
1714 // Finds out the bearer type and priority of the service type from given IAP |
1741 // Finds out the bearer type and priority of the service type from given IAP |
1715 // record. |
1742 // record. performs LoadL()-call on the provided IAP record. |
1716 //----------------------------------------------------------------------------- |
1743 //----------------------------------------------------------------------------- |
1717 // |
1744 // |
1718 void CCmmCache::BearerInfoFromIapRecordL( |
1745 void CCmmCache::BearerInfoFromIapRecordL( |
1719 CommsDat::CCDIAPRecord* aIapRecord, |
1746 CommsDat::CCDIAPRecord* aIapRecord, |
1720 TUint32& aBearerType, |
1747 TUint32& aBearerType, |
1721 TUint& aBearerPriority ) const |
1748 TUint& aBearerPriority ) const |
1722 { |
1749 { |
1723 OstTraceFunctionEntry0( CCMMCACHE_BEARERINFOFROMIAPRECORDL_ENTRY ); |
1750 OstTraceFunctionEntry0( CCMMCACHE_BEARERINFOFROMIAPRECORDL_ENTRY ); |
1724 |
1751 |
1725 // Load the IAP record from IAP table. This is an optimization that plugins |
1752 // Load the IAP record from IAP table. This is an optimization so that |
1726 // doesn't have to do it every time the CanHandleIapIdL() is called. |
1753 // plugins don't have to do it every time the CanHandleIapIdL() is called. |
1727 aIapRecord->LoadL( Session() ); |
1754 aIapRecord->LoadL( Session() ); |
1728 BearerPriorityFromIapRecordL( aIapRecord, aBearerPriority ); |
1755 BearerPriorityFromIapRecordL( aIapRecord, aBearerPriority ); |
1729 BearerTypeFromIapRecordL( aIapRecord, aBearerType ); |
1756 BearerTypeFromIapRecordL( aIapRecord, aBearerType ); |
1730 |
1757 |
1731 OstTraceFunctionExit0( CCMMCACHE_BEARERINFOFROMIAPRECORDL_EXIT ); |
1758 OstTraceFunctionExit0( CCMMCACHE_BEARERINFOFROMIAPRECORDL_EXIT ); |
1767 TInt foundIndex( KErrNotFound ); |
1794 TInt foundIndex( KErrNotFound ); |
1768 |
1795 |
1769 // Check which bearer handles the given IAP ID. |
1796 // Check which bearer handles the given IAP ID. |
1770 for ( TInt i = 0; i < iPlugins->Count(); i++ ) |
1797 for ( TInt i = 0; i < iPlugins->Count(); i++ ) |
1771 { |
1798 { |
1772 TRAP( err, canHandle = (*iPlugins)[i]->CanHandleIapIdL( aIapRecord ) ); //TODO, check leave, trap needed? |
1799 TRAP( err, canHandle = (*iPlugins)[i]->CanHandleIapIdL( aIapRecord ) ); |
1773 if ( !err && canHandle ) |
1800 if ( !err && canHandle ) |
1774 { |
1801 { |
1775 TUint32 thisExtLevel = (*iPlugins)[i]->GetBearerInfoIntL( ECmExtensionLevel ); |
1802 TUint32 thisExtLevel = (*iPlugins)[i]->GetBearerInfoIntL( ECmExtensionLevel ); |
1776 if ( extLevel < thisExtLevel ) |
1803 if ( extLevel < thisExtLevel ) |
1777 { |
1804 { |
1786 User::Leave( KErrNotSupported ); |
1813 User::Leave( KErrNotSupported ); |
1787 } |
1814 } |
1788 aBearerType = (*iPlugins)[foundIndex]->GetBearerInfoIntL( CMManager::ECmBearerType ); |
1815 aBearerType = (*iPlugins)[foundIndex]->GetBearerInfoIntL( CMManager::ECmBearerType ); |
1789 |
1816 |
1790 OstTraceFunctionExit0( CCMMCACHE_BEARERTYPEFROMIAPRECORDL_EXIT ); |
1817 OstTraceFunctionExit0( CCMMCACHE_BEARERTYPEFROMIAPRECORDL_EXIT ); |
|
1818 } |
|
1819 |
|
1820 // --------------------------------------------------------------------------- |
|
1821 // Find and return a copy of a connection method item matching the given ID. |
|
1822 // Returns KErrNotFound, if the connection method is not found. |
|
1823 // --------------------------------------------------------------------------- |
|
1824 // |
|
1825 TInt CCmmCache::GetConnMethodItem( |
|
1826 const TUint32 aConnMethodId, |
|
1827 TCmmConnMethodItem& aConnMethodItem ) const |
|
1828 { |
|
1829 OstTraceFunctionEntry0( CCMMCACHE_GETCONNMETHODITEM_ENTRY ); |
|
1830 |
|
1831 TInt result = iInstanceMapping->GetConnMethodItem( aConnMethodId, aConnMethodItem ); |
|
1832 |
|
1833 OstTraceFunctionExit0( CCMMCACHE_GETCONNMETHODITEM_EXIT ); |
|
1834 return result; |
1791 } |
1835 } |
1792 |
1836 |
1793 //----------------------------------------------------------------------------- |
1837 //----------------------------------------------------------------------------- |
1794 // Returns all conenction method IDs. Unsupported connection methods are |
1838 // Returns all conenction method IDs. Unsupported connection methods are |
1795 // included if aCheckBearerType is set to EFalse. |
1839 // included if aCheckBearerType is set to EFalse. |
1808 |
1852 |
1809 //----------------------------------------------------------------------------- |
1853 //----------------------------------------------------------------------------- |
1810 // Returns the number of destinations the provided connection method belongs to. |
1854 // Returns the number of destinations the provided connection method belongs to. |
1811 //----------------------------------------------------------------------------- |
1855 //----------------------------------------------------------------------------- |
1812 // |
1856 // |
1813 TInt CCmmCache::DestinationsContainingConnMethod( const TUint32& aConnMethodId ) const |
1857 TInt CCmmCache::DestinationsContainingConnMethod( const TUint32 aConnMethodId ) const |
1814 { |
1858 { |
1815 OstTraceFunctionEntry0( CCMMCACHE_CONNMETHODREFERENCECOUNT_ENTRY ); |
1859 OstTraceFunctionEntry0( CCMMCACHE_CONNMETHODREFERENCECOUNT_ENTRY ); |
1816 |
1860 |
1817 TInt count = iInstanceMapping->DestinationsContainingConnMethod( aConnMethodId ); |
1861 TInt count = iInstanceMapping->DestinationsContainingConnMethod( aConnMethodId ); |
1818 |
1862 |
1891 //----------------------------------------------------------------------------- |
1935 //----------------------------------------------------------------------------- |
1892 // Returns all the valid connection methods under given destination. |
1936 // Returns all the valid connection methods under given destination. |
1893 //----------------------------------------------------------------------------- |
1937 //----------------------------------------------------------------------------- |
1894 // |
1938 // |
1895 void CCmmCache::GetConnMethodsFromDestinationL( |
1939 void CCmmCache::GetConnMethodsFromDestinationL( |
1896 const TUint32& aDestinationId, |
1940 const TUint32 aDestinationId, |
1897 RArray<TCmmConnMethodItem>& aConnMethodArray ) const |
1941 RArray<TCmmConnMethodItem>& aConnMethodArray ) const |
1898 { |
1942 { |
1899 OstTraceFunctionEntry0( CCMMCACHE_GETCONNMETHODSFROMDESTINATIONL_ENTRY ); |
1943 OstTraceFunctionEntry0( CCMMCACHE_GETCONNMETHODSFROMDESTINATIONL_ENTRY ); |
1900 |
1944 |
1901 iInstanceMapping->GetConnMethodsFromDestinationL( |
1945 iInstanceMapping->GetConnMethodsFromDestinationL( |
1934 // Check from database if the given connection method belongs to any other |
1978 // Check from database if the given connection method belongs to any other |
1935 // destination than the one provided. |
1979 // destination than the one provided. |
1936 //----------------------------------------------------------------------------- |
1980 //----------------------------------------------------------------------------- |
1937 // |
1981 // |
1938 TBool CCmmCache::ConnMethodInOtherDestination( |
1982 TBool CCmmCache::ConnMethodInOtherDestination( |
1939 const TUint32& aConnMethodId, |
1983 const TUint32 aConnMethodId, |
1940 const TUint32& aDestinationId ) |
1984 const TUint32 aDestinationId ) |
1941 { |
1985 { |
1942 OstTraceFunctionEntry0( CCMMCACHE_CONNMETHODINOTHERDESTINATION_ENTRY ); |
1986 OstTraceFunctionEntry0( CCMMCACHE_CONNMETHODINOTHERDESTINATION_ENTRY ); |
1943 |
1987 |
1944 TBool cmInOtherDestination = iInstanceMapping-> |
1988 TBool cmInOtherDestination = iInstanceMapping-> |
1945 ConnMethodInOtherDestination( aConnMethodId, aDestinationId ); |
1989 ConnMethodInOtherDestination( aConnMethodId, aDestinationId ); |
1973 //----------------------------------------------------------------------------- |
2017 //----------------------------------------------------------------------------- |
1974 // Find an open destination matching the give ID from cache. |
2018 // Find an open destination matching the give ID from cache. |
1975 // Returns either a valid array index or KErrNotFound. |
2019 // Returns either a valid array index or KErrNotFound. |
1976 //----------------------------------------------------------------------------- |
2020 //----------------------------------------------------------------------------- |
1977 // |
2021 // |
1978 TInt CCmmCache::FindDestinationFromCache( const TUint32& aId ) |
2022 TInt CCmmCache::FindDestinationFromCache( const TUint32 aId ) |
1979 { |
2023 { |
1980 OstTraceFunctionEntry0( CCMMCACHE_FINDDESTINATIONFROMCACHE_ENTRY ); |
2024 OstTraceFunctionEntry0( CCMMCACHE_FINDDESTINATIONFROMCACHE_ENTRY ); |
1981 |
2025 |
1982 TInt result( KErrNotFound ); |
2026 TInt result( KErrNotFound ); |
1983 |
2027 |
2002 // Find an open destination matching the given name from cache. If a destination |
2046 // Find an open destination matching the given name from cache. If a destination |
2003 // ID is provided, the search will exclude the relevant destination. |
2047 // ID is provided, the search will exclude the relevant destination. |
2004 // Returns either a valid array index or KErrNotFound. |
2048 // Returns either a valid array index or KErrNotFound. |
2005 //----------------------------------------------------------------------------- |
2049 //----------------------------------------------------------------------------- |
2006 // |
2050 // |
2007 TInt CCmmCache::FindNotSavedDestinationFromCacheL( const TDesC& aName, const TUint32& aDestinationId ) |
2051 TInt CCmmCache::FindNotSavedDestinationFromCacheL( |
|
2052 const TDesC& aName, |
|
2053 const TUint32 aDestinationId ) |
2008 { |
2054 { |
2009 OstTraceFunctionEntry0( CCMMCACHE_FINDNOTSAVEDDESTINATIONFROMCACHEL_ENTRY ); |
2055 OstTraceFunctionEntry0( CCMMCACHE_FINDNOTSAVEDDESTINATIONFROMCACHEL_ENTRY ); |
2010 |
2056 |
2011 TInt result( KErrNotFound ); |
2057 TInt result( KErrNotFound ); |
2012 |
2058 |
2045 //----------------------------------------------------------------------------- |
2091 //----------------------------------------------------------------------------- |
2046 // Find an open connection method matching the given ID from cache. |
2092 // Find an open connection method matching the given ID from cache. |
2047 // Returns either a valid array index or KErrNotFound. |
2093 // Returns either a valid array index or KErrNotFound. |
2048 //----------------------------------------------------------------------------- |
2094 //----------------------------------------------------------------------------- |
2049 // |
2095 // |
2050 TInt CCmmCache::FindConnMethodFromCache( const TUint32& aConnMethodId ) |
2096 TInt CCmmCache::FindConnMethodFromCache( const TUint32 aConnMethodId ) |
2051 { |
2097 { |
2052 OstTraceFunctionEntry0( CCMMCACHE_FINDCONNMETHODFROMCACHE_ENTRY ); |
2098 OstTraceFunctionEntry0( CCMMCACHE_FINDCONNMETHODFROMCACHE_ENTRY ); |
2053 |
2099 |
2054 TInt result( KErrNotFound ); |
2100 TInt result( KErrNotFound ); |
2055 |
2101 |
2074 // Loads and initializes a connection method instance. |
2120 // Loads and initializes a connection method instance. |
2075 //----------------------------------------------------------------------------- |
2121 //----------------------------------------------------------------------------- |
2076 // |
2122 // |
2077 void CCmmCache::OpenConnectionMethodInstanceL( |
2123 void CCmmCache::OpenConnectionMethodInstanceL( |
2078 CCmmConnMethodInstance& aConnMethodInstance, |
2124 CCmmConnMethodInstance& aConnMethodInstance, |
2079 const TUint32& aConnMethodId ) |
2125 const TUint32 aConnMethodId ) |
2080 { |
2126 { |
2081 OstTraceFunctionEntry0( CCMMCACHE_OPENCONNECTIONMETHODINSTANCEL_ENTRY ); |
2127 OstTraceFunctionEntry0( CCMMCACHE_OPENCONNECTIONMETHODINSTANCEL_ENTRY ); |
2082 |
2128 |
2083 // Find out the connection method bearer type. |
2129 // Find out the connection method bearer type. |
2084 TUint32 bearerType( 0 ); |
2130 TUint32 bearerType( 0 ); |
2101 { |
2147 { |
2102 User::Leave( KErrNotSupported ); |
2148 User::Leave( KErrNotSupported ); |
2103 } |
2149 } |
2104 |
2150 |
2105 // Store the connection method into cache. |
2151 // Store the connection method into cache. |
2106 CCmmConnMethodStruct* connMethodStruct = CCmmConnMethodStruct::NewLC( aConnMethodId ); |
2152 CCmmConnMethodStruct* connMethodStruct = CCmmConnMethodStruct::NewL( aConnMethodId ); |
2107 connMethodStruct->SetPlugin( plugin, bearerType, ECmmConnMethodStatusValid ); |
2153 connMethodStruct->SetPlugin( plugin, bearerType, ECmmConnMethodStatusValid ); |
|
2154 CleanupStack::Pop( plugin ); |
|
2155 CleanupStack::PushL( connMethodStruct ); |
2108 iConnMethodArray.AppendL( connMethodStruct ); |
2156 iConnMethodArray.AppendL( connMethodStruct ); |
2109 CleanupStack::Pop( connMethodStruct ); |
2157 CleanupStack::Pop( connMethodStruct ); |
2110 CleanupStack::Pop( plugin ); //TODO, pop after SetPlugin()-call? |
|
2111 |
2158 |
2112 // Copy the connection method data to session instance. |
2159 // Copy the connection method data to session instance. |
2113 aConnMethodInstance.CopyDataL( connMethodStruct ); // Will increase reference counter. |
2160 aConnMethodInstance.CopyDataL( connMethodStruct ); // Will increase reference counter. |
2114 |
2161 |
2115 OstTraceFunctionExit0( CCMMCACHE_OPENCONNECTIONMETHODINSTANCEL_EXIT ); |
2162 OstTraceFunctionExit0( CCMMCACHE_OPENCONNECTIONMETHODINSTANCEL_EXIT ); |
2118 //----------------------------------------------------------------------------- |
2165 //----------------------------------------------------------------------------- |
2119 // CCmmCache::GetConnectionMethodInfoIntL |
2166 // CCmmCache::GetConnectionMethodInfoIntL |
2120 //----------------------------------------------------------------------------- |
2167 //----------------------------------------------------------------------------- |
2121 // |
2168 // |
2122 TUint32 CCmmCache::GetConnectionMethodInfoIntL( |
2169 TUint32 CCmmCache::GetConnectionMethodInfoIntL( |
2123 const TUint32& aCmId, |
2170 const TUint32 aCmId, |
2124 const TUint32& aAttribute ) |
2171 const TUint32 aAttribute ) |
2125 { |
2172 { |
2126 OstTraceFunctionEntry0( CCMMCACHE_GETCONNECTIONMETHODINFOINTL_ENTRY ); |
2173 OstTraceFunctionEntry0( CCMMCACHE_GETCONNECTIONMETHODINFOINTL_ENTRY ); |
2127 |
2174 |
2128 TUint32 retVal( 0 ); |
2175 TUint32 retVal( 0 ); |
2129 |
2176 |
2152 //----------------------------------------------------------------------------- |
2199 //----------------------------------------------------------------------------- |
2153 // CCmmCache::GetConnectionMethodInfoBoolL |
2200 // CCmmCache::GetConnectionMethodInfoBoolL |
2154 //----------------------------------------------------------------------------- |
2201 //----------------------------------------------------------------------------- |
2155 // |
2202 // |
2156 TBool CCmmCache::GetConnectionMethodInfoBoolL( |
2203 TBool CCmmCache::GetConnectionMethodInfoBoolL( |
2157 const TUint32& aCmId, |
2204 const TUint32 aCmId, |
2158 const TUint32& aAttribute ) |
2205 const TUint32 aAttribute ) |
2159 { |
2206 { |
2160 OstTraceFunctionEntry0( CCMMCACHE_GETCONNECTIONMETHODINFOBOOLL_ENTRY ); |
2207 OstTraceFunctionEntry0( CCMMCACHE_GETCONNECTIONMETHODINFOBOOLL_ENTRY ); |
2161 |
2208 |
2162 TBool retVal( EFalse ); |
2209 TBool retVal( EFalse ); |
2163 |
2210 |
2186 //----------------------------------------------------------------------------- |
2233 //----------------------------------------------------------------------------- |
2187 // CCmmCache::GetConnectionMethodInfoStringL |
2234 // CCmmCache::GetConnectionMethodInfoStringL |
2188 //----------------------------------------------------------------------------- |
2235 //----------------------------------------------------------------------------- |
2189 // |
2236 // |
2190 HBufC* CCmmCache::GetConnectionMethodInfoStringL( |
2237 HBufC* CCmmCache::GetConnectionMethodInfoStringL( |
2191 const TUint32& aCmId, |
2238 const TUint32 aCmId, |
2192 const TUint32& aAttribute ) |
2239 const TUint32 aAttribute ) |
2193 { |
2240 { |
2194 OstTraceFunctionEntry0( CCMMCACHE_GETCONNECTIONMETHODINFOSTRINGL_ENTRY ); |
2241 OstTraceFunctionEntry0( CCMMCACHE_GETCONNECTIONMETHODINFOSTRINGL_ENTRY ); |
2195 |
2242 |
2196 HBufC* retVal( NULL ); |
2243 HBufC* retVal( NULL ); |
2197 |
2244 |
2220 //----------------------------------------------------------------------------- |
2267 //----------------------------------------------------------------------------- |
2221 // CCmmCache::GetConnectionMethodInfoString8L |
2268 // CCmmCache::GetConnectionMethodInfoString8L |
2222 //----------------------------------------------------------------------------- |
2269 //----------------------------------------------------------------------------- |
2223 // |
2270 // |
2224 HBufC8* CCmmCache::GetConnectionMethodInfoString8L( |
2271 HBufC8* CCmmCache::GetConnectionMethodInfoString8L( |
2225 const TUint32& aCmId, |
2272 const TUint32 aCmId, |
2226 const TUint32& aAttribute ) |
2273 const TUint32 aAttribute ) |
2227 { |
2274 { |
2228 OstTraceFunctionEntry0( CCMMCACHE_GETCONNECTIONMETHODINFOSTRING8L_ENTRY ); |
2275 OstTraceFunctionEntry0( CCMMCACHE_GETCONNECTIONMETHODINFOSTRING8L_ENTRY ); |
2229 |
2276 |
2230 HBufC8* retVal( NULL ); |
2277 HBufC8* retVal( NULL ); |
2231 |
2278 |
2255 //----------------------------------------------------------------------------- |
2302 //----------------------------------------------------------------------------- |
2256 // CCmmCache::GetBearerInfoIntL |
2303 // CCmmCache::GetBearerInfoIntL |
2257 //----------------------------------------------------------------------------- |
2304 //----------------------------------------------------------------------------- |
2258 // |
2305 // |
2259 TUint32 CCmmCache::GetBearerInfoIntL( |
2306 TUint32 CCmmCache::GetBearerInfoIntL( |
2260 const TUint32& aBearerType, |
2307 const TUint32 aBearerType, |
2261 const TUint32& aAttribute ) |
2308 const TUint32 aAttribute ) |
2262 { |
2309 { |
2263 OstTraceFunctionEntry0( CCMMCACHE_GETBEARERINFOINTL_ENTRY ); |
2310 OstTraceFunctionEntry0( CCMMCACHE_GETBEARERINFOINTL_ENTRY ); |
2264 |
2311 |
2265 TUint32 retVal( 0 ); |
2312 TUint32 retVal( 0 ); |
2266 TBool found( EFalse ); |
2313 TBool found( EFalse ); |
2286 //----------------------------------------------------------------------------- |
2333 //----------------------------------------------------------------------------- |
2287 // CCmmCache::GetBearerInfoBoolL |
2334 // CCmmCache::GetBearerInfoBoolL |
2288 //----------------------------------------------------------------------------- |
2335 //----------------------------------------------------------------------------- |
2289 // |
2336 // |
2290 TBool CCmmCache::GetBearerInfoBoolL( |
2337 TBool CCmmCache::GetBearerInfoBoolL( |
2291 const TUint32& aBearerType, |
2338 const TUint32 aBearerType, |
2292 const TUint32& aAttribute ) |
2339 const TUint32 aAttribute ) |
2293 { |
2340 { |
2294 OstTraceFunctionEntry0( CCMMCACHE_GETBEARERINFOBOOLL_ENTRY ); |
2341 OstTraceFunctionEntry0( CCMMCACHE_GETBEARERINFOBOOLL_ENTRY ); |
2295 |
2342 |
2296 TBool retVal( EFalse ); |
2343 TBool retVal( EFalse ); |
2297 TBool found( EFalse ); |
2344 TBool found( EFalse ); |
2317 //----------------------------------------------------------------------------- |
2364 //----------------------------------------------------------------------------- |
2318 // CCmmCache::GetBearerInfoStringL |
2365 // CCmmCache::GetBearerInfoStringL |
2319 //----------------------------------------------------------------------------- |
2366 //----------------------------------------------------------------------------- |
2320 // |
2367 // |
2321 HBufC* CCmmCache::GetBearerInfoStringL( |
2368 HBufC* CCmmCache::GetBearerInfoStringL( |
2322 const TUint32& aBearerType, |
2369 const TUint32 aBearerType, |
2323 const TUint32& aAttribute ) |
2370 const TUint32 aAttribute ) |
2324 { |
2371 { |
2325 OstTraceFunctionEntry0( CCMMCACHE_GETBEARERINFOSTRINGL_ENTRY ); |
2372 OstTraceFunctionEntry0( CCMMCACHE_GETBEARERINFOSTRINGL_ENTRY ); |
2326 |
2373 |
2327 HBufC* retVal( NULL ); |
2374 HBufC* retVal( NULL ); |
2328 TBool found( EFalse ); |
2375 TBool found( EFalse ); |
2348 //----------------------------------------------------------------------------- |
2395 //----------------------------------------------------------------------------- |
2349 // CCmmCache::GetBearerInfoString8L |
2396 // CCmmCache::GetBearerInfoString8L |
2350 //----------------------------------------------------------------------------- |
2397 //----------------------------------------------------------------------------- |
2351 // |
2398 // |
2352 HBufC8* CCmmCache::GetBearerInfoString8L( |
2399 HBufC8* CCmmCache::GetBearerInfoString8L( |
2353 const TUint32& aBearerType, |
2400 const TUint32 aBearerType, |
2354 const TUint32& aAttribute ) |
2401 const TUint32 aAttribute ) |
2355 { |
2402 { |
2356 OstTraceFunctionEntry0( CCMMCACHE_GETBEARERINFOSTRING8L_ENTRY ); |
2403 OstTraceFunctionEntry0( CCMMCACHE_GETBEARERINFOSTRING8L_ENTRY ); |
2357 |
2404 |
2358 HBufC8* retVal( NULL ); |
2405 HBufC8* retVal( NULL ); |
2359 TBool found( EFalse ); |
2406 TBool found( EFalse ); |
2409 } |
2456 } |
2410 else |
2457 else |
2411 { |
2458 { |
2412 iTrans->OpenTransactionLC(); |
2459 iTrans->OpenTransactionLC(); |
2413 |
2460 |
2414 TUint defConnType( 0 ); |
|
2415 TUint internetSnapId( 0 ); |
|
2416 iInstanceMapping->InternetDestinationIdL( internetSnapId ); |
|
2417 if ( internetSnapId ) |
|
2418 { |
|
2419 defConnType = ECmDefConnDestination; |
|
2420 } |
|
2421 |
|
2422 aGenConnSettings.iUsageOfWlan = ECmUsageOfWlanKnown; |
2461 aGenConnSettings.iUsageOfWlan = ECmUsageOfWlanKnown; |
2423 aGenConnSettings.iCellularDataUsageHome = ECmCellularDataUsageAutomatic; |
2462 aGenConnSettings.iCellularDataUsageHome = ECmCellularDataUsageAutomatic; |
2424 aGenConnSettings.iCellularDataUsageVisitor = ECmCellularDataUsageConfirm; |
2463 aGenConnSettings.iCellularDataUsageVisitor = ECmCellularDataUsageConfirm; |
2425 |
2464 |
2426 defConnRecord->SetRecordId( KCDNewRecordRequest ); |
2465 defConnRecord->SetRecordId( KCDNewRecordRequest ); |
2427 defConnRecord->iDefConnType = defConnType; |
|
2428 defConnRecord->iDefConnUid = internetSnapId; |
|
2429 defConnRecord->iUsageOfWlan = ( TUint )aGenConnSettings.iUsageOfWlan; |
2466 defConnRecord->iUsageOfWlan = ( TUint )aGenConnSettings.iUsageOfWlan; |
2430 defConnRecord->iCellularDataUsageHome = ( TUint )aGenConnSettings.iCellularDataUsageHome; |
2467 defConnRecord->iCellularDataUsageHome = |
2431 defConnRecord->iCellularDataUsageVisitor = ( TUint )aGenConnSettings.iCellularDataUsageVisitor; |
2468 ( TUint )aGenConnSettings.iCellularDataUsageHome; |
|
2469 defConnRecord->iCellularDataUsageVisitor = |
|
2470 ( TUint )aGenConnSettings.iCellularDataUsageVisitor; |
2432 defConnRecord->StoreL( Session() ); |
2471 defConnRecord->StoreL( Session() ); |
2433 |
2472 |
2434 iTrans->CommitTransactionL(); |
2473 iTrans->CommitTransactionL(); |
2435 } |
2474 } |
2436 |
2475 |
2525 // --------------------------------------------------------------------------- |
2564 // --------------------------------------------------------------------------- |
2526 // Enumerates connections and checks if the given connection method is |
2565 // Enumerates connections and checks if the given connection method is |
2527 // connected. |
2566 // connected. |
2528 // --------------------------------------------------------------------------- |
2567 // --------------------------------------------------------------------------- |
2529 // |
2568 // |
2530 TBool CCmmCache::CheckIfCmConnected( const TUint32& aCmId ) const |
2569 TBool CCmmCache::CheckIfCmConnected( const TUint32 aCmId ) const |
2531 { |
2570 { |
2532 OstTraceFunctionEntry0( CCMMCACHE_CHECKIFCMCONNECTED_ENTRY ); |
2571 OstTraceFunctionEntry0( CCMMCACHE_CHECKIFCMCONNECTED_ENTRY ); |
2533 |
2572 |
2534 TBool result( EFalse ); |
2573 TBool result( EFalse ); |
2535 RSocketServ ss; |
2574 RSocketServ ss; |
2645 // --------------------------------------------------------------------------- |
2686 // --------------------------------------------------------------------------- |
2646 // Check from database if the given destination is an embedded destination in |
2687 // Check from database if the given destination is an embedded destination in |
2647 // any other destination. |
2688 // any other destination. |
2648 // --------------------------------------------------------------------------- |
2689 // --------------------------------------------------------------------------- |
2649 // |
2690 // |
2650 TBool CCmmCache::DestinationIsEmbedded( const TUint32& aDestinationId ) const |
2691 TBool CCmmCache::DestinationIsEmbedded( const TUint32 aDestinationId ) const |
2651 { |
2692 { |
2652 OstTraceFunctionEntry0( CCMMCACHE_DESTINATIONISEMBEDDED_ENTRY ); |
2693 OstTraceFunctionEntry0( CCMMCACHE_DESTINATIONISEMBEDDED_ENTRY ); |
2653 |
2694 |
2654 TBool isEmbedded = iInstanceMapping->DestinationIsEmbedded( aDestinationId ); |
2695 TBool isEmbedded = iInstanceMapping->DestinationIsEmbedded( aDestinationId ); |
2655 |
2696 |
2659 |
2700 |
2660 // --------------------------------------------------------------------------- |
2701 // --------------------------------------------------------------------------- |
2661 // Check from database if the given destination has an embedded destination. |
2702 // Check from database if the given destination has an embedded destination. |
2662 // --------------------------------------------------------------------------- |
2703 // --------------------------------------------------------------------------- |
2663 // |
2704 // |
2664 TBool CCmmCache::DestinationHasEmbedded( const TUint32& aDestinationId ) const |
2705 TBool CCmmCache::DestinationHasEmbedded( const TUint32 aDestinationId ) const |
2665 { |
2706 { |
2666 OstTraceFunctionEntry0( CCMMCACHE_DESTINATIONHASEMBEDDED_ENTRY ); |
2707 OstTraceFunctionEntry0( CCMMCACHE_DESTINATIONHASEMBEDDED_ENTRY ); |
2667 |
2708 |
2668 TBool hasEmbedded = iInstanceMapping->DestinationHasEmbedded( aDestinationId ); |
2709 TBool hasEmbedded = iInstanceMapping->DestinationHasEmbedded( aDestinationId ); |
2669 |
2710 |
2674 // --------------------------------------------------------------------------- |
2715 // --------------------------------------------------------------------------- |
2675 // Check from database if the given destination is pointed to by any virtual |
2716 // Check from database if the given destination is pointed to by any virtual |
2676 // IAP. |
2717 // IAP. |
2677 // --------------------------------------------------------------------------- |
2718 // --------------------------------------------------------------------------- |
2678 // |
2719 // |
2679 TBool CCmmCache::DestinationPointedToByVirtualIap( const TUint32& aDestinationId ) const |
2720 TBool CCmmCache::DestinationPointedToByVirtualIap( const TUint32 aDestinationId ) const |
2680 { |
2721 { |
2681 OstTraceFunctionEntry0( CCMMCACHE_DESTINATIONPOINTEDTOBYVIRTUALIAP_ENTRY ); |
2722 OstTraceFunctionEntry0( CCMMCACHE_DESTINATIONPOINTEDTOBYVIRTUALIAP_ENTRY ); |
2682 |
2723 |
2683 TBool pointedByVirtual = |
2724 TBool pointedByVirtual = |
2684 iInstanceMapping->DestinationPointedToByVirtualIap( aDestinationId ); |
2725 iInstanceMapping->DestinationPointedToByVirtualIap( aDestinationId ); |
2690 // --------------------------------------------------------------------------- |
2731 // --------------------------------------------------------------------------- |
2691 // Check from database if the given connection method is pointed to by any |
2732 // Check from database if the given connection method is pointed to by any |
2692 // virtual IAP. |
2733 // virtual IAP. |
2693 // --------------------------------------------------------------------------- |
2734 // --------------------------------------------------------------------------- |
2694 // |
2735 // |
2695 TBool CCmmCache::ConnMethodPointedToByVirtualIap( const TUint32& aConnMethodId ) const |
2736 TBool CCmmCache::ConnMethodPointedToByVirtualIap( const TUint32 aConnMethodId ) const |
2696 { |
2737 { |
2697 |
2738 OstTraceFunctionEntry0( CCMMCACHE_CONNMETHODPOINTEDTOBYVIRTUALIAP_ENTRY ); |
2698 TBool pointedByVirtual = |
2739 |
|
2740 TBool pointedToByVirtual = |
2699 iInstanceMapping->ConnMethodPointedToByVirtualIap( aConnMethodId ); |
2741 iInstanceMapping->ConnMethodPointedToByVirtualIap( aConnMethodId ); |
2700 |
2742 |
2701 return pointedByVirtual; |
2743 OstTraceFunctionExit0( CCMMCACHE_CONNMETHODPOINTEDTOBYVIRTUALIAP_EXIT ); |
|
2744 return pointedToByVirtual; |
2702 } |
2745 } |
2703 |
2746 |
2704 // --------------------------------------------------------------------------- |
2747 // --------------------------------------------------------------------------- |
2705 // Check if the given connection method is the only connection method in the |
2748 // Check if the given connection method is the only connection method in the |
2706 // given destination and if a virtual IAP points to that destination. |
2749 // given destination and if a virtual IAP points to that destination. |
2707 // --------------------------------------------------------------------------- |
2750 // --------------------------------------------------------------------------- |
2708 // |
2751 // |
2709 TBool CCmmCache::ConnMethodInDestinationButLocked( |
2752 TBool CCmmCache::ConnMethodInDestinationButLocked( |
2710 const TUint32& aConnMethodId, const TUint32& aDestinationId ) const |
2753 const TUint32 aConnMethodId, |
|
2754 const TUint32 aDestinationId ) const |
2711 { |
2755 { |
2712 OstTraceFunctionEntry0( CCMMCACHE_CONNMETHODINDESTINATIONBUTLOCKED_ENTRY ); |
2756 OstTraceFunctionEntry0( CCMMCACHE_CONNMETHODINDESTINATIONBUTLOCKED_ENTRY ); |
2713 |
2757 |
2714 TBool inAndlocked = iInstanceMapping-> |
2758 TBool inAndlocked = iInstanceMapping-> |
2715 ConnMethodInDestinationButLocked( aConnMethodId, aDestinationId ); |
2759 ConnMethodInDestinationButLocked( aConnMethodId, aDestinationId ); |
2843 // IDs for any newly created connection methods. These real IDs are held in the |
2887 // IDs for any newly created connection methods. These real IDs are held in the |
2844 // temporary array iUpdatedConnMethods until successful commit to database. |
2888 // temporary array iUpdatedConnMethods until successful commit to database. |
2845 // This method is used to find out those real IDs before that. |
2889 // This method is used to find out those real IDs before that. |
2846 // --------------------------------------------------------------------------- |
2890 // --------------------------------------------------------------------------- |
2847 // |
2891 // |
2848 void CCmmCache::TranslateTemporaryId( const TUint32& aTemporaryId, TUint32& aRealId ) const |
2892 void CCmmCache::TranslateTemporaryId( const TUint32 aTemporaryId, TUint32& aRealId ) const |
2849 { |
2893 { |
2850 OstTraceFunctionEntry0( CCMMCACHE_TRANSLATETEMPORARYID_ENTRY ); |
2894 OstTraceFunctionEntry0( CCMMCACHE_TRANSLATETEMPORARYID_ENTRY ); |
2851 |
2895 |
2852 aRealId = 0; |
2896 aRealId = 0; |
2853 |
2897 |
2873 // --------------------------------------------------------------------------- |
2917 // --------------------------------------------------------------------------- |
2874 // |
2918 // |
2875 void CCmmCache::CheckIfConnMethodReferencesCanBeRemovedL( |
2919 void CCmmCache::CheckIfConnMethodReferencesCanBeRemovedL( |
2876 const CCmmConnMethodInstance& aConnMethodInstance ) |
2920 const CCmmConnMethodInstance& aConnMethodInstance ) |
2877 { |
2921 { |
|
2922 OstTraceFunctionEntry0( CCMMCACHE_CHECKIFCONNMETHODREFERENCESCANBEREMOVEDL_ENTRY ); |
|
2923 |
2878 TUint32 connMethodId( aConnMethodInstance.GetId() ); |
2924 TUint32 connMethodId( aConnMethodInstance.GetId() ); |
2879 |
2925 |
2880 // Check that connection method exists in database. |
2926 // Check that connection method exists in database. |
2881 if ( !iInstanceMapping->ValidConnMethodId( connMethodId ) ) |
2927 if ( !iInstanceMapping->ValidConnMethodId( connMethodId ) ) |
2882 { |
2928 { |
2886 // Can't remove an embedded destination this way. |
2932 // Can't remove an embedded destination this way. |
2887 if ( aConnMethodInstance.IsEmbeddedDestination() ) |
2933 if ( aConnMethodInstance.IsEmbeddedDestination() ) |
2888 { |
2934 { |
2889 User::Leave( KErrArgument ); |
2935 User::Leave( KErrArgument ); |
2890 } |
2936 } |
2891 |
|
2892 //TODO, what if protected? |
|
2893 |
2937 |
2894 // Iterate all destinations in database and check if possible reference can |
2938 // Iterate all destinations in database and check if possible reference can |
2895 // be removed. |
2939 // be removed. |
2896 RArray<TUint32> dbDestinations; |
2940 RArray<TUint32> dbDestinations; |
2897 CleanupClosePushL( dbDestinations ); |
2941 CleanupClosePushL( dbDestinations ); |
2898 iInstanceMapping->GetDestinationsL( dbDestinations ); |
2942 iInstanceMapping->GetDestinationsL( dbDestinations ); |
2899 for ( TInt i = 0; i < dbDestinations.Count(); i++ ) |
2943 for ( TInt i = 0; i < dbDestinations.Count(); i++ ) |
2900 { |
2944 { |
2901 if ( iInstanceMapping->ConnMethodInDestinationButLocked( connMethodId, dbDestinations[i] ) ) |
2945 if ( iInstanceMapping->ConnMethodInDestinationButLocked( |
|
2946 connMethodId, |
|
2947 dbDestinations[i] ) ) |
2902 { |
2948 { |
2903 User::Leave( KErrLocked ); |
2949 User::Leave( KErrLocked ); |
2904 } |
2950 } |
2905 } |
2951 } |
2906 CleanupStack::PopAndDestroy( &dbDestinations ); |
2952 CleanupStack::PopAndDestroy( &dbDestinations ); |
2908 // Can't remove a connection method that is in use. |
2954 // Can't remove a connection method that is in use. |
2909 if ( CheckIfCmConnected( connMethodId ) ) |
2955 if ( CheckIfCmConnected( connMethodId ) ) |
2910 { |
2956 { |
2911 User::Leave( KErrInUse ); |
2957 User::Leave( KErrInUse ); |
2912 } |
2958 } |
|
2959 |
|
2960 OstTraceFunctionExit0( CCMMCACHE_CHECKIFCONNMETHODREFERENCESCANBEREMOVEDL_EXIT ); |
|
2961 } |
|
2962 |
|
2963 // --------------------------------------------------------------------------- |
|
2964 // Check if given connection method is referenced from any protected destination. |
|
2965 // --------------------------------------------------------------------------- |
|
2966 // |
|
2967 void CCmmCache::CheckIfConnMethodBelongsToProtectedDestinationL( |
|
2968 const CCmmConnMethodInstance& aConnMethodInstance, |
|
2969 TBool& aBelongsToProtectedDestination ) |
|
2970 { |
|
2971 OstTraceFunctionEntry0( CCMMCACHE_CHECKIFCONNMETHODBELONGSTOPROTECTEDDESTINATIONL_ENTRY ); |
|
2972 |
|
2973 TUint32 connMethodId( aConnMethodInstance.GetId() ); |
|
2974 |
|
2975 // Check that connection method exists in database. |
|
2976 if ( !iInstanceMapping->ValidConnMethodId( connMethodId ) ) |
|
2977 { |
|
2978 User::Leave( KErrNotFound ); |
|
2979 } |
|
2980 |
|
2981 aBelongsToProtectedDestination = EFalse; |
|
2982 // Get destinations which have references to connection method passed as parameter. |
|
2983 RArray<TUint32> dbDestinations; |
|
2984 CleanupClosePushL( dbDestinations ); |
|
2985 iInstanceMapping->DestinationsContainingConnMethodL( connMethodId, dbDestinations ); |
|
2986 TUint32 metadata( 0 ); |
|
2987 for ( TInt i = 0; i < dbDestinations.Count(); i++ ) |
|
2988 { |
|
2989 // Check if any of destinations is protected. |
|
2990 metadata = iInstanceMapping->DestinationMetadata( dbDestinations[i] ); |
|
2991 TUint32 protlevel = |
|
2992 ( metadata & KDestProtectionLevelMask ) >> KBitsToShiftDestProtectionLevel; |
|
2993 if ( protlevel == CMManager::EProtLevel1 || protlevel == CMManager::EProtLevel3 ) |
|
2994 { |
|
2995 aBelongsToProtectedDestination = ETrue; |
|
2996 break; |
|
2997 } |
|
2998 } |
|
2999 CleanupStack::PopAndDestroy( &dbDestinations ); |
|
3000 |
|
3001 OstTraceFunctionExit0( CCMMCACHE_CHECKIFCONNMETHODBELONGSTOPROTECTEDDESTINATIONL_EXIT ); |
2913 } |
3002 } |
2914 |
3003 |
2915 // --------------------------------------------------------------------------- |
3004 // --------------------------------------------------------------------------- |
2916 // Check if the given connection method can be deleted. |
3005 // Check if the given connection method can be deleted. |
2917 // --------------------------------------------------------------------------- |
3006 // --------------------------------------------------------------------------- |
2918 // |
3007 // |
2919 void CCmmCache::CheckIfConnMethodCanBeDeletedL( |
3008 void CCmmCache::CheckIfConnMethodCanBeDeletedL( |
2920 const CCmmConnMethodInstance& aConnMethodInstance ) |
3009 const CCmmConnMethodInstance& aConnMethodInstance ) |
2921 { |
3010 { |
|
3011 OstTraceFunctionEntry0( CCMMCACHE_CHECKIFCONNMETHODCANBEDELETEDL_ENTRY ); |
|
3012 |
2922 TUint32 connMethodId( aConnMethodInstance.GetId() ); |
3013 TUint32 connMethodId( aConnMethodInstance.GetId() ); |
2923 |
3014 |
2924 // Find connection method from cache. |
3015 // Find connection method from cache. |
2925 TInt index = FindConnMethodFromCache( connMethodId ); |
3016 TInt index = FindConnMethodFromCache( connMethodId ); |
2926 if ( index == KErrNotFound ) |
3017 if ( index == KErrNotFound ) |
2959 // Check that no virtual IAP points to this connection method. |
3050 // Check that no virtual IAP points to this connection method. |
2960 if ( iInstanceMapping->ConnMethodPointedToByVirtualIap( connMethodId ) ) |
3051 if ( iInstanceMapping->ConnMethodPointedToByVirtualIap( connMethodId ) ) |
2961 { |
3052 { |
2962 User::Leave( KErrLocked ); |
3053 User::Leave( KErrLocked ); |
2963 } |
3054 } |
|
3055 |
|
3056 OstTraceFunctionExit0( CCMMCACHE_CHECKIFCONNMETHODCANBEDELETEDL_EXIT ); |
2964 } |
3057 } |
2965 |
3058 |
2966 // --------------------------------------------------------------------------- |
3059 // --------------------------------------------------------------------------- |
2967 // Check if the given destination can be deleted. |
3060 // Check if the given destination can be deleted. |
2968 // --------------------------------------------------------------------------- |
3061 // --------------------------------------------------------------------------- |
2969 // |
3062 // |
2970 void CCmmCache::CheckIfDestinationCanBeDeletedL( |
3063 void CCmmCache::CheckIfDestinationCanBeDeletedL( |
2971 const CCmmDestinationInstance& aDestinationInstance ) |
3064 const CCmmDestinationInstance& aDestinationInstance ) |
2972 { |
3065 { |
|
3066 OstTraceFunctionEntry0( CCMMCACHE_CHECKIFDESTINATIONCANBEDELETEDL_ENTRY ); |
|
3067 |
2973 TUint32 destinationId( aDestinationInstance.GetId() ); |
3068 TUint32 destinationId( aDestinationInstance.GetId() ); |
2974 |
3069 |
2975 // Find destination from cache. |
3070 // Find destination from cache. |
2976 TInt index = FindDestinationFromCache( destinationId ); |
3071 TInt index = FindDestinationFromCache( destinationId ); |
2977 if ( index == KErrNotFound ) |
3072 if ( index == KErrNotFound ) |
3017 // Check if any of the connection methods in this destination are currently in use. |
3112 // Check if any of the connection methods in this destination are currently in use. |
3018 if ( DestinationConnectedL( destinationId ) ) |
3113 if ( DestinationConnectedL( destinationId ) ) |
3019 { |
3114 { |
3020 User::Leave( KErrInUse ); |
3115 User::Leave( KErrInUse ); |
3021 } |
3116 } |
|
3117 |
|
3118 OstTraceFunctionExit0( CCMMCACHE_CHECKIFDESTINATIONCANBEDELETEDL_EXIT ); |
3022 } |
3119 } |
3023 |
3120 |
3024 // --------------------------------------------------------------------------- |
3121 // --------------------------------------------------------------------------- |
3025 // Return the requested table ID. |
3122 // Return the requested table ID. |
3026 // --------------------------------------------------------------------------- |
3123 // --------------------------------------------------------------------------- |
3033 // --------------------------------------------------------------------------- |
3130 // --------------------------------------------------------------------------- |
3034 // Initiate the deletion of given destination if none of the connection |
3131 // Initiate the deletion of given destination if none of the connection |
3035 // methods inside it are connected. |
3132 // methods inside it are connected. |
3036 // --------------------------------------------------------------------------- |
3133 // --------------------------------------------------------------------------- |
3037 // |
3134 // |
3038 void CCmmCache::DeleteDestinationForcedL( CCmmDestinationInstance& aDestinationInstance ) //TODO, OST |
3135 void CCmmCache::DeleteDestinationForcedL( CCmmDestinationInstance& aDestinationInstance ) |
3039 { |
3136 { |
3040 //TODO |
3137 OstTraceFunctionEntry0( CCMMCACHE_DELETEDESTINATIONFORCEDL_ENTRY ); |
|
3138 |
3041 if ( !DestinationConnectedL( 0, &aDestinationInstance ) ) |
3139 if ( !DestinationConnectedL( 0, &aDestinationInstance ) ) |
3042 { |
3140 { |
3043 DeleteDestinationL( aDestinationInstance, ETrue ); |
3141 DeleteDestinationL( aDestinationInstance, ETrue ); |
3044 } |
3142 } |
|
3143 |
|
3144 OstTraceFunctionExit0( CCMMCACHE_DELETEDESTINATIONFORCEDL_EXIT ); |
3045 } |
3145 } |
3046 |
3146 |
3047 // End of file |
3147 // End of file |