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 |
#include "btabstractdelegate.h"
|
42
|
19 |
#include "btqtconstants.h"
|
31
|
20 |
#include <btsettingmodel.h>
|
|
21 |
#include <btdevicemodel.h>
|
57
|
22 |
#include <btengsettings.h>
|
|
23 |
#include <bluetoothuitrace.h>
|
29
|
24 |
|
|
25 |
/*!
|
|
26 |
Constructor.
|
|
27 |
*/
|
31
|
28 |
BtAbstractDelegate::BtAbstractDelegate( BtSettingModel *settingModel,
|
|
29 |
BtDeviceModel *deviceModel, QObject *parent )
|
57
|
30 |
: QObject( parent ), mSettingModel(settingModel), mDeviceModel(deviceModel),
|
|
31 |
mExecuting(false)
|
29
|
32 |
{
|
|
33 |
}
|
|
34 |
|
|
35 |
/*!
|
|
36 |
Destructor.
|
|
37 |
*/
|
|
38 |
BtAbstractDelegate::~BtAbstractDelegate()
|
|
39 |
{
|
|
40 |
}
|
|
41 |
|
57
|
42 |
bool BtAbstractDelegate::isExecuting()
|
|
43 |
{
|
|
44 |
return mExecuting;
|
|
45 |
}
|
|
46 |
|
|
47 |
BtSettingModel *BtAbstractDelegate::settingModel()
|
31
|
48 |
{
|
|
49 |
return mSettingModel;
|
|
50 |
}
|
|
51 |
|
57
|
52 |
BtDeviceModel *BtAbstractDelegate::deviceModel()
|
29
|
53 |
{
|
31
|
54 |
return mDeviceModel;
|
29
|
55 |
}
|
31
|
56 |
|
|
57 |
void BtAbstractDelegate::cancel()
|
|
58 |
{
|
57
|
59 |
BOstraceFunctionEntry1( DUMMY_DEVLIST, this );
|
|
60 |
BOstraceFunctionExit0( DUMMY_DEVLIST );
|
31
|
61 |
}
|
|
62 |
|
42
|
63 |
bool BtAbstractDelegate::isBtPowerOn()
|
|
64 |
{
|
57
|
65 |
TBTPowerStateValue state(EBTPowerOff);
|
|
66 |
CBTEngSettings *settings(0);
|
|
67 |
TRAP_IGNORE(settings = CBTEngSettings::NewL());
|
|
68 |
if (settings) {
|
|
69 |
// error on function call is treated as BT OFF
|
|
70 |
(void) settings->GetPowerState(state);
|
|
71 |
delete settings;
|
|
72 |
}
|
|
73 |
BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, state);
|
|
74 |
return (EBTPowerOn == state);
|
42
|
75 |
}
|
|
76 |
|
57
|
77 |
void BtAbstractDelegate::completeDelegateExecution(int error)
|
|
78 |
{
|
|
79 |
BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, error);
|
|
80 |
setExecuting(false);
|
|
81 |
emit delegateCompleted(error, this);
|
|
82 |
BOstraceFunctionExit0( DUMMY_DEVLIST );
|
|
83 |
}
|
42
|
84 |
|
57
|
85 |
void BtAbstractDelegate::setExecuting(bool status)
|
|
86 |
{
|
|
87 |
mExecuting = status;
|
|
88 |
}
|