16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 // INCLUDE FILES |
19 // INCLUDE FILES |
20 #include <e32std.h> |
20 #include <e32std.h> |
21 #include <WPVoIPAdapter.rsg> |
21 #include <wpvoipadapter.rsg> |
22 #include <charconv.h> |
22 #include <charconv.h> |
23 #include <in_sock.h> // TInetAddr, TSockAddr |
23 #include <in_sock.h> // TInetAddr, TSockAddr |
24 #include <crcseprofileentry.h> |
24 #include <crcseprofileentry.h> |
25 #include <crcseprofileregistry.h> |
25 #include <crcseprofileregistry.h> |
26 #include <crcseaudiocodecentry.h> |
26 #include <crcseaudiocodecentry.h> |
70 |
70 |
71 // IM related constants. |
71 // IM related constants. |
72 const TUint32 KIMSubServicePluginId = 0x1027545A; // KSIPConnectivityPluginImplUid |
72 const TUint32 KIMSubServicePluginId = 0x1027545A; // KSIPConnectivityPluginImplUid |
73 const TUint32 KIMLaunchUid = 0x200255D0; |
73 const TUint32 KIMLaunchUid = 0x200255D0; |
74 const TInt KIMSettingsId = 1; |
74 const TInt KIMSettingsId = 1; |
|
75 |
|
76 // Bearer related constants |
|
77 const TUint32 KBearerNotSpecified = 0; |
|
78 const TUint32 KBearerWlanOnly = 1; |
|
79 const TUint32 KBearerCellularOnly = 2; |
75 |
80 |
76 // Following lines are for enabling debug prints. |
81 // Following lines are for enabling debug prints. |
77 #ifdef _DEBUG |
82 #ifdef _DEBUG |
78 #define DBG_PRINT(p) RDebug::Print(_L(p)) |
83 #define DBG_PRINT(p) RDebug::Print(_L(p)) |
79 #define DBG_PRINT2(p,a) RDebug::Print(_L(p),a) |
84 #define DBG_PRINT2(p,a) RDebug::Print(_L(p),a) |
875 for ( TInt codecIndex = 0; codecIndex < numberOfCodecs; codecIndex++ ) |
880 for ( TInt codecIndex = 0; codecIndex < numberOfCodecs; codecIndex++ ) |
876 { |
881 { |
877 priorityArray.Append( iCodecs[codecIndex]->iPriorityIndex ); |
882 priorityArray.Append( iCodecs[codecIndex]->iPriorityIndex ); |
878 } |
883 } |
879 priorityArray.Sort(); |
884 priorityArray.Sort(); |
|
885 |
|
886 //delete possible duplicate priority index |
|
887 for ( TInt index = 0; index < priorityArray.Count()-1; ++index ) |
|
888 { |
|
889 TInt tmpIndex = index + 1; |
|
890 while ( tmpIndex < priorityArray.Count() && |
|
891 priorityArray[tmpIndex] == priorityArray[index] ) |
|
892 { |
|
893 priorityArray.Remove( tmpIndex ); |
|
894 } |
|
895 } |
|
896 |
880 RPointerArray<CWPVoIPCodec> tmpArray; |
897 RPointerArray<CWPVoIPCodec> tmpArray; |
881 |
898 |
882 for ( TInt priorityIndex = 0; priorityIndex < numberOfCodecs; |
899 TInt numberOfPriority = priorityArray.Count(); |
|
900 for ( TInt priorityIndex = 0; priorityIndex < numberOfPriority; |
883 priorityIndex++ ) |
901 priorityIndex++ ) |
884 { |
902 { |
885 for ( TInt codecIndex = 0; codecIndex < numberOfCodecs; |
903 for ( TInt codecIndex = 0; codecIndex < numberOfCodecs; |
886 codecIndex++ ) |
904 codecIndex++ ) |
887 { |
905 { |
988 |
1006 |
989 // VoIPPluginUid |
1007 // VoIPPluginUid |
990 if ( KNotSet != iVoIPPluginUid ) |
1008 if ( KNotSet != iVoIPPluginUid ) |
991 { |
1009 { |
992 cRCSEProfileEntry->iVoIPPluginUID = iVoIPPluginUid; |
1010 cRCSEProfileEntry->iVoIPPluginUID = iVoIPPluginUid; |
993 } |
|
994 |
|
995 // AllowVoIPOverWCDMA |
|
996 if ( KNotSet != iAllowVoIPOverWCDMA ) |
|
997 { |
|
998 cRCSEProfileEntry->iAllowVoIPoverWCDMA = |
|
999 static_cast<VoIPProfileEntry::TOnOff>( iAllowVoIPOverWCDMA ); |
|
1000 } |
1011 } |
1001 |
1012 |
1002 // VoIPDigits |
1013 // VoIPDigits |
1003 if ( KNotSet != iVoIPDigits ) |
1014 if ( KNotSet != iVoIPDigits ) |
1004 { |
1015 { |
1567 CSIPManagedProfile* sipManagedProf = |
1578 CSIPManagedProfile* sipManagedProf = |
1568 static_cast<CSIPManagedProfile*>( sipProf ); |
1579 static_cast<CSIPManagedProfile*>( sipProf ); |
1569 CleanupStack::PushL( sipManagedProf ); // CS:4 |
1580 CleanupStack::PushL( sipManagedProf ); // CS:4 |
1570 sipManagedProf->SetParameter( KSIPSnapId, iSnapId ); |
1581 sipManagedProf->SetParameter( KSIPSnapId, iSnapId ); |
1571 sipManagedProf->SetParameter( KSIPAccessPointId, (TUint32)0 ); |
1582 sipManagedProf->SetParameter( KSIPAccessPointId, (TUint32)0 ); |
|
1583 DBG_PRINT2( "CWPVoIPItem::SavingFinalizedL - SNAP ID (1): %d", iSnapId ); |
1572 sipReg->SaveL( *sipManagedProf ); |
1584 sipReg->SaveL( *sipManagedProf ); |
1573 CleanupStack::PopAndDestroy( sipManagedProf ); // CS:3 |
1585 CleanupStack::PopAndDestroy( sipManagedProf ); // CS:3 |
1574 CleanupStack::Pop( sipProf ); // CS:2 |
1586 CleanupStack::Pop( sipProf ); // CS:2 |
1575 sipProf = NULL; |
1587 sipProf = NULL; |
1576 // sipReg, sipObs |
1588 // sipReg, sipObs |
1716 CleanupStack::PopAndDestroy( &cmManager ); |
1728 CleanupStack::PopAndDestroy( &cmManager ); |
1717 |
1729 |
1718 // Update sip profile to use default snap |
1730 // Update sip profile to use default snap |
1719 sipManagedProf->SetParameter( KSIPAccessPointId, (TUint32)0 ); |
1731 sipManagedProf->SetParameter( KSIPAccessPointId, (TUint32)0 ); |
1720 sipManagedProf->SetParameter( KSIPSnapId, iSnapId ); |
1732 sipManagedProf->SetParameter( KSIPSnapId, iSnapId ); |
|
1733 DBG_PRINT2( "CWPVoIPItem::SavingFinalizedL - SNAP ID (2): %d", iSnapId ); |
1721 sipReg->SaveL( *sipManagedProf ); |
1734 sipReg->SaveL( *sipManagedProf ); |
1722 } |
1735 } |
1723 } |
1736 } |
1724 |
1737 |
1725 CleanupStack::PopAndDestroy( sipManagedProf ); // CS:3 |
1738 CleanupStack::PopAndDestroy( sipManagedProf ); // CS:3 |
1726 CleanupStack::Pop( sipProf ); // CS:2 |
1739 CleanupStack::Pop( sipProf ); // CS:2 |
1727 sipProf = NULL; |
1740 sipProf = NULL; |
1728 // sipReg, sipObs |
1741 // sipReg, sipObs |
1729 CleanupStack::PopAndDestroy( 2, sipObs ); // CS:0 |
1742 CleanupStack::PopAndDestroy( 2, sipObs ); // CS:0 |
|
1743 sipReg = NULL; |
1730 } |
1744 } |
1731 |
1745 |
1732 if ( iSnapIdSet ) |
1746 if ( iSnapIdSet ) |
1733 { |
1747 { |
1734 err = property->SetName( ESubPropertyVoIPPreferredSNAPId ); |
1748 err = property->SetName( ESubPropertyVoIPPreferredSNAPId ); |
1769 } |
1783 } |
1770 |
1784 |
1771 User::LeaveIfError( spSettings->UpdateEntryL( *spEntry ) ); |
1785 User::LeaveIfError( spSettings->UpdateEntryL( *spEntry ) ); |
1772 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \ |
1786 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \ |
1773 Service provider entry updated" ); |
1787 Service provider entry updated" ); |
|
1788 |
|
1789 DBG_PRINT2( "CWPVoIPItem::SavingFinalizedL - \ |
|
1790 set allow VoIP over wcdma iAlowVoIPOverWCDMA=%d", iAllowVoIPOverWCDMA ); |
|
1791 |
|
1792 //*********************** |
|
1793 // Allow VoIP over WCDMA |
|
1794 //*********************** |
|
1795 CSIPProfileRegistryObserver* sipObs = |
|
1796 CSIPProfileRegistryObserver::NewLC(); // CS:1 |
|
1797 CSIPManagedProfileRegistry* sipReg = |
|
1798 CSIPManagedProfileRegistry::NewLC( *sipObs ); // CS:2 |
|
1799 CSIPProfile* sipProf = NULL; |
|
1800 sipProf = sipReg->ProfileL( iSipId ); |
|
1801 CleanupStack::PushL( sipProf ); // CS:3 |
|
1802 CSIPManagedProfile* sipManagedProf = |
|
1803 static_cast<CSIPManagedProfile*>( sipProf ); |
|
1804 CleanupStack::PushL( sipManagedProf ); // CS:4 |
|
1805 |
|
1806 if ( iAllowVoIPOverWCDMA == 1 ) |
|
1807 { |
|
1808 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \ |
|
1809 set bearer not specified" ); |
|
1810 |
|
1811 // If VoIP is allowed over wcdma set bearer type to sip as |
|
1812 // not specified. |
|
1813 sipManagedProf->SetParameter( KBearerType, KBearerNotSpecified ); |
|
1814 } |
|
1815 else |
|
1816 { |
|
1817 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \ |
|
1818 set bearer setting wlan only" ); |
|
1819 |
|
1820 // If not allowed set bearer type to sip as wlan only |
|
1821 sipManagedProf->SetParameter( KBearerType, KBearerWlanOnly ); |
|
1822 } |
|
1823 |
|
1824 sipReg->SaveL( *sipManagedProf ); |
|
1825 CleanupStack::PopAndDestroy( sipManagedProf ); // CS:3 |
|
1826 CleanupStack::Pop( sipProf ); // CS:2 |
|
1827 sipProf = NULL; |
|
1828 // sipReg, sipObs |
|
1829 CleanupStack::PopAndDestroy( 2, sipObs ); // CS:0 |
|
1830 |
|
1831 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \ |
|
1832 bearer settings set" ); |
1774 |
1833 |
1775 // property, spEntry spSettings, cRCSEProfileEntry, cRCSEProfileRegistry |
1834 // property, spEntry spSettings, cRCSEProfileEntry, cRCSEProfileRegistry |
1776 CleanupStack::PopAndDestroy( 5, cRCSEProfileRegistry ); // CS:0 |
1835 CleanupStack::PopAndDestroy( 5, cRCSEProfileRegistry ); // CS:0 |
1777 iSipIdSet = EFalse; |
1836 iSipIdSet = EFalse; |
1778 |
1837 |