40 // --------------------------------------------------------------------------- |
39 // --------------------------------------------------------------------------- |
41 // |
40 // |
42 CCmmDestinationStruct* CCmmDestinationStruct::NewL( |
41 CCmmDestinationStruct* CCmmDestinationStruct::NewL( |
43 CCmmCache* aCache, |
42 CCmmCache* aCache, |
44 CCmmTransactionHandler* aTransactionHandler, |
43 CCmmTransactionHandler* aTransactionHandler, |
45 const TUint32& aDestinationId ) |
44 const TUint32 aDestinationId ) |
46 { |
45 { |
47 OstTraceFunctionEntry0( CCMMDESTINATIONSTRUCT_NEWL_ENTRY ); |
46 OstTraceFunctionEntry0( CCMMDESTINATIONSTRUCT_NEWL_ENTRY ); |
48 |
47 |
49 CCmmDestinationStruct* self = CCmmDestinationStruct::NewLC( aCache, aTransactionHandler, aDestinationId ); |
48 CCmmDestinationStruct* self = CCmmDestinationStruct::NewLC( |
|
49 aCache, |
|
50 aTransactionHandler, |
|
51 aDestinationId ); |
50 CleanupStack::Pop( self ); |
52 CleanupStack::Pop( self ); |
51 |
53 |
52 OstTraceFunctionExit0( CCMMDESTINATIONSTRUCT_NEWL_EXIT ); |
54 OstTraceFunctionExit0( CCMMDESTINATIONSTRUCT_NEWL_EXIT ); |
53 return self; |
55 return self; |
54 } |
56 } |
61 // |
63 // |
62 CCmmDestinationStruct* CCmmDestinationStruct::NewL( |
64 CCmmDestinationStruct* CCmmDestinationStruct::NewL( |
63 CCmmCache* aCache, |
65 CCmmCache* aCache, |
64 CCmmTransactionHandler* aTransactionHandler, |
66 CCmmTransactionHandler* aTransactionHandler, |
65 const TDesC& aName, |
67 const TDesC& aName, |
66 const TUint32& aDestinationId ) |
68 const TUint32 aDestinationId ) |
67 { |
69 { |
68 OstTraceFunctionEntry0( DUP1_CCMMDESTINATIONSTRUCT_NEWL_ENTRY ); |
70 OstTraceFunctionEntry0( DUP1_CCMMDESTINATIONSTRUCT_NEWL_ENTRY ); |
69 |
71 |
70 CCmmDestinationStruct* self = CCmmDestinationStruct::NewLC( aCache, aTransactionHandler, aName, aDestinationId ); |
72 CCmmDestinationStruct* self = CCmmDestinationStruct::NewLC( |
|
73 aCache, |
|
74 aTransactionHandler, |
|
75 aName, |
|
76 aDestinationId ); |
71 CleanupStack::Pop( self ); |
77 CleanupStack::Pop( self ); |
72 |
78 |
73 OstTraceFunctionExit0( DUP1_CCMMDESTINATIONSTRUCT_NEWL_EXIT ); |
79 OstTraceFunctionExit0( DUP1_CCMMDESTINATIONSTRUCT_NEWL_EXIT ); |
74 return self; |
80 return self; |
75 } |
81 } |
80 // --------------------------------------------------------------------------- |
86 // --------------------------------------------------------------------------- |
81 // |
87 // |
82 CCmmDestinationStruct* CCmmDestinationStruct::NewLC( |
88 CCmmDestinationStruct* CCmmDestinationStruct::NewLC( |
83 CCmmCache* aCache, |
89 CCmmCache* aCache, |
84 CCmmTransactionHandler* aTransactionHandler, |
90 CCmmTransactionHandler* aTransactionHandler, |
85 const TUint32& aDestinationId ) |
91 const TUint32 aDestinationId ) |
86 { |
92 { |
87 OstTraceFunctionEntry0( CCMMDESTINATIONSTRUCT_NEWLC_ENTRY ); |
93 OstTraceFunctionEntry0( CCMMDESTINATIONSTRUCT_NEWLC_ENTRY ); |
88 |
94 |
89 CCmmDestinationStruct* self = new( ELeave ) CCmmDestinationStruct( aCache, aTransactionHandler ); |
95 CCmmDestinationStruct* self = new( ELeave ) CCmmDestinationStruct( |
|
96 aCache, |
|
97 aTransactionHandler ); |
90 CleanupStack::PushL( self ); |
98 CleanupStack::PushL( self ); |
91 self->ConstructL( aDestinationId ); |
99 self->ConstructL( aDestinationId ); |
92 |
100 |
93 OstTraceFunctionExit0( CCMMDESTINATIONSTRUCT_NEWLC_EXIT ); |
101 OstTraceFunctionExit0( CCMMDESTINATIONSTRUCT_NEWLC_EXIT ); |
94 return self; |
102 return self; |
102 // |
110 // |
103 CCmmDestinationStruct* CCmmDestinationStruct::NewLC( |
111 CCmmDestinationStruct* CCmmDestinationStruct::NewLC( |
104 CCmmCache* aCache, |
112 CCmmCache* aCache, |
105 CCmmTransactionHandler* aTransactionHandler, |
113 CCmmTransactionHandler* aTransactionHandler, |
106 const TDesC& aName, |
114 const TDesC& aName, |
107 const TUint32& aDestinationId ) |
115 const TUint32 aDestinationId ) |
108 { |
116 { |
109 OstTraceFunctionEntry0( DUP1_CCMMDESTINATIONSTRUCT_NEWLC_ENTRY ); |
117 OstTraceFunctionEntry0( DUP1_CCMMDESTINATIONSTRUCT_NEWLC_ENTRY ); |
110 |
118 |
111 CCmmDestinationStruct* self = new( ELeave ) CCmmDestinationStruct( aCache, aTransactionHandler ); |
119 CCmmDestinationStruct* self = new( ELeave ) CCmmDestinationStruct( |
|
120 aCache, |
|
121 aTransactionHandler ); |
112 CleanupStack::PushL( self ); |
122 CleanupStack::PushL( self ); |
113 self->ConstructL( aName, aDestinationId ); |
123 self->ConstructL( aName, aDestinationId ); |
114 |
124 |
115 OstTraceFunctionExit0( DUP1_CCMMDESTINATIONSTRUCT_NEWLC_EXIT ); |
125 OstTraceFunctionExit0( DUP1_CCMMDESTINATIONSTRUCT_NEWLC_EXIT ); |
116 return self; |
126 return self; |
167 // --------------------------------------------------------------------------- |
177 // --------------------------------------------------------------------------- |
168 // Second phase constructor. |
178 // Second phase constructor. |
169 // Opens an existing destination based on ID. |
179 // Opens an existing destination based on ID. |
170 // --------------------------------------------------------------------------- |
180 // --------------------------------------------------------------------------- |
171 // |
181 // |
172 void CCmmDestinationStruct::ConstructL( const TUint32& aDestinationId ) |
182 void CCmmDestinationStruct::ConstructL( const TUint32 aDestinationId ) |
173 { |
183 { |
174 OstTraceFunctionEntry0( CCMMDESTINATIONSTRUCT_CONSTRUCTL_ENTRY ); |
184 OstTraceFunctionEntry0( CCMMDESTINATIONSTRUCT_CONSTRUCTL_ENTRY ); |
175 |
185 |
176 // Check ID is in valid range. |
186 // Check ID is in valid range. |
177 if ( aDestinationId <= KCmDefaultDestinationAPTagId || aDestinationId >= KCmMaxDestinationAPTagId ) |
187 if ( aDestinationId <= KCmDefaultDestinationAPTagId || |
|
188 aDestinationId >= KCmMaxDestinationAPTagId ) |
178 { |
189 { |
179 User::Leave( KErrArgument ); |
190 User::Leave( KErrArgument ); |
180 } |
191 } |
181 iId = aDestinationId; |
192 iId = aDestinationId; |
182 |
193 |
209 if ( !iMetadataRecord->FindL( iTransactionHandler->Session() ) ) |
220 if ( !iMetadataRecord->FindL( iTransactionHandler->Session() ) ) |
210 { |
221 { |
211 // Not found -> fill in with default values. |
222 // Not found -> fill in with default values. |
212 iMetadataRecord->iSNAP = iId; |
223 iMetadataRecord->iSNAP = iId; |
213 iMetadataRecord->iMetadata = 0; |
224 iMetadataRecord->iMetadata = 0; |
214 //iMetadataRecord->iIcon = 0;//TODO, set to 0 or not? |
|
215 iMetadataRecord->SetRecordId( KCDNewRecordRequest ); |
225 iMetadataRecord->SetRecordId( KCDNewRecordRequest ); |
216 iMetadataRecordStatus = ECmmRecordStatusUnsaved; |
226 iMetadataRecordStatus = ECmmRecordStatusUnsaved; |
217 } |
227 } |
218 else |
228 else |
219 { |
229 { |
229 // --------------------------------------------------------------------------- |
239 // --------------------------------------------------------------------------- |
230 // Second phase constructor. |
240 // Second phase constructor. |
231 // Creates a new destination. With name and optionally also with ID. |
241 // Creates a new destination. With name and optionally also with ID. |
232 // --------------------------------------------------------------------------- |
242 // --------------------------------------------------------------------------- |
233 // |
243 // |
234 void CCmmDestinationStruct::ConstructL( const TDesC& aName, const TUint32& aDestinationId ) |
244 void CCmmDestinationStruct::ConstructL( const TDesC& aName, const TUint32 aDestinationId ) |
235 { |
245 { |
236 OstTraceFunctionEntry0( DUP1_CCMMDESTINATIONSTRUCT_CONSTRUCTL_ENTRY ); |
246 OstTraceFunctionEntry0( DUP1_CCMMDESTINATIONSTRUCT_CONSTRUCTL_ENTRY ); |
237 |
247 |
238 SetStatus( ECmmDestinationStatusNotSaved ); |
248 SetStatus( ECmmDestinationStatusNotSaved ); |
239 iId = aDestinationId; |
249 iId = aDestinationId; |
284 |
294 |
285 // --------------------------------------------------------------------------- |
295 // --------------------------------------------------------------------------- |
286 // Set the destination ID. |
296 // Set the destination ID. |
287 // --------------------------------------------------------------------------- |
297 // --------------------------------------------------------------------------- |
288 // |
298 // |
289 void CCmmDestinationStruct::SetId( const TUint32& aId ) |
299 void CCmmDestinationStruct::SetId( const TUint32 aId ) |
290 { |
300 { |
291 iId = aId; |
301 iId = aId; |
292 } |
302 } |
293 |
303 |
294 // --------------------------------------------------------------------------- |
304 // --------------------------------------------------------------------------- |
413 // --------------------------------------------------------------------------- |
423 // --------------------------------------------------------------------------- |
414 // Copies the data for this destination to a session instance and increments |
424 // Copies the data for this destination to a session instance and increments |
415 // the reference counter by one. |
425 // the reference counter by one. |
416 // --------------------------------------------------------------------------- |
426 // --------------------------------------------------------------------------- |
417 // |
427 // |
418 void CCmmDestinationStruct::CreateSessionInstanceL( |
428 void CCmmDestinationStruct::CreateDestinationInstanceL( |
419 CCmmDestinationInstance& aDestinationInstance ) |
429 CCmmDestinationInstance& aDestinationInstance ) |
420 { |
430 { |
421 OstTraceFunctionEntry0( CCMMDESTINATIONSTRUCT_CREATESESSIONINSTANCEL_ENTRY ); |
431 OstTraceFunctionEntry0( CCMMDESTINATIONSTRUCT_CREATESESSIONINSTANCEL_ENTRY ); |
422 |
432 |
423 // This should work according to status. If status is valid, this |
433 // This should work according to status. If status is valid, this |
430 // For a non-valid destination, to save memory, transfer the ownership of |
440 // For a non-valid destination, to save memory, transfer the ownership of |
431 // record pointers straight to the session and mark the cache pointers as |
441 // record pointers straight to the session and mark the cache pointers as |
432 // NULL. When update is called, copy the records into the cache also. |
442 // NULL. When update is called, copy the records into the cache also. |
433 // |
443 // |
434 |
444 |
435 switch ( iStatus ) //TODO, add missing status values |
445 switch ( iStatus ) |
436 { |
446 { |
437 case ECmmDestinationStatusNotSaved: |
447 case ECmmDestinationStatusNotSaved: |
438 { |
448 { |
439 // Transfer ownership of table records to session. Mark local pointers to NULL. |
449 // Transfer ownership of table records to session. Mark local pointers to NULL. |
440 |
450 |
473 |
485 |
474 OstTraceFunctionExit0( CCMMDESTINATIONSTRUCT_CREATESESSIONINSTANCEL_EXIT ); |
486 OstTraceFunctionExit0( CCMMDESTINATIONSTRUCT_CREATESESSIONINSTANCEL_EXIT ); |
475 } |
487 } |
476 |
488 |
477 // --------------------------------------------------------------------------- |
489 // --------------------------------------------------------------------------- |
478 // TODO |
490 // Refresh the data contained in aDestinationInstance. This means reloading |
|
491 // the data from database if necessary. After this call the contents of |
|
492 // aDestinationInstance will reflect the current state in the database. |
479 // --------------------------------------------------------------------------- |
493 // --------------------------------------------------------------------------- |
480 // |
494 // |
481 void CCmmDestinationStruct::RefreshDestinationInstanceL( |
495 void CCmmDestinationStruct::RefreshDestinationInstanceL( |
482 CCmmDestinationInstance& aDestinationInstance ) |
496 CCmmDestinationInstance& aDestinationInstance ) |
483 { |
497 { |
626 void CCmmDestinationStruct::UpdateL( |
640 void CCmmDestinationStruct::UpdateL( |
627 CCmmDestinationInstance& aDestinationInstance, |
641 CCmmDestinationInstance& aDestinationInstance, |
628 CCmmCache* aCache ) |
642 CCmmCache* aCache ) |
629 { |
643 { |
630 OstTraceFunctionEntry0( CCMMDESTINATIONSTRUCT_UPDATEL_ENTRY ); |
644 OstTraceFunctionEntry0( CCMMDESTINATIONSTRUCT_UPDATEL_ENTRY ); |
|
645 |
|
646 TBool setProtection( EFalse ); |
|
647 CMManager::TProtectionLevel protLevel( CMManager::EProtLevel0 ); |
631 |
648 |
632 // Structure: |
649 // Structure: |
633 // - Use ModifyL() or StoreL() according to own status (new destination or |
650 // - Use ModifyL() or StoreL() according to own status (new destination or |
634 // changes to existing one). |
651 // changes to existing one). |
635 // |
652 // |
666 CCDSNAPMetadataRecord* instanceMetadataRecord = |
683 CCDSNAPMetadataRecord* instanceMetadataRecord = |
667 static_cast<CCDSNAPMetadataRecord*>( recordPointer ); |
684 static_cast<CCDSNAPMetadataRecord*>( recordPointer ); |
668 |
685 |
669 recordPointer = NULL; |
686 recordPointer = NULL; |
670 |
687 |
|
688 // Set protections on network record as needed. |
|
689 protLevel = aDestinationInstance.CurrentProtectionLevelL(); |
|
690 if ( protLevel == CMManager::EProtLevel1 || |
|
691 protLevel == CMManager::EProtLevel2 ) |
|
692 { |
|
693 setProtection = ETrue; |
|
694 } |
|
695 SetAttribute( instanceNetworkRecord, CommsDat::ECDProtectedWrite, setProtection ); |
|
696 |
671 switch ( iStatus ) |
697 switch ( iStatus ) |
672 { |
698 { |
673 case ECmmDestinationStatusNotSaved: |
699 case ECmmDestinationStatusNotSaved: |
674 { |
700 { |
675 // This is a new destination that doesn't exist in database yet. |
701 // This is a new destination that doesn't exist in database yet. |
676 |
702 |
677 // Store network record first, the record ID is needed for |
703 // Store network record first, the record ID is needed for |
678 // destination access point record. |
704 // destination access point record. |
679 // Record ID for network record is set during construction. |
705 // Record ID for network record is set during construction. |
680 |
|
681 //TODO, Check method call from old CmManager: |
|
682 //TODO, SetAttribute( iData->iNetworkRecord, ECDProtectedWrite, ProtectionLevel() == EProtLevel1 ); |
|
683 instanceNetworkRecord->StoreL( iTransactionHandler->Session() ); |
706 instanceNetworkRecord->StoreL( iTransactionHandler->Session() ); |
684 |
707 |
685 // If ID is out of valid range, it means this destination was created |
708 // If ID is out of valid range, it means this destination was created |
686 // without a specific ID. It is a temporary ID and can now be replaced |
709 // without a specific ID. It is a temporary ID and can now be replaced |
687 // with the real database ID. This also enables this destination to be |
710 // with the real database ID. This also enables this destination to be |
689 // Record ID from network record must be used as real ID. |
712 // Record ID from network record must be used as real ID. |
690 if ( iId >= KTemporaryIdCounterStart ) |
713 if ( iId >= KTemporaryIdCounterStart ) |
691 { |
714 { |
692 id = instanceNetworkRecord->RecordId() + KCmDefaultDestinationAPTagId; |
715 id = instanceNetworkRecord->RecordId() + KCmDefaultDestinationAPTagId; |
693 instanceDestApRecord->iRecordTag = id; |
716 instanceDestApRecord->iRecordTag = id; |
694 instanceDestApRecord->iCustomSelectionPolicy = ( id - KCmDefaultDestinationAPTagId ); |
717 instanceDestApRecord->iCustomSelectionPolicy = |
|
718 ( id - KCmDefaultDestinationAPTagId ); |
695 instanceMetadataRecord->iSNAP = id; |
719 instanceMetadataRecord->iSNAP = id; |
696 } |
720 } |
697 instanceDestApRecord->StoreL( iTransactionHandler->Session() ); |
721 instanceDestApRecord->StoreL( iTransactionHandler->Session() ); |
698 instanceMetadataRecord->StoreL( iTransactionHandler->Session() ); |
722 instanceMetadataRecord->StoreL( iTransactionHandler->Session() ); |
699 } |
723 } |
702 case ECmmDestinationStatusValid: |
726 case ECmmDestinationStatusValid: |
703 case ECmmDestinationStatusToBeDeleted: |
727 case ECmmDestinationStatusToBeDeleted: |
704 { |
728 { |
705 // This destination already exists in database and is beeing modified. |
729 // This destination already exists in database and is beeing modified. |
706 |
730 |
707 //TODO, Check method call from old CmManager: |
|
708 //TODO, SetAttribute( iData->iNetworkRecord, ECDProtectedWrite, ProtectionLevel() == EProtLevel1 ); |
|
709 instanceNetworkRecord->ModifyL( iTransactionHandler->Session() ); |
731 instanceNetworkRecord->ModifyL( iTransactionHandler->Session() ); |
710 instanceDestApRecord->ModifyL( iTransactionHandler->Session() ); |
732 instanceDestApRecord->ModifyL( iTransactionHandler->Session() ); |
711 if ( iMetadataRecordStatus == ECmmRecordStatusUnsaved ) |
733 if ( iMetadataRecordStatus == ECmmRecordStatusUnsaved ) |
712 { |
734 { |
713 instanceMetadataRecord->StoreL( iTransactionHandler->Session() ); |
735 instanceMetadataRecord->StoreL( iTransactionHandler->Session() ); |
732 iNetworkRecord = NULL; |
754 iNetworkRecord = NULL; |
733 iMetadataRecord = NULL; |
755 iMetadataRecord = NULL; |
734 iDestApRecordStatus = ECmmRecordStatusBlank; |
756 iDestApRecordStatus = ECmmRecordStatusBlank; |
735 iNetworkRecordStatus = ECmmRecordStatusBlank; |
757 iNetworkRecordStatus = ECmmRecordStatusBlank; |
736 iMetadataRecordStatus = ECmmRecordStatusBlank; |
758 iMetadataRecordStatus = ECmmRecordStatusBlank; |
737 iDestApRecord = static_cast<CommsDat::CCDAccessPointRecord*>( CopyRecordL( ECmmDestApRecord, instanceDestApRecord ) ); |
759 iDestApRecord = static_cast<CommsDat::CCDAccessPointRecord*>( |
738 iNetworkRecord = static_cast<CommsDat::CCDNetworkRecord*>( CopyRecordL( ECmmDestNetworkRecord, instanceNetworkRecord ) ); |
760 CopyRecordL( ECmmDestApRecord, instanceDestApRecord ) ); |
739 iMetadataRecord = static_cast<CCDSNAPMetadataRecord*>( CopyRecordL( ECmmDestMetadataRecord, instanceMetadataRecord ) ); |
761 iNetworkRecord = static_cast<CommsDat::CCDNetworkRecord*>( |
|
762 CopyRecordL( ECmmDestNetworkRecord, instanceNetworkRecord ) ); |
|
763 iMetadataRecord = static_cast<CCDSNAPMetadataRecord*>( |
|
764 CopyRecordL( ECmmDestMetadataRecord, instanceMetadataRecord ) ); |
740 |
765 |
741 instanceDestApRecord = NULL; |
766 instanceDestApRecord = NULL; |
742 instanceNetworkRecord = NULL; |
767 instanceNetworkRecord = NULL; |
743 instanceMetadataRecord = NULL; |
768 instanceMetadataRecord = NULL; |
744 |
769 |
779 TInt index( 0 ); |
804 TInt index( 0 ); |
780 |
805 |
781 // Initial record for destination itself. |
806 // Initial record for destination itself. |
782 snapRecord1->iSNAP = id; |
807 snapRecord1->iSNAP = id; |
783 snapRecord1->iRecordName.SetL( iNetworkRecord->iRecordName.GetL() ); |
808 snapRecord1->iRecordName.SetL( iNetworkRecord->iRecordName.GetL() ); |
|
809 |
|
810 // Set protections on snap record. |
|
811 SetAttribute( snapRecord1, CommsDat::ECDProtectedWrite, setProtection ); |
|
812 |
784 if ( existingRecordCount > index ) |
813 if ( existingRecordCount > index ) |
785 { |
814 { |
786 snapRecord1->SetElementId( snapRecordSet->iRecords[index]->ElementId() ); |
815 snapRecord1->SetElementId( snapRecordSet->iRecords[index]->ElementId() ); |
787 snapRecord1->iEmbeddedSNAP = 0; |
816 snapRecord1->iEmbeddedSNAP = 0; |
788 snapRecord1->iIAP = 0; |
817 snapRecord1->iIAP = 0; |
818 aCache->TranslateTemporaryId( |
847 aCache->TranslateTemporaryId( |
819 aDestinationInstance.iConnMethodItemArray[i].iId, |
848 aDestinationInstance.iConnMethodItemArray[i].iId, |
820 connMethodRealId ); |
849 connMethodRealId ); |
821 } |
850 } |
822 |
851 |
823 //TODO, if protection level is 1 (dest AND CMs), set ECDProtectedWrite. See oldimplementation. |
852 // Set protections on destination contents as needed. |
824 |
853 setProtection = EFalse; |
825 if ( aDestinationInstance.iConnMethodItemArray[i].iBearerType == KUidEmbeddedDestination ) |
854 protLevel = aDestinationInstance.CurrentProtectionLevelL(); |
|
855 if ( protLevel == CMManager::EProtLevel1 ) |
|
856 { |
|
857 setProtection = ETrue; |
|
858 } |
|
859 SetAttribute( snapRecord2, CommsDat::ECDProtectedWrite, setProtection ); |
|
860 |
|
861 if ( aDestinationInstance.iConnMethodItemArray[i].IsEmbedded() ) |
826 { |
862 { |
827 // Embedded destination. |
863 // Embedded destination. |
828 snapRecord2->iEmbeddedSNAP = ( TInt )connMethodRealId; |
864 snapRecord2->iEmbeddedSNAP = ( TInt )connMethodRealId; |
829 snapRecord2->iIAP = 0; |
865 snapRecord2->iIAP = 0; |
830 snapRecord2->iPriority = |
866 snapRecord2->iPriority = |
831 CMManager::KDataMobilitySelectionPolicyPriorityWildCard; |
867 CMManager::KDataMobilitySelectionPolicyPriorityWildCard; |
832 aDestinationInstance.iConnMethodItemArray[i].iPriority = |
868 aDestinationInstance.iConnMethodItemArray[i].iPriority = |
833 CMManager::KDataMobilitySelectionPolicyPriorityWildCard; // Update this just in case. |
869 CMManager::KDataMobilitySelectionPolicyPriorityWildCard; |
834 } |
870 } |
835 else |
871 else |
836 { |
872 { |
837 // Normal connection method. |
873 // Normal connection method. |
838 snapRecord2->iEmbeddedSNAP = 0; |
874 snapRecord2->iEmbeddedSNAP = 0; |
839 snapRecord2->iIAP = CommsDat::KCDTIdIAPRecord | ( connMethodRealId << 8 ); |
875 snapRecord2->iIAP = CommsDat::KCDTIdIAPRecord | ( connMethodRealId << 8 ); |
840 snapRecord2->iPriority = i + 1; // Priority values start from 1. |
876 // If the connection method is a virtual IAP that doesn't |
841 aDestinationInstance.iConnMethodItemArray[i].iPriority = i + 1; // Update this just in case. |
877 // link to an IAP, set priority to wildcard. |
|
878 if ( aDestinationInstance.iConnMethodItemArray[i].IsVirtual() && |
|
879 aDestinationInstance.iConnMethodItemArray[i].LinkedIapId() == 0 ) |
|
880 { |
|
881 snapRecord2->iPriority = |
|
882 CMManager::KDataMobilitySelectionPolicyPriorityWildCard; |
|
883 aDestinationInstance.iConnMethodItemArray[i].iPriority = |
|
884 CMManager::KDataMobilitySelectionPolicyPriorityWildCard; |
|
885 } |
|
886 else |
|
887 { |
|
888 snapRecord2->iPriority = i + 1; // Priority values start from 1. |
|
889 aDestinationInstance.iConnMethodItemArray[i].iPriority = i + 1; |
|
890 } |
842 } |
891 } |
843 |
892 |
844 if ( existingRecordCount > index ) |
893 if ( existingRecordCount > index ) |
845 { |
894 { |
846 // An old record can be reused. |
895 // An old record can be reused. |
894 // |
943 // |
895 void CCmmDestinationStruct::DeleteL() |
944 void CCmmDestinationStruct::DeleteL() |
896 { |
945 { |
897 OstTraceFunctionEntry0( CCMMDESTINATIONSTRUCT_DELETEL_ENTRY ); |
946 OstTraceFunctionEntry0( CCMMDESTINATIONSTRUCT_DELETEL_ENTRY ); |
898 |
947 |
899 // Check general status. |
|
900 /*switch ( iStatus ) //TODO, already done? yes, cleanup |
|
901 { |
|
902 case ECmmDestinationStatusNotSaved: |
|
903 { |
|
904 // Doesn'texist in database. |
|
905 User::Leave( KErrNotFound ); |
|
906 } |
|
907 break; |
|
908 case ECmmDestinationStatusValid: |
|
909 // Proceed. |
|
910 break; |
|
911 case ECmmDestinationStatusToBeDeleted: |
|
912 { |
|
913 // Already deleted, nothing to do. |
|
914 return; |
|
915 } |
|
916 case ECmmDestinationStatusChanged: |
|
917 default: |
|
918 ASSERT( 0 ); // Error, invalid argument. |
|
919 User::Leave( KErrCorrupt ); |
|
920 break; |
|
921 }*/ |
|
922 |
|
923 // Check status for records. |
948 // Check status for records. |
924 switch ( iNetworkRecordStatus ) |
949 switch ( iNetworkRecordStatus ) |
925 { |
950 { |
926 case ECmmRecordStatusLoaded: |
951 case ECmmRecordStatusLoaded: |
927 case ECmmRecordStatusExpired: |
952 case ECmmRecordStatusExpired: |
1016 // This should be called when a client session closes a destination handle. |
1041 // This should be called when a client session closes a destination handle. |
1017 // Reference counter is decremented by one and the remaining number of |
1042 // Reference counter is decremented by one and the remaining number of |
1018 // references is returned. |
1043 // references is returned. |
1019 // --------------------------------------------------------------------------- |
1044 // --------------------------------------------------------------------------- |
1020 // |
1045 // |
1021 TInt CCmmDestinationStruct::SessionInstanceClosed() |
1046 TInt CCmmDestinationStruct::DestinationInstanceClosed() |
1022 { |
1047 { |
1023 OstTraceFunctionEntry0( CCMMDESTINATIONSTRUCT_SESSIONINSTANCECLOSED_ENTRY ); |
1048 OstTraceFunctionEntry0( CCMMDESTINATIONSTRUCT_SESSIONINSTANCECLOSED_ENTRY ); |
1024 |
1049 |
1025 iReferenceCounter--; |
1050 iReferenceCounter--; |
1026 if ( iReferenceCounter < 0 ) |
1051 if ( iReferenceCounter < 0 ) |
1180 protocolRecord->LoadL( iTransactionHandler->Session() ); |
1205 protocolRecord->LoadL( iTransactionHandler->Session() ); |
1181 iDestApRecord->iProtocol = protocolRecord->ElementId(); |
1206 iDestApRecord->iProtocol = protocolRecord->ElementId(); |
1182 CleanupStack::PopAndDestroy( protocolRecord ); |
1207 CleanupStack::PopAndDestroy( protocolRecord ); |
1183 |
1208 |
1184 OstTraceFunctionExit0( CCMMDESTINATIONSTRUCT_SETDEFAULTPROTOCOLL_EXIT ); |
1209 OstTraceFunctionExit0( CCMMDESTINATIONSTRUCT_SETDEFAULTPROTOCOLL_EXIT ); |
|
1210 } |
|
1211 |
|
1212 // ----------------------------------------------------------------------------- |
|
1213 // Set attribute flag on the given record. |
|
1214 // ----------------------------------------------------------------------------- |
|
1215 void CCmmDestinationStruct::SetAttribute( |
|
1216 CommsDat::CCDRecordBase* aRecord, |
|
1217 TUint32 aAttribute, |
|
1218 TBool aSet ) |
|
1219 { |
|
1220 OstTraceFunctionEntry0( CCMMDESTINATIONSTRUCT_SETATTRIBUTE_ENTRY ); |
|
1221 |
|
1222 if ( aSet ) |
|
1223 { |
|
1224 aRecord->SetAttributes( aAttribute ); |
|
1225 } |
|
1226 else |
|
1227 { |
|
1228 aRecord->ClearAttributes( aAttribute ); |
|
1229 } |
|
1230 |
|
1231 OstTraceFunctionExit0( CCMMDESTINATIONSTRUCT_SETATTRIBUTE_EXIT ); |
1185 } |
1232 } |
1186 |
1233 |
1187 // ----------------------------------------------------------------------------- |
1234 // ----------------------------------------------------------------------------- |
1188 // Creates a copy of a record of the given type. |
1235 // Creates a copy of a record of the given type. |
1189 // ----------------------------------------------------------------------------- |
1236 // ----------------------------------------------------------------------------- |
1331 } |
1378 } |
1332 if ( !source->iIcon.IsNull() ) |
1379 if ( !source->iIcon.IsNull() ) |
1333 { |
1380 { |
1334 metadataRecord->iIcon.SetL( source->iIcon ); |
1381 metadataRecord->iIcon.SetL( source->iIcon ); |
1335 } |
1382 } |
1336 //if ( !source->iIconFileName.IsNull() )//TODO, enable after commsdat icon changes are implemented. |
1383 if ( !source->iIconFileName.IsNull() ) |
1337 //{ |
1384 { |
1338 //metadataRecord->iIconFileName.SetL( source->iIconFileName ); |
1385 metadataRecord->iIconFileName.SetL( source->iIconFileName ); |
1339 //} |
1386 } |
1340 metadataRecord->SetElementId( source->ElementId() ); |
1387 metadataRecord->SetElementId( source->ElementId() ); |
1341 |
1388 |
1342 CleanupStack::Pop( metadataRecord ); |
1389 CleanupStack::Pop( metadataRecord ); |
1343 target = static_cast<CommsDat::CCDRecordBase*>( metadataRecord ); |
1390 target = static_cast<CommsDat::CCDRecordBase*>( metadataRecord ); |
1344 } |
1391 } |