mediator/src/Client/MediatorCommandInitiator.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 issuing Mediator Service commands.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include    <e32base.h>
       
    21 #include    "MediatorCommandInitiator.h"
       
    22 #include    "MediatorCommandInitiatorBody.h"
       
    23 
       
    24 
       
    25 // ============================ MEMBER FUNCTIONS ===============================
       
    26 
       
    27 CMediatorCommandInitiator::CMediatorCommandInitiator()
       
    28     {
       
    29     }
       
    30 
       
    31 void CMediatorCommandInitiator::ConstructL(
       
    32         MMediatorCommandResponseObserver* aObserver )
       
    33     {
       
    34     iBody = CMediatorCommandInitiatorBody::NewL( aObserver );
       
    35     }
       
    36 
       
    37 EXPORT_C CMediatorCommandInitiator* CMediatorCommandInitiator::NewL(
       
    38                 MMediatorCommandResponseObserver* aObserver )
       
    39     {
       
    40     CMediatorCommandInitiator* self 
       
    41                 = new( ELeave ) CMediatorCommandInitiator();
       
    42     
       
    43     CleanupStack::PushL( self );
       
    44     self->ConstructL( aObserver );
       
    45     CleanupStack::Pop( self );
       
    46 
       
    47     return self;
       
    48     }
       
    49     
       
    50 CMediatorCommandInitiator::~CMediatorCommandInitiator()
       
    51     {
       
    52     if ( iBody )
       
    53         {
       
    54         iBody->Cancel();
       
    55         }
       
    56     delete iBody;
       
    57     }
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 // CMediatorCommandInitiator::IssueCommandL
       
    61 //  
       
    62 // (other items were commented in a header).
       
    63 // -----------------------------------------------------------------------------
       
    64 //
       
    65 EXPORT_C TInt CMediatorCommandInitiator::IssueCommand( TUid aDomain,
       
    66                                                        TUid aCategory, 
       
    67                                                        TInt aCommandId,
       
    68                                                        TVersion aVersion, 
       
    69                                                        const TDesC8& aData )
       
    70     {
       
    71     return iBody->IssueCommand( aDomain, aCategory, aCommandId, aVersion, aData );
       
    72     }
       
    73 // -----------------------------------------------------------------------------
       
    74 // CMediatorCommandInitiator::CancelCommand
       
    75 //  
       
    76 // (other items were commented in a header).
       
    77 // -----------------------------------------------------------------------------
       
    78 //
       
    79 EXPORT_C void CMediatorCommandInitiator::CancelCommand( TUid aDomain, 
       
    80                                                         TUid aCategory, 
       
    81                                                         TInt aCommandId )
       
    82     {
       
    83     iBody->CancelCommand( aDomain, aCategory, aCommandId );
       
    84     }
       
    85 
       
    86 //  End of File