mediator/src/Client/MediatorCommandResponder.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 responding to Mediator Service commands.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    <e32base.h>
       
    22 #include    "MediatorCommandResponder.h"
       
    23 #include    "MediatorCommandResponderBody.h"
       
    24 #include    "Debug.h"
       
    25 
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 CMediatorCommandResponder::CMediatorCommandResponder( )
       
    30     {
       
    31     }
       
    32 
       
    33 void CMediatorCommandResponder::ConstructL( MMediatorCommandObserver* aObserver )
       
    34     {
       
    35     iBody = CMediatorCommandResponderBody::NewL( aObserver );
       
    36     }
       
    37 
       
    38 EXPORT_C CMediatorCommandResponder* CMediatorCommandResponder::NewL(
       
    39                 MMediatorCommandObserver* aObserver )
       
    40     {
       
    41     CMediatorCommandResponder* self 
       
    42             = new( ELeave ) CMediatorCommandResponder( );
       
    43     
       
    44     CleanupStack::PushL( self );
       
    45     self->ConstructL( aObserver );
       
    46     CleanupStack::Pop( self );
       
    47 
       
    48     return self;
       
    49     }
       
    50     
       
    51 CMediatorCommandResponder::~CMediatorCommandResponder()
       
    52     {
       
    53     if ( iBody )
       
    54         {
       
    55         iBody->Cancel();
       
    56         }
       
    57     delete iBody;
       
    58     }
       
    59 
       
    60     
       
    61 // -----------------------------------------------------------------------------
       
    62 // CMediatorCommandResponder::RegisterCommandL
       
    63 // Register a command category.
       
    64 // (other items were commented in a header).
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 EXPORT_C TInt CMediatorCommandResponder::RegisterCommand( 
       
    68                                         TUid aDomain,
       
    69                                         TUid aCategory, 
       
    70                                         const RCommandList& aCommands )
       
    71     {
       
    72     return iBody->RegisterCommand( aDomain, aCategory, aCommands );
       
    73     }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CMediatorCommandResponder::RegisterCommandL
       
    77 // Register a command.
       
    78 // (other items were commented in a header).
       
    79 // -----------------------------------------------------------------------------
       
    80 //        
       
    81 EXPORT_C TInt CMediatorCommandResponder::RegisterCommand( TUid aDomain, 
       
    82                                                           TUid aCategory, 
       
    83                                                           TInt aCommandId, 
       
    84                                                           TVersion aVersion,
       
    85                                                           TCapabilitySet aCaps, 
       
    86                                                           TInt aTimeOut )
       
    87     {
       
    88     return iBody->RegisterCommand( aDomain, 
       
    89                                    aCategory, 
       
    90                                    aCommandId, 
       
    91                                    aVersion, 
       
    92                                    aCaps, 
       
    93                                    aTimeOut );
       
    94     }
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CMediatorCommandResponder::UnregisterCommand
       
    98 // Unregister a command list.
       
    99 // (other items were commented in a header).
       
   100 // -----------------------------------------------------------------------------
       
   101 //        
       
   102 EXPORT_C TInt CMediatorCommandResponder::UnregisterCommand( 
       
   103                                             TUid aDomain, 
       
   104                                             TUid aCategory,
       
   105                                             const RCommandList& aCommands )
       
   106     {
       
   107     return iBody->UnregisterCommand( aDomain, aCategory, aCommands );
       
   108     }
       
   109 
       
   110 // -----------------------------------------------------------------------------
       
   111 // CMediatorCommandResponder::UnregisterCommand
       
   112 // Unregister a command.
       
   113 // (other items were commented in a header).
       
   114 // -----------------------------------------------------------------------------
       
   115 //        
       
   116 EXPORT_C TInt CMediatorCommandResponder::UnregisterCommand( 
       
   117                                          TUid aDomain, 
       
   118                                          TUid aCategory, 
       
   119                                          TInt aCommandId )
       
   120     {
       
   121     return iBody->UnregisterCommand( aDomain, aCategory, aCommandId );
       
   122     }
       
   123 
       
   124 // -----------------------------------------------------------------------------
       
   125 // CMediatorCommandResponder::IssueResponseL
       
   126 // Issue a response to a command.
       
   127 // (other items were commented in a header).
       
   128 // -----------------------------------------------------------------------------
       
   129 //        
       
   130 EXPORT_C TInt CMediatorCommandResponder::IssueResponse( TUid aDomain,
       
   131                                                         TUid aCategory, 
       
   132                                                         TInt aCommandId,
       
   133                                                         TInt aStatus, 
       
   134                                                         const TDesC8& aData )
       
   135     {
       
   136     return iBody->IssueResponse( aDomain, aCategory, aCommandId, aStatus, aData );
       
   137     }
       
   138 
       
   139 //  End of File