|
1 /* |
|
2 * Copyright (c) 2002 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: BT device and service searcher |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CBTOBEXSEARCHER_H |
|
21 #define CBTOBEXSEARCHER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <ObexSearcherBase.h> |
|
25 #include <bttypes.h> |
|
26 #include <obex.h> |
|
27 #include <btengsettings.h> |
|
28 #include "Btconninfo.h" |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CNSmlObexServiceSearcher; |
|
32 class CObexClient; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * Searches for Bluetooth devices |
|
38 */ |
|
39 class CBTObexSearcher : public CObexSearcherBase , public MBTEngSettingsObserver |
|
40 { |
|
41 public: // Constructors and destructor |
|
42 |
|
43 /** |
|
44 * Two-phased constructor. |
|
45 */ |
|
46 static CBTObexSearcher* NewL( const TBTConnInfo& aBTConnInfo ); |
|
47 |
|
48 /** |
|
49 * Destructor. |
|
50 */ |
|
51 virtual ~CBTObexSearcher(); |
|
52 |
|
53 protected: // Functions from base classes |
|
54 |
|
55 /** |
|
56 * Search for a device |
|
57 */ |
|
58 void SearchDeviceL(); |
|
59 |
|
60 /** |
|
61 * Search for a service |
|
62 */ |
|
63 void SearchServiceL(); |
|
64 |
|
65 /** |
|
66 * Create OBEX client |
|
67 */ |
|
68 CObexClient* CreateObexClientL(); |
|
69 |
|
70 void RunL(); |
|
71 |
|
72 void DoCancel(); |
|
73 |
|
74 /** |
|
75 * From MBTEngSettingsObserver. |
|
76 * Provides notification of changes in the power state |
|
77 * of the Bluetooth hardware. |
|
78 * |
|
79 * |
|
80 * @param aState EBTPowerOff if the BT hardware has been turned off, |
|
81 * EBTPowerOn if it has been turned on. |
|
82 */ |
|
83 void PowerStateChanged( TBTPowerStateValue aState ); |
|
84 |
|
85 /** |
|
86 * From MBTEngSettingsObserver. |
|
87 * Provides notification of changes in the discoverability |
|
88 * mode of the Bluetooth hardware. |
|
89 * |
|
90 * |
|
91 * @param aState EBTDiscModeHidden if the BT hardware is in hidden mode, |
|
92 * EBTDiscModeGeneral if it is in visible mode. |
|
93 */ |
|
94 void VisibilityModeChanged( TBTVisibilityMode aState ); |
|
95 |
|
96 private: |
|
97 |
|
98 /** |
|
99 * C++ default constructor. |
|
100 */ |
|
101 CBTObexSearcher(); |
|
102 |
|
103 /** |
|
104 * By default Symbian 2nd phase constructor is private. |
|
105 */ |
|
106 void ConstructL( const TBTConnInfo& aBTConnInfo ); |
|
107 |
|
108 /** |
|
109 * Checks the offline mode and queries the user for turning BT on if |
|
110 * required. |
|
111 * |
|
112 * |
|
113 * @return ETrue if the phone is in offline mode, otherwise EFalse. |
|
114 */ |
|
115 TBool CheckOfflineModeL(); |
|
116 |
|
117 private: // Data |
|
118 |
|
119 CNSmlObexServiceSearcher* iServiceSearcher; |
|
120 |
|
121 TBool iWaitingForBTPower; |
|
122 |
|
123 TPckgBuf<TBool> iOffline; |
|
124 |
|
125 RNotifier iNotifier; |
|
126 |
|
127 CBTEngSettings* iSettings; |
|
128 }; |
|
129 |
|
130 #endif // CBTOBEXSEARCHER_H |
|
131 |
|
132 // End of File |