42
|
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 |
|
47
|
18 |
#ifndef BTDEVICEMODELPRIVATE_H
|
|
19 |
#define BTDEVICEMODELPRIVATE_H
|
42
|
20 |
|
|
21 |
#include "btuimodeltypes.h"
|
|
22 |
#include <btdevicemodel.h>
|
|
23 |
|
|
24 |
#include <e32base.h>
|
|
25 |
#include <btservices/btdevrepository.h>
|
|
26 |
#include <btservices/devdiscoveryobserver.h>
|
|
27 |
|
|
28 |
class CAdvanceDevDiscoverer;
|
|
29 |
|
|
30 |
/*!
|
|
31 |
\class BtDeviceData
|
|
32 |
\brief class for providing remote device data.
|
|
33 |
|
|
34 |
BtDeviceData class is responsible for providing the latest information
|
|
35 |
regarding the properties of remote devices.
|
|
36 |
|
|
37 |
\\sa bluetoothuimodel
|
|
38 |
*/
|
|
39 |
class BtDeviceModelPrivate : public QObject,
|
|
40 |
public MBtDevRepositoryObserver,
|
|
41 |
public MDevDiscoveryObserver
|
|
42 |
{
|
|
43 |
Q_OBJECT
|
|
44 |
|
|
45 |
public:
|
|
46 |
explicit BtDeviceModelPrivate( BtDeviceModel& model, QObject *parent = 0 );
|
|
47 |
|
|
48 |
virtual ~BtDeviceModelPrivate();
|
|
49 |
|
|
50 |
bool isValid( int row, int col ) const;
|
|
51 |
|
|
52 |
int rowCount() const;
|
|
53 |
|
|
54 |
int columnCount() const;
|
|
55 |
|
|
56 |
void data(QVariant& val, int row, int col, int role ) const;
|
|
57 |
|
|
58 |
BtuiModelDataItem itemData( int row, int col ) const;
|
|
59 |
|
|
60 |
bool searchDevice();
|
|
61 |
|
|
62 |
void cancelSearchDevice();
|
|
63 |
|
|
64 |
void removeTransientDevices();
|
|
65 |
|
|
66 |
private:
|
|
67 |
// From MBtDeviceRepositoryObserver
|
|
68 |
|
|
69 |
void RepositoryInitialized();
|
|
70 |
|
|
71 |
void DeletedFromRegistry( const TBTDevAddr& addr );
|
|
72 |
|
|
73 |
void AddedToRegistry( const CBtDevExtension& dev );
|
|
74 |
|
|
75 |
void ChangedInRegistry( const CBtDevExtension& dev, TUint similarity );
|
|
76 |
|
|
77 |
void ServiceConnectionChanged(
|
|
78 |
const CBtDevExtension& dev, TBool connected );
|
|
79 |
|
|
80 |
// from MDevDiscoveryObserver
|
|
81 |
void HandleNextDiscoveryResultL(
|
|
82 |
const TInquirySockAddr& inqAddr, const TDesC& name );
|
|
83 |
|
|
84 |
void HandleDiscoveryCompleted( TInt error );
|
|
85 |
|
|
86 |
signals:
|
|
87 |
|
|
88 |
void deviceDataChanged( int row, void *parent );
|
|
89 |
|
|
90 |
void deviceDataChanged( int first, int last, void *parent );
|
|
91 |
|
|
92 |
void beginInsertDevices(int first, int last, void *parent);
|
|
93 |
void endInsertDevices();
|
|
94 |
|
|
95 |
void beginRemoveDevices(int first, int last, void *parent);
|
|
96 |
void endRemoveDevices();
|
|
97 |
|
|
98 |
void deviceSearchCompleted( int error );
|
|
99 |
|
|
100 |
public slots:
|
|
101 |
//void activeRequestCompleted( int status, int id );
|
|
102 |
|
|
103 |
private:
|
|
104 |
|
|
105 |
void initializeDataStore();
|
|
106 |
|
|
107 |
void updateDeviceProperty(BtuiModelDataItem& qtdev,
|
|
108 |
const CBtDevExtension& dev, TUint similarity );
|
|
109 |
|
|
110 |
int indexOf( const TBTDevAddr& addr ) const;
|
|
111 |
|
|
112 |
void updateRssi(BtuiModelDataItem& qtdev, int rssi );
|
|
113 |
|
|
114 |
void updateSeqNum(BtuiModelDataItem& qtdev, int seqNum );
|
|
115 |
|
|
116 |
void setMajorProperty( BtuiModelDataItem& qtdev, int prop, bool addto);
|
|
117 |
|
|
118 |
bool isDeviceInRange( const BtuiModelDataItem& qtdev );
|
|
119 |
|
|
120 |
bool isDeviceInRegistry( const BtuiModelDataItem& qtdev );
|
|
121 |
|
|
122 |
private:
|
|
123 |
|
|
124 |
BtuiModelDataSource mData;
|
|
125 |
|
|
126 |
BtDeviceModel& mModel;
|
|
127 |
|
|
128 |
CBtDevRepository* mDeviceRepo;
|
|
129 |
|
|
130 |
CAdvanceDevDiscoverer* mDiscover;
|
|
131 |
|
|
132 |
bool isSearchingDevice;
|
|
133 |
|
|
134 |
int mSeqNum; // sequence number based on order the device is found during search
|
|
135 |
|
|
136 |
Q_DISABLE_COPY(BtDeviceModelPrivate)
|
|
137 |
|
|
138 |
};
|
|
139 |
|
47
|
140 |
#endif // BTDEVICEMODELPRIVATE_H
|