--- a/connectionmonitoring/connmon/connectionmonitor/group/ConnMon.mmp Fri Jul 23 09:11:14 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/group/ConnMon.mmp Fri Aug 06 19:11:03 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -57,6 +57,7 @@
SOURCE ConnMonBearerNotifier.cpp ConnMonEGprsNotifier.cpp ConnMonHsdpaNotifier.cpp
SOURCE cellulardatausagekeyupdater.cpp
+SOURCE connmondialupoverridenotifier.cpp
USERINCLUDE ../inc
--- a/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonDef.h Fri Jul 23 09:11:14 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonDef.h Fri Aug 06 19:11:03 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -108,6 +108,16 @@
};
/**
+ * Status values for dial-up PDP context override functionality.
+ */
+enum TConnMonDialUpOverrideStatus
+ {
+ EConnMonDialUpOverrideDisabled = 0,
+ EConnMonDialUpOverrideInactive,
+ EConnMonDialUpOverrideActive
+ };
+
+/**
* TEventInfo
*/
class TEventInfo
--- a/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonIAP.h Fri Jul 23 09:11:14 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonIAP.h Fri Aug 06 19:11:03 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -491,6 +491,12 @@
void GetActiveConnectionsIds( const TUint& aBearerId, RArray<TUint>& aIdArray );
/**
+ * Return ETrue if one or more active packetdata connections are found,
+ * EFalse otherwise.
+ */
+ TBool ActivePacketdataConnectionsFound();
+
+ /**
* Tells whether bearer is supported or not.
* @since
* @param aConnectionId Generic bearer id (EBearerIdGPRS, EBEarerIdCSD).
--- a/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonNoti.h Fri Jul 23 09:11:14 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonNoti.h Fri Aug 06 19:11:03 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -673,7 +673,7 @@
* @return void.
*/
void SetInterfaceClosed();
-
+
/**
* Tells whether interface has been closed or not.
* @since
@@ -687,14 +687,14 @@
* @return void.
*/
void SetLinkLayerClosed();
-
+
/**
* Sets link layer status to NOT closed.
* @since
* @return void.
*/
void SetLinkLayerOpen();
-
+
/**
* Return ETrue if KLinkLayerClosed has been received.
* @since
--- a/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonServ.h Fri Jul 23 09:11:14 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonServ.h Fri Aug 06 19:11:03 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -134,6 +134,8 @@
class TConnMonSNAPInfo;
class TConnMonId;
class CCellularDataUsageKeyUpdater;
+class CConnMonDialUpOverrideNotifier;
+class CConnMonDialUpOverrideTimer;
/**
* CConnMonServer
@@ -335,6 +337,23 @@
inline CCellularDataUsageKeyUpdater* CellularDataUsageKeyUpdater()
{ return iCellularDataUsageKeyUpdater; }
+ /**
+ * Return the current dial-up PDP context override status.
+ */
+ inline TInt GetDialUpOverrideStatus() { return iDialUpOverrideStatus; }
+
+ /**
+ * Set the dial-up PDP context override feature status. Either activates or
+ * deactivates it. Does nothing if the feature itself has not been enabled.
+ */
+ void SetDialUpOverrideStatus( TInt aStatus );
+
+ /**
+ * Signals that all internal PDP connections have closed through the
+ * KDialUpConnection P&S-property.
+ */
+ void ConnectionsClosedForDialUpOverride();
+
public:
/**
* From CServer Creates a new session for a client.
@@ -377,6 +396,15 @@
CConnMonBearerGroupManager* iBearerGroupManager;
CCellularDataUsageKeyUpdater* iCellularDataUsageKeyUpdater;
+
+ // Notifier to listen for changes in the the KDialUpConnection P&S-property.
+ CConnMonDialUpOverrideNotifier* iDialUpOverrideNotifier;
+
+ // Timeout timer for the dial-up PDP context override feature.
+ CConnMonDialUpOverrideTimer* iDialUpOverrideTimer;
+
+ // Current status of the dial-up PDP context override feature.
+ TInt iDialUpOverrideStatus;
};
/**
@@ -462,6 +490,34 @@
CConnMonServer* iServer;
};
+/**
+* CConnMonDialUpOverrideTimer
+* A simple timer to ensure dial-up PDP context override feature can not stay
+* active longer than the specied timeout value.
+*/
+NONSHARABLE_CLASS( CConnMonDialUpOverrideTimer ) : public CActive
+ {
+public:
+ static CConnMonDialUpOverrideTimer* NewL( CConnMonServer* aServer );
+ static CConnMonDialUpOverrideTimer* NewLC( CConnMonServer* aServer );
+ virtual ~CConnMonDialUpOverrideTimer();
+
+private:
+ CConnMonDialUpOverrideTimer( CConnMonServer* aServer );
+ void ConstructL();
+
+public:
+ void Start();
+
+private:
+ void DoCancel();
+ void RunL();
+
+private: // Data
+ RTimer iTimer;
+ CConnMonServer* iServer;
+ };
+
// INLINES
inline CConnMonScheduler::TSignal::TSignal()
:
--- a/connectionmonitoring/connmon/connectionmonitor/inc/cellulardatausagekeyupdater.h Fri Jul 23 09:11:14 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/cellulardatausagekeyupdater.h Fri Aug 06 19:11:03 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -38,6 +38,11 @@
void UpdateKeyL( const TInt aRegistration ) const;
+ /**
+ * Return ETrue if dial-up PDP context override feature is enabled.
+ */
+ TBool DialUpOverrideEnabled() const;
+
private:
CCellularDataUsageKeyUpdater(
CConnMonServer* aServer );
@@ -56,7 +61,13 @@
private:
CConnMonServer* iServer;
TUint32 iTableId;
- CRepository* iRepository;
+
+ // CommsDat central repository.
+ CRepository* iCommsRepository;
+
+ // CmManager central repository.
+ CRepository* iCmmRepository;
+
TInt iErrorCounter;
// used for complete runl. Not owned.
TRequestStatus* iInitStatus;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/connmondialupoverridenotifier.h Fri Aug 06 19:11:03 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Listens for changes in dial-up PDP context override P&S-key.
+*
+*/
+
+#ifndef CONNMONDIALUPOVERRIDENOTIFIER_H
+#define CONNMONDIALUPOVERRIDENOTIFIER_H
+
+class CConnMonServer;
+
+/**
+ * Stop requesting new notifications after this many consecutive errors.
+ */
+const TInt KConnMonPsEventErrorThreshold = 80;
+
+/**
+ * Maximum time that dial-up PDP context override is allowed to stay on.
+ */
+const TUint KConnMonDialUpOverrideInterval = 45000000; // 45sec
+
+/**
+ * Read policy for dial-up PDP context override key.
+ */
+_LIT_SECURITY_POLICY_PASS( KDialUpOverrideReadC0 );
+
+/**
+ * Write policy for dial-up PDP context override key.
+ */
+_LIT_SECURITY_POLICY_C2( KDialUpOverrideWriteC2, ECapabilityNetworkControl, ECapabilityNetworkServices );
+
+/**
+ * An active object to listen for changes in the dial-up PDP context override
+ * P&S-key. Only used if the feature is enabled by the CenRep key
+ * KDialUpOverride in CmManager repository (KCRUidCmManager).
+ */
+NONSHARABLE_CLASS( CConnMonDialUpOverrideNotifier ) : public CActive
+ {
+public:
+ static CConnMonDialUpOverrideNotifier* NewL( CConnMonServer* aServer );
+ static CConnMonDialUpOverrideNotifier* NewLC( CConnMonServer* aServer );
+ virtual ~CConnMonDialUpOverrideNotifier();
+
+ /**
+ * Set the KDialUpConnection-property in Connection Monitor RProperty
+ * category to the initial state of EConnMonReady.
+ */
+ TInt ResetStatus();
+
+private:
+ CConnMonDialUpOverrideNotifier( CConnMonServer* aServer );
+ void ConstructL();
+ void RequestNotifications();
+
+private: // Methods from base class
+ void DoCancel();
+ void RunL();
+
+private:
+ // Pointer back to ConnMon server class.
+ CConnMonServer* iServer;
+
+ // Counter for notification errors.
+ TInt iErrorCounter;
+
+ // Dial-up PDP context override property.
+ // Used to signal an incoming dial-up connection and the completion of
+ // preparatory actions by ConnMon (Closing down internal PDP contexts).
+ RProperty iDialUpProperty;
+ };
+
+#endif // CONNMONDIALUPOVERRIDENOTIFIER_H
+
+// End of file
--- a/connectionmonitoring/connmon/connectionmonitor/src/CPsdFax.cpp Fri Jul 23 09:11:14 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/src/CPsdFax.cpp Fri Aug 06 19:11:03 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -737,7 +737,7 @@
iOpen = ETrue;
// Start status notifier
- if ( !iStatusNotifier->IsActive() )
+ if ( iStatusNotifier && !iStatusNotifier->IsActive() )
{
LOGIT("OpenContext: start status notifier")
iStatusNotifier->Start( iContext );
@@ -850,7 +850,7 @@
err = status.Int();
// Remove from server tables if status notifier is not active.
- if ( !iStatusNotifier->IsActive() )
+ if ( !iStatusNotifier || !iStatusNotifier->IsActive() )
{
// Remove from server tables
RemoveFromServer();
@@ -1284,6 +1284,11 @@
// Close the context
iConnDataModule->CloseContext();
+ // Dial-up connection has gone down. Make sure the dial-up PDP
+ // context override is disabled.
+ LOGIT("External PSD connection status EStatusDeleted, disabling dial-up override")
+ iServer->SetDialUpOverrideStatus( EConnMonDialUpOverrideInactive );
+
// Delete all old connection objects. This method should be used
// carefully because it will delete ConnectionData and
// statusnotifier objects. Get out fast from RunL().
@@ -1292,6 +1297,13 @@
// Stop listening
return;
}
+ else if ( iContextStatus == RPacketContext::EStatusActive )
+ {
+ // Dial-up connection has been established. Make sure the dial-up
+ // PDP context override is disabled.
+ LOGIT("External PSD connection status EStatusActive, disabling dial-up override")
+ iServer->SetDialUpOverrideStatus( EConnMonDialUpOverrideInactive );
+ }
// New request
Receive();
--- a/connectionmonitoring/connmon/connectionmonitor/src/ConnMonIAP.cpp Fri Jul 23 09:11:14 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonIAP.cpp Fri Aug 06 19:11:03 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -421,7 +421,6 @@
TInt CConnMonIAP::EnumerateConnections( TUint& aCount )
{
// Server must be 'blocked' while updating the connection table.
- TConnectionInfoBuf connInfoBuf;
TBearerInfo bearerInfo;
TConnInfo connInfo( 0, 0, 0, 0, bearerInfo );
TInt err( KErrNone );
@@ -2312,6 +2311,18 @@
}
iConnInfos.Remove( index );
+
+ // If dial-up PDP context override feature is enabled and active (a dial-up
+ // connection is about to start), connection closures need to be reported
+ // in case dial-up connection is waiting for a free PDP context.
+ if ( iServer->GetDialUpOverrideStatus() == EConnMonDialUpOverrideActive )
+ {
+ if ( !ActivePacketdataConnectionsFound() )
+ {
+ iServer->ConnectionsClosedForDialUpOverride();
+ }
+ }
+
err = KErrNone;
}
@@ -3330,6 +3341,64 @@
//LOGEXITFN("CConnMonIAP::GetActiveConnectionsIds()")
}
+// -----------------------------------------------------------------------------
+// CConnMonIAP::ActivePacketdataConnectionsFound
+// Return ETrue if one or more active packetdata connections are found,
+// EFalse otherwise.
+// -----------------------------------------------------------------------------
+//
+TBool CConnMonIAP::ActivePacketdataConnectionsFound()
+ {
+ LOGENTRFN("CConnMonIAP::ActivePacketdataConnectionsFound()")
+ TBool result( EFalse );
+ TInt unknownBearers( 0 );
+
+ const TInt count = iConnInfos.Count();
+ for ( TInt i = 0; i < count; i++ )
+ {
+ // Bearer might still be uninitialized
+ if ( iConnInfos[i].iBearer == EBearerUnknown )
+ {
+ unknownBearers++;
+ }
+ else if ( iConnInfos[i].iBearer == EBearerGPRS ||
+ iConnInfos[i].iBearer == EBearerEdgeGPRS ||
+ iConnInfos[i].iBearer == EBearerWCDMA )
+ {
+ result = ETrue;
+ break;
+ }
+ }
+ if ( !result && unknownBearers )
+ {
+ for ( TInt i = 0; i < count; i++ )
+ {
+ if ( iConnInfos[i].iBearer == EBearerUnknown )
+ {
+ LOGIT1("ActivePacketdataConnectionsFound: bearer unknown for conn.id %d",
+ iConnInfos[i].iConnectionId)
+ TInt err = GetBearer(
+ iConnInfos[i].iConnectionId,
+ iConnInfos[i].iBearer,
+ iConnInfos[i].iBearerInfo );
+
+ if ( err == KErrNone )
+ {
+ if ( iConnInfos[i].iBearer == EBearerGPRS ||
+ iConnInfos[i].iBearer == EBearerEdgeGPRS ||
+ iConnInfos[i].iBearer == EBearerWCDMA )
+ {
+ result = ETrue;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ LOGEXITFN1("CConnMonIAP::ActivePacketdataConnectionsFound()", result)
+ return result;
+ }
// -----------------------------------------------------------------------------
// CConnMonIAP::GetBearerSupportInfo
--- a/connectionmonitoring/connmon/connectionmonitor/src/ConnMonNoti.cpp Fri Jul 23 09:11:14 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonNoti.cpp Fri Aug 06 19:11:03 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -201,7 +201,7 @@
}
if ( subConnUpDownNotifier->LinkLayerClosed() )
- {
+ {
// KLinkLayerClosed already received, finish with this connection
subConnUpDownNotifier->SendDeletedEvent();
}
@@ -634,7 +634,7 @@
LOGIT("CProgressNotifier::RunL triggered HandleAvailabilityChange()")
iServer->AvailabilityManager()->HandleAvailabilityChange();
}
-
+
}
else if ( iInfoBuf().iStage == KLinkLayerClosed )
{
@@ -647,16 +647,16 @@
if ( KErrNone == err )
{
subConnUpDownNotifier->SetLinkLayerClosed();
-
+
if ( subConnUpDownNotifier->InterfaceClosed() )
{
// EInterfaceDown has arrived before KLinkLayerClosed
- // Let's finish with this connection.
+ // Let's finish with this connection.
subConnUpDownNotifier->SendDeletedEvent();
return;
}
- }
- }
+ }
+ }
iFilter = KNoFiltering;
}
@@ -2141,7 +2141,7 @@
if ( !iDeleteSent )
{
LOGIT("CSubConnUpDownNotifier::SendDeletedEvent")
-
+
iEventInfo.Reset();
iEventInfo.iEventType = EConnMonDeleteConnection;
@@ -2281,7 +2281,7 @@
if ( !progressNotifier->IsActive() )
{
iStatus = KErrDied;
- // might delete this object
+ // might delete this object
SendDeletedEvent();
return;
}
@@ -2305,7 +2305,7 @@
iConnectionId, iTotalUplinkDataVolume, iTotalDownlinkDataVolume)
iStatus = KErrDisconnected;
-
+
CProgressNotifier* progressNotifier = 0;
TInt err = iServer->Iap()->GetProgressNotifier( iConnectionId, &progressNotifier );
if ( err == KErrNone )
@@ -2320,7 +2320,7 @@
}
else
{
- // might delete this object
+ // might delete this object
SendDeletedEvent();
return;
}
--- a/connectionmonitoring/connmon/connectionmonitor/src/ConnMonServ.cpp Fri Jul 23 09:11:14 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonServ.cpp Fri Aug 06 19:11:03 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -34,6 +34,7 @@
#include "ConnMonBearerGroupManager.h"
#include "connmoncommsdatnotifier.h"
#include "cellulardatausagekeyupdater.h"
+#include "connmondialupoverridenotifier.h"
// ============================ LOCAL FUNCTIONS ===============================
@@ -236,7 +237,21 @@
CConnMonServer::CConnMonServer()
:
CPolicyServer( CActive::EPriorityStandard, KConnMonPolicy ),
- iAvailabilityManager( NULL )
+ iIap( NULL ),
+ iEventQueue( NULL ),
+ iSessionCount( 0 ),
+ iShutdown( NULL ),
+ iContainerIndex( NULL ),
+ iCommsDatCache( NULL ),
+ iAvailabilityManager( NULL ),
+ iIapTableNotifier( NULL ),
+ iSnapTableNotifier( NULL ),
+ iVirtualTableNotifier( NULL ),
+ iBearerGroupManager( NULL ),
+ iCellularDataUsageKeyUpdater( NULL ),
+ iDialUpOverrideNotifier( NULL ),
+ iDialUpOverrideTimer( NULL ),
+ iDialUpOverrideStatus( EConnMonDialUpOverrideDisabled )
{
}
@@ -322,7 +337,18 @@
iCellularDataUsageKeyUpdater = CCellularDataUsageKeyUpdater::NewL( this );
LOGIT("ConstructL: CCellularDataUsageKeyUpdater constructed")
-
+
+ // Add P&S listener for dial-up PDP context override, if feature enabled.
+ if ( iCellularDataUsageKeyUpdater->DialUpOverrideEnabled() )
+ {
+ iDialUpOverrideNotifier = CConnMonDialUpOverrideNotifier::NewL( this );
+ iDialUpOverrideStatus = EConnMonDialUpOverrideInactive;
+ LOGIT("ConstructL: Dial-up override notifier constructed")
+
+ // Construct dial-up PDP context override timer.
+ iDialUpOverrideTimer = CConnMonDialUpOverrideTimer::NewL( this );
+ }
+
// Identify ourselves and open for service
StartL( KConnectionMonitorServerName );
@@ -380,9 +406,15 @@
// Bearer Group Manager
delete iBearerGroupManager;
-
+
delete iCellularDataUsageKeyUpdater;
+ // Dial-up PDP context override timer.
+ delete iDialUpOverrideTimer;
+
+ // P&S listener for dial-up PDP context override.
+ delete iDialUpOverrideNotifier;
+
FeatureManager::UnInitializeLib();
}
@@ -792,6 +824,78 @@
}
// -----------------------------------------------------------------------------
+// Set the dial-up PDP context override feature status. Either activates or
+// deactivates it. Does nothing if the feature itself has not been enabled.
+// -----------------------------------------------------------------------------
+//
+void CConnMonServer::SetDialUpOverrideStatus( TInt aStatus )
+ {
+ LOGENTRFN("CConnMonServer::SetDialUpOverrideStatus()")
+
+ // Do nothing if whole feature is disabled.
+ LOGIT2("iDialUpOverrideStatus = %d, aStatus = %d", iDialUpOverrideStatus, aStatus)
+ if ( iDialUpOverrideStatus == EConnMonDialUpOverrideInactive &&
+ aStatus == EConnMonDialUpOverrideActive )
+ {
+ LOGIT("Setting dial-up override status from inactive to active")
+ // Start the dial-up override timer to ensure packetdata connectivity
+ // is restored to original state eventually. Normally it is restored
+ // after the dial-up connection has been successfully established.
+ iDialUpOverrideTimer->Start();
+ // Status must be set before updating cellular data usage key.
+ iDialUpOverrideStatus = aStatus;
+
+ // Disable cellular data usage until the expected dial-up
+ // connection has been established (or timeout).
+ TRAP_IGNORE( iCellularDataUsageKeyUpdater->UpdateKeyL( 0 ) );
+
+ LOGIT("SetDialUpOverrideStatus() triggered HandleAvailabilityChange()")
+ AvailabilityManager()->HandleAvailabilityChange();
+ }
+ else if ( iDialUpOverrideStatus == EConnMonDialUpOverrideActive &&
+ aStatus == EConnMonDialUpOverrideInactive )
+ {
+ LOGIT("Setting dial-up override status from active to inactive")
+ // Stop the dial-up override timer.
+ iDialUpOverrideTimer->Cancel();
+ // Status must be set before updating cellular data usage key.
+ iDialUpOverrideStatus = aStatus;
+
+ TInt registration( ENetworkRegistrationExtUnknown );
+ TInt err = iIap->GetNetworkRegistration_v2( registration );
+ if ( err == KErrNone )
+ {
+ TRAP_IGNORE( iCellularDataUsageKeyUpdater->UpdateKeyL( registration ) );
+ }
+ else
+ {
+ LOGIT1("GetNetworkRegistration_v2 failed <%d>", err)
+ }
+ iDialUpOverrideNotifier->ResetStatus();
+
+ LOGIT("SetDialUpOverrideStatus() triggered HandleAvailabilityChange()")
+ AvailabilityManager()->HandleAvailabilityChange();
+ }
+
+ LOGEXITFN("CConnMonServer::SetDialUpOverrideStatus()")
+ }
+
+// -----------------------------------------------------------------------------
+// Signals that all internal PDP connections have closed through the
+// KDialUpConnection P&S-property.
+// -----------------------------------------------------------------------------
+//
+void CConnMonServer::ConnectionsClosedForDialUpOverride()
+ {
+ LOGENTRFN("CConnMonServer::ConnectionsClosedForDialUpOverride()")
+ if ( iDialUpOverrideStatus == EConnMonDialUpOverrideActive )
+ {
+ iDialUpOverrideNotifier->ResetStatus();
+ }
+ LOGEXITFN("CConnMonServer::ConnectionsClosedForDialUpOverride()")
+ }
+
+// -----------------------------------------------------------------------------
// CConnMonServer::CustomSecurityCheckL
// Implements custom security checking for IPCs marked with
// TSpecialCase::ECustomCheck.
@@ -889,4 +993,95 @@
CActiveScheduler::Stop();
}
-// End-of-file
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideTimer::NewL
+// -----------------------------------------------------------------------------
+//
+CConnMonDialUpOverrideTimer* CConnMonDialUpOverrideTimer::NewL(
+ CConnMonServer* aServer )
+ {
+ CConnMonDialUpOverrideTimer* self = CConnMonDialUpOverrideTimer::NewLC( aServer );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideTimer::NewLC
+// -----------------------------------------------------------------------------
+//
+CConnMonDialUpOverrideTimer* CConnMonDialUpOverrideTimer::NewLC(
+ CConnMonServer* aServer )
+ {
+ CConnMonDialUpOverrideTimer* self = new( ELeave ) CConnMonDialUpOverrideTimer( aServer );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideTimer::~CConnMonDialUpOverrideTimer
+// -----------------------------------------------------------------------------
+//
+CConnMonDialUpOverrideTimer::~CConnMonDialUpOverrideTimer()
+ {
+ Cancel();
+ iTimer.Close();
+ iServer = NULL;
+ }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideTimer::CConnMonDialUpOverrideTimer
+// -----------------------------------------------------------------------------
+//
+CConnMonDialUpOverrideTimer::CConnMonDialUpOverrideTimer(
+ CConnMonServer* aServer )
+ :
+ CActive( EConnMonPriorityNormal ),
+ iServer( aServer )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideTimer::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CConnMonDialUpOverrideTimer::ConstructL()
+ {
+ CActiveScheduler::Add( this );
+ User::LeaveIfError( iTimer.CreateLocal() );
+ }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideTimer::Start
+// -----------------------------------------------------------------------------
+//
+void CConnMonDialUpOverrideTimer::Start()
+ {
+ if ( !IsActive() )
+ {
+ iTimer.After( iStatus, KConnMonDialUpOverrideInterval );
+ SetActive();
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideTimer::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CConnMonDialUpOverrideTimer::DoCancel()
+ {
+ iTimer.Cancel();
+ }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideTimer::RunL
+// -----------------------------------------------------------------------------
+//
+void CConnMonDialUpOverrideTimer::RunL()
+ {
+ LOGIT(".")
+ LOGIT1("RunL: CConnMonDialUpOverrideTimer <%d>", iStatus.Int())
+ iServer->SetDialUpOverrideStatus( EConnMonDialUpOverrideInactive );
+ }
+
+// End of file
--- a/connectionmonitoring/connmon/connectionmonitor/src/cellulardatausagekeyupdater.cpp Fri Jul 23 09:11:14 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/src/cellulardatausagekeyupdater.cpp Fri Aug 06 19:11:03 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -71,7 +71,8 @@
{
// Cancel outstanding request, if exists
Cancel();
- delete iRepository;
+ delete iCommsRepository;
+ delete iCmmRepository;
}
// -----------------------------------------------------------------------------
@@ -81,50 +82,75 @@
void CCellularDataUsageKeyUpdater::UpdateKeyL( const TInt aRegistration ) const
{
LOGENTRFN("CCellularDataUsageKeyUpdater::UpdateKeyL()")
- LOGIT1("CCellularDataUsageKeyUpdater::UpdateKeyL: aRegistration <%d>",
+ LOGIT1("CCellularDataUsageKeyUpdater::UpdateKeyL: aRegistration <%d>",
aRegistration)
-
- TCmGenConnSettings occSettings = ReadGenConnSettingsL();
-
+
TInt value( ECmCellularDataUsageDisabled );
-
- if ( aRegistration == ENetworkRegistrationExtRoamingInternational )
- {
- value = occSettings.iCellularDataUsageVisitor;
- }
- else if ( aRegistration == ENetworkRegistrationExtHomeNetwork ||
- aRegistration == ENetworkRegistrationExtRoamingNational )
- {
- value = occSettings.iCellularDataUsageHome;
+
+ // If dial-up PDP context override is active, disable cellular data usage (temporarily).
+ if ( iServer->GetDialUpOverrideStatus() != EConnMonDialUpOverrideActive )
+ {
+ TCmGenConnSettings occSettings = ReadGenConnSettingsL();
+
+ if ( aRegistration == ENetworkRegistrationExtRoamingInternational )
+ {
+ value = occSettings.iCellularDataUsageVisitor;
+ }
+ else if ( aRegistration == ENetworkRegistrationExtHomeNetwork ||
+ aRegistration == ENetworkRegistrationExtRoamingNational )
+ {
+ value = occSettings.iCellularDataUsageHome;
+ }
}
- CRepository* cmRepository = NULL;
-
- TRAPD( err, cmRepository = CRepository::NewL( KCRUidCmManager ) )
-
- if ( err == KErrNone )
+ TInt previous( 0 );
+ TInt err = iCmmRepository->Get( KCurrentCellularDataUsage, previous );
+ if ( err == KErrNone && ( value != previous ) )
+ {
+ iCmmRepository->Set( KCurrentCellularDataUsage, value );
+ LOGIT1("KCurrentCellularDataUsage set to %d", value)
+ }
+ else
{
- TInt previous( 0 );
- err = cmRepository->Get( KCurrentCellularDataUsage, previous );
-
- if ( err == KErrNone && ( value != previous ) )
+ LOGIT2("KCurrentCellularDataUsage already up-to-date %d <%d>", previous, err)
+ }
+
+ LOGEXITFN("CCellularDataUsageKeyUpdater::UpdateKeyL()")
+ }
+
+// -----------------------------------------------------------------------------
+// Return ETrue if dial-up PDP context override feature is enabled.
+// -----------------------------------------------------------------------------
+//
+TBool CCellularDataUsageKeyUpdater::DialUpOverrideEnabled() const
+ {
+ LOGENTRFN("CCellularDataUsageKeyUpdater::DialUpOverrideEnabled()")
+ TBool result( EFalse );
+
+ if ( iCmmRepository )
+ {
+ TInt value( 0 );
+ TInt err = iCmmRepository->Get( KDialUpOverride, value );
+ if ( err == KErrNone )
{
- cmRepository->Set( KCurrentCellularDataUsage, value );
- LOGIT1("KCurrentCellularDataUsage set to %d", value)
+ if ( value )
+ {
+ result = ETrue;
+ LOGIT("ConstructL: Dial-up override enabled")
+ }
+ else
+ {
+ LOGIT("ConstructL: Dial-up override disabled")
+ }
}
else
{
- LOGIT1("KCurrentCellularDataUsage already up-to-date %d", previous)
+ LOGIT1("Failed to read KDialUpOverride-key from repository <%d>", err)
}
-
- delete cmRepository;
- }
- else
- {
- LOGIT1("CCRepository::NewL( KCRUidCmManager ) FAILED <%d>", err)
}
- LOGEXITFN("CCellularDataUsageKeyUpdater::UpdateKeyL()")
+ LOGEXITFN1("CCellularDataUsageKeyUpdater::DialUpOverrideEnabled()", result)
+ return result;
}
// -----------------------------------------------------------------------------
@@ -136,7 +162,8 @@
CActive( EConnMonPriorityNormal ),
iServer( aServer )
{
- iRepository = NULL;
+ iCommsRepository = NULL;
+ iCmmRepository = NULL;
iErrorCounter = 0;
}
@@ -146,13 +173,21 @@
//
void CCellularDataUsageKeyUpdater::ConstructL()
{
- iRepository = CRepository::NewL( KCDCommsRepositoryId );
-
+ iCommsRepository = CRepository::NewL( KCDCommsRepositoryId );
+
+ // Open CmManager central repository.
+ TRAPD( err, iCmmRepository = CRepository::NewL( KCRUidCmManager ) )
+ if ( err )
+ {
+ LOGIT1("CRepository::NewL( KCRUidCmManager ) FAILED <%d>", err)
+ err = KErrNone;
+ }
+
// Find out Default connection table id.
// It contains iCellularDataUsageHome and iCellularDataUsageVisitor keys.
CMDBSession* db = CMDBSession::NewLC( CMDBSession::LatestVersion() );
- TRAPD( err, iTableId = CCDDefConnRecord::TableIdL( *db ) )
-
+ TRAP( err, iTableId = CCDDefConnRecord::TableIdL( *db ) )
+
if ( err )
{
LOGIT1("ERROR, CCDDefConnRecord::TableIdL() <%d>", err)
@@ -176,8 +211,8 @@
//
TInt CCellularDataUsageKeyUpdater::RequestNotifications()
{
- LOGIT1("Calling iRepository->NotifyRequest() for table 0x%08X", iTableId)
- TInt err = iRepository->NotifyRequest( iTableId, KCDMaskShowRecordType, iStatus );
+ LOGIT1("Calling iCommsRepository->NotifyRequest() for table 0x%08X", iTableId)
+ TInt err = iCommsRepository->NotifyRequest( iTableId, KCDMaskShowRecordType, iStatus );
if ( err == KErrNone )
{
@@ -185,7 +220,7 @@
}
else
{
- LOGIT1("ERROR, iRepository->NotifyRequest() <%d>", err)
+ LOGIT1("ERROR, iCommsRepository->NotifyRequest() <%d>", err)
}
return err;
@@ -197,7 +232,7 @@
//
void CCellularDataUsageKeyUpdater::DoCancel()
{
- iRepository->NotifyCancel( iTableId, KCDMaskShowRecordType );
+ iCommsRepository->NotifyCancel( iTableId, KCDMaskShowRecordType );
}
// -----------------------------------------------------------------------------
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/connmondialupoverridenotifier.cpp Fri Aug 06 19:11:03 2010 +0300
@@ -0,0 +1,216 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Listens for changes in dial-up PDP context override P&S-key.
+*
+*/
+
+#include <e32base.h>
+#include <e32property.h>
+
+#include "connmondialupoverridenotifier.h"
+#include "connectionmonitorpskeys.h"
+#include "ConnMonServ.h"
+#include "ConnMonIAP.h"
+#include "log.h"
+
+
+// -----------------------------------------------------------------------------
+// Two phased construction.
+// -----------------------------------------------------------------------------
+//
+CConnMonDialUpOverrideNotifier* CConnMonDialUpOverrideNotifier::NewL(
+ CConnMonServer* aServer )
+ {
+ CConnMonDialUpOverrideNotifier* self =
+ CConnMonDialUpOverrideNotifier::NewLC( aServer );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// Two phased construction.
+// -----------------------------------------------------------------------------
+//
+CConnMonDialUpOverrideNotifier* CConnMonDialUpOverrideNotifier::NewLC(
+ CConnMonServer* aServer )
+ {
+ CConnMonDialUpOverrideNotifier* self =
+ new( ELeave ) CConnMonDialUpOverrideNotifier( aServer );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CConnMonDialUpOverrideNotifier::~CConnMonDialUpOverrideNotifier()
+ {
+ // Cancel outstanding request, if exists.
+ Cancel();
+ iDialUpProperty.Delete( KConnectionMonitorPS, KDialUpConnection );
+ iDialUpProperty.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideNotifier::ResetStatus
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonDialUpOverrideNotifier::ResetStatus()
+ {
+ // Set property value to EConnMonReady.
+ TInt err = iDialUpProperty.Set( EConnMonReady );
+ LOGIT1("ResetStatus: Dial-up property value set to EConnMonReady <%d>", err)
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CConnMonDialUpOverrideNotifier::CConnMonDialUpOverrideNotifier(
+ CConnMonServer* aServer )
+ :
+ CActive( EConnMonPriorityMedium ),
+ iServer( aServer),
+ iErrorCounter( 0 )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// Two phased construction.
+// -----------------------------------------------------------------------------
+//
+void CConnMonDialUpOverrideNotifier::ConstructL()
+ {
+ LOGENTRFN("CConnMonDialUpOverrideNotifier::ConstructL()")
+
+ // Define Dial-up property.
+ TInt err = iDialUpProperty.Define(
+ KConnectionMonitorPS,
+ KDialUpConnection,
+ RProperty::EInt,
+ KDialUpOverrideReadC0, // Read: Always pass
+ KDialUpOverrideWriteC2, // Write: NetworkControl, NetworkServices
+ 0 );
+ LOGIT1("Dial-up property defined <%d>", err)
+ User::LeaveIfError( err );
+
+ // Attach to property.
+ err = iDialUpProperty.Attach(
+ KConnectionMonitorPS,
+ KDialUpConnection );
+ LOGIT1("Dial-up property attach <%d>", err)
+ User::LeaveIfError( err );
+
+ // Set property value to EConnMonReady.
+ ResetStatus();
+
+ CActiveScheduler::Add( this );
+ RequestNotifications();
+
+ LOGEXITFN("CConnMonDialUpOverrideNotifier::ConstructL()")
+ }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideNotifier::RequestNotifications
+// -----------------------------------------------------------------------------
+//
+void CConnMonDialUpOverrideNotifier::RequestNotifications()
+ {
+ LOGENTRFN("CConnMonDialUpOverrideNotifier::RequestNotifications()")
+
+ if ( !IsActive() )
+ {
+ iDialUpProperty.Subscribe( iStatus );
+ LOGIT("KDialUpConnection-key, Subscribe()")
+ SetActive();
+ }
+
+ LOGEXITFN("CConnMonDialUpOverrideNotifier::RequestNotifications()")
+ return;
+ }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideNotifier::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CConnMonDialUpOverrideNotifier::DoCancel()
+ {
+ LOGIT("Canceling dialup property subscription.")
+ iDialUpProperty.Cancel();
+ }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideNotifier::RunL
+// -----------------------------------------------------------------------------
+//
+void CConnMonDialUpOverrideNotifier::RunL()
+ {
+ LOGIT(".")
+ LOGIT1("RunL: CConnMonDialUpOverrideNotifier <%d>", iStatus.Int())
+
+ if ( iStatus.Int() == KErrNone )
+ {
+ iErrorCounter = 0;
+ TInt value = -1;
+ TInt err = iDialUpProperty.Get( value );
+ LOGIT2("Dial-up override value is %d <%d>", value, err)
+
+ switch ( value )
+ {
+ case EConnMonDialUpClosed:
+ {
+ // Deactivate the dial-up override (if active). This will return
+ // cellular data connectivity back to normal.
+ iServer->SetDialUpOverrideStatus( EConnMonDialUpOverrideInactive );
+ ResetStatus();
+ }
+ break;
+ case EConnMonDialUpInit:
+ {
+ // Set the dial-up override status to active. This will block
+ // other cellular data connectivity and start the timeout timer.
+ iServer->SetDialUpOverrideStatus( EConnMonDialUpOverrideActive );
+
+ // If there are no active packetdata connections, signal EConnMonReady
+ // immediately. If there are active connections, EConnMonReady is
+ // signaled when those connections have gone down.
+ if ( !iServer->Iap()->ActivePacketdataConnectionsFound() )
+ {
+ ResetStatus();
+ }
+ }
+ break;
+ case EConnMonReady:
+ default:
+ break;
+ }
+ }
+ else
+ {
+ LOGIT1("Dial-up override notification error <%d>", iStatus.Int())
+ iErrorCounter++;
+ if ( iErrorCounter > KConnMonPsEventErrorThreshold )
+ {
+ LOGIT1("Over %d consecutive errors, stopping", KConnMonPsEventErrorThreshold)
+ return;
+ }
+ }
+ RequestNotifications();
+ }
+
+// End of file