47 #include "SIPProfileStorageIndex.h" |
47 #include "SIPProfileStorageIndex.h" |
48 #include <siperr.h> |
48 #include <siperr.h> |
49 #include <sipsystemstatemonitor.h> |
49 #include <sipsystemstatemonitor.h> |
50 #include <random.h> |
50 #include <random.h> |
51 |
51 |
|
52 #include <CommsDatTypesV1_1.h> |
|
53 #include <MetaDatabase.h> |
|
54 #include <commsdattypeinfov1_1_internal.h> |
|
55 using namespace CommsDat; |
52 |
56 |
53 // ============================ MEMBER FUNCTIONS =============================== |
57 // ============================ MEMBER FUNCTIONS =============================== |
54 |
58 |
55 // ----------------------------------------------------------------------------- |
59 // ----------------------------------------------------------------------------- |
56 // CSIPProfileServerCore::NewL |
60 // CSIPProfileServerCore::NewL |
944 // CSIPProfileServerCore::ForceDisableProfileL |
948 // CSIPProfileServerCore::ForceDisableProfileL |
945 // ----------------------------------------------------------------------------- |
949 // ----------------------------------------------------------------------------- |
946 // |
950 // |
947 CSIPConcreteProfile::TStatus CSIPProfileServerCore::ForceDisableProfileL( |
951 CSIPConcreteProfile::TStatus CSIPProfileServerCore::ForceDisableProfileL( |
948 TUint32 aProfileId, |
952 TUint32 aProfileId, |
949 const MSIPExtendedConcreteProfileObserver& aObserver) |
953 const MSIPExtendedConcreteProfileObserver& /* aObserver */) |
950 { |
954 { |
951 CSIPProfileCacheItem* item = ProfileCacheItemL(aProfileId); |
955 CSIPProfileCacheItem* item = ProfileCacheItemL(aProfileId); |
952 (void)aObserver; |
956 |
953 //When profile state is not unregistered, |
957 //When profile state is not unregistered, |
954 //perform cleanup and send event notification |
958 //perform cleanup and send event notification |
955 |
959 |
956 if(CSIPConcreteProfile::EUnregistered != item->UsedProfile().Status()) |
960 if(CSIPConcreteProfile::EUnregistered != item->UsedProfile().Status()) |
957 { |
961 { |
1769 // ----------------------------------------------------------------------------- |
1773 // ----------------------------------------------------------------------------- |
1770 // |
1774 // |
1771 TBool CSIPProfileServerCore::ShouldChangeIap(CSIPConcreteProfile& aProfile, TInt aError) const |
1775 TBool CSIPProfileServerCore::ShouldChangeIap(CSIPConcreteProfile& aProfile, TInt aError) const |
1772 { |
1776 { |
1773 PROFILE_DEBUG3("CSIPProfileServerCore::ShouldChangeIap, error", aError) |
1777 PROFILE_DEBUG3("CSIPProfileServerCore::ShouldChangeIap, error", aError) |
1774 TUint32 dummySnapId(0); |
1778 TUint32 snapId(0); |
1775 if ( aProfile.ExtensionParameter(KSIPSnapId, dummySnapId) == KErrNone && |
1779 if ( aProfile.ExtensionParameter(KSIPSnapId, snapId) == KErrNone |
1776 !AnyRegisteredProfileUsesIap(aProfile.IapId()) ) |
1780 && !AnyRegisteredProfileUsesIap(aProfile.IapId()) ) |
1777 { |
1781 { |
1778 PROFILE_DEBUG1("CSIPProfileServerCore::ShouldChangeIap, snap is in use") |
1782 PROFILE_DEBUG1("CSIPProfileServerCore::ShouldChangeIap, snap is in use") |
1779 |
1783 |
1780 // This profile uses a SNAP. |
1784 // This profile uses a SNAP. |
1781 // There are no registered profiles using the same IAP as this profile. |
1785 // There are no registered profiles using the same IAP as this profile. |
1782 |
1786 |
1783 if ( aError == KErrTimedOut || |
1787 TUint iapCount(0); |
1784 aError == KErrSIPResolvingFailure ) |
1788 TRAPD(err, iapCount = IAPCountL(snapId)); |
1785 { |
1789 if(KErrNone == err) |
1786 PROFILE_DEBUG1("CSIPProfileServerCore::ShouldChangeIap returns True") |
1790 { |
1787 return ETrue; |
1791 if ( (aError == KErrTimedOut || |
1788 } |
1792 aError == KErrSIPResolvingFailure) |
1789 } |
1793 && iapCount > 1) |
|
1794 { |
|
1795 PROFILE_DEBUG1("CSIPProfileServerCore::ShouldChangeIap returns True") |
|
1796 return ETrue; |
|
1797 } |
|
1798 } |
|
1799 |
|
1800 } |
1790 PROFILE_DEBUG1("CSIPProfileServerCore::ShouldChangeIap returns false") |
1801 PROFILE_DEBUG1("CSIPProfileServerCore::ShouldChangeIap returns false") |
1791 return EFalse; |
1802 return EFalse; |
1792 } |
1803 } |
1793 |
1804 |
1794 TBool CSIPProfileServerCore::AnyRegisteredProfileUsesIap(TUint aIap) const |
1805 TBool CSIPProfileServerCore::AnyRegisteredProfileUsesIap(TUint aIap) const |
1837 { |
1848 { |
1838 TRAP_IGNORE(obs[i]->RegistrationStatusChangedL(aItem.ProfileId(), |
1849 TRAP_IGNORE(obs[i]->RegistrationStatusChangedL(aItem.ProfileId(), |
1839 aItem.Profile().Status(), ESipProfileItcOpProfileForciblyDisabled)); |
1850 aItem.Profile().Status(), ESipProfileItcOpProfileForciblyDisabled)); |
1840 } |
1851 } |
1841 } |
1852 } |
|
1853 |
|
1854 |
|
1855 // ----------------------------------------------------------------------------- |
|
1856 // CSIPProfileServerCore::IAPCount |
|
1857 // ----------------------------------------------------------------------------- |
|
1858 // |
|
1859 TInt CSIPProfileServerCore::IAPCountL(TUint32 aSnapId) const |
|
1860 { |
|
1861 const TUint KRecordId = aSnapId; |
|
1862 TUint32 count(0); |
|
1863 CMDBSession* db = CMDBSession::NewLC( KCDVersion1_2); |
|
1864 db->SetAttributeMask( ECDHidden ); |
|
1865 |
|
1866 //Load the Selection Policy record |
|
1867 CCDIAPPrioritySelectionPolicyRecord *selPolRecord = (CCDIAPPrioritySelectionPolicyRecord *)CCDRecordBase::RecordFactoryL(KCDTIdIapPrioritySelectionPolicyRecord); |
|
1868 |
|
1869 CleanupStack::PushL(selPolRecord); |
|
1870 selPolRecord->SetRecordId(KRecordId); |
|
1871 |
|
1872 selPolRecord->LoadL( *db ); |
|
1873 count = selPolRecord->iIapCount; |
|
1874 PROFILE_DEBUG3("CSIPProfileServerCore::IAPCount, IAP Count", count) |
|
1875 |
|
1876 CleanupStack::PopAndDestroy(selPolRecord); |
|
1877 CleanupStack::PopAndDestroy( db ); |
|
1878 return count; |
|
1879 } |
|
1880 |