localconnectivityservice/generichid/tsrc/GenericHidTest/src/tdialclient.cpp
branchRCL_3
changeset 42 0aa8cc770c8a
equal deleted inserted replaced
40:453dfc402455 42:0aa8cc770c8a
       
     1 /*
       
     2 * Copyright (c) 2009 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:  Dialhandling class for hid test application
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "tdialclient.h"
       
    20 
       
    21 // ======== MEMBER FUNCTIONS ========
       
    22 
       
    23 
       
    24 // ---------------------------------------------------------------------------
       
    25 // ?description_if_needed
       
    26 // ---------------------------------------------------------------------------
       
    27 //
       
    28 CDialClient* CDialClient::NewL()
       
    29     {
       
    30     CDialClient* self = CDialClient::NewLC();
       
    31     CleanupStack::Pop( self );
       
    32     return self;
       
    33     }
       
    34 
       
    35 
       
    36 // ---------------------------------------------------------------------------
       
    37 // ?description_if_needed
       
    38 // ---------------------------------------------------------------------------
       
    39 //
       
    40 CDialClient* CDialClient::NewLC()
       
    41     {
       
    42     CDialClient* self = new( ELeave ) CDialClient;
       
    43     CleanupStack::PushL( self );
       
    44     self->ConstructL();
       
    45     return self;
       
    46     }
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 // Constructor
       
    50 // ---------------------------------------------------------------------------
       
    51 //
       
    52 CDialClient::CDialClient()
       
    53 : CActive(EPriorityNormal), iCallParamsPckg(iCallParams),
       
    54   iCallStarted(EFalse)
       
    55     {
       
    56     CActiveScheduler::Add(this);
       
    57     }
       
    58 
       
    59 // ---------------------------------------------------------------------------
       
    60 // ConstructL
       
    61 // ---------------------------------------------------------------------------
       
    62 //
       
    63 void CDialClient::ConstructL()
       
    64     {
       
    65     iTelephony = CTelephony::NewL();
       
    66     }
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // Destructor
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 CDialClient::~CDialClient()
       
    73     {
       
    74     Cancel();
       
    75     delete iTelephony;
       
    76     }
       
    77 
       
    78 // ---------------------------------------------------------------------------
       
    79 // RunL
       
    80 // ---------------------------------------------------------------------------
       
    81 //
       
    82 void CDialClient::RunL()
       
    83     {
       
    84     if ( iSyncWaiter.IsStarted() )
       
    85         {
       
    86         iSyncWaiter.AsyncStop();
       
    87         }
       
    88     }
       
    89 
       
    90 // ---------------------------------------------------------------------------
       
    91 // DoCancel()
       
    92 // ---------------------------------------------------------------------------
       
    93 //
       
    94 void CDialClient::DoCancel()
       
    95     {
       
    96         
       
    97     }
       
    98 // ---------------------------------------------------------------------------
       
    99 // CreateCall()
       
   100 // ---------------------------------------------------------------------------
       
   101 //
       
   102 void CDialClient::CreateCall(const TDesC& aNumber)
       
   103     {
       
   104     if ( IsActive() )
       
   105         {
       
   106         return;
       
   107         }
       
   108     CTelephony::TTelNumber telNumber(aNumber);       
       
   109     iCallParams.iIdRestrict = CTelephony::ESendMyId;        
       
   110     iTelephony->DialNewCall(iStatus, iCallParamsPckg, telNumber, iCallId);
       
   111     
       
   112     SetActive();    
       
   113     iSyncWaiter.Start();    
       
   114     }
       
   115 
       
   116 // ---------------------------------------------------------------------------
       
   117 // HangUp()
       
   118 // ---------------------------------------------------------------------------
       
   119 //
       
   120 void CDialClient::HangUp()
       
   121     {    
       
   122     iTelephony->Hangup( iStatus , iCallId );    
       
   123     }