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