|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "tavsrc.h" |
|
17 |
|
18 void CAVTestApp::RegisterSinkSDPRecordL(RSdpDatabase& aDB, TBool aHeadphone, |
|
19 TBool aSpeaker,TBool aRecorder,TBool aAmp) |
|
20 { |
|
21 CSdpAttrValue* attrVal = 0; |
|
22 CSdpAttrValueDES* attrValDES = 0; |
|
23 |
|
24 // Set Attr 1 (service class list) to list with UUID = Audio Sink |
|
25 aDB.CreateServiceRecordL(TUUID(KAudioSinkUUID), iSnkHandle); |
|
26 |
|
27 // Protocol Descriptor List |
|
28 attrValDES = CSdpAttrValueDES::NewDESL(0); |
|
29 CleanupStack::PushL(attrValDES); |
|
30 |
|
31 attrValDES->StartListL() |
|
32 ->BuildDESL() |
|
33 ->StartListL() |
|
34 ->BuildUUIDL(TUUID(TUint16(KL2CAPUUID))) // L2CAP |
|
35 ->BuildUintL(TSdpIntBuf<TUint16>(KAVDTP)) // PSM = AVDTP |
|
36 ->EndListL() |
|
37 ->BuildDESL() |
|
38 ->StartListL() |
|
39 ->BuildUUIDL(TUUID(TUint16(KAvdtpUUID))) // Avdtp UUID |
|
40 ->BuildUintL(TSdpIntBuf<TUint16>(0x0100)) // Version |
|
41 ->EndListL() |
|
42 ->EndListL(); |
|
43 aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdProtocolDescriptorList, *attrValDES); |
|
44 CleanupStack::PopAndDestroy(attrValDES); |
|
45 attrValDES = 0; |
|
46 |
|
47 //BrowseGroupList |
|
48 /* |
|
49 This has been added in order to be interoperable with remote devices which only look for the |
|
50 service in the PublicBrowseGroup (the root of the browse hierarchy). This is not a mandatory feature. |
|
51 */ |
|
52 attrValDES = CSdpAttrValueDES::NewDESL(0); |
|
53 CleanupStack::PushL(attrValDES); |
|
54 |
|
55 attrValDES->StartListL() |
|
56 ->BuildUUIDL(TUUID(TUint16(KPublicBrowseGroupUUID))) // Public browse group (the root) |
|
57 ->EndListL(); |
|
58 aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdBrowseGroupList, *attrValDES); //attribute 5 |
|
59 CleanupStack::PopAndDestroy(attrValDES); |
|
60 attrValDES = NULL; |
|
61 |
|
62 // Language |
|
63 attrValDES = CSdpAttrValueDES::NewDESL(0); |
|
64 CleanupStack::PushL(attrValDES); |
|
65 |
|
66 attrValDES->StartListL() |
|
67 ->BuildUintL(TSdpIntBuf<TUint16>(KLanguageEnglish)) |
|
68 ->BuildUintL(TSdpIntBuf<TUint16>(KSdpAttrIdCharacterEncodingUTF8)) |
|
69 ->BuildUintL(TSdpIntBuf<TUint16>(KSdpAttrIdBasePrimaryLanguage)) |
|
70 ->EndListL(); |
|
71 aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdLanguageBaseAttributeIDList, *attrValDES); |
|
72 CleanupStack::PopAndDestroy(attrValDES); |
|
73 attrValDES = 0; |
|
74 |
|
75 // BT Profile Description |
|
76 attrValDES = CSdpAttrValueDES::NewDESL(0); |
|
77 CleanupStack::PushL(attrValDES); |
|
78 |
|
79 attrValDES->StartListL() |
|
80 ->BuildDESL()->StartListL() |
|
81 ->BuildUUIDL(KAdvancedAudioDistributionUUID) |
|
82 ->BuildUintL(TSdpIntBuf<TUint16>(0x0100)) // version |
|
83 ->EndListL() |
|
84 ->EndListL(); |
|
85 aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdBluetoothProfileDescriptorList, *attrValDES); |
|
86 |
|
87 CleanupStack::PopAndDestroy(attrValDES); |
|
88 attrValDES = 0; |
|
89 |
|
90 |
|
91 // provider name |
|
92 attrVal = CSdpAttrValueString::NewStringL(_L8("Symbian Software Ltd")); |
|
93 CleanupStack::PushL(attrVal); |
|
94 aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetProviderName, *attrVal); |
|
95 CleanupStack::PopAndDestroy(attrVal); |
|
96 attrVal = 0; |
|
97 |
|
98 // service name |
|
99 attrVal = CSdpAttrValueString::NewStringL(_L8("Advanced audio distribution sink")); |
|
100 CleanupStack::PushL(attrVal); |
|
101 aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceName, *attrVal); |
|
102 CleanupStack::PopAndDestroy(attrVal); |
|
103 attrVal = 0; |
|
104 |
|
105 // service description |
|
106 attrVal = CSdpAttrValueString::NewStringL(_L8("kick back and listen to some fine tunes with this neat service")); |
|
107 CleanupStack::PushL(attrVal); |
|
108 aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceDescription, *attrVal); |
|
109 CleanupStack::PopAndDestroy(attrVal); |
|
110 attrVal = 0; |
|
111 |
|
112 // supported features |
|
113 TUint16 supportedFeatures = aHeadphone ? 1:0; |
|
114 supportedFeatures|=aSpeaker ? 2:0; |
|
115 supportedFeatures|=aRecorder ? 4:0; |
|
116 supportedFeatures|=aAmp ? 8:0; |
|
117 attrVal = CSdpAttrValueUint::NewUintL(TSdpIntBuf<TUint16>(supportedFeatures)); |
|
118 CleanupStack::PushL(attrVal); |
|
119 |
|
120 aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdSupportedFeatures, *attrVal); |
|
121 CleanupStack::PopAndDestroy(attrVal); |
|
122 attrVal = 0; |
|
123 } |
|
124 |
|
125 |
|
126 void CAVTestApp::RegisterSourceSDPRecordL(RSdpDatabase& aDB, TBool aPlayer, |
|
127 TBool aMic,TBool aTuner,TBool aMixer) |
|
128 { |
|
129 CSdpAttrValue* attrVal = 0; |
|
130 CSdpAttrValueDES* attrValDES = 0; |
|
131 |
|
132 // Set Attr 1 (service class list) to list with UUID = Audio Sink |
|
133 aDB.CreateServiceRecordL(TUUID(KAudioSourceUUID), iSrcHandle); |
|
134 |
|
135 // Protocol Descriptor List |
|
136 attrValDES = CSdpAttrValueDES::NewDESL(0); |
|
137 CleanupStack::PushL(attrValDES); |
|
138 |
|
139 attrValDES->StartListL() |
|
140 ->BuildDESL() |
|
141 ->StartListL() |
|
142 ->BuildUUIDL(TUUID(TUint16(KL2CAPUUID))) // L2CAP |
|
143 ->BuildUintL(TSdpIntBuf<TUint16>(KAVDTP)) // PSM = AVDTP |
|
144 ->EndListL() |
|
145 ->BuildDESL() |
|
146 ->StartListL() |
|
147 ->BuildUUIDL(TUUID(TUint16(KAvdtpUUID))) // Avdtp UUID |
|
148 ->BuildUintL(TSdpIntBuf<TUint16>(0x0100)) // Version |
|
149 ->EndListL() |
|
150 ->EndListL(); |
|
151 aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdProtocolDescriptorList, *attrValDES); |
|
152 CleanupStack::PopAndDestroy(attrValDES); |
|
153 attrValDES = 0; |
|
154 |
|
155 //BrowseGroupList |
|
156 /* |
|
157 This has been added in order to be interoperable with remote devices which only look for the |
|
158 service in the PublicBrowseGroup (the root of the browse hierarchy). This is not a mandatory feature. |
|
159 */ |
|
160 attrValDES = CSdpAttrValueDES::NewDESL(0); |
|
161 CleanupStack::PushL(attrValDES); |
|
162 |
|
163 attrValDES->StartListL() |
|
164 ->BuildUUIDL(TUUID(TUint16(KPublicBrowseGroupUUID))) // Public browse group (the root) |
|
165 ->EndListL(); |
|
166 aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdBrowseGroupList, *attrValDES); //attribute 5 |
|
167 CleanupStack::PopAndDestroy(attrValDES); |
|
168 attrValDES = NULL; |
|
169 |
|
170 // Language |
|
171 attrValDES = CSdpAttrValueDES::NewDESL(0); |
|
172 CleanupStack::PushL(attrValDES); |
|
173 |
|
174 attrValDES->StartListL() |
|
175 ->BuildUintL(TSdpIntBuf<TUint16>(KLanguageEnglish)) |
|
176 ->BuildUintL(TSdpIntBuf<TUint16>(KSdpAttrIdCharacterEncodingUTF8)) |
|
177 ->BuildUintL(TSdpIntBuf<TUint16>(KSdpAttrIdBasePrimaryLanguage)) |
|
178 ->EndListL(); |
|
179 aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdLanguageBaseAttributeIDList, *attrValDES); |
|
180 CleanupStack::PopAndDestroy(attrValDES); |
|
181 attrValDES = 0; |
|
182 |
|
183 // BT Profile Description |
|
184 attrValDES = CSdpAttrValueDES::NewDESL(0); |
|
185 CleanupStack::PushL(attrValDES); |
|
186 |
|
187 attrValDES->StartListL() |
|
188 ->BuildDESL()->StartListL() |
|
189 ->BuildUUIDL(KAdvancedAudioDistributionUUID) |
|
190 ->BuildUintL(TSdpIntBuf<TUint16>(0x0100)) // version |
|
191 ->EndListL() |
|
192 ->EndListL(); |
|
193 aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdBluetoothProfileDescriptorList, *attrValDES); |
|
194 |
|
195 CleanupStack::PopAndDestroy(attrValDES); |
|
196 attrValDES = 0; |
|
197 |
|
198 |
|
199 // provider name |
|
200 attrVal = CSdpAttrValueString::NewStringL(_L8("Symbian Software Ltd")); |
|
201 CleanupStack::PushL(attrVal); |
|
202 aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetProviderName, *attrVal); |
|
203 CleanupStack::PopAndDestroy(attrVal); |
|
204 attrVal = 0; |
|
205 |
|
206 // service name |
|
207 attrVal = CSdpAttrValueString::NewStringL(_L8("Advanced audio distribution source")); |
|
208 CleanupStack::PushL(attrVal); |
|
209 aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceName, *attrVal); |
|
210 CleanupStack::PopAndDestroy(attrVal); |
|
211 attrVal = 0; |
|
212 |
|
213 // service description |
|
214 attrVal = CSdpAttrValueString::NewStringL(_L8("plug your wireless cans into me!")); |
|
215 CleanupStack::PushL(attrVal); |
|
216 aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceDescription, *attrVal); |
|
217 CleanupStack::PopAndDestroy(attrVal); |
|
218 attrVal = 0; |
|
219 |
|
220 // supported features |
|
221 |
|
222 TUint16 supportedFeatures = aPlayer ? 1:0; |
|
223 supportedFeatures|=aMic ? 2:0; |
|
224 supportedFeatures|=aTuner ? 4:0; |
|
225 supportedFeatures|=aMixer ? 8:0; |
|
226 attrVal = CSdpAttrValueUint::NewUintL(TSdpIntBuf<TUint16>(supportedFeatures)); |
|
227 CleanupStack::PushL(attrVal); |
|
228 |
|
229 aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdSupportedFeatures, *attrVal); |
|
230 CleanupStack::PopAndDestroy(attrVal); |
|
231 attrVal = 0; |
|
232 } |
|
233 |