wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/wllddpowerhandler.cpp
changeset 0 c40eb8fe8501
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/wllddpowerhandler.cpp	Tue Feb 02 02:03:13 2010 +0200
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:   Implementation of the DWlanPowerHandler class
+*
+*/
+
+/*
+* %version: 6 %
+*/
+
+#include "wllddpowerhandler.h"
+#include "wllddpowerindicator.h"
+
+_LIT(KWlanPowerHandlerName,"WLAN power handler");
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------------------------
+// C++ constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+DWlanPowerHandler::DWlanPowerHandler( 
+    MWlanPowerIndicator& aWlanLdd ,
+    TDynamicDfcQue& aDfcQ ):
+    DPowerHandler( KWlanPowerHandlerName ),
+    iWlanLdd( &aWlanLdd ),
+    iPowerUpDfc( PowerUpDfcFn, this, NULL, 0 ),
+    iPowerDownDfc( PowerDownDfcFn, this, NULL, 0 )
+    {
+    iPowerUpDfc.SetDfcQ( &aDfcQ );
+    iPowerDownDfc.SetDfcQ( &aDfcQ );
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+DWlanPowerHandler::~DWlanPowerHandler()
+    {
+    iWlanLdd = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+void DWlanPowerHandler::PowerDownDfcFn( TAny *aPtr )
+    {
+    DWlanPowerHandler *pwrHandler = static_cast<DWlanPowerHandler*>(aPtr);
+    pwrHandler->PowerDownOperation();
+    }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+void DWlanPowerHandler::PowerUpDfcFn( TAny *aPtr )
+    {
+    DWlanPowerHandler *pwrHandler = static_cast<DWlanPowerHandler*>(aPtr);
+    pwrHandler->PowerUpOperation();
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void DWlanPowerHandler::PowerDown( TPowerState ) 
+    {
+    iPowerDownDfc.Enque();
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void DWlanPowerHandler::PowerUp() 
+    {
+    iPowerUpDfc.Enque();
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void DWlanPowerHandler::OnPowerDownDone() 
+    {
+    // Acknowledge back to power manager that power down has been done
+    PowerDownDone();
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void DWlanPowerHandler::OnPowerUpDone() 
+    {
+    // Acknowledge back to power manager that power up handling has been done
+    PowerUpDone();
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void DWlanPowerHandler::PowerDownOperation()
+    {
+    // Forward the request
+    iWlanLdd->OnPowerDown();
+    }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+void DWlanPowerHandler::PowerUpOperation()
+    {
+    // Forward the indication
+    iWlanLdd->OnPowerUp();
+    }