bluetoothengine/btui/btuidelegate/btdelegatepower.h
branchRCL_3
changeset 56 9386f31cc85b
parent 55 613943a21004
child 61 269724087bed
equal deleted inserted replaced
55:613943a21004 56:9386f31cc85b
     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 #ifndef BTDELEGATEPOWER_H
       
    19 #define BTDELEGATEPOWER_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <btengsettings.h>
       
    23 #include <btengconnman.h>
       
    24 #include "btabstractdelegate.h"
       
    25 
       
    26 class BtuiModel;
       
    27 class HbAction;
       
    28 
       
    29 /*!
       
    30     \class BtDelegatePower
       
    31     \brief the base class for handling Bluetooth power management.
       
    32 
       
    33     \\sa btuidelegate
       
    34  */
       
    35 class BtDelegatePower : public BtAbstractDelegate, public MBTEngSettingsObserver, 
       
    36         public MBTEngConnObserver 
       
    37 {
       
    38     Q_OBJECT
       
    39 
       
    40 public:
       
    41     explicit BtDelegatePower(
       
    42             BtSettingModel* settingModel, 
       
    43             BtDeviceModel* deviceModel, QObject *parent = 0 );
       
    44     
       
    45     virtual ~BtDelegatePower();
       
    46 
       
    47     virtual void exec( const QVariant &params );
       
    48     
       
    49     //from MBTEngSettingsObserver
       
    50     
       
    51     virtual void PowerStateChanged( TBTPowerStateValue aState );
       
    52 
       
    53     virtual void VisibilityModeChanged( TBTVisibilityMode aState );
       
    54     
       
    55 public slots:
       
    56     void btOnQuestionClose(int action);
       
    57     
       
    58     void btOnWarningClose();
       
    59     
       
    60     void disconnectDelegateCompleted(int err);
       
    61     
       
    62     
       
    63 protected:
       
    64     //From MBTEngConnObserver
       
    65     virtual void ConnectComplete( TBTDevAddr& aAddr, TInt aErr, 
       
    66                                    RBTDevAddrArray* aConflicts );
       
    67     virtual void DisconnectComplete( TBTDevAddr& aAddr, TInt aErr );
       
    68     
       
    69     
       
    70 private:
       
    71     void switchBTOn();
       
    72     
       
    73     void switchBTOff();
       
    74     
       
    75     bool checkOfflineMode(bool& btEnabledInOffline);
       
    76     
       
    77     void disconnectOngoingConnections();
       
    78     
       
    79 
       
    80 private:
       
    81     CBTEngSettings* mBtengSettings;
       
    82     bool mActiveHandling; 
       
    83     TBTPowerStateValue mReqPowerState;
       
    84     
       
    85     BtAbstractDelegate* mDisconnectDelegate;
       
    86     
       
    87     
       
    88 private:
       
    89 
       
    90     Q_DISABLE_COPY(BtDelegatePower)
       
    91 
       
    92 };
       
    93 
       
    94 #endif // BTDELEGATEPOWER_H