PECengine/PresenceManager2/SrcNWSessionSlot/CPEngNWSessionSlotNotifier2.cpp
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Notifier API to listen NWSessionSlot changes.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "CPEngNWSessionSlotNotifier2.h"
       
    20 #include "CPEngNWSessionSlotNotifier2Imp.h"
       
    21 #include "CPEngNWSessionSlotID2.h"
       
    22 #include "PresenceDebugPrint.h"
       
    23 
       
    24 
       
    25 // ============================ MEMBER FUNCTIONS ===============================
       
    26 
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // CPEngNWSessionSlotNotifier2::NewL()
       
    30 // Two-phased constructor.
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 EXPORT_C CPEngNWSessionSlotNotifier2* CPEngNWSessionSlotNotifier2::NewL(
       
    34     TInt aPriority )
       
    35     {
       
    36     PENG_DP_TXT( "CPEngNWSessionSlotNotifier2::NewL()" );
       
    37 
       
    38     CPEngNWSessionSlotNotifier2* self = new ( ELeave ) CPEngNWSessionSlotNotifier2;
       
    39     CleanupStack::PushL( self );
       
    40     self->iImp = CPEngNWSessionSlotNotifier2Imp::NewL( *self, aPriority );
       
    41     CleanupStack::Pop( self );
       
    42     return self;
       
    43     }
       
    44 
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // CPEngNWSessionSlotNotifier2::NewLC()
       
    48 // Two-phased constructor.
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 EXPORT_C CPEngNWSessionSlotNotifier2* CPEngNWSessionSlotNotifier2::NewLC(
       
    52     TInt aPriority )
       
    53     {
       
    54     PENG_DP_TXT( "CPEngNWSessionSlotNotifier2::NewLC()" );
       
    55 
       
    56     CPEngNWSessionSlotNotifier2* self = new ( ELeave ) CPEngNWSessionSlotNotifier2;
       
    57     CleanupStack::PushL( self );
       
    58     self->iImp = CPEngNWSessionSlotNotifier2Imp::NewL( *self, aPriority );
       
    59     return self;
       
    60     }
       
    61 
       
    62 
       
    63 
       
    64 // Destructor
       
    65 CPEngNWSessionSlotNotifier2::~CPEngNWSessionSlotNotifier2()
       
    66     {
       
    67     PENG_DP_TXT( "CPEngNWSessionSlotNotifier2::~CPEngNWSessionSlotNotifier2()" );
       
    68 
       
    69     delete iImp;
       
    70     }
       
    71 
       
    72 
       
    73 
       
    74 // -----------------------------------------------------------------------------
       
    75 // CPEngNWSessionSlotNotifier2::CPEngNWSessionSlotNotifier2
       
    76 // C++ default constructor can NOT contain any code, that
       
    77 // might leave.
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 CPEngNWSessionSlotNotifier2::CPEngNWSessionSlotNotifier2()
       
    81     {
       
    82     }
       
    83 
       
    84 
       
    85 // -----------------------------------------------------------------------------
       
    86 // CPEngNWSessionSlotNotifier2::Start()
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 EXPORT_C TInt CPEngNWSessionSlotNotifier2::Start()
       
    90     {
       
    91     PENG_DP_TXT( "CPEngNWSessionSlotNotifier2::Start() - all events" );
       
    92 
       
    93     TRAPD( err, iImp->StartL( NULL, NULL ) );
       
    94     return err;
       
    95     }
       
    96 
       
    97 
       
    98 // -----------------------------------------------------------------------------
       
    99 // CPEngNWSessionSlotNotifier2::Start()
       
   100 // -----------------------------------------------------------------------------
       
   101 //
       
   102 EXPORT_C TInt CPEngNWSessionSlotNotifier2::Start(
       
   103     const CPEngNWSessionSlotID2& aMatchPattern )
       
   104     {
       
   105     PENG_DP_TXT( "CPEngNWSessionSlotNotifier2::Start() - by slot ID match" );
       
   106 
       
   107     TRAPD( err, iImp->StartL( aMatchPattern.Implementation(), NULL ) );
       
   108     return err;
       
   109     }
       
   110 
       
   111 
       
   112 // -----------------------------------------------------------------------------
       
   113 // CPEngNWSessionSlotNotifier2::Start()
       
   114 // -----------------------------------------------------------------------------
       
   115 //
       
   116 EXPORT_C TInt CPEngNWSessionSlotNotifier2::Start(
       
   117     const TArray<TPEngNWSessionSlotEvent>& aEvents )
       
   118 
       
   119     {
       
   120     PENG_DP( D_PENG_LIT( "CPEngNWSessionSlotNotifier2::Start() - by event match, %d events" ),
       
   121              aEvents.Count() );
       
   122 
       
   123     TRAPD( err, iImp->StartL( NULL, &aEvents ) );
       
   124     return err;
       
   125     }
       
   126 
       
   127 
       
   128 // -----------------------------------------------------------------------------
       
   129 // CPEngNWSessionSlotNotifier2::Stop()
       
   130 // -----------------------------------------------------------------------------
       
   131 //
       
   132 EXPORT_C void CPEngNWSessionSlotNotifier2::Stop()
       
   133     {
       
   134     PENG_DP_TXT( "CPEngNWSessionSlotNotifier2::Stop()" );
       
   135 
       
   136     iImp->Stop();
       
   137     }
       
   138 
       
   139 
       
   140 // -----------------------------------------------------------------------------
       
   141 // CPEngNWSessionSlotNotifier2::IsActive()
       
   142 // -----------------------------------------------------------------------------
       
   143 //
       
   144 EXPORT_C TBool CPEngNWSessionSlotNotifier2::IsActive() const
       
   145     {
       
   146     PENG_DP_TXT( "CPEngNWSessionSlotNotifier2::IsActive()" );
       
   147 
       
   148     return iImp->IsActive();
       
   149     }
       
   150 
       
   151 
       
   152 // -----------------------------------------------------------------------------
       
   153 // CPEngNWSessionSlotNotifier2::PushNWSessionSlotStateToObservers()
       
   154 // -----------------------------------------------------------------------------
       
   155 //
       
   156 EXPORT_C TInt CPEngNWSessionSlotNotifier2::PushNWSessionSlotStateToObservers(
       
   157     const CPEngNWSessionSlotID2& aMatchPattern )
       
   158 
       
   159     {
       
   160     PENG_DP_TXT( "CPEngNWSessionSlotNotifier2::PushNWSessionSlotStateToObservers()" );
       
   161 
       
   162     return iImp->PushNWSessionSlotStateToObservers( aMatchPattern );
       
   163     }
       
   164 
       
   165 
       
   166 // -----------------------------------------------------------------------------
       
   167 // CPEngNWSessionSlotNotifier2::GetNWSessionSlotState()
       
   168 // -----------------------------------------------------------------------------
       
   169 //
       
   170 EXPORT_C TInt CPEngNWSessionSlotNotifier2::GetNWSessionSlotState(
       
   171     const CPEngNWSessionSlotID2& aNWSessionSlotID,
       
   172     TPEngNWSessionSlotState& aState ) const
       
   173     {
       
   174     PENG_DP_TXT( "CPEngNWSessionSlotNotifier2::GetNWSessionSlotState()" );
       
   175 
       
   176     return iImp->GetNWSessionSlotState( aNWSessionSlotID, aState );
       
   177     }
       
   178 
       
   179 
       
   180 // -----------------------------------------------------------------------------
       
   181 // CPEngNWSessionSlotNotifier2::AddObserver()
       
   182 // -----------------------------------------------------------------------------
       
   183 //
       
   184 EXPORT_C TInt CPEngNWSessionSlotNotifier2::AddObserver(
       
   185     MPEngNWSessionSlotObserver2& aObserver )
       
   186 
       
   187     {
       
   188     PENG_DP_TXT( "CPEngNWSessionSlotNotifier2::AddObserver()" );
       
   189 
       
   190     return iImp->AddObserver( aObserver );
       
   191     }
       
   192 
       
   193 
       
   194 // -----------------------------------------------------------------------------
       
   195 // CPEngNWSessionSlotNotifier2::RemoveObserver()
       
   196 // -----------------------------------------------------------------------------
       
   197 //
       
   198 EXPORT_C TInt CPEngNWSessionSlotNotifier2::RemoveObserver(
       
   199     MPEngNWSessionSlotObserver2& aObserver )
       
   200 
       
   201     {
       
   202     PENG_DP_TXT( "CPEngNWSessionSlotNotifier2::RemoveObserver()" );
       
   203 
       
   204     return iImp->RemoveObserver( aObserver );
       
   205     }
       
   206 
       
   207 
       
   208 // End of File
       
   209 
       
   210