--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmplatformdata.cpp Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmplatformdata.cpp Fri May 14 17:41:09 2010 +0300
@@ -16,7 +16,7 @@
*/
/*
-* %version: 12 %
+* %version: 13 %
*/
// INCLUDE FILES
@@ -27,6 +27,7 @@
#include <startupdomainpskeys.h>
#include <ctsydomainpskeys.h>
#include "wlaninternalpskeys.h"
+#include "wlandevicesettingsinternalcrkeys.h"
#include "wlmplatformdata.h"
#include "am_debug.h"
@@ -43,7 +44,8 @@
iCurrentIcon( EWlmIconStatusNotAvailable ),
iIsStartupComplete( EFalse ),
iIsInOffline( EFalse ),
- iIsEmergencyCall( EFalse )
+ iIsEmergencyCall( EFalse ),
+ iNotifiedWlanState( CWlmPlatformData::EWlanNotifiedNone )
{
DEBUG( "CWlmPlatformData::CWlmPlatformData()" );
}
@@ -76,6 +78,18 @@
KPSUidCtsyEmergencyCallInfo, KCTSYEmergencyCallInfo );
iEmergencyCall->IssueRequest();
+ // Create subscriber for WLAN master switch
+ iWlanOnOff = CWlmPlatformSubscriber::NewL(
+ EWlmSubscribeTypeCenRep, *this,
+ KCRUidWlanDeviceSettingsRegistryId, KWlanOnOff );
+ iWlanOnOff->IssueRequest();
+
+ // Create subscriber for WLAN force disable
+ iWlanForceDisable = CWlmPlatformSubscriber::NewL(
+ EWlmSubscribeTypeCenRep, *this,
+ KCRUidWlanDeviceSettingsRegistryId, KWlanForceDisable );
+ iWlanForceDisable->IssueRequest();
+
// Create PubSub property for publishing MAC address
TInt ret( KErrNone );
ret = RProperty::Define( KPSWlanMacAddress, KPSWlanMacAddressType,
@@ -106,6 +120,17 @@
}
User::LeaveIfError( iPsBgScanInterval.Attach( KPSUidWlan,
KPSWlanBgScanInterval, EOwnerThread ) );
+
+ // Create PubSub property for publishing WLAN on/off state
+ ret = RProperty::Define( KPSWlanOnOffState, KPSWlanOnOffStateType,
+ KWlmPSReadPolicy, KWlmPSWritePolicy );
+ if( ret != KErrAlreadyExists )
+ {
+ User::LeaveIfError( ret );
+ }
+ User::LeaveIfError( iPsOnOffState.Attach( KPSUidWlan,
+ KPSWlanOnOffState, EOwnerThread ) );
+
}
// ---------------------------------------------------------
@@ -137,7 +162,9 @@
RProperty::Delete( KPSUidWlan, KPSWlanBgScanInterval );
delete iPropertySystemState;
delete iBtConnections;
- delete iEmergencyCall;
+ delete iEmergencyCall;
+ delete iWlanOnOff;
+ delete iWlanForceDisable;
}
// ---------------------------------------------------------
@@ -305,6 +332,11 @@
}
}
}
+ else if( aCategory == KCRUidWlanDeviceSettingsRegistryId ) // WLAN on/off
+ {
+ // Notify WLAN on/off observer
+ NotifyWlanOnOffObserver();
+ }
}
// ---------------------------------------------------------
@@ -378,6 +410,9 @@
KPropertyKeyBluetoothGetPHYCount ) );
TRAP_IGNORE( HandlePropertyChangedL( KPSUidStartup,
KPSGlobalSystemState ) );
+ // Call NotifyWlanOnOffObserver to inform observer WLAN on/off
+ // state and to get it also published via P&S
+ NotifyWlanOnOffObserver();
}
// ---------------------------------------------------------
@@ -408,3 +443,103 @@
return iPsBgScanInterval.Set( aInterval );
}
+
+
+// ---------------------------------------------------------
+// CWlmPlatformData::GetWlanOnOffState
+// Status : Draft
+// ---------------------------------------------------------
+//
+TWlanOnOffState CWlmPlatformData::GetWlanOnOffState()
+ {
+ DEBUG( "CWlmPlatformData::GetWlanOnOffState()" );
+
+ TWlanOnOffState wlanState( EWlanOff );
+
+ // Read WLAN master switch
+ TInt wlanOn( EFalse );
+ iWlanOnOff->Get( wlanOn );
+
+ // Read WLAN force disable switch
+ TInt wlanForceDisable( EFalse );
+ iWlanForceDisable->Get( wlanForceDisable );
+
+ DEBUG2( "CWlmPlatformData::GetWlanOnOffState() - WlanOnOff: %d, WlanForceDisable: %d",
+ wlanOn, wlanForceDisable );
+
+ // Check first if WLAN is forcibly disabled as it overrides all the other settings
+ if( wlanForceDisable )
+ {
+ wlanState = EWlanForceOff;
+ }
+ // Check if WLAN master switch is ON
+ else if( wlanOn )
+ {
+ wlanState = EWlanOn;
+ }
+
+ DEBUG1( "CWlmPlatformData::GetWlanOnOffState() return value: %d",
+ wlanState );
+
+ return wlanState;
+ }
+
+// ---------------------------------------------------------
+// CWlmPlatformData::NotifyWlanOnOffObserver
+// Status : Draft
+// ---------------------------------------------------------
+//
+void CWlmPlatformData::NotifyWlanOnOffObserver()
+ {
+ DEBUG( "CWlmPlatformData::NotifyWlanOnOffObserver()" );
+
+ // Read WLAN master switch
+ TInt wlanOn( EFalse );
+ iWlanOnOff->Get( wlanOn );
+
+ // Read WLAN force disable switch
+ TInt wlanForceDisable( EFalse );
+ iWlanForceDisable->Get( wlanForceDisable );
+
+ DEBUG3( " WlanOnOff: %d, WlanForceDisable: %d, NotifiedToObserver: %d",
+ wlanOn, wlanForceDisable, iNotifiedWlanState );
+
+ // Note that the observer is only notified if the
+ // state really changes
+
+ // If WLAN is set ON and it is not forcibly disabled
+ if( wlanOn && // WLAN set ON
+ wlanForceDisable == EFalse && // WLAN force disable not set
+ iNotifiedWlanState != CWlmPlatformData::EWlanNotifiedOn ) // WLAN ON not notified yet
+ {
+ // Notify observer that WLAN is set ON
+ iCallback.WlanOn();
+ iNotifiedWlanState = CWlmPlatformData::EWlanNotifiedOn;
+ (void)PublishWlanOnOff( EPSWlanOn );
+ // Note! P&S write operation return value is not checked
+ DEBUG( "CWlmPlatformData::NotifyWlanOnOffObserver() - WLAN ON notified, P&S updated" );
+ }
+ // WLAN is set OFF
+ else if( iNotifiedWlanState != CWlmPlatformData::EWlanNotifiedOff ) // WLAN OFF not notified yet
+ {
+ // Notify observer that WLAN is set OFF
+ iCallback.WlanOff();
+ iNotifiedWlanState = CWlmPlatformData::EWlanNotifiedOff;
+ (void)PublishWlanOnOff( EPSWlanOff );
+ // Note! P&S write operation return value is not checked
+ DEBUG( "CWlmPlatformData::NotifyWlanOnOffObserver() - WLAN OFF notified, P&S updated" );
+ }
+ }
+
+// ---------------------------------------------------------
+// CWlmPlatformData::PublishWlanOnOff
+// Status : Draft
+// ---------------------------------------------------------
+//
+TInt CWlmPlatformData::PublishWlanOnOff( TPSWlanOnOff aWlanState )
+ {
+ DEBUG1( "CWlmPlatformData::PublishWlanOnOff( wlanState = %d )",
+ aWlanState );
+
+ return iPsOnOffState.Set( aWlanState );
+ }