utilityapps/loadgen/engine/inc/loadgen_bluetooth.h
changeset 55 2d9cac8919d3
parent 51 b048e15729d6
equal deleted inserted replaced
53:819e59dfc032 55:2d9cac8919d3
       
     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 
       
    20 #ifndef LOADGEN_BLUETOOTH_H
       
    21 #define LOADGEN_BLUETOOTH_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32std.h>
       
    25 #include <e32base.h>
       
    26 #include <centralrepository.h>
       
    27 #include "loadgen_loadbase.h"
       
    28 #include "loadgen_loadattributes.h"
       
    29 #include <es_sock.h>
       
    30 #include <bt_sock.h>
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 
       
    34 // CLASS DECLARATIONS
       
    35 
       
    36 class CBluetooth : public CLoadBase
       
    37     {
       
    38 public:
       
    39     static CBluetooth* NewL(TBluetoothAttributes& aAttributes, TInt aReferenceNumber);
       
    40     virtual ~CBluetooth();
       
    41         
       
    42 private: // Constructors
       
    43     CBluetooth(TBluetoothAttributes& aAttributes, TInt aReferenceNumber);
       
    44     void ConstructL();  
       
    45 
       
    46 public:  // New methods
       
    47     virtual void Resume();
       
    48     virtual void Suspend();
       
    49     virtual void SetPriority();
       
    50     virtual void Close();
       
    51     virtual TPtrC Description();
       
    52     inline TBluetoothAttributes& Attributes() { return iAttributes; }
       
    53 	inline void SetAttributes(const TBluetoothAttributes& aAttributes) { iAttributes = aAttributes; }
       
    54     
       
    55 public:  // New static methods
       
    56     static TInt ThreadFunction(TAny* aThreadArg);
       
    57     
       
    58 private:  // New static methods
       
    59     static void GenerateLoad(TBluetoothAttributes& aAttributes);    
       
    60     void InitializeBluetoothL();
       
    61     TBool SetBTPowerState(TBool aState);
       
    62     
       
    63 private: // Data
       
    64            
       
    65     TBluetoothAttributes    iAttributes;    
       
    66     RThread                 iThread; 
       
    67     };
       
    68  
       
    69 
       
    70 
       
    71  
       
    72 class CBTManager : public CActive//, public MBTPowerManagerObserver
       
    73     {
       
    74     public:
       
    75         
       
    76         static CBTManager* NewL(TBluetoothAttributes& aAttrs);
       
    77         virtual ~CBTManager();
       
    78  
       
    79     private:
       
    80         
       
    81         CBTManager( TBluetoothAttributes& aAttrs);
       
    82         void ConstructL();
       
    83         TInt StartBTDeviceDiscovery();
       
    84  
       
    85     private:
       
    86             
       
    87         static TInt PeriodicTimerCallBack(TAny* aAny);        
       
    88     public:
       
    89                                                         
       
    90         /**
       
    91          * From CActive:
       
    92          */
       
    93         void RunL();
       
    94         void DoCancel();       
       
    95 
       
    96     private:
       
    97         
       
    98         CPeriodic*              iPeriodicTimer;
       
    99         TBluetoothAttributes&   iAttributes;  
       
   100         CRepository*            iBTPowerStateCRepo;
       
   101         RSocketServ             iSocketServerHnd;
       
   102         RHostResolver           iHostResolver;        
       
   103         TNameEntry              iBTNameEntry;        
       
   104     };
       
   105 
       
   106 
       
   107 #endif
       
   108