uiservicetab/vimpstcmdprocess/src/cvimpstcmdhandler.cpp
branchRCL_3
changeset 28 3104fc151679
parent 27 2b7283837edb
child 29 9a48e301e94b
equal deleted inserted replaced
27:2b7283837edb 28:3104fc151679
     1 /*
       
     2 * Copyright (c) 2008 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: implementation for CVIMPSTCmdHandler  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "cvimpstcmdhandler.h"
       
    21 #include "cvimpstcmdfactory.h"
       
    22 
       
    23 #include "mvimpstcmd.h"
       
    24 #include "mvimpstengine.h"
       
    25 
       
    26 
       
    27 // --------------------------------------------------------------------------
       
    28 // CVIMPSTCmdHandler::CVIMPSTCmdHandler
       
    29 // --------------------------------------------------------------------------
       
    30 //
       
    31 CVIMPSTCmdHandler::CVIMPSTCmdHandler()
       
    32     {
       
    33     }
       
    34 
       
    35 // --------------------------------------------------------------------------
       
    36 // CVIMPSTCmdHandler::~CVIMPSTCmdHandler
       
    37 // --------------------------------------------------------------------------
       
    38 //
       
    39 CVIMPSTCmdHandler::~CVIMPSTCmdHandler()
       
    40     {
       
    41     delete iCommandFactory;
       
    42     }
       
    43 
       
    44 // --------------------------------------------------------------------------
       
    45 // CVIMPSTCmdHandler::NewL
       
    46 // --------------------------------------------------------------------------
       
    47 //
       
    48 EXPORT_C CVIMPSTCmdHandler* CVIMPSTCmdHandler::NewL(MVIMPSTEngine& aEngine)
       
    49     {
       
    50     CVIMPSTCmdHandler* self = new(ELeave) CVIMPSTCmdHandler();
       
    51     CleanupStack::PushL(self);
       
    52     self->ConstructL(aEngine);
       
    53     CleanupStack::Pop(self);
       
    54     return self;
       
    55     }
       
    56 
       
    57 // --------------------------------------------------------------------------
       
    58 // CVIMPSTCmdHandler::ConstructL
       
    59 // --------------------------------------------------------------------------
       
    60 //
       
    61 inline void CVIMPSTCmdHandler::ConstructL(MVIMPSTEngine& aEngine)
       
    62     {
       
    63     iCommandFactory = CVIMPSTCmdFactory::NewL(aEngine);
       
    64     }
       
    65 
       
    66 // --------------------------------------------------------------------------
       
    67 // CVIMPSTCmdHandler::HandleCommandL
       
    68 // --------------------------------------------------------------------------
       
    69 //
       
    70 TBool CVIMPSTCmdHandler::HandleCommandL
       
    71         ( const TImCommandId aCommandId, MVIMPSTCmdObserver* aObserver, 
       
    72           TAny* aData )
       
    73     {
       
    74     TBool ret = EFalse;
       
    75 
       
    76 	//use the variable aData to set the command related data
       
    77     MVIMPSTCmd* cmd = iCommandFactory->CreateCommandForIdL(
       
    78             aCommandId,aData);
       
    79     
       
    80     if (cmd)
       
    81 	    {
       
    82 	    cmd->AddObserver(*aObserver);
       
    83 	    TRAPD (err, cmd->ExecuteLD());
       
    84 	    User::LeaveIfError(err);
       
    85 	    ret = ETrue;
       
    86 	    }
       
    87 
       
    88     return ret;
       
    89     }
       
    90  // --------------------------------------------------------------------------
       
    91 // CVIMPSTCmdHandler::RegisterEventObserver
       
    92 // --------------------------------------------------------------------------
       
    93 //
       
    94 void CVIMPSTCmdHandler::RegisterEventObserverL( MVIMPSTCmdObserver* aObserver ) 
       
    95 	{
       
    96 	iCommandFactory->AddObserverL(aObserver);
       
    97 	
       
    98 	}
       
    99 // --------------------------------------------------------------------------
       
   100 // CVIMPSTCmdHandler::UnRegisterEventObserver
       
   101 // --------------------------------------------------------------------------
       
   102 //
       
   103 void CVIMPSTCmdHandler::UnRegisterEventObserver( MVIMPSTCmdObserver* aObserver ) 
       
   104 	{
       
   105 	iCommandFactory->RemoveObserver(aObserver);
       
   106 	}
       
   107 // --------------------------------------------------------------------------
       
   108 // CVIMPSTCmdHandler::GetProcessInterface
       
   109 // --------------------------------------------------------------------------
       
   110 //
       
   111 MVIMPSTProcessArray& CVIMPSTCmdHandler::GetProcessInterface() 
       
   112 	{
       
   113 	return iCommandFactory->GetProcessInterface(); 	
       
   114 	}
       
   115 	
       
   116 	
       
   117 // End of File