upnpavcontroller/upnpavcontrollerclient/src/upnpavconnectionactive.cpp
changeset 0 7f85d04be362
child 38 5360b7ddc251
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /*
       
     2 * Copyright (c) 2006 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 "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:      AO that monitors WLAN connection in client side
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 #include "upnpavconnectionactive.h"
       
    24 
       
    25 #include "upnpavcontrollerclient.h"
       
    26 
       
    27 #include "upnpconnectionmonitorobserver.h"
       
    28 
       
    29 _LIT( KComponentLogfile, "upnpavcontrollerclient.txt");
       
    30 #include "upnplog.h"
       
    31 
       
    32 
       
    33 // ======== MEMBER FUNCTIONS ========
       
    34 
       
    35 // --------------------------------------------------------------------------
       
    36 // CUPnPAVConnectionActive::NewL
       
    37 // Two-phase constructor
       
    38 // --------------------------------------------------------------------------
       
    39 CUPnPAVConnectionActive* CUPnPAVConnectionActive::NewL(
       
    40     RUPnPAVControllerClient& aServer,
       
    41     MUPnPConnectionMonitorObserver& aObserver )
       
    42     {
       
    43     CUPnPAVConnectionActive* self = new (ELeave) CUPnPAVConnectionActive(
       
    44         aServer, aObserver );
       
    45     CleanupStack::PushL( self );
       
    46     self->ConstructL();
       
    47     CleanupStack::Pop( self );
       
    48     return self;
       
    49     }
       
    50 
       
    51 // --------------------------------------------------------------------------
       
    52 // CUPnPAVConnectionActive::CUPnPAVConnectionActive
       
    53 // Constructor
       
    54 // --------------------------------------------------------------------------
       
    55 CUPnPAVConnectionActive::CUPnPAVConnectionActive(
       
    56     RUPnPAVControllerClient& aServer,
       
    57     MUPnPConnectionMonitorObserver& aObserver ):
       
    58     CActive( EPriorityStandard ),
       
    59     iServer( aServer ),
       
    60     iObserver( aObserver )
       
    61     {
       
    62     CActiveScheduler::Add( this );
       
    63     }
       
    64 
       
    65 // --------------------------------------------------------------------------
       
    66 // CUPnPAVConnectionActive::~CUPnPAVConnectionActive
       
    67 // Destructor
       
    68 // --------------------------------------------------------------------------
       
    69 CUPnPAVConnectionActive::~CUPnPAVConnectionActive()
       
    70     {
       
    71     Cancel();
       
    72     }
       
    73 
       
    74 // --------------------------------------------------------------------------
       
    75 // CUPnPAVConnectionActive::ConstructL
       
    76 // Two-phase constructor
       
    77 // --------------------------------------------------------------------------
       
    78 void CUPnPAVConnectionActive::ConstructL()
       
    79     {
       
    80         
       
    81     }
       
    82 
       
    83 // --------------------------------------------------------------------------
       
    84 // CUPnPAVConnectionActive::RunL
       
    85 // From CActive
       
    86 // --------------------------------------------------------------------------
       
    87 void CUPnPAVConnectionActive::RunL()
       
    88     {
       
    89     // Connection is lost
       
    90     if( iStatus.Int() == EAVControllerConnectionLost )
       
    91         {
       
    92         iObserver.ConnectionLost();
       
    93         }
       
    94     }
       
    95     
       
    96 // --------------------------------------------------------------------------
       
    97 // CUPnPAVConnectionActive::DoCancel
       
    98 // From CActive
       
    99 // --------------------------------------------------------------------------
       
   100 void CUPnPAVConnectionActive::DoCancel()
       
   101     {
       
   102     iServer.CancelMonitorConnection(); // Ignore error
       
   103     }
       
   104     
       
   105 // --------------------------------------------------------------------------
       
   106 // CUPnPAVConnectionActive::RunError
       
   107 // From CActive
       
   108 // --------------------------------------------------------------------------
       
   109 TInt CUPnPAVConnectionActive::RunError( TInt /*aError*/ )
       
   110     {
       
   111     return KErrNone;
       
   112     }
       
   113     
       
   114 // --------------------------------------------------------------------------
       
   115 // CUPnPAVConnectionActive::StartMonitoring
       
   116 // Starts monitoring
       
   117 // --------------------------------------------------------------------------
       
   118 void CUPnPAVConnectionActive::StartMonitoring()
       
   119     {
       
   120     __ASSERTD( !IsActive(), __FILE__, __LINE__ );
       
   121     iServer.MonitorConnection( iStatus );
       
   122     SetActive();
       
   123     }
       
   124 
       
   125 // end of file