emailcontacts/remotecontactlookup/engine/src/cpbkxrclcbrsender.cpp
branchRCL_3
changeset 12 4ce476e64c59
parent 11 0396474f30f5
child 13 8592a65ad3fb
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
     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 
       
    20 
       
    21 
       
    22 #include "emailtrace.h"
       
    23 #include <pbkxrclengine.rsg>
       
    24 
       
    25 #include <AiwServiceHandler.h>
       
    26 
       
    27 #include <AiwPoCParameters.h>
       
    28 
       
    29 #include <CPbkContactItem.h>
       
    30 
       
    31 #include <coemain.h>
       
    32 
       
    33 
       
    34 
       
    35 #include "cpbkxrclcbrsender.h"
       
    36 
       
    37 #include "pbkxrclutils.h"
       
    38 
       
    39 #include "pbkxrclengineuids.hrh"
       
    40 
       
    41 
       
    42 
       
    43 // ======== MEMBER FUNCTIONS ========
       
    44 
       
    45 
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 
       
    49 // CPbkxRclCbRSender::NewL
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 
       
    53 //
       
    54 
       
    55 CPbkxRclCbRSender* CPbkxRclCbRSender::NewL()
       
    56 
       
    57     {
       
    58     FUNC_LOG;
       
    59     CPbkxRclCbRSender* sender = CPbkxRclCbRSender::NewLC();
       
    60 
       
    61     CleanupStack::Pop( sender );
       
    62 
       
    63     return sender;
       
    64 
       
    65     }
       
    66 
       
    67 
       
    68 
       
    69 // ---------------------------------------------------------------------------
       
    70 
       
    71 // CPbkxRclCbRSender::NewLC
       
    72 
       
    73 // ---------------------------------------------------------------------------
       
    74 
       
    75 //
       
    76 
       
    77 CPbkxRclCbRSender* CPbkxRclCbRSender::NewLC()
       
    78 
       
    79     {
       
    80     FUNC_LOG;
       
    81     CPbkxRclCbRSender* sender = new ( ELeave ) CPbkxRclCbRSender();
       
    82 
       
    83     CleanupStack::PushL( sender );
       
    84 
       
    85     sender->ConstructL();
       
    86 
       
    87     return sender;
       
    88 
       
    89     }
       
    90 
       
    91 
       
    92 
       
    93 // ---------------------------------------------------------------------------
       
    94 
       
    95 // CPbkxRclCbRSender::CPbkxRclCbRSender
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 
       
    99 //
       
   100 
       
   101 CPbkxRclCbRSender::CPbkxRclCbRSender() : CBase()
       
   102 
       
   103     {
       
   104     FUNC_LOG;
       
   105     }
       
   106 
       
   107 
       
   108 
       
   109 // ---------------------------------------------------------------------------
       
   110 
       
   111 // CPbkxRclCbRSender::~CPbkxRclCbRSender
       
   112 
       
   113 // ---------------------------------------------------------------------------
       
   114 
       
   115 //
       
   116 
       
   117 CPbkxRclCbRSender::~CPbkxRclCbRSender()
       
   118 
       
   119     {
       
   120     FUNC_LOG;
       
   121     delete iServiceHandler;
       
   122 
       
   123     }
       
   124 
       
   125 
       
   126 
       
   127 // ---------------------------------------------------------------------------
       
   128 
       
   129 // CPbkxRclCbRSender::ConstructL
       
   130 
       
   131 // ---------------------------------------------------------------------------
       
   132 
       
   133 //
       
   134 
       
   135 void CPbkxRclCbRSender::ConstructL()
       
   136 
       
   137     {
       
   138     FUNC_LOG;
       
   139     iServiceHandler = CAiwServiceHandler::NewL();
       
   140 
       
   141     iServiceHandler->AttachL( R_RCL_POC_INTEREST );
       
   142 
       
   143     }
       
   144 
       
   145 
       
   146 
       
   147 // ---------------------------------------------------------------------------
       
   148 
       
   149 // CPbkxRclCbRSender::SendCallbackRequestL
       
   150 
       
   151 // ---------------------------------------------------------------------------
       
   152 
       
   153 //
       
   154 
       
   155 void CPbkxRclCbRSender::SendCallbackRequestL( CPbkContactItem& aContactItem )
       
   156 
       
   157     {
       
   158     FUNC_LOG;
       
   159 
       
   160 
       
   161     // check for PTT settings
       
   162 
       
   163     HBufC* ptt = PbkxRclUtils::FieldTextL( &aContactItem, EPbkFieldIdPushToTalk );
       
   164 
       
   165     if ( ptt == NULL )
       
   166 
       
   167         {
       
   168 
       
   169         User::Leave( KErrNotSupported );
       
   170 
       
   171         }
       
   172 
       
   173     else
       
   174 
       
   175         {
       
   176 
       
   177         CleanupStack::PushL( ptt );
       
   178 
       
   179         }
       
   180 
       
   181     
       
   182 
       
   183     CAiwGenericParamList& params = iServiceHandler->InParamListL();
       
   184 
       
   185     TAiwPocParameterData pocParameter;
       
   186 
       
   187     pocParameter.iConsumerAppUid = TUid::Uid( KPbkxRclEngineUid );
       
   188 
       
   189     pocParameter.iConsumerWindowGroup =
       
   190 
       
   191         CCoeEnv::Static()->RootWin().Identifier();
       
   192 
       
   193         
       
   194 
       
   195     pocParameter.iCommandId = EAiwPoCCmdSendCallBackRequest;
       
   196 
       
   197 
       
   198 
       
   199     TAiwGenericParam param = TAiwGenericParam(
       
   200 
       
   201         EGenericParamPoCData,
       
   202 
       
   203         TAiwVariant( TAiwPocParameterDataPckg( pocParameter ) ) );
       
   204 
       
   205     params.AppendL(param);            
       
   206 
       
   207     
       
   208 
       
   209     TAiwGenericParam addressParam = TAiwGenericParam( 
       
   210 
       
   211         EGenericParamSIPAddress, 
       
   212 
       
   213         TAiwVariant( *ptt ) );
       
   214 
       
   215   
       
   216 
       
   217     params.AppendL( addressParam );            
       
   218 
       
   219     
       
   220 
       
   221     iServiceHandler->ExecuteServiceCmdL(
       
   222 
       
   223         KAiwCmdPoC,
       
   224 
       
   225         params,
       
   226 
       
   227         iServiceHandler->OutParamListL(), 
       
   228 
       
   229         0,
       
   230 
       
   231         NULL );
       
   232 
       
   233       
       
   234 
       
   235     CleanupStack::PopAndDestroy( ptt );
       
   236 
       
   237 
       
   238 
       
   239     }
       
   240 
       
   241 
       
   242