loadgen/engine/inc/loadgen_phonecall.h
branchRCL_3
changeset 19 b3cee849fa46
equal deleted inserted replaced
18:48060abbbeaf 19:b3cee849fa46
       
     1 /*
       
     2 * Copyright (c) 2010 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 #ifndef LOADGEN_PHONECALL_H
       
    20 #define LOADGEN_PHONECALL_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 #include <etel3rdparty.h>
       
    26 
       
    27 
       
    28 #include "loadgen_loadbase.h"
       
    29 #include "loadgen_loadattributes.h"
       
    30 
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CPhoneCallManager;
       
    34 class CDialer;
       
    35 
       
    36 
       
    37 // CLASS DECLARATIONS
       
    38 
       
    39 class CPhoneCall : public CLoadBase
       
    40     {
       
    41 public:
       
    42     static CPhoneCall* NewL(TPhoneCallAttributes& aAttributes, TInt aReferenceNumber);
       
    43     virtual ~CPhoneCall();
       
    44         
       
    45 private: // Constructors
       
    46     CPhoneCall(TPhoneCallAttributes& aAttributes, TInt aReferenceNumber);
       
    47     void ConstructL();  
       
    48 
       
    49 public:  // New methods
       
    50     virtual void Resume();
       
    51     virtual void Suspend();
       
    52     virtual void SetPriority();
       
    53     virtual void Close();
       
    54     virtual TPtrC Description();
       
    55     inline TPhoneCallAttributes& Attributes() { return iAttributes; }
       
    56 	inline void SetAttributes(TPhoneCallAttributes aAttributes) { iAttributes = aAttributes; }
       
    57 	
       
    58 public:  // New static methods
       
    59     static TInt ThreadFunction(TAny* aThreadArg);
       
    60 
       
    61 private:  // New static methods
       
    62     static void GenerateLoad(TPhoneCallAttributes& aAttributes);
       
    63 
       
    64 private: // Data
       
    65     TPhoneCallAttributes        iAttributes;    
       
    66     RThread                     iThread;
       
    67     };
       
    68 
       
    69     
       
    70 
       
    71 class CPhoneCallManager : public CActive
       
    72     { 
       
    73 private:
       
    74     enum TState
       
    75         {
       
    76         EStateIdle = 0,
       
    77         EStateCall
       
    78         };
       
    79 public:
       
    80     static CPhoneCallManager* NewL(TPhoneCallAttributes& aAttributes);
       
    81     ~CPhoneCallManager();
       
    82 
       
    83 private:
       
    84     CPhoneCallManager(TPhoneCallAttributes& aAttributes);
       
    85     void ConstructL();
       
    86 
       
    87 private:
       
    88     void RunL();
       
    89     void DoCancel();
       
    90 
       
    91 private:
       
    92     static TInt PeriodicTimerCallBack(TAny* aAny);
       
    93     void HandleCalls();
       
    94     void DoDial();
       
    95     void DoHangup();
       
    96 
       
    97 public:
       
    98     inline CPeriodic* PeriodicTimer() { return iPeriodicTimer; }
       
    99     void HandleStatus(TInt aErr);
       
   100 
       
   101 private:
       
   102     TPhoneCallAttributes&               iAttributes;
       
   103     CDialer*                            iDialer;   
       
   104     CPeriodic*                          iPeriodicTimer;
       
   105     TInt                                iState;
       
   106     }; 
       
   107 
       
   108 
       
   109 class CDialer : public CActive
       
   110     { 
       
   111 public:
       
   112     static CDialer* NewL(CPhoneCallManager& aManager);
       
   113     ~CDialer();
       
   114 
       
   115 private:
       
   116     CDialer(CPhoneCallManager& aManager);
       
   117     void ConstructL();
       
   118 
       
   119 private:
       
   120     void RunL();
       
   121     void DoCancel();
       
   122 
       
   123 public:
       
   124     void Dial(const TDesC& aDestination);
       
   125     void Hangup();
       
   126 
       
   127 private:
       
   128     CPhoneCallManager&                  iManager;
       
   129     CTelephony*                         iTelephony;
       
   130     CTelephony::TCallId                 iCallId;
       
   131     CTelephony::TCallParamsV1           iCallParams;
       
   132     CTelephony::TCallParamsV1Pckg       iCallParamsPckg;
       
   133     };
       
   134         
       
   135 #endif