homescreensrv_plat/sapi_actionhandler/actionhandlerplugins/src/ahtelkeyhandler.cpp
branchRCL_3
changeset 114 a5a39a295112
equal deleted inserted replaced
113:0efa10d348c0 114:a5a39a295112
       
     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:
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #include <AiwServiceHandler.h>      // AIW
       
    20 #include <aiwdialdata.h>    //include\oem
       
    21 #include <liwvariant.h>
       
    22 #include <mmf/common/mmfcontrollerpluginresolver.h>
       
    23 
       
    24 #include "ahtelkeyhandler.h"
       
    25 #include "ahproperties.hrh"
       
    26 
       
    27 // ======== MEMBER FUNCTIONS ========
       
    28 
       
    29 // ---------------------------------------------------------------------------
       
    30 // 2nd phase constructor may leave
       
    31 // ---------------------------------------------------------------------------
       
    32 void CAHTelKeyHandler::ConstructL()
       
    33     {
       
    34     }
       
    35 
       
    36 // ---------------------------------------------------------------------------
       
    37 // Two-phased constructor
       
    38 // ---------------------------------------------------------------------------
       
    39 CAHTelKeyHandler* CAHTelKeyHandler::NewL()
       
    40     {
       
    41     CAHTelKeyHandler* self = CAHTelKeyHandler::NewLC( );
       
    42     CleanupStack::Pop( self );
       
    43     return self;
       
    44     }
       
    45 
       
    46 // ---------------------------------------------------------------------------
       
    47 // Two-phased constructor
       
    48 // ---------------------------------------------------------------------------
       
    49 CAHTelKeyHandler* CAHTelKeyHandler::NewLC()
       
    50     {
       
    51     CAHTelKeyHandler* self = new( ELeave ) CAHTelKeyHandler;
       
    52     CleanupStack::PushL( self );
       
    53     self->ConstructL( );
       
    54     return self;
       
    55     }
       
    56 
       
    57 // ---------------------------------------------------------------------------
       
    58 // destructor
       
    59 // ---------------------------------------------------------------------------
       
    60 CAHTelKeyHandler::~CAHTelKeyHandler()
       
    61     {
       
    62     delete iServiceHandler;
       
    63     }
       
    64 
       
    65 // ---------------------------------------------------------------------------
       
    66 // Helper method for AIW attach
       
    67 // ---------------------------------------------------------------------------
       
    68 void CAHTelKeyHandler::AttachServiceHandlerL()
       
    69     {
       
    70     iServiceHandler = CAiwServiceHandler::NewL();
       
    71 
       
    72     RCriteriaArray interest;
       
    73     CleanupResetAndDestroy<RCriteriaArray>::PushL( interest );
       
    74 
       
    75     TAiwServiceCommands serviceCommand = KAiwCmdCall;
       
    76     _LIT8( KStar, "*" );
       
    77     // Service command used as criteria item ID
       
    78     CAiwCriteriaItem* criteria = CAiwCriteriaItem::NewLC( serviceCommand,
       
    79         serviceCommand, KStar );
       
    80 
       
    81     // We are using a base service.
       
    82     TUid base = { KAiwClassBase };
       
    83     criteria->SetServiceClass( base );
       
    84     interest.AppendL( criteria );
       
    85     CleanupStack::Pop( criteria );
       
    86 
       
    87     iServiceHandler->AttachL( interest );
       
    88     CleanupStack::PopAndDestroy( &interest );
       
    89     }
       
    90 
       
    91 // ---------------------------------------------------------------------------
       
    92 // Executes provided action
       
    93 // ---------------------------------------------------------------------------
       
    94 //
       
    95 TInt CAHTelKeyHandler::ExecuteActionL( const CLiwMap* aMap )
       
    96     {
       
    97     TInt errCode(KErrArgument);
       
    98     TLiwVariant variantNumber;
       
    99     variantNumber.PushL( );
       
   100     if ( aMap->FindL( KNumber, variantNumber ) )
       
   101         {
       
   102         TPtrC number( KNullDesC );
       
   103         if ( variantNumber.Get( number ) )
       
   104             {
       
   105             CAiwDialData* dialData = CAiwDialData::NewLC( );
       
   106             dialData->SetCallType( CAiwDialData::EAIWVoice );
       
   107             dialData->SetPhoneNumberL( number );
       
   108             dialData->SetWindowGroup( AIWDialData::KAiwGoToIdle );
       
   109             // Attach the interest to the AIW framework.
       
   110             if ( !iServiceHandler )
       
   111                 {
       
   112                 AttachServiceHandlerL();
       
   113                 }
       
   114             // Set parameters for the AIW call
       
   115             CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC( );
       
   116             CAiwGenericParamList& paramListOut =
       
   117                 iServiceHandler->OutParamListL( );
       
   118 
       
   119             dialData->FillInParamListL( *paramList );
       
   120             iServiceHandler->ExecuteServiceCmdL( KAiwCmdCall, *paramList,
       
   121                 paramListOut, 0, NULL );
       
   122             errCode = KErrNone;
       
   123             paramListOut.Reset( );
       
   124             CleanupStack::PopAndDestroy( paramList );
       
   125             CleanupStack::PopAndDestroy( dialData );
       
   126             }
       
   127         }
       
   128     CleanupStack::PopAndDestroy( &variantNumber );
       
   129     return errCode;
       
   130     }
       
   131 //End of file