phonebookui/Phonebook2/remotecontactlookup/engine/src/cpbkxrclcbrsender.cpp
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Definition of the class CPbkxRclCbRSender.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "emailtrace.h"
       
    20 #include <pbk2rclengine.rsg>
       
    21 #include <AiwServiceHandler.h>
       
    22 #include <AiwPoCParameters.h>
       
    23 #include <CPbkContactItem.h>
       
    24 #include <coemain.h>
       
    25 
       
    26 #include "cpbkxrclcbrsender.h"
       
    27 #include "pbkxrclutils.h"
       
    28 
       
    29 // ======== MEMBER FUNCTIONS ========
       
    30 
       
    31 // ---------------------------------------------------------------------------
       
    32 // CPbkxRclCbRSender::NewL
       
    33 // ---------------------------------------------------------------------------
       
    34 //
       
    35 CPbkxRclCbRSender* CPbkxRclCbRSender::NewL()
       
    36     {
       
    37     FUNC_LOG;
       
    38     CPbkxRclCbRSender* sender = CPbkxRclCbRSender::NewLC();
       
    39     CleanupStack::Pop( sender );
       
    40     return sender;
       
    41     }
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // CPbkxRclCbRSender::NewLC
       
    45 // ---------------------------------------------------------------------------
       
    46 //
       
    47 CPbkxRclCbRSender* CPbkxRclCbRSender::NewLC()
       
    48     {
       
    49     FUNC_LOG;
       
    50     CPbkxRclCbRSender* sender = new ( ELeave ) CPbkxRclCbRSender();
       
    51     CleanupStack::PushL( sender );
       
    52     sender->ConstructL();
       
    53     return sender;
       
    54     }
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // CPbkxRclCbRSender::CPbkxRclCbRSender
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 CPbkxRclCbRSender::CPbkxRclCbRSender() : CBase()
       
    61     {
       
    62     FUNC_LOG;
       
    63     }
       
    64 
       
    65 // ---------------------------------------------------------------------------
       
    66 // CPbkxRclCbRSender::~CPbkxRclCbRSender
       
    67 // ---------------------------------------------------------------------------
       
    68 //
       
    69 CPbkxRclCbRSender::~CPbkxRclCbRSender()
       
    70     {
       
    71     FUNC_LOG;
       
    72     delete iServiceHandler;
       
    73     }
       
    74 
       
    75 // ---------------------------------------------------------------------------
       
    76 // CPbkxRclCbRSender::ConstructL
       
    77 // ---------------------------------------------------------------------------
       
    78 //
       
    79 void CPbkxRclCbRSender::ConstructL()
       
    80     {
       
    81     FUNC_LOG;
       
    82     iServiceHandler = CAiwServiceHandler::NewL();
       
    83     iServiceHandler->AttachL( R_RCL_POC_INTEREST );
       
    84     }
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // CPbkxRclCbRSender::SendCallbackRequestL
       
    88 // ---------------------------------------------------------------------------
       
    89 //
       
    90 void CPbkxRclCbRSender::SendCallbackRequestL( CPbkContactItem& aContactItem )
       
    91     {
       
    92     FUNC_LOG;
       
    93 
       
    94     // check for PTT settings
       
    95     HBufC* ptt = PbkxRclUtils::FieldTextL( &aContactItem, EPbkFieldIdPushToTalk );
       
    96     if ( ptt == NULL )
       
    97         {
       
    98         User::Leave( KErrNotSupported );
       
    99         }
       
   100     else
       
   101         {
       
   102         CleanupStack::PushL( ptt );
       
   103         }
       
   104     
       
   105     CAiwGenericParamList& params = iServiceHandler->InParamListL();
       
   106     TAiwPocParameterData pocParameter;
       
   107 
       
   108     //TODO 21.9.2009 Need to fix this. 
       
   109     //pocParameter.iConsumerAppUid = TUid::Uid( KPbkxRclEngineUid );
       
   110 
       
   111 
       
   112     pocParameter.iConsumerWindowGroup =
       
   113         CCoeEnv::Static()->RootWin().Identifier();
       
   114         
       
   115     pocParameter.iCommandId = EAiwPoCCmdSendCallBackRequest;
       
   116 
       
   117     TAiwGenericParam param = TAiwGenericParam(
       
   118         EGenericParamPoCData,
       
   119         TAiwVariant( TAiwPocParameterDataPckg( pocParameter ) ) );
       
   120     params.AppendL(param);            
       
   121     
       
   122     TAiwGenericParam addressParam = TAiwGenericParam( 
       
   123         EGenericParamSIPAddress, 
       
   124         TAiwVariant( *ptt ) );
       
   125   
       
   126     params.AppendL( addressParam );            
       
   127     
       
   128     iServiceHandler->ExecuteServiceCmdL(
       
   129         KAiwCmdPoC,
       
   130         params,
       
   131         iServiceHandler->OutParamListL(), 
       
   132         0,
       
   133         NULL );
       
   134       
       
   135     CleanupStack::PopAndDestroy( ptt );
       
   136 
       
   137     }
       
   138