|
1 /* |
|
2 * Copyright (c) 2006-2007 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: Maintain a Bluetooth devices data model for Blocked devices view. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "btblockedmodel.h" |
|
21 #include "debug.h" |
|
22 |
|
23 // --------------------------------------------------------------------- |
|
24 // constructor |
|
25 // ---------------------------------------------------------------------- |
|
26 CBTBlockedModel::CBTBlockedModel(MBTDeviceObserver* aObserver,TBTDeviceSortOrder* aOrder ) |
|
27 : CBTDevModelBase(aObserver, aOrder) |
|
28 { |
|
29 TRACE_FUNC |
|
30 } |
|
31 // --------------------------------------------------------------------- |
|
32 // CBTBlockedModel::NewL |
|
33 // ---------------------------------------------------------------------- |
|
34 CBTBlockedModel* CBTBlockedModel::NewL(MBTDeviceObserver* aObserver, TBTDeviceSortOrder* aOrder ) |
|
35 { |
|
36 CBTBlockedModel* self = new (ELeave) CBTBlockedModel(aObserver, aOrder); |
|
37 CleanupStack::PushL(self); |
|
38 self->ConstructL(); |
|
39 CleanupStack::Pop(self); |
|
40 return self; |
|
41 } |
|
42 // --------------------------------------------------------------------- |
|
43 // destructor |
|
44 // ---------------------------------------------------------------------- |
|
45 CBTBlockedModel::~CBTBlockedModel() |
|
46 { |
|
47 TRACE_FUNC |
|
48 } |
|
49 // --------------------------------------------------------------------- |
|
50 // CBTBlockedModel::ConstructL |
|
51 // ---------------------------------------------------------------------- |
|
52 void CBTBlockedModel::ConstructL() |
|
53 { |
|
54 TRACE_FUNC_ENTRY |
|
55 // get all devices from btregistry to iDeviceArray - a TBTDevice array |
|
56 iDevMan = CBTEngDevMan::NewL(this); |
|
57 iSearchPattern.FindAll(); |
|
58 iRegistryObserver = CBTRegistryObserver::NewL(this, iSearchPattern); |
|
59 iRegistryObserver->Refresh(); |
|
60 TRACE_FUNC_EXIT |
|
61 } |
|
62 // --------------------------------------------------------------------- |
|
63 // CBTBlockedModel::HandleNewDeviceL |
|
64 // from CBTDevModel |
|
65 // ---------------------------------------------------------------------- |
|
66 void CBTBlockedModel::HandleNewDeviceL(const CBTDevice* aRegDevice, |
|
67 TNameEntry* aNameEntry) |
|
68 { |
|
69 TRACE_FUNC_ENTRY |
|
70 TBTDeviceSecurity security = aRegDevice->GlobalSecurity(); |
|
71 if (security.Banned()) |
|
72 { |
|
73 AddDeviceL(aRegDevice, aNameEntry, EOpBlock); |
|
74 } |
|
75 TRACE_FUNC_EXIT |
|
76 } |
|
77 |