37 #include "mpmconfirmdlgroaming.h" |
38 #include "mpmconfirmdlgroaming.h" |
38 #include "mpmconfirmdlgstarting.h" |
39 #include "mpmconfirmdlgstarting.h" |
39 #include "mpmdefaultconnection.h" |
40 #include "mpmdefaultconnection.h" |
40 #include "mpmcommsdataccess.h" |
41 #include "mpmcommsdataccess.h" |
41 #include "mpmwlanquerydialog.h" |
42 #include "mpmwlanquerydialog.h" |
42 #include "mpmdialog.h" |
|
43 #include "mpmprivatecrkeys.h" |
43 #include "mpmprivatecrkeys.h" |
44 #include "mpmcsidwatcher.h" |
44 #include "mpmcsidwatcher.h" |
45 #include "mpmdatausagewatcher.h" |
45 #include "mpmdatausagewatcher.h" |
46 #include "mpmpropertydef.h" |
46 #include "mpmpropertydef.h" |
|
47 #include "mpmofflinewatcher.h" |
47 |
48 |
48 // ============================= LOCAL FUNCTIONS =============================== |
49 // ============================= LOCAL FUNCTIONS =============================== |
49 |
50 |
50 // ----------------------------------------------------------------------------- |
51 // ----------------------------------------------------------------------------- |
51 // PanicServer |
52 // PanicServer |
87 iWLANScanRequired( EFalse ), |
88 iWLANScanRequired( EFalse ), |
88 iDisconnectQueue( NULL ), |
89 iDisconnectQueue( NULL ), |
89 iRoamingQueue( NULL ), |
90 iRoamingQueue( NULL ), |
90 iStartingQueue( NULL ), |
91 iStartingQueue( NULL ), |
91 iWlanQueryQueue( NULL ), |
92 iWlanQueryQueue( NULL ), |
92 iConnectDialogQueue( NULL ), |
|
93 iDefaultConnection( NULL ), |
93 iDefaultConnection( NULL ), |
94 iConnectionCounter( 0 ) |
94 iConnectionCounter( 0 ), |
|
95 iOfflineMode( ECoreAppUIsNetworkConnectionAllowed ) |
95 { |
96 { |
96 } |
97 } |
97 |
98 |
98 |
99 |
99 // ----------------------------------------------------------------------------- |
100 // ----------------------------------------------------------------------------- |
161 iStartingQueue = new ( ELeave ) CArrayPtrFlat<CMPMConfirmDlgStarting>( KGranularity ); |
163 iStartingQueue = new ( ELeave ) CArrayPtrFlat<CMPMConfirmDlgStarting>( KGranularity ); |
162 iStartingQueue->Reset(); |
164 iStartingQueue->Reset(); |
163 |
165 |
164 iWlanQueryQueue = new ( ELeave ) CArrayPtrFlat<CMPMWlanQueryDialog>( KGranularity ); |
166 iWlanQueryQueue = new ( ELeave ) CArrayPtrFlat<CMPMWlanQueryDialog>( KGranularity ); |
165 iWlanQueryQueue->Reset(); |
167 iWlanQueryQueue->Reset(); |
166 |
|
167 iConnectDialogQueue = new ( ELeave ) CArrayPtrFlat<CMPMDialog>( KGranularity ); |
|
168 iConnectDialogQueue->Reset(); |
|
169 |
168 |
170 iDefaultConnection = CMPMDefaultConnection::NewL( this ); |
169 iDefaultConnection = CMPMDefaultConnection::NewL( this ); |
171 |
170 |
172 // Create central repository watcher and start it |
171 // Create central repository watcher and start it |
173 iMpmCsIdWatcher = CMpmCsIdWatcher::NewL(); |
172 iMpmCsIdWatcher = CMpmCsIdWatcher::NewL(); |
174 iMpmCsIdWatcher->StartL(); |
173 iMpmCsIdWatcher->StartL(); |
175 |
174 |
176 // Create another central repository watcher and start it |
175 // Create another central repository watcher and start it |
177 // TODO: Trapped, because currently it may fatally leave in HW. |
|
178 // (Possibly because of the capability updates of data usage watcher's CR-keys.) |
|
179 TRAPD( duwErr, iMpmDataUsageWatcher = CMpmDataUsageWatcher::NewL( this ) ); |
176 TRAPD( duwErr, iMpmDataUsageWatcher = CMpmDataUsageWatcher::NewL( this ) ); |
180 if (duwErr == KErrNone) |
177 if (duwErr == KErrNone) |
181 { |
178 { |
182 iMpmDataUsageWatcher->StartL(); |
179 iMpmDataUsageWatcher->StartL(); |
183 } |
180 } |
185 { |
182 { |
186 iMpmDataUsageWatcher = NULL; |
183 iMpmDataUsageWatcher = NULL; |
187 MPMLOGSTRING( "CMPMServer::ConstructL: CMpmDataUsageWatcher::NewL() failed!" ) |
184 MPMLOGSTRING( "CMPMServer::ConstructL: CMpmDataUsageWatcher::NewL() failed!" ) |
188 } |
185 } |
189 |
186 |
190 // Define P&S keys (snap & iap) for the user connection |
187 // Create another central repository watcher and start it |
191 TInt ret = RProperty::Define( KMPMUserConnectionCategory, |
188 TRAPD( owErr, iMpmOfflineWatcher = CMpmOfflineWatcher::NewL( this ) ); |
192 KMPMPSKeyUserConnectionSnap, |
189 if (owErr == KErrNone) |
193 KMPMUserConnectionSnapType, |
190 { |
194 KMPMUserConnectionReadPolicy, |
191 iMpmOfflineWatcher->StartL(); |
195 KMPMUserConnectionWritePolicy ); |
192 } |
196 |
193 else |
197 if ( (ret != KErrNone) && (ret != KErrAlreadyExists) ) |
194 { |
198 { |
195 iMpmOfflineWatcher = NULL; |
199 User::Leave(err); |
196 MPMLOGSTRING( "CMPMServer::ConstructL: CMpmOfflineWatcher::NewL() failed!" ) |
200 } |
197 } |
201 |
|
202 ret = RProperty::Define( KMPMUserConnectionCategory, |
|
203 KMPMPSKeyUserConnectionIap, |
|
204 KMPMUserConnectionIapType, |
|
205 KMPMUserConnectionReadPolicy, |
|
206 KMPMUserConnectionWritePolicy ); |
|
207 |
|
208 if ( (ret != KErrNone) && (ret != KErrAlreadyExists) ) |
|
209 { |
|
210 User::Leave(err); |
|
211 } |
|
212 |
|
213 // Set initial values for the keys |
|
214 User::LeaveIfError(RProperty::Set( KMPMUserConnectionCategory, |
|
215 KMPMPSKeyUserConnectionSnap, |
|
216 0 )); |
|
217 |
|
218 User::LeaveIfError(RProperty::Set( KMPMUserConnectionCategory, |
|
219 KMPMPSKeyUserConnectionIap, |
|
220 0 )); |
|
221 |
198 |
222 // Read dedicated clients from the central repository |
199 // Read dedicated clients from the central repository |
223 CRepository* repository = CRepository::NewL( KCRUidMPM ); |
200 CRepository* repository = CRepository::NewL( KCRUidMPM ); |
224 |
201 |
225 CleanupStack::PushL( repository ); |
202 CleanupStack::PushL( repository ); |
226 |
203 |
227 TUint32 baseKey = KMpmDedicatedClientBase; |
204 TUint32 baseKey = KMpmDedicatedClientBase; |
228 TInt value; |
205 TInt value; |
229 ret = KErrNone; |
206 TInt ret = KErrNone; |
230 |
207 |
231 while ( ret == KErrNone ) |
208 while ( ret == KErrNone ) |
232 { |
209 { |
233 ret = repository->Get ( baseKey, value ); |
210 ret = repository->Get ( baseKey, value ); |
234 |
211 |
240 |
217 |
241 baseKey++; |
218 baseKey++; |
242 } |
219 } |
243 |
220 |
244 CleanupStack::PopAndDestroy ( repository ); |
221 CleanupStack::PopAndDestroy ( repository ); |
245 |
|
246 // Define P&S keys for the connection dialogs |
|
247 ret = RProperty::Define( KMPMActiveConnectionCategory, |
|
248 KMPMPSKeyActiveConnectionIap, |
|
249 KMPMActiveConnectionIapType, |
|
250 KMPMActiveConnectionReadPolicy, |
|
251 KMPMActiveConnectionWritePolicy ); |
|
252 |
|
253 if ( (ret != KErrNone) && (ret != KErrAlreadyExists) ) |
|
254 { |
|
255 User::Leave(err); |
|
256 } |
|
257 |
|
258 ret = RProperty::Define( KMPMActiveConnectionCategory, |
|
259 KMPMPSKeyActiveConnectionSnap, |
|
260 KMPMActiveConnectionSnapType, |
|
261 KMPMActiveConnectionReadPolicy, |
|
262 KMPMActiveConnectionWritePolicy ); |
|
263 |
|
264 if ( (ret != KErrNone) && (ret != KErrAlreadyExists) ) |
|
265 { |
|
266 User::Leave(err); |
|
267 } |
|
268 |
|
269 ret = RProperty::Define( KMPMActiveConnectionCategory, |
|
270 KMPMPSKeyActiveConnectionBearer, |
|
271 KMPMActiveConnectionBearerType, |
|
272 KMPMActiveConnectionReadPolicy, |
|
273 KMPMActiveConnectionWritePolicy ); |
|
274 |
|
275 if ( (ret != KErrNone) && (ret != KErrAlreadyExists) ) |
|
276 { |
|
277 User::Leave(err); |
|
278 } |
|
279 |
222 |
280 PublishActiveConnection(); |
223 iConnUiUtils = CConnectionUiUtilities::NewL(); |
281 } |
224 } |
282 |
225 |
283 |
226 |
284 // ----------------------------------------------------------------------------- |
227 // ----------------------------------------------------------------------------- |
285 // CMPMServer::~CMPMServer |
228 // CMPMServer::~CMPMServer |
701 |
605 |
702 // ----------------------------------------------------------------------------- |
606 // ----------------------------------------------------------------------------- |
703 // CMPMServer::CheckIfStarted |
607 // CMPMServer::CheckIfStarted |
704 // ----------------------------------------------------------------------------- |
608 // ----------------------------------------------------------------------------- |
705 // |
609 // |
706 TBool CMPMServer::CheckIfStarted( const TUint32 aIapId ) |
610 TBool CMPMServer::CheckIfStarted( const TUint32 aIapId , |
707 { |
611 const TConnectionId aConnId ) |
708 MPMLOGSTRING2( "CMPMServer::CheckIfStarted - aIapId = %i", aIapId ) |
612 { |
|
613 MPMLOGSTRING3( "CMPMServer::CheckIfStarted - aIapId = %i, aConnId = 0x%x", |
|
614 aIapId, aConnId ) |
709 |
615 |
710 TConnectionState state( EIdle ); |
616 TConnectionState state( EIdle ); |
711 TBool stopLoop( EFalse ); |
617 TBool stopLoop( EFalse ); |
712 |
618 |
713 // Loop all connections until EStarted is found or no more connections |
619 // Loop all connections until EStarted is found or no more connections |
714 // |
620 // |
715 for ( TInt i = 0; ( ( i < iActiveBMConns.Count() ) && !stopLoop ); i++ ) |
621 for ( TInt i = 0; ( ( i < iActiveBMConns.Count() ) && !stopLoop ); i++ ) |
716 { |
622 { |
717 // Check if IAP Id matches |
623 // Check if IAP Id matches; exclude matching with own connection |
718 // |
624 // |
719 if ( iActiveBMConns[i].iConnInfo.iIapId == aIapId ) |
625 if ( iActiveBMConns[i].iConnInfo.iIapId == aIapId && |
|
626 iActiveBMConns[i].iConnInfo.iConnId != aConnId) |
720 { |
627 { |
721 state = iActiveBMConns[i].iConnInfo.iState; |
628 state = iActiveBMConns[i].iConnInfo.iState; |
722 |
629 |
723 // Stop looping if EStarted found |
630 // Stop looping if EStarted found |
724 // |
631 // |
1004 for ( TInt i = 0; i < iSessions.Count(); i++ ) |
892 for ( TInt i = 0; i < iSessions.Count(); i++ ) |
1005 { |
893 { |
1006 iapInfo = iSessions[i]->GetAvailableIAPs( ); |
894 iapInfo = iSessions[i]->GetAvailableIAPs( ); |
1007 iSessions[i]->PrefIAPNotificationL( iapInfo, aCaller ); |
895 iSessions[i]->PrefIAPNotificationL( iapInfo, aCaller ); |
1008 } |
896 } |
1009 |
897 } |
1010 // If a session is displaying connection selection dialog |
898 |
1011 // the contents of the dialog should be updated according to the |
|
1012 // current iap availability |
|
1013 // |
|
1014 for ( TInt i( 0 ); i < iSessions.Count(); i++ ) |
|
1015 { |
|
1016 iSessions[i]->UpdateConnectionDialogL(); |
|
1017 } |
|
1018 } |
|
1019 |
|
1020 // ----------------------------------------------------------------------------- |
|
1021 // CMPMServer::UpdateSessionConnectionDlgL |
|
1022 // ----------------------------------------------------------------------------- |
|
1023 // |
|
1024 void CMPMServer::UpdateSessionConnectionDlgL() |
|
1025 { |
|
1026 MPMLOGSTRING( "CMPMServer::UpdateSessionConnectionDlgL" ) |
|
1027 |
|
1028 // If a session is displaying connection selection dialog |
|
1029 // the contents of the dialog should be updated according to the |
|
1030 // current iap availability |
|
1031 // |
|
1032 for ( TInt i( 0 ); i < iSessions.Count(); i++ ) |
|
1033 { |
|
1034 iSessions[i]->UpdateConnectionDialogL(); |
|
1035 } |
|
1036 } |
|
1037 |
899 |
1038 // ----------------------------------------------------------------------------- |
900 // ----------------------------------------------------------------------------- |
1039 // CMPMServer::HandleServerBlackListIap |
901 // CMPMServer::HandleServerBlackListIap |
1040 // ----------------------------------------------------------------------------- |
902 // ----------------------------------------------------------------------------- |
1041 // |
903 // |
1159 // ----------------------------------------------------------------------------- |
1032 // ----------------------------------------------------------------------------- |
1160 // |
1033 // |
1161 void CMPMServer::HandleServerUnblackListIap( |
1034 void CMPMServer::HandleServerUnblackListIap( |
1162 TBlacklistCategory aCategory ) |
1035 TBlacklistCategory aCategory ) |
1163 { |
1036 { |
1164 MPMLOGSTRING2( "CMPMServer::HandleServerUnblackListIap -\ |
1037 MPMLOGSTRING3( "CMPMServer::HandleServerUnblackListIap -\ |
1165 aCategory = %i", aCategory ) |
1038 aCategory = %i blacklisted Id count = %d", |
|
1039 aCategory, iBlackListIdList.Count() ) |
1166 |
1040 |
1167 for( TInt i( 0 ); i < iBlackListIdList.Count(); i++ ) |
1041 for( TInt i( 0 ); i < iBlackListIdList.Count(); i++ ) |
1168 { |
1042 { |
1169 // found blacklisted Connection Id |
1043 // found blacklisted Connection Id |
1170 TMPMBlackListConnId connIdInfo = iBlackListIdList[i]; |
1044 TMPMBlackListConnId connIdInfo = iBlackListIdList[i]; |
1171 iBlackListIdList.Remove( i ); // remove from the list |
1045 iBlackListIdList.Remove( i ); // remove from the list |
1172 |
1046 |
|
1047 MPMLOGSTRING3( "CMPMServer::HandleServerUnblackListIap - \ |
|
1048 aConnId = 0x%x, blacklisted IapId count = %d", connIdInfo.iConnId, |
|
1049 connIdInfo.Count() ) |
|
1050 |
1173 for (TInt j = 0; j < connIdInfo.Count(); j++) |
1051 for (TInt j = 0; j < connIdInfo.Count(); j++) |
1174 { |
1052 { |
1175 if ( connIdInfo.Category( j ) == aCategory ) |
1053 if ( connIdInfo.Category( j ) == aCategory ) |
1176 { |
1054 { |
1177 // found and remove blacklisted iap |
1055 // found and remove blacklisted iap |
|
1056 MPMLOGSTRING3( "CMPMServer::HandleServerUnblackListIap - \ |
|
1057 removed blacklisted iap id %i in index: %d", connIdInfo.Iap( j ), j ) |
1178 connIdInfo.Remove( j ); |
1058 connIdInfo.Remove( j ); |
1179 } |
1059 } |
1180 } |
1060 } |
1181 // If any blacklisted iaps remain reinsert at the |
1061 // If any blacklisted iaps remain reinsert at the |
1182 // beginning connIdInfo to reflect activeness |
1062 // beginning connIdInfo to reflect activeness |
1183 // |
1063 // |
1184 if( connIdInfo.Count() > 0 ) |
1064 if( connIdInfo.Count() > 0 ) |
1185 { |
1065 { |
|
1066 MPMLOGSTRING( "reinsert connIdInfo to reflect activeness" ) |
1186 iBlackListIdList.Insert( connIdInfo, 0 ); |
1067 iBlackListIdList.Insert( connIdInfo, 0 ); |
1187 } |
1068 } |
1188 } |
1069 } |
1189 } |
1070 } |
1190 |
1071 |
1520 // CMPMServer::StopConnections |
1401 // CMPMServer::StopConnections |
1521 // ----------------------------------------------------------------------------- |
1402 // ----------------------------------------------------------------------------- |
1522 // |
1403 // |
1523 void CMPMServer::StopConnections( TInt aIapId ) |
1404 void CMPMServer::StopConnections( TInt aIapId ) |
1524 { |
1405 { |
|
1406 MPMLOGSTRING2( "CMPMServer::StopConnections aIapId = %d", aIapId ) |
1525 for (TInt index = 0; index < iSessions.Count(); index++) |
1407 for (TInt index = 0; index < iSessions.Count(); index++) |
1526 { |
1408 { |
1527 /* if (iSessions[index]->UserConnection()) |
1409 CMPMServerSession* session = iSessions[index]; |
1528 continue; |
|
1529 */ |
|
1530 // Stop connection |
1410 // Stop connection |
1531 if ( aIapId == 0 ) |
1411 if ( aIapId == 0 ) |
1532 { |
1412 { |
1533 iSessions[index]->StopConnection(); |
1413 session->StopConnection(); |
1534 } |
1414 } |
1535 else |
1415 else if ( GetBMIap( session->ConnectionId() ) == aIapId ) |
1536 { |
1416 { |
1537 TRAP_IGNORE( iSessions[index]->StopIAPNotificationL( aIapId )); |
1417 TRAP_IGNORE( session->StopIAPNotificationL( aIapId )); |
1538 } |
1418 } |
1539 |
1419 } |
1540 } |
|
1541 } |
|
1542 |
|
1543 // ----------------------------------------------------------------------------- |
|
1544 // CMPMServer::UpdateActiveConnectionL |
|
1545 // ----------------------------------------------------------------------------- |
|
1546 // |
|
1547 void CMPMServer::UpdateActiveConnectionL( CMPMServerSession& aSession ) |
|
1548 { |
|
1549 MPMLOGSTRING( "CMPMServer::UpdateActiveConnectionL" ) |
|
1550 TUint32 snapId; |
|
1551 |
|
1552 if ( !NumberOfActiveConnections() ) |
|
1553 { |
|
1554 // If no active connections then just reset keys and publish |
|
1555 iActiveBearerType = EMPMBearerTypeNone; |
|
1556 iActiveIapId = 0; |
|
1557 iActiveSnapId = 0; |
|
1558 PublishActiveConnection(); |
|
1559 return; |
|
1560 } |
|
1561 |
|
1562 // Check if all active connections are in same snap |
|
1563 if ( CommsDatAccess()->AreActiveIapsInSameSnapL( |
|
1564 iActiveBMConns, snapId ) ) |
|
1565 { |
|
1566 // Select active connection according to priority |
|
1567 CommsDatAccess()->SelectActiveConnectionL ( |
|
1568 snapId, |
|
1569 iActiveBMConns, |
|
1570 iActiveIapId, |
|
1571 iActiveSnapId, |
|
1572 iActiveBearerType, |
|
1573 aSession ); |
|
1574 |
|
1575 PublishActiveConnection(); |
|
1576 return; |
|
1577 } |
|
1578 |
|
1579 // Reset active connections |
|
1580 iActiveBearerType = EMPMBearerTypeNone; |
|
1581 iActiveIapId = 0; |
|
1582 iActiveSnapId = 0; |
|
1583 |
|
1584 // Active connections locating in different snaps |
|
1585 // Use priority order vpn, wlan and packet |
|
1586 for ( TInt index = 0; index < iActiveBMConns.Count(); index++ ) |
|
1587 { |
|
1588 CMPMServerSession* serverSession = GetServerSession( |
|
1589 iActiveBMConns[index].iConnInfo.iConnId ); |
|
1590 |
|
1591 // Do check only for active connections |
|
1592 if ( iActiveBMConns[index].iConnInfo.iState == EStarted && |
|
1593 serverSession->ChooseBestIapCalled() ) |
|
1594 { |
|
1595 TMPMBearerType bearerType = EMPMBearerTypeOther; |
|
1596 |
|
1597 if ( iDedicatedClients.Find( iActiveBMConns[index].iConnInfo.iAppUid ) == |
|
1598 KErrNone ) |
|
1599 { |
|
1600 // Skip dedicated client |
|
1601 continue; |
|
1602 } |
|
1603 |
|
1604 bearerType = CommsDatAccess()->GetBearerTypeL( |
|
1605 iActiveBMConns[index].iConnInfo.iIapId ); |
|
1606 |
|
1607 if ( bearerType == EMPMBearerTypeOther ) |
|
1608 { |
|
1609 // Don't publish this connection |
|
1610 continue; |
|
1611 } |
|
1612 |
|
1613 // This is true if, |
|
1614 // bearer type is smaller or different than none |
|
1615 // or |
|
1616 // bearer type is same and iap is different. |
|
1617 if ( ( bearerType < iActiveBearerType ) || |
|
1618 ( iActiveBearerType == EMPMBearerTypeNone ) || |
|
1619 ( ( bearerType == iActiveBearerType) && |
|
1620 ( iActiveIapId != iActiveBMConns[index].iConnInfo.iIapId ) ) ) |
|
1621 { |
|
1622 iActiveBearerType = bearerType; |
|
1623 iActiveIapId = iActiveBMConns[index].iConnInfo.iIapId; |
|
1624 iActiveSnapId = iActiveBMConns[index].iConnInfo.iSnap; |
|
1625 } |
|
1626 } |
|
1627 |
|
1628 PublishActiveConnection(); |
|
1629 } |
|
1630 } |
|
1631 |
|
1632 // ----------------------------------------------------------------------------- |
|
1633 // CMPMServer::MapBearerType |
|
1634 // ----------------------------------------------------------------------------- |
|
1635 // |
|
1636 TUint32 CMPMServer::MapBearerType(TMPMBearerType aBearerType) |
|
1637 { |
|
1638 MPMLOGSTRING( "CMPMServer::MapBearerType" ) |
|
1639 |
|
1640 switch ( aBearerType ) |
|
1641 { |
|
1642 case EMPMBearerTypeNone: |
|
1643 return 0; |
|
1644 |
|
1645 case EMPMBearerTypeVpn: |
|
1646 return KCommDbBearerVirtual; |
|
1647 |
|
1648 case EMPMBearerTypeWlan: |
|
1649 return KCommDbBearerWLAN; |
|
1650 |
|
1651 case EMPMBearerTypePacketData: |
|
1652 return KCommDbBearerWcdma; |
|
1653 |
|
1654 case EMPMBearerTypeOther: |
|
1655 return KCommDbBearerUnknown; |
|
1656 |
|
1657 default: |
|
1658 MPMLOGSTRING( "CMPMServer::MapBearerType: Unknown bearer type" ) |
|
1659 break; |
|
1660 } |
|
1661 |
|
1662 return KCommDbBearerUnknown; |
|
1663 } |
|
1664 |
|
1665 // ----------------------------------------------------------------------------- |
|
1666 // CMPMServer::PublishActiveConnection |
|
1667 // ----------------------------------------------------------------------------- |
|
1668 // |
|
1669 void CMPMServer::PublishActiveConnection() |
|
1670 { |
|
1671 MPMLOGSTRING( "CMPMServer::PublishActiveConnection" ) |
|
1672 |
|
1673 // update active connection keys |
|
1674 RProperty::Set( KMPMActiveConnectionCategory, |
|
1675 KMPMPSKeyActiveConnectionIap, |
|
1676 iActiveIapId ); |
|
1677 |
|
1678 RProperty::Set( KMPMActiveConnectionCategory, |
|
1679 KMPMPSKeyActiveConnectionSnap, |
|
1680 iActiveSnapId ); |
|
1681 |
|
1682 RProperty::Set( KMPMActiveConnectionCategory, |
|
1683 KMPMPSKeyActiveConnectionBearer, |
|
1684 MapBearerType( iActiveBearerType ) ); |
|
1685 |
|
1686 MPMLOGSTRING4( "CMPMServer::PublishActiveConnection: Set to: %d, %d, %d", |
|
1687 iActiveIapId, iActiveSnapId, iActiveBearerType ) |
|
1688 } |
|
1689 |
|
1690 // ----------------------------------------------------------------------------- |
|
1691 // CMPMServer::NumberOfActiveConnections |
|
1692 // ----------------------------------------------------------------------------- |
|
1693 // |
|
1694 TInt CMPMServer::NumberOfActiveConnections() |
|
1695 { |
|
1696 MPMLOGSTRING( "CMPMServer::NumberOfActiveConnections" ) |
|
1697 |
|
1698 TInt count( 0 ); |
|
1699 |
|
1700 for ( TInt index = 0; index < iActiveBMConns.Count(); index++ ) |
|
1701 { |
|
1702 CMPMServerSession* serverSession = GetServerSession( |
|
1703 iActiveBMConns[index].iConnInfo.iConnId ); |
|
1704 |
|
1705 if ( iActiveBMConns[index].iConnInfo.iState == EStarted && |
|
1706 serverSession->ChooseBestIapCalled() ) |
|
1707 { |
|
1708 count++; |
|
1709 } |
|
1710 } |
|
1711 |
|
1712 return count; |
|
1713 } |
1420 } |
1714 |
1421 |
1715 // ----------------------------------------------------------------------------- |
1422 // ----------------------------------------------------------------------------- |
1716 // CMPMServer::UserConnectionInInternet |
1423 // CMPMServer::UserConnectionInInternet |
1717 // ----------------------------------------------------------------------------- |
1424 // ----------------------------------------------------------------------------- |
2073 } |
1780 } |
2074 } |
1781 } |
2075 stoppedIaps.Close(); |
1782 stoppedIaps.Close(); |
2076 } |
1783 } |
2077 |
1784 |
|
1785 // --------------------------------------------------------------------------- |
|
1786 // CMPMServer::UpdateOfflineMode |
|
1787 // Offline watcher listens the offline mode and calls this when it's changed. |
|
1788 // --------------------------------------------------------------------------- |
|
1789 // |
|
1790 void CMPMServer::UpdateOfflineMode( TInt aNewModeValue ) |
|
1791 { |
|
1792 MPMLOGSTRING2( "CMPMServer::UpdateOfflineMode: Value %d", aNewModeValue ) |
|
1793 |
|
1794 iOfflineMode = aNewModeValue; |
|
1795 |
|
1796 if ( iOfflineMode == ECoreAppUIsNetworkConnectionAllowed ) |
|
1797 { |
|
1798 // Offline mode finished, reset the QueryResponse variable. |
|
1799 iOfflineWlanQueryResponse = EOfflineResponseUndefined; |
|
1800 } |
|
1801 } |
|
1802 |
|
1803 // --------------------------------------------------------------------------- |
|
1804 // CMPMServer::IsPhoneOffline |
|
1805 // Returns the current offline mode. |
|
1806 // --------------------------------------------------------------------------- |
|
1807 // |
|
1808 TBool CMPMServer::IsPhoneOffline() |
|
1809 { |
|
1810 MPMLOGSTRING( "CMPMServer::IsPhoneOffline" ) |
|
1811 |
|
1812 TBool retval = EFalse; |
|
1813 if ( iOfflineMode == ECoreAppUIsNetworkConnectionNotAllowed) |
|
1814 { |
|
1815 retval = ETrue; |
|
1816 MPMLOGSTRING( "CMPMServer::IsPhoneOffline: Yes." ) |
|
1817 } |
|
1818 return retval; |
|
1819 } |
|
1820 |
|
1821 // --------------------------------------------------------------------------- |
|
1822 // CMPMServer::OfflineWlanQueryResponse |
|
1823 // Tells the "Use WLAN in offline mode" query's response during the |
|
1824 // current offline mode session. |
|
1825 // --------------------------------------------------------------------------- |
|
1826 // |
|
1827 TOfflineWlanQueryResponse CMPMServer::OfflineWlanQueryResponse() |
|
1828 { |
|
1829 MPMLOGSTRING( "CMPMServer::OfflineWlanQueryResponse" ) |
|
1830 |
|
1831 #ifndef _PLATFORM_SIMULATOR_ |
|
1832 MPMLOGSTRING2( "CMPMServer::IsOfflineWlanQueryAccepted: %d", iOfflineWlanQueryResponse ) |
|
1833 return iOfflineWlanQueryResponse; |
|
1834 #else |
|
1835 // Platsim simulates WLAN and offline-mode. To ease automated testing, |
|
1836 // offline connection confirmation is not asked in Platsim-variant |
|
1837 MPMLOGSTRING( "CMPMServer::OfflineWlanQueryResponse: yes for Platsim" ) |
|
1838 return EOfflineResponseYes; |
|
1839 #endif |
|
1840 } |
|
1841 |
|
1842 // --------------------------------------------------------------------------- |
|
1843 // CMPMServer::SetOfflineWlanQueryResponse |
|
1844 // Called when the "Use WLAN in offline mode" note has been responded. |
|
1845 // --------------------------------------------------------------------------- |
|
1846 // |
|
1847 void CMPMServer::SetOfflineWlanQueryResponse( TOfflineWlanQueryResponse aResponse) |
|
1848 { |
|
1849 MPMLOGSTRING( "CMPMServer::SetOfflineWlanQueryResponse" ) |
|
1850 |
|
1851 iOfflineWlanQueryResponse = aResponse; |
|
1852 } |
|
1853 |
2078 // ----------------------------------------------------------------------------- |
1854 // ----------------------------------------------------------------------------- |
2079 // TMPMBlackListConnId::Append |
1855 // TMPMBlackListConnId::Append |
2080 // ----------------------------------------------------------------------------- |
1856 // ----------------------------------------------------------------------------- |
2081 // |
1857 // |
2082 void TMPMBlackListConnId::Append( TUint32 aIap, TBlacklistCategory aCategory ) |
1858 void TMPMBlackListConnId::Append( TUint32 aIap, TBlacklistCategory aCategory ) |