satengine/SatServer/Engine/src/csatbipsubconneventobserver.cpp
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2007 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:  Observer of Subconnection parameters granted event
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <cs_subconevents.h>
       
    20 #include "csatbipsubconneventobserver.h"
       
    21 #include "CSatBIPGPRSDataChannel.h"
       
    22 #include "SatLog.h"
       
    23 
       
    24 
       
    25 // ======== MEMBER FUNCTIONS ========
       
    26 
       
    27 // ---------------------------------------------------------------------------
       
    28 // C++ default constructor can NOT contain any code, that
       
    29 // might leave.
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 CSatBIPSubConnEventObserver::CSatBIPSubConnEventObserver(
       
    33     CSatBIPGPRSDataChannel& aDataChannel ) :
       
    34     CActive( EPriorityNormal ),
       
    35     iDataChannel( aDataChannel )
       
    36     {
       
    37     LOG( NORMAL, "SATENGINE: CSatBIPSubConnEventObserver::\
       
    38         CSatBIPSubConnEventObserver calling" )
       
    39     CActiveScheduler::Add( this );
       
    40     
       
    41     iEventFilter.iEventGroupUid = KSubConnGenericEventsImplUid;
       
    42     iEventFilter.iEventMask =
       
    43         KSubConGenericEventParamsRejected | KSubConGenericEventParamsGranted;
       
    44         
       
    45     LOG( NORMAL, "SATENGINE: CSatBIPSubConnObserver::\
       
    46         CSatBIPSubConnEventObserver exiting" )
       
    47     }
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 // Destructor
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 CSatBIPSubConnEventObserver::~CSatBIPSubConnEventObserver()
       
    54     {
       
    55     LOG( SIMPLE,
       
    56         "SATENGINE: CSatBIPSubConnEventObserver::~CSatBIPSubConnEventObserver \
       
    57         calling" )
       
    58     Cancel();
       
    59     LOG( SIMPLE,
       
    60         "SATENGINE: CSatBIPSubConnEventObserver::~CSatBIPSubConnEventObserver \
       
    61         exiting" )
       
    62     }
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // Starts to observe connection status
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 void CSatBIPSubConnEventObserver::StartObservSubConnEvent()
       
    69     {
       
    70     LOG( NORMAL, 
       
    71         "SATENGINE: CSatBIPSubConnEventObserver::StartObservSubConnEvent\
       
    72          calling" )
       
    73 
       
    74     if ( !IsActive() )
       
    75         {
       
    76         LOG( SIMPLE, "  Activating observer" )
       
    77         iDataChannel.SubConnection().EventNotification(
       
    78             iEventBuffer, &iEventFilter, 1, iStatus );
       
    79         SetActive();
       
    80         }
       
    81 
       
    82     LOG( NORMAL, 
       
    83         "SATENGINE: CSatBIPSubConnEventObserver::StartObservSubConnEvent\
       
    84         exiting" )
       
    85     }
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 // From base class
       
    89 // RunL
       
    90 // ---------------------------------------------------------------------------
       
    91 //
       
    92 void CSatBIPSubConnEventObserver::RunL()
       
    93     {
       
    94     LOG( NORMAL, "SATENGINE: CSatBIPSubConnEventObserver::RunL calling" )
       
    95 
       
    96     const TInt errStatus( iStatus.Int() );
       
    97     LOG2( SIMPLE, " RunL (%i)", errStatus )
       
    98     if ( KErrNone == errStatus )
       
    99         {
       
   100         iDataChannel.GrantedEventReceivedL( iEventBuffer );
       
   101         }
       
   102     else
       
   103         {
       
   104         LOG( NORMAL, 
       
   105             "SATENGINE: CSatBIPSubConnEventObserver::RunL Leave with err" )
       
   106         User::LeaveIfError( errStatus );
       
   107         }
       
   108 
       
   109     LOG( NORMAL, "SATENGINE: CSatBIPSubConnEventObserver::RunL exiting" )
       
   110     }
       
   111 
       
   112 // ---------------------------------------------------------------------------
       
   113 // From base class
       
   114 // DoCancel
       
   115 // ---------------------------------------------------------------------------
       
   116 //
       
   117 void CSatBIPSubConnEventObserver::DoCancel()
       
   118     {
       
   119     LOG( NORMAL, "SATENGINE: CSatBIPSubConnEventObserver::DoCancel calling" )
       
   120 
       
   121     iDataChannel.SubConnection().CancelEventNotification();
       
   122 
       
   123     LOG( NORMAL, "SATENGINE: CSatBIPSubConnEventObserver::DoCancel exiting" )
       
   124     }
       
   125 
       
   126 // End of File