loadgen/inc/loadgen_phonecall.h
branchRCL_3
changeset 22 fad26422216a
parent 0 d6fe6244b863
equal deleted inserted replaced
21:b3cee849fa46 22:fad26422216a
       
     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:  
       
    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 
       
    57 public:  // New static methods
       
    58     static TInt ThreadFunction(TAny* aThreadArg);
       
    59 
       
    60 private:  // New static methods
       
    61     static void GenerateLoad(TPhoneCallAttributes& aAttributes);
       
    62 
       
    63 private: // Data
       
    64     TPhoneCallAttributes        iAttributes;    
       
    65     RThread                     iThread;
       
    66     };
       
    67 
       
    68     
       
    69 
       
    70 class CPhoneCallManager : public CActive
       
    71     { 
       
    72 private:
       
    73     enum TState
       
    74         {
       
    75         EStateIdle = 0,
       
    76         EStateCall
       
    77         };
       
    78 public:
       
    79     static CPhoneCallManager* NewL(TPhoneCallAttributes& aAttributes);
       
    80     ~CPhoneCallManager();
       
    81 
       
    82 private:
       
    83     CPhoneCallManager(TPhoneCallAttributes& aAttributes);
       
    84     void ConstructL();
       
    85 
       
    86 private:
       
    87     void RunL();
       
    88     void DoCancel();
       
    89 
       
    90 private:
       
    91     static TInt PeriodicTimerCallBack(TAny* aAny);
       
    92     void HandleCalls();
       
    93     void DoDial();
       
    94     void DoHangup();
       
    95 
       
    96 public:
       
    97     inline CPeriodic* PeriodicTimer() { return iPeriodicTimer; }
       
    98     void HandleStatus(TInt aErr);
       
    99 
       
   100 private:
       
   101     TPhoneCallAttributes&               iAttributes;
       
   102     CDialer*                            iDialer;   
       
   103     CPeriodic*                          iPeriodicTimer;
       
   104     TInt                                iState;
       
   105     }; 
       
   106 
       
   107 
       
   108 class CDialer : public CActive
       
   109     { 
       
   110 public:
       
   111     static CDialer* NewL(CPhoneCallManager& aManager);
       
   112     ~CDialer();
       
   113 
       
   114 private:
       
   115     CDialer(CPhoneCallManager& aManager);
       
   116     void ConstructL();
       
   117 
       
   118 private:
       
   119     void RunL();
       
   120     void DoCancel();
       
   121 
       
   122 public:
       
   123     void Dial(const TDesC& aDestination);
       
   124     void Hangup();
       
   125 
       
   126 private:
       
   127     CPhoneCallManager&                  iManager;
       
   128     CTelephony*                         iTelephony;
       
   129     CTelephony::TCallId                 iCallId;
       
   130     CTelephony::TCallParamsV1           iCallParams;
       
   131     CTelephony::TCallParamsV1Pckg       iCallParamsPckg;
       
   132     };
       
   133         
       
   134 #endif