1 /* |
|
2 * Copyright (c) 2004-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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CBTSDPADVERTISER_H |
|
20 #define CBTSDPADVERTISER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <btsdp.h> |
|
24 #include <btmanclient.h> |
|
25 |
|
26 /** |
|
27 * CBtSdpAdvertiser |
|
28 * Base class for advertising service in the SDP database. |
|
29 */ |
|
30 NONSHARABLE_CLASS( CBtSdpAdvertiser ) : public CBase |
|
31 { |
|
32 public: // Constructors and destructor |
|
33 |
|
34 /** |
|
35 * ~CBtSdpAdvertiser() |
|
36 * Destroy the object, close all open handles |
|
37 * and remove the advertised service. |
|
38 */ |
|
39 virtual ~CBtSdpAdvertiser(); |
|
40 |
|
41 /** |
|
42 * StartAdvertisingL() |
|
43 * Start the advertising of this service |
|
44 * @param aPort the port being used by the service |
|
45 */ |
|
46 void StartAdvertisingL( TInt aPort ); |
|
47 |
|
48 /** |
|
49 * StopAdvertisingL() |
|
50 * Stop advertising this service. Remove the record |
|
51 * from the sdp database |
|
52 */ |
|
53 void StopAdvertisingL(); |
|
54 |
|
55 /** |
|
56 * IsAdvertising() |
|
57 * Does the SDP database contain a record for this service |
|
58 * @return ETrue whether the service is being advertised |
|
59 */ |
|
60 TBool IsAdvertising(); |
|
61 |
|
62 /** |
|
63 * UpdateAvailabilityL() |
|
64 * Update the service availability field of the service record |
|
65 * @param aIsAvailable ETrue is the service is not busy. |
|
66 */ |
|
67 void UpdateAvailabilityL( TBool aIsAvailable ); |
|
68 |
|
69 protected: // Constructor |
|
70 |
|
71 /** |
|
72 * CBtSdpAdvertiser() |
|
73 * Construct this object |
|
74 */ |
|
75 CBtSdpAdvertiser(); |
|
76 |
|
77 /** |
|
78 * BuildProtocolDescriptionL() |
|
79 * Builds the protocol description |
|
80 * @param aProtocolDescriptor the protocol descriptor |
|
81 * @param aPort the service port |
|
82 */ |
|
83 virtual void BuildProtocolDescriptionL( |
|
84 CSdpAttrValueDES* aProtocolDescriptor, TInt aPort ) = 0; |
|
85 |
|
86 /** |
|
87 * ServiceClass() |
|
88 * @return the service class |
|
89 */ |
|
90 virtual TUint ServiceClass() = 0; |
|
91 |
|
92 /** |
|
93 * ServiceName() |
|
94 * @return the service name |
|
95 */ |
|
96 virtual const TDesC& ServiceName() = 0; |
|
97 |
|
98 /** |
|
99 * ServiceDescription() |
|
100 * @return the service description |
|
101 */ |
|
102 virtual const TDesC& ServiceDescription() = 0; |
|
103 |
|
104 private: |
|
105 |
|
106 /** |
|
107 * ConnectL |
|
108 * Connect to the SDP database |
|
109 */ |
|
110 void ConnectL(); |
|
111 |
|
112 private: //data |
|
113 |
|
114 /** iSdpSession a handle to the SDP session */ |
|
115 RSdp iSdpSession; |
|
116 |
|
117 /** iSdpDatabase a connection to the SDP database */ |
|
118 RSdpDatabase iSdpDatabase; |
|
119 |
|
120 /**iRecord the record handle of the service |
|
121 record for this server |
|
122 */ |
|
123 TSdpServRecordHandle iRecord; |
|
124 |
|
125 /**iRecordState the current record state - change number */ |
|
126 TInt iRecordState; |
|
127 |
|
128 /** iIsConnected has a connection been made to the SDP Database */ |
|
129 TBool iIsConnected; |
|
130 }; |
|
131 |
|
132 #endif // CBTSDPADVERTISER_H |
|
133 |
|
134 // End of File |
|