mediator/src/Client/MediatorEventConsumer.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2005 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:  An interface for receiving Mediator events.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include    <e32base.h>
       
    21 #include    "MediatorEventConsumer.h"
       
    22 #include    "MediatorEventConsumerBody.h"
       
    23 
       
    24 
       
    25 // ============================ MEMBER FUNCTIONS ===============================
       
    26 
       
    27 CMediatorEventConsumer::CMediatorEventConsumer()
       
    28     {
       
    29     }
       
    30 
       
    31 void CMediatorEventConsumer::ConstructL( MMediatorEventObserver* aObserver )
       
    32     {
       
    33     iBody = CMediatorEventConsumerBody::NewL( aObserver ); 
       
    34     }
       
    35 
       
    36 EXPORT_C CMediatorEventConsumer* CMediatorEventConsumer::NewL(
       
    37                         MMediatorEventObserver* aObserver )
       
    38     {
       
    39     CMediatorEventConsumer* self = new( ELeave ) CMediatorEventConsumer();
       
    40     
       
    41     CleanupStack::PushL( self );
       
    42     self->ConstructL( aObserver );
       
    43     CleanupStack::Pop( self );
       
    44 
       
    45     return self;
       
    46     }
       
    47     
       
    48 CMediatorEventConsumer::~CMediatorEventConsumer()
       
    49     {
       
    50     if ( iBody )
       
    51         {
       
    52         iBody->Cancel();
       
    53         }
       
    54     delete iBody;
       
    55     }
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // CMediatorEventConsumer::SubscribeEventL
       
    59 // Subscribe to event category
       
    60 // (other items were commented in a header).
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 EXPORT_C TInt CMediatorEventConsumer::SubscribeEvent( TUid aDomain,
       
    64                                                       TUid aCategory,
       
    65                                                       const REventList& aEvents )
       
    66     {
       
    67     return iBody->SubscribeEvent( aDomain, aCategory, aEvents );
       
    68     }
       
    69     
       
    70 // -----------------------------------------------------------------------------
       
    71 // CMediatorEventConsumer::SubscribeEventL
       
    72 // Subscribe to event
       
    73 // (other items were commented in a header).
       
    74 // -----------------------------------------------------------------------------
       
    75 //
       
    76 EXPORT_C TInt CMediatorEventConsumer::SubscribeEvent( TUid aDomain,
       
    77                                                       TUid aCategory, 
       
    78                                                       TInt aEventId,
       
    79                                                       TVersion aVersion )
       
    80     {
       
    81     return iBody->SubscribeEvent( aDomain, aCategory, aEventId, aVersion );
       
    82     }
       
    83     
       
    84 // -----------------------------------------------------------------------------
       
    85 // CMediatorEventConsumer::UnsubscribeEvent
       
    86 // Unsubscibe an event category.
       
    87 // (other items were commented in a header).
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 EXPORT_C TInt CMediatorEventConsumer::UnsubscribeEvent( TUid aDomain,
       
    91                                                         TUid aCategory,
       
    92                                                         const REventList& aEvents )
       
    93     {
       
    94     return iBody->UnsubscribeEvent( aDomain, aCategory, aEvents );
       
    95     }
       
    96     
       
    97 // -----------------------------------------------------------------------------
       
    98 // CMediatorEventConsumer::UnsubscribeEvent
       
    99 // Unsubscibe an event.
       
   100 // (other items were commented in a header).
       
   101 // -----------------------------------------------------------------------------
       
   102 //
       
   103 EXPORT_C TInt CMediatorEventConsumer::UnsubscribeEvent( TUid aDomain,
       
   104                                                         TUid aCategory, 
       
   105                                                         TInt aEventId )
       
   106     {
       
   107     return iBody->UnsubscribeEvent( aDomain, aCategory, aEventId );
       
   108     }
       
   109 
       
   110 //  End of File