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