wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlannotificationhandler.cpp
changeset 0 c40eb8fe8501
equal deleted inserted replaced
-1:000000000000 0:c40eb8fe8501
       
     1 /*
       
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Class to receive asynchronous notifications from WLAN drivers
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <e32def.h>
       
    21 #include <e32std.h>
       
    22 #include "wlannotificationhandler.h"
       
    23 #include "RWlanLogicalChannel.h"
       
    24 #include "am_debug.h"
       
    25 
       
    26 // ================= MEMBER FUNCTIONS =======================
       
    27 
       
    28 // C++ default constructor can NOT contain any code, that
       
    29 // might leave.
       
    30 //
       
    31 CWlanNotificationHandler::CWlanNotificationHandler(
       
    32     RWlanLogicalChannel& aChannel,
       
    33     MWlanNotificationCallback& aClient ):
       
    34     CActive( CActive::EPriorityStandard ),
       
    35     iChannel( aChannel ),
       
    36     iClient( aClient )
       
    37     {
       
    38     DEBUG( "CWlanNotificationHandler::CWlanNotificationHandler()" );
       
    39     };
       
    40 
       
    41 // Destructor
       
    42 CWlanNotificationHandler::~CWlanNotificationHandler()
       
    43     {
       
    44     DEBUG( "CWlanNotificationHandler::~CWlanNotificationHandler()" );
       
    45     Cancel();
       
    46     };
       
    47 
       
    48 // ---------------------------------------------------------
       
    49 // CWlanNotificationHandler::NewL
       
    50 // ---------------------------------------------------------
       
    51 //
       
    52 CWlanNotificationHandler* CWlanNotificationHandler::NewL(
       
    53     RWlanLogicalChannel& aChannel,
       
    54     MWlanNotificationCallback& aClient )
       
    55     {
       
    56     DEBUG( "CWlanNotificationHandler::NewL()" );
       
    57     CWlanNotificationHandler* self = new(ELeave) CWlanNotificationHandler( aChannel, aClient );
       
    58     CleanupStack::PushL( self );
       
    59     self->ConstructL();
       
    60     CleanupStack::Pop( self );
       
    61     return self;
       
    62     }
       
    63 
       
    64 // ---------------------------------------------------------
       
    65 // CWlanNotificationHandler::ConstructL
       
    66 // ---------------------------------------------------------
       
    67 //
       
    68 void CWlanNotificationHandler::ConstructL()
       
    69     {
       
    70     DEBUG( "CWlanNotificationHandler::ConstructL()" );
       
    71 
       
    72     CActiveScheduler::Add( this );    
       
    73     }
       
    74 
       
    75 // ---------------------------------------------------------
       
    76 // CWlanNotificationHandler::DoCancel
       
    77 // Cancel is called by the framework when Cancel() is called.
       
    78 // Pending indication is cancelled from the device driver.
       
    79 // ---------------------------------------------------------
       
    80 //
       
    81 void CWlanNotificationHandler::DoCancel()
       
    82     {
       
    83     DEBUG( "CWlanNotificationHandler::DoCancel() " );
       
    84     iChannel.CancelRequestSignal();
       
    85     }
       
    86 
       
    87 // ---------------------------------------------------------
       
    88 // CWlanNotificationHandler::RunL
       
    89 // This is called when active object has received an
       
    90 // indication.
       
    91 // ---------------------------------------------------------
       
    92 //
       
    93 void CWlanNotificationHandler::RunL()
       
    94     {
       
    95     DEBUG( "CWlanNotificationHandler::RunL()" );
       
    96     iClient.OnNotify( iIndication );
       
    97     IssueRequest();
       
    98     }
       
    99 
       
   100 // ---------------------------------------------------------
       
   101 // CWlanNotificationHandler::Start
       
   102 // ---------------------------------------------------------
       
   103 //
       
   104 TInt CWlanNotificationHandler::Start()
       
   105     {
       
   106     DEBUG( "CWlanNotificationHandler::Start()" );
       
   107     IssueRequest();
       
   108     return KErrNone;
       
   109     }
       
   110 
       
   111 // ---------------------------------------------------------
       
   112 // CWlanNotificationHandler::Stop
       
   113 // ---------------------------------------------------------
       
   114 //
       
   115 void CWlanNotificationHandler::Stop()
       
   116     {
       
   117     DEBUG( "CWlanNotificationHandler::Stop()" );
       
   118     Cancel();
       
   119     }    
       
   120 
       
   121 // ---------------------------------------------------------
       
   122 // CWlanNotificationHandler::IssueRequest
       
   123 // Registers pending indication buffer to the device driver.
       
   124 // ---------------------------------------------------------
       
   125 //
       
   126 void CWlanNotificationHandler::IssueRequest()
       
   127     {
       
   128     DEBUG( "CWlanNotificationHandler::IssueRequest()" );
       
   129     iChannel.RequestSignal( iStatus, iIndication );
       
   130     SetActive();
       
   131     }
       
   132 
       
   133 // End of file