29
|
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>
|
42
|
23 |
#include <btengconnman.h>
|
29
|
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 |
*/
|
42
|
35 |
class BtDelegatePower : public BtAbstractDelegate, public MBTEngSettingsObserver,
|
|
36 |
public MBTEngConnObserver
|
29
|
37 |
{
|
|
38 |
Q_OBJECT
|
|
39 |
|
|
40 |
public:
|
31
|
41 |
explicit BtDelegatePower(
|
|
42 |
BtSettingModel* settingModel,
|
|
43 |
BtDeviceModel* deviceModel, QObject *parent = 0 );
|
29
|
44 |
|
|
45 |
virtual ~BtDelegatePower();
|
|
46 |
|
|
47 |
virtual void exec( const QVariant ¶ms );
|
|
48 |
|
42
|
49 |
//from MBTEngSettingsObserver
|
|
50 |
|
29
|
51 |
virtual void PowerStateChanged( TBTPowerStateValue aState );
|
|
52 |
|
|
53 |
virtual void VisibilityModeChanged( TBTVisibilityMode aState );
|
|
54 |
|
|
55 |
public slots:
|
|
56 |
void btOnQuestionClose(HbAction *action);
|
|
57 |
|
|
58 |
void btOnWarningClose();
|
|
59 |
|
42
|
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 |
|
29
|
69 |
|
|
70 |
private:
|
|
71 |
void switchBTOn();
|
|
72 |
|
|
73 |
void switchBTOff();
|
|
74 |
|
42
|
75 |
bool checkOfflineMode(bool& btEnabledInOffline);
|
29
|
76 |
|
42
|
77 |
void disconnectOngoingConnections();
|
|
78 |
|
29
|
79 |
|
|
80 |
private:
|
|
81 |
CBTEngSettings* mBtengSettings;
|
42
|
82 |
bool mActiveHandling;
|
|
83 |
TBTPowerStateValue mReqPowerState;
|
|
84 |
|
|
85 |
BtAbstractDelegate* mDisconnectDelegate;
|
|
86 |
|
|
87 |
|
29
|
88 |
private:
|
|
89 |
|
|
90 |
Q_DISABLE_COPY(BtDelegatePower)
|
|
91 |
|
|
92 |
};
|
|
93 |
|
|
94 |
#endif // BTDELEGATEPOWER_H
|