satengine/SatServer/EventMonitors/src/CSatBIPChannelStatusMonitor.cpp
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2002-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:  Monitor for Channel status events
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include    "CSatBIPChannelStatusMonitor.h"
       
    21 #include    "MSatEventMonitorUtils.h"
       
    22 #include    "MSatBIPEventNotifier.h"
       
    23 #include    "SatLog.h"
       
    24 
       
    25 // ============================ MEMBER FUNCTIONS ===============================
       
    26 // -----------------------------------------------------------------------------
       
    27 // CSatBIPChannelStatusMonitor::CSatBIPChannelStatusMonitor
       
    28 // C++ default constructor can NOT contain any code, that
       
    29 // might leave.
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 CSatBIPChannelStatusMonitor::CSatBIPChannelStatusMonitor(
       
    33     MSatEventMonitorUtils& aUtils ) :
       
    34     CSatEventMonitorHandler( aUtils )
       
    35     {
       
    36     LOG( SIMPLE, "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::\
       
    37         CSatBIPChannelStatusMonitor calling-exiting" )
       
    38     }
       
    39 
       
    40 // Destructor
       
    41 CSatBIPChannelStatusMonitor::~CSatBIPChannelStatusMonitor()
       
    42     {
       
    43     LOG( SIMPLE, "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::\
       
    44         ~CSatBIPChannelStatusMonitor calling-exiting" )
       
    45     }
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // CSatBIPChannelStatusMonitor::NewL
       
    49 // Two-phased constructor.
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 CSatBIPChannelStatusMonitor* CSatBIPChannelStatusMonitor::NewL(
       
    53     MSatEventMonitorUtils& aUtils )
       
    54     {
       
    55     LOG( SIMPLE,
       
    56         "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::NewL calling" )
       
    57 
       
    58     CSatBIPChannelStatusMonitor* self =
       
    59         new ( ELeave ) CSatBIPChannelStatusMonitor( aUtils );
       
    60     CleanupStack::PushL( self );
       
    61     self->ConstructL();
       
    62     CleanupStack::Pop( self );
       
    63 
       
    64     LOG( SIMPLE,
       
    65         "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::NewL exiting" )
       
    66     return self;
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // CSatBIPChannelStatusMonitor::ConstructL
       
    71 // Symbian 2nd phase constructor can leave.
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 void CSatBIPChannelStatusMonitor::ConstructL()
       
    75     {
       
    76     LOG( SIMPLE,
       
    77         "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::ConstructL calling" )
       
    78 
       
    79     // Create base class and give this monitors event as a parameter
       
    80     BaseConstructL( MSatEventMonitor::EChannelStatus );
       
    81     iIsActive = EFalse;
       
    82 
       
    83     LOG( SIMPLE,
       
    84         "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::ConstructL exiting" )
       
    85     }
       
    86 
       
    87 // -----------------------------------------------------------------------------
       
    88 // CSatBIPChannelStatusMonitor::DoCancelMonitor
       
    89 // Cancels monitor.
       
    90 // -----------------------------------------------------------------------------
       
    91 //
       
    92 void CSatBIPChannelStatusMonitor::DoCancelMonitor()
       
    93     {
       
    94     LOG( SIMPLE, "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::\
       
    95         DoCancelMonitor calling" )
       
    96 
       
    97     if ( iIsActive )
       
    98         {
       
    99         LOG( SIMPLE, "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::\
       
   100             DoCancelMonitor Canceling monitor" )
       
   101         // Call MSatBIPEventNotifier.CancelChannelStatus
       
   102         iEventUtils.BipNotifier().CancelChannelStatus();
       
   103         }
       
   104 
       
   105     LOG( SIMPLE, "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::\
       
   106         DoCancelMonitor exiting" )
       
   107     }
       
   108 
       
   109 // -----------------------------------------------------------------------------
       
   110 // CSatBIPChannelStatusMonitor::StartMonitor
       
   111 // Starts monitor.
       
   112 // -----------------------------------------------------------------------------
       
   113 //
       
   114 TInt CSatBIPChannelStatusMonitor::StartMonitor()
       
   115     {
       
   116     LOG( SIMPLE,
       
   117         "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::StartMonitor calling" )
       
   118 
       
   119     if ( !iIsActive )
       
   120         {
       
   121         LOG( NORMAL, "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::\
       
   122             StartMonitor Activating monitor" )
       
   123         // Call MSatBIPEventNotifier.NotifyChannelStatus
       
   124         iEventUtils.BipNotifier().NotifyChannelStatus( this );
       
   125         }
       
   126 
       
   127     LOG( SIMPLE,
       
   128         "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::StartMonitor exiting" )
       
   129     return KErrNone;
       
   130     }
       
   131 
       
   132 // -----------------------------------------------------------------------------
       
   133 // CSatBIPChannelStatusMonitor::ChannelStatus
       
   134 // Called when data is received
       
   135 // -----------------------------------------------------------------------------
       
   136 //
       
   137 void CSatBIPChannelStatusMonitor::ChannelStatus(
       
   138     const TInt aChannelId, const TInt aStatus )
       
   139     {
       
   140     LOG( SIMPLE,
       
   141         "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::ChannelStatus calling" )
       
   142 
       
   143     // Send BIP Event.
       
   144     EventOccured( aChannelId, aStatus );
       
   145 
       
   146     LOG( SIMPLE,
       
   147         "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::ChannelStatus exiting" )
       
   148     }
       
   149 
       
   150 // End of file