connectivitymodules/SeCon/servers/pcconn/inc/sconbtengine.h
branchRCL_3
changeset 19 0aa8cc770c8a
parent 18 453dfc402455
child 20 4a793f564d72
equal deleted inserted replaced
18:453dfc402455 19: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:  CSconBtEngine declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef SCONBTENGINE_H_
       
    21 #define SCONBTENGINE_H_
       
    22 
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 #include <s32mem.h>
       
    26 #include <BTEngDevMan.h>
       
    27 #include <btengsettings.h>
       
    28 
       
    29 const TInt KCenRepAddrBufSize = 2 * KBTDevAddrSize;
       
    30 
       
    31 class CSconBtEngine : public CBase,
       
    32                       public MBTEngDevManObserver,
       
    33                       public MBTEngSettingsObserver
       
    34     {
       
    35 public:
       
    36     static CSconBtEngine* NewL();
       
    37     ~CSconBtEngine();
       
    38     
       
    39     void ReadBTInfoL( RBufWriteStream& aStream );
       
    40     
       
    41     void SetBtAuthorizedL( const TDesC& aBtDevAddress, TBool aAuthorized );
       
    42     
       
    43     TInt SetBtPowerState( TBool aPower );
       
    44     
       
    45     TInt SetBtName( const TDesC& aBtName );
       
    46     
       
    47 protected:
       
    48     // From MBTEngDevManObserver
       
    49     void HandleDevManComplete( TInt aErr );
       
    50     void HandleGetDevicesComplete( TInt aErr, 
       
    51            CBTDeviceArray* aDeviceArray );
       
    52     
       
    53     // From MBTEngSettingsObserver
       
    54     void PowerStateChanged( TBTPowerStateValue aState );
       
    55     void VisibilityModeChanged( TBTVisibilityMode aState );
       
    56     
       
    57 private:
       
    58     CSconBtEngine();
       
    59     void ConstructL();
       
    60     
       
    61     void PrintDevicesL();
       
    62     
       
    63 private:
       
    64     enum TState
       
    65         {
       
    66         EIdle,
       
    67         ERequestBtInfo,
       
    68         EChangeBtState,
       
    69         EChangeAuthorized
       
    70         };
       
    71     TState iState;
       
    72     TInt   iOperationError;
       
    73     CActiveSchedulerWait    iWait;
       
    74     RBufWriteStream*        iStream;
       
    75     CBTEngDevMan*           iBtEng;
       
    76     CBTDeviceArray*         iBtDevArray;
       
    77     CBTEngSettings*         iBtSettings;
       
    78     TBool                   iAuthorizedValue;
       
    79     TBuf<KCenRepAddrBufSize> iBtAddress;
       
    80     };
       
    81 
       
    82 #endif /* SCONBTENGINE_H_ */