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 #include <bt_sock.h> |
|
20 |
|
21 #include "cbtdprserviceadvertiser.h" |
|
22 #include "btprotocolconsts.h" |
|
23 #include "cbtdiscover.h" |
|
24 |
|
25 // ============================ MEMBER FUNCTIONS ============================== |
|
26 |
|
27 // ---------------------------------------------------------------------------- |
|
28 // CBtDprServiceAdvertiser::NewL() |
|
29 // Two-phased constructor. |
|
30 // ---------------------------------------------------------------------------- |
|
31 // |
|
32 CBtDprServiceAdvertiser* CBtDprServiceAdvertiser::NewL() |
|
33 { |
|
34 CBtDprServiceAdvertiser* self = |
|
35 CBtDprServiceAdvertiser::NewLC(); |
|
36 CleanupStack::Pop( self ); |
|
37 return self; |
|
38 } |
|
39 |
|
40 // ---------------------------------------------------------------------------- |
|
41 // CBtDprServiceAdvertiser::NewLC() |
|
42 // Two-phased constructor. |
|
43 // ---------------------------------------------------------------------------- |
|
44 // |
|
45 CBtDprServiceAdvertiser* CBtDprServiceAdvertiser::NewLC() |
|
46 { |
|
47 CBtDprServiceAdvertiser* self = new ( |
|
48 ELeave ) CBtDprServiceAdvertiser(); |
|
49 CleanupStack::PushL( self ); |
|
50 self->ConstructL(); |
|
51 return self; |
|
52 } |
|
53 |
|
54 // ---------------------------------------------------------------------------- |
|
55 // CBtDprServiceAdvertiser::ConstructL() |
|
56 // Symbian 2nd phase constructor can leave. |
|
57 // ---------------------------------------------------------------------------- |
|
58 // |
|
59 void CBtDprServiceAdvertiser::ConstructL() |
|
60 { |
|
61 iServiceDescription = KServiceDescription().AllocL(); |
|
62 } |
|
63 |
|
64 // ---------------------------------------------------------------------------- |
|
65 // CBtDprServiceAdvertiser::CBtDprServiceAdvertiser() |
|
66 // Constructor. |
|
67 // ---------------------------------------------------------------------------- |
|
68 // |
|
69 CBtDprServiceAdvertiser::CBtDprServiceAdvertiser() |
|
70 { |
|
71 // no implementation required |
|
72 } |
|
73 |
|
74 // ---------------------------------------------------------------------------- |
|
75 // CBtDprServiceAdvertiser::~CBtDprServiceAdvertiser() |
|
76 // Destructor. |
|
77 // ---------------------------------------------------------------------------- |
|
78 // |
|
79 CBtDprServiceAdvertiser::~CBtDprServiceAdvertiser() |
|
80 { |
|
81 |
|
82 // Delete private member |
|
83 delete iServiceDescription; |
|
84 } |
|
85 |
|
86 // ---------------------------------------------------------------------------- |
|
87 // CBtDprServiceAdvertiser::BuildProtocolDescriptionL() |
|
88 // Builds the protocol description. |
|
89 // ---------------------------------------------------------------------------- |
|
90 // |
|
91 void CBtDprServiceAdvertiser |
|
92 ::BuildProtocolDescriptionL( CSdpAttrValueDES* aProtocolDescriptor, |
|
93 TInt aPort ) |
|
94 { |
|
95 TBuf8<1> channel; |
|
96 channel.Append( ( TChar )aPort ); |
|
97 |
|
98 aProtocolDescriptor |
|
99 ->StartListL() // List of protocols required for this method |
|
100 ->BuildDESL() |
|
101 ->StartListL() // Details of lowest level protocol |
|
102 ->BuildUUIDL( KL2CAP ) |
|
103 ->EndListL() |
|
104 |
|
105 ->BuildDESL() |
|
106 ->StartListL() |
|
107 ->BuildUUIDL( KRFCOMM ) |
|
108 ->BuildUintL( channel ) |
|
109 ->EndListL() |
|
110 |
|
111 ->BuildDESL() |
|
112 ->StartListL() |
|
113 ->BuildUUIDL( KBTSDPObex ) |
|
114 ->EndListL() |
|
115 |
|
116 ->BuildDESL() |
|
117 ->StartListL() |
|
118 ->BuildUUIDL( KBTSDPDPROService ) |
|
119 ->EndListL() |
|
120 ->EndListL(); |
|
121 |
|
122 } |
|
123 |
|
124 // ---------------------------------------------------------------------------- |
|
125 // CBtDprServiceAdvertiser::ServiceName() |
|
126 // ---------------------------------------------------------------------------- |
|
127 // |
|
128 const TDesC& CBtDprServiceAdvertiser::ServiceName() |
|
129 { |
|
130 return KServiceName; |
|
131 } |
|
132 |
|
133 // ---------------------------------------------------------------------------- |
|
134 // CBtDprServiceAdvertiser::ServiceDescription() |
|
135 // ---------------------------------------------------------------------------- |
|
136 // |
|
137 const TDesC& CBtDprServiceAdvertiser::ServiceDescription() |
|
138 { |
|
139 return *iServiceDescription; |
|
140 } |
|
141 |
|
142 // ---------------------------------------------------------------------------- |
|
143 // CBtDprServiceAdvertiser::ServiceClass() |
|
144 // ---------------------------------------------------------------------------- |
|
145 // |
|
146 TUint CBtDprServiceAdvertiser::ServiceClass() |
|
147 { |
|
148 return KServiceClass; |
|
149 } |
|
150 |
|
151 // End of File |
|