|
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 // Build a static SDP Database |
|
15 // |
|
16 // |
|
17 |
|
18 #include "SDPDatabase.h" |
|
19 |
|
20 |
|
21 // Offsets and constants |
|
22 /*const TInt KRecordHandleOffset = 9; |
|
23 const TInt KTotalCountOffset = 5; |
|
24 const TInt KCurrentCountOffset = 7; |
|
25 const TInt KErrorCodeOffset = 5; |
|
26 const TInt KAttributeByteCountOffset = 5; |
|
27 const TInt KAttributeListOffset = 7;*/ |
|
28 |
|
29 |
|
30 void BuildRecordZeroL(CSdpDatabase* aDb) |
|
31 /** |
|
32 Record 0 should be used when a server instance is created. |
|
33 note that attributes 2, 5 and 0x201 should be updated. |
|
34 also note only English, pas de Francais, keine Deutsch, non Espanol |
|
35 **/ |
|
36 { |
|
37 TBuf8<2> attrId; |
|
38 TBuf8<4> val; |
|
39 CSdpServRecord* theRec = CSdpServRecord::NewL(); |
|
40 CleanupStack::PushL(theRec); |
|
41 |
|
42 |
|
43 // Set Attr 0 (Record handle) to 0 |
|
44 attrId.FillZ(2); |
|
45 val.FillZ(4); |
|
46 theRec->BuildUintL(attrId)->BuildUintL(val); |
|
47 |
|
48 // Set Attr 1 (service class list) to list with UUID = 0x1000 |
|
49 attrId[0] = 0x00; |
|
50 attrId[1] = 0x01; |
|
51 theRec->BuildUintL(attrId)->BuildDESL() |
|
52 ->StartListL() |
|
53 ->BuildUUIDL(TUUID(TUint16(0x1000))) |
|
54 ->EndListL(); |
|
55 |
|
56 // Set Attr 2 (service record state) to 0 |
|
57 attrId[0] = 0x00; |
|
58 attrId[1] = 0x02; |
|
59 val.FillZ(4); |
|
60 theRec->BuildUintL(attrId)->BuildUintL(val); |
|
61 |
|
62 |
|
63 // Set attr 4 (protocol list) to L2CAP, no RFCOMM, no OBEX |
|
64 attrId[0] = 0x00; |
|
65 attrId[1] = 0x04; |
|
66 val.FillZ(4); |
|
67 val[3] = 1; |
|
68 theRec->BuildUintL(attrId)->BuildDESL() |
|
69 ->StartListL() |
|
70 ->BuildDESL() |
|
71 ->StartListL() |
|
72 ->BuildUUIDL(TUUID(TUint16(0x0100))) // L2CAP |
|
73 ->EndListL() |
|
74 ->EndListL(); |
|
75 |
|
76 // Set Attr 5 (browse group list) to list with one UUID |
|
77 // 0x1000 (SDP server class) |
|
78 // this should be updated with other service classes when other services are added. |
|
79 attrId[0] = 0x00; |
|
80 attrId[1] = 5; |
|
81 theRec->BuildUintL(attrId)->BuildDESL() |
|
82 ->StartListL() |
|
83 ->BuildUUIDL(TUUID(TUint32(0x1002))) |
|
84 ->EndListL(); |
|
85 |
|
86 // Set Attr 0x006 (language base) |
|
87 attrId[0] = 0x00; |
|
88 attrId[1] = 0x06; |
|
89 TUint16 lang = 0x656e; |
|
90 TUint16 coding = 0x006a; |
|
91 TUint16 base = 0x0100; |
|
92 |
|
93 theRec->BuildUintL(attrId)->BuildDESL() |
|
94 ->StartListL() |
|
95 ->BuildUintL(TSdpIntBuf<TUint16>(lang)) // english |
|
96 ->BuildUintL(TSdpIntBuf<TUint16>(coding)) // UTF-8 |
|
97 ->BuildUintL(TSdpIntBuf<TUint16>(base)) // language base |
|
98 ->EndListL(); |
|
99 |
|
100 // Set Attr 0x007 (time to live) to 1200 (0x4B0) seconds (20 minutes) |
|
101 attrId[0] = 0x00; |
|
102 attrId[1] = 0x07; |
|
103 val.FillZ(4); |
|
104 val[2]=4; |
|
105 val[3]=0xb0; |
|
106 theRec->BuildUintL(attrId)->BuildUintL(val); |
|
107 |
|
108 // Set Attr 0x008 (availability) to 0xff - fully available - not in use |
|
109 attrId[0] = 0x00; |
|
110 attrId[1] = 0x08; |
|
111 TBuf8<1> val4; |
|
112 val4.FillZ(1); |
|
113 val4[0]=0xff; |
|
114 theRec->BuildUintL(attrId)->BuildUintL(val4); |
|
115 |
|
116 |
|
117 // Set Attr 0x100 (default Name) to string |
|
118 attrId[0] = 0x01; |
|
119 attrId[1] = 0; |
|
120 theRec->BuildUintL(attrId)->BuildStringL(_L8("SDP Server")); |
|
121 |
|
122 // Set Attr 0x101 (def. description) to string |
|
123 attrId[0] = 0x01; |
|
124 attrId[1] = 1; |
|
125 theRec->BuildUintL(attrId)->BuildStringL(_L8("EPOC SDP server UPF-4")); |
|
126 |
|
127 // Set Attr 0x102 (def. provider) to Symbian |
|
128 attrId[0] = 0x01; |
|
129 attrId[1] = 2; |
|
130 theRec->BuildUintL(attrId)->BuildStringL(_L8("Symbian Ltd.")); |
|
131 |
|
132 // Set Attr 0x201 (service database state) to 0 |
|
133 attrId[0] = 0x02; |
|
134 attrId[1] = 0x01; |
|
135 val.FillZ(4); |
|
136 theRec->BuildUintL(attrId)->BuildUintL(val); |
|
137 |
|
138 CleanupStack::Pop(); |
|
139 // Add the record into the database |
|
140 aDb->AddRecord(theRec); |
|
141 } |
|
142 |
|
143 |
|
144 |
|
145 // this is a real dummy database which doesn't conform to the service class attribute numbering |
|
146 CSdpDatabase *BuildDbL() |
|
147 { |
|
148 CSdpDatabase *theDb = CSdpDatabase::NewL(); |
|
149 |
|
150 // First Record |
|
151 CSdpServRecord *theRec = CSdpServRecord::NewL(); |
|
152 |
|
153 // Set Attr 0 (Record handle) to 0 |
|
154 theRec->BuildUintL(TSdpIntBuf<TUint16>(0))->BuildUintL(TSdpIntBuf<TUint32>(0)); |
|
155 // Set Attr 0x100 (default Name) to string |
|
156 theRec->BuildUintL(TSdpIntBuf<TUint16>(0x100))->BuildStringL(_L8("SDP Server")); |
|
157 // Set Attr 0x102 (def. provider) to Symbian |
|
158 theRec->BuildUintL(TSdpIntBuf<TUint16>(0x102))->BuildStringL(_L8("Symbian Ltd.")); |
|
159 // Set Attr 0x101 (def. description) to string |
|
160 theRec->BuildUintL(TSdpIntBuf<TUint16>(0x101))->BuildStringL(_L8("EPOC SDP server test suite")); |
|
161 // Set Attr 1 (service class list) to list with one UUID = 0x1000 (SDP server service) |
|
162 theRec->BuildUintL(TSdpIntBuf<TUint16>(1))->BuildDESL() |
|
163 ->StartListL() |
|
164 ->BuildUUIDL(TUUID(TUint32(0x1000))) |
|
165 ->EndListL(); |
|
166 // Add the record into the database |
|
167 theDb->AddRecord(theRec); |
|
168 |
|
169 // Second Record |
|
170 theRec = CSdpServRecord::NewL(); |
|
171 |
|
172 // Set Attr 0 (Record handle) to 0x11223344 |
|
173 theRec->BuildUintL(TSdpIntBuf<TUint16>(0))->BuildUintL(TSdpIntBuf<TUint32>(0x11223344)); |
|
174 // Set Attr 0x100 (default Name) to string |
|
175 theRec->BuildUintL(TSdpIntBuf<TUint16>(0x100))->BuildStringL(_L8("Dummy Service")); |
|
176 // Set Attr 0x101 (def. description) to string |
|
177 theRec->BuildUintL(TSdpIntBuf<TUint16>(0x101))->BuildStringL(_L8("A Test SDP record")); |
|
178 // Set Attr 1 (service class list) to list with Two UUID = 0x1000, 0x55667788 |
|
179 theRec->BuildUintL(TSdpIntBuf<TUint16>(1))->BuildDESL() |
|
180 ->StartListL() |
|
181 ->BuildUUIDL(TUUID(TUint32(0x1000))) |
|
182 ->BuildUUIDL(TUUID(TUint32(0x55667788))) |
|
183 ->EndListL(); |
|
184 // Set Attr 3 (service ID) to a bogoid 0x9999 |
|
185 theRec->BuildUintL(TSdpIntBuf<TUint16>(3))->BuildUUIDL(TUUID(TUint16(0x9999))); |
|
186 // Add the record into the database |
|
187 theDb->AddRecord(theRec); |
|
188 |
|
189 // Third Record |
|
190 theRec = CSdpServRecord::NewL(); |
|
191 |
|
192 // Set Attr 0 (Record handle) to 0x9899 |
|
193 theRec->BuildUintL(TSdpIntBuf<TUint16>(0))->BuildUintL(TSdpIntBuf<TUint32>(0x9899)); |
|
194 // Set Attr 0x100 (default Name) to string |
|
195 theRec->BuildUintL(TSdpIntBuf<TUint16>(0x100))->BuildStringL(_L8("Another dummy service")); |
|
196 // Set Attr 0x101 (def. description) to string |
|
197 theRec->BuildUintL(TSdpIntBuf<TUint16>(0x101))->BuildStringL(_L8("This is the second service on SDP")); |
|
198 // Set Attr 1 (service class list) to list with one UUID = 0x1105 (OBEX Push) |
|
199 theRec->BuildUintL(TSdpIntBuf<TUint16>(1))->BuildDESL() |
|
200 ->StartListL() |
|
201 ->BuildUUIDL(TUUID(TUint32(0x1105))) |
|
202 ->EndListL(); |
|
203 // Set attr 4 (protocol list) to L2CAP, RFCOMM (DLCI=5) |
|
204 |
|
205 theRec->BuildUintL(TSdpIntBuf<TUint16>(4))->BuildDESL() |
|
206 ->StartListL() |
|
207 ->BuildDESL() |
|
208 ->StartListL() |
|
209 ->BuildUUIDL(TUUID(TUint16(0x0100))) // L2CAP |
|
210 ->EndListL() |
|
211 ->BuildDESL() |
|
212 ->StartListL() |
|
213 ->BuildUUIDL(TUUID(TUint16(0x0003))) // RFCOMM |
|
214 ->BuildUintL(TSdpIntBuf<TUint32>(5)) // DLCI = 5 |
|
215 ->EndListL() |
|
216 ->BuildDESL() |
|
217 ->StartListL() |
|
218 ->BuildUUIDL(TUUID(TUint16(0x0008))) // OBEX |
|
219 ->EndListL() |
|
220 ->EndListL(); |
|
221 |
|
222 // Add the record into the database |
|
223 theDb->AddRecord(theRec); |
|
224 |
|
225 return theDb; |
|
226 } |
|
227 |
|
228 |
|
229 // this is the nearest thing to a real database. |
|
230 // originally for UPF4, but record 0 removed above. |
|
231 |
|
232 CSdpDatabase *BuildUpf4DbL() |
|
233 { |
|
234 CSdpDatabase *theDb = CSdpDatabase::NewL(); |
|
235 |
|
236 TBuf8<2> attrId; |
|
237 TBuf8<4> val; |
|
238 CSdpServRecord *theRec = CSdpServRecord::NewL(); |
|
239 // all attribute IDs are BIG ENDian |
|
240 |
|
241 // Record 0 should be used when a server instance is created. |
|
242 // note that attributes 2, 5 and 0x201 should be updated. |
|
243 // also note only English, pas de Francais, keine Deutsch, non Espanol |
|
244 BuildRecordZeroL(theDb); |
|
245 |
|
246 // Second Record DUN service |
|
247 |
|
248 attrId.FillZ(2); |
|
249 val.FillZ(4); |
|
250 // Set Attr 0 (Record handle) to 0x00010000 |
|
251 val[0] = 0x00; |
|
252 val[1] = 0x01; |
|
253 val[2] = 0x00; |
|
254 val[3] = 0x00; |
|
255 theRec->BuildUintL(attrId)->BuildUintL(val); |
|
256 |
|
257 // Set Attr 1 (service class list) to list with Two UUID = 0x1103, 0x1201 |
|
258 attrId[0] = 0x00; |
|
259 attrId[1] = 0x01; |
|
260 theRec->BuildUintL(attrId)->BuildDESL() |
|
261 ->StartListL() |
|
262 ->BuildUUIDL(TUUID(TUint16(0x1103))) // dial up networking |
|
263 ->BuildUUIDL(TUUID(TUint16(0x1201))) // generic networking |
|
264 ->EndListL(); |
|
265 |
|
266 // Set attr 4 (protocol list) to L2CAP, RFCOMM (DLCI=1), no OBEX |
|
267 attrId[0] = 0x00; |
|
268 attrId[1] = 0x04; |
|
269 val.FillZ(4); |
|
270 val[3] = 1; |
|
271 theRec->BuildUintL(attrId)->BuildDESL() |
|
272 ->StartListL() |
|
273 ->BuildDESL() |
|
274 ->StartListL() |
|
275 ->BuildUUIDL(TUUID(TUint16(0x0100))) // L2CAP |
|
276 ->EndListL() |
|
277 ->BuildDESL() |
|
278 ->StartListL() |
|
279 ->BuildUUIDL(TUUID(TUint16(0x0003))) // RFCOMM |
|
280 ->BuildUintL(TSdpIntBuf<TUint8>(1)) // DLCI = 1 |
|
281 // ->BuildUintL(val) was four bytes // DLCI = 1 |
|
282 ->EndListL() |
|
283 ->EndListL(); |
|
284 |
|
285 // Set Attr 0x005 (browse group list) to public root |
|
286 attrId[0] = 0x00; |
|
287 attrId[1] = 0x05; |
|
288 theRec->BuildUintL(attrId)->BuildDESL() |
|
289 ->StartListL() |
|
290 ->BuildUUIDL(TUUID(TUint16(0x1002))) // publicBrowseRoot |
|
291 ->EndListL(); |
|
292 |
|
293 // Set Attr 0x006 (language base) |
|
294 attrId[0] = 0x00; |
|
295 attrId[1] = 0x06; |
|
296 /* val.FillZ(2); |
|
297 val[0] = 0x65; |
|
298 val[1] = 0x6e; |
|
299 TBuf8<2> val2; |
|
300 TBuf8<2> val3; |
|
301 val2.FillZ(2); |
|
302 val3.FillZ(2); |
|
303 val2[1] = 0x6a; |
|
304 val3[0] = 0x01; |
|
305 */ |
|
306 TUint16 lang = 0x656e; |
|
307 TUint16 coding = 0x006a; |
|
308 TUint16 base = 0x0100; |
|
309 |
|
310 theRec->BuildUintL(attrId)->BuildDESL() |
|
311 ->StartListL() |
|
312 ->BuildUintL(TSdpIntBuf<TUint16>(lang)) // english |
|
313 ->BuildUintL(TSdpIntBuf<TUint16>(coding)) // UTF-8 |
|
314 ->BuildUintL(TSdpIntBuf<TUint16>(base)) // language base |
|
315 ->EndListL(); |
|
316 |
|
317 // Set Attr 0x009 (profile descriptor list) to Dun version 1.00 |
|
318 attrId[0] = 0x00; |
|
319 attrId[1] = 0x09; |
|
320 val.FillZ(2); |
|
321 val[0] = 0x01; |
|
322 |
|
323 theRec->BuildUintL(attrId)->BuildDESL() |
|
324 ->StartListL()->BuildDESL() |
|
325 ->StartListL() |
|
326 ->BuildUUIDL(TUUID(TUint16(KDialUpNetworkingUUID))) // Dialup Networking |
|
327 ->BuildUintL(val) // version 0x100 |
|
328 ->EndListL() |
|
329 ->EndListL(); |
|
330 |
|
331 // Set Attr 0x100 (default Name) to string |
|
332 attrId[1] = 0x00; |
|
333 attrId[0] = 0x01; |
|
334 theRec->BuildUintL(attrId)->BuildStringL(_L8("Dial-up networking")); |
|
335 |
|
336 // Add the record into the database |
|
337 theDb->AddRecord(theRec); |
|
338 |
|
339 |
|
340 |
|
341 // Third Record Fax |
|
342 theRec = CSdpServRecord::NewL(); |
|
343 |
|
344 attrId.FillZ(2); |
|
345 val.FillZ(4); |
|
346 // Set Attr 0 (Record handle) to 0x00010001 |
|
347 val[0] = 0x00; |
|
348 val[1] = 0x01; |
|
349 val[2] = 0x00; |
|
350 val[3] = 0x01; |
|
351 theRec->BuildUintL(attrId)->BuildUintL(val); |
|
352 |
|
353 // Set Attr 1 (service class list) to list with Two UUID = 0x1111, 0x1204 |
|
354 attrId[0] = 0x00; |
|
355 attrId[1] = 0x01; |
|
356 theRec->BuildUintL(attrId)->BuildDESL() |
|
357 ->StartListL() |
|
358 ->BuildUUIDL(TUUID(TUint16(0x1111))) // Fax |
|
359 ->BuildUUIDL(TUUID(TUint16(0x1204))) // generic telephony |
|
360 ->EndListL(); |
|
361 |
|
362 // Set attr 4 (protocol list) to L2CAP, RFCOMM (DLCI=2), no OBEX |
|
363 attrId[0] = 0x00; |
|
364 attrId[1] = 0x04; |
|
365 val.FillZ(4); |
|
366 val[3] = 2; |
|
367 theRec->BuildUintL(attrId)->BuildDESL() |
|
368 ->StartListL() |
|
369 ->BuildDESL() |
|
370 ->StartListL() |
|
371 ->BuildUUIDL(TUUID(TUint16(0x0100))) // L2CAP |
|
372 ->EndListL() |
|
373 ->BuildDESL() |
|
374 ->StartListL() |
|
375 ->BuildUUIDL(TUUID(TUint16(0x0003))) // RFCOMM |
|
376 ->BuildUintL(val) // DLCI = 2 |
|
377 ->EndListL() |
|
378 ->EndListL(); |
|
379 |
|
380 // Set Attr 0x005 (browse group list) to public root |
|
381 attrId[0] = 0x00; |
|
382 attrId[1] = 0x05; |
|
383 theRec->BuildUintL(attrId)->BuildDESL() |
|
384 ->StartListL() |
|
385 ->BuildUUIDL(TUUID(TUint16(0x1002))) // publicBrowseRoot |
|
386 ->EndListL(); |
|
387 |
|
388 // Set Attr 0x006 (language base) |
|
389 attrId[0] = 0x00; |
|
390 attrId[1] = 0x06; |
|
391 lang = 0x656e; |
|
392 coding = 0x006a; |
|
393 base = 0x0100; |
|
394 |
|
395 theRec->BuildUintL(attrId)->BuildDESL() |
|
396 ->StartListL() |
|
397 ->BuildUintL(TSdpIntBuf<TUint16>(lang)) // english |
|
398 ->BuildUintL(TSdpIntBuf<TUint16>(coding)) // UTF-8 |
|
399 ->BuildUintL(TSdpIntBuf<TUint16>(base)) // language base |
|
400 ->EndListL(); |
|
401 |
|
402 // Set Attr 0x009 (profile descriptor list) to Dun version 1.00 |
|
403 attrId[0] = 0x00; |
|
404 attrId[1] = 0x09; |
|
405 val.FillZ(2); |
|
406 val[0] = 0x01; |
|
407 |
|
408 theRec->BuildUintL(attrId)->BuildDESL() |
|
409 ->StartListL()->BuildDESL() |
|
410 ->StartListL() |
|
411 ->BuildUUIDL(TUUID(TUint16(KFaxUUID))) // Fax |
|
412 ->BuildUintL(val) // version 0x100 |
|
413 ->EndListL() |
|
414 ->EndListL(); |
|
415 |
|
416 // Set Attr 0x100 (default Name) to string |
|
417 attrId[1] = 0x00; |
|
418 attrId[0] = 0x01; |
|
419 theRec->BuildUintL(attrId)->BuildStringL(_L8("Fax")); |
|
420 |
|
421 // Add the record into the database |
|
422 theDb->AddRecord(theRec); |
|
423 |
|
424 // Fourth Record Obex |
|
425 theRec = CSdpServRecord::NewL(); |
|
426 |
|
427 attrId.FillZ(2); |
|
428 val.FillZ(4); |
|
429 // Set Attr 0 (Record handle) to 0x00010001 |
|
430 val[0] = 0x00; |
|
431 val[1] = 0x01; |
|
432 val[2] = 0x00; |
|
433 val[3] = 0x02; |
|
434 theRec->BuildUintL(attrId)->BuildUintL(val); |
|
435 |
|
436 // Set Attr 1 (service class list) to list with One UUID = 0x1105 |
|
437 attrId[0] = 0x00; |
|
438 attrId[1] = 0x01; |
|
439 theRec->BuildUintL(attrId)->BuildDESL() |
|
440 ->StartListL() |
|
441 ->BuildUUIDL(TUUID(TUint16(0x1105))) // Obex |
|
442 ->EndListL(); |
|
443 |
|
444 // Set attr 4 (protocol list) to L2CAP, RFCOMM (DLCI=3), OBEX |
|
445 attrId[0] = 0x00; |
|
446 attrId[1] = 0x04; |
|
447 val.FillZ(4); |
|
448 val[3] = 3; |
|
449 theRec->BuildUintL(attrId)->BuildDESL() |
|
450 ->StartListL() |
|
451 ->BuildDESL() |
|
452 ->StartListL() |
|
453 ->BuildUUIDL(TUUID(TUint16(0x0100))) // L2CAP |
|
454 ->EndListL() |
|
455 ->BuildDESL() |
|
456 ->StartListL() |
|
457 ->BuildUUIDL(TUUID(TUint16(0x0003))) // RFCOMM |
|
458 ->BuildUintL(val) // DLCI = 3 |
|
459 ->EndListL() |
|
460 ->BuildDESL() |
|
461 ->StartListL() |
|
462 ->BuildUUIDL(TUUID(TUint16(0x0008))) // Obex |
|
463 ->EndListL() |
|
464 ->EndListL(); |
|
465 |
|
466 // Set Attr 0x005 (browse group list) to public root |
|
467 attrId[0] = 0x00; |
|
468 attrId[1] = 0x05; |
|
469 theRec->BuildUintL(attrId)->BuildDESL() |
|
470 ->StartListL() |
|
471 ->BuildUUIDL(TUUID(TUint16(0x1002))) // publicBrowseRoot |
|
472 ->EndListL(); |
|
473 |
|
474 // Set Attr 0x006 (language base) |
|
475 attrId[0] = 0x00; |
|
476 attrId[1] = 0x06; |
|
477 lang = 0x656e; |
|
478 coding = 0x006a; |
|
479 base = 0x0100; |
|
480 |
|
481 theRec->BuildUintL(attrId)->BuildDESL() |
|
482 ->StartListL() |
|
483 ->BuildUintL(TSdpIntBuf<TUint16>(lang)) // english |
|
484 ->BuildUintL(TSdpIntBuf<TUint16>(coding)) // UTF-8 |
|
485 ->BuildUintL(TSdpIntBuf<TUint16>(base)) // language base |
|
486 ->EndListL(); |
|
487 |
|
488 // Set Attr 0x009 (profile descriptor list) to Obex version 1.00 |
|
489 attrId[0] = 0x00; |
|
490 attrId[1] = 0x09; |
|
491 |
|
492 val.FillZ(2); |
|
493 val[0] = 0x01; |
|
494 |
|
495 theRec->BuildUintL(attrId)->BuildDESL() |
|
496 ->StartListL()->BuildDESL() |
|
497 ->StartListL() |
|
498 ->BuildUUIDL(TUUID(TUint16(KObexUUID))) // Obex |
|
499 ->BuildUintL(val) // version 0x100 |
|
500 ->EndListL() |
|
501 ->EndListL(); |
|
502 |
|
503 // Set Attr 0x100 (default Name) to string |
|
504 attrId[1] = 0x00; |
|
505 attrId[0] = 0x01; |
|
506 theRec->BuildUintL(attrId)->BuildStringL(_L8("OBEX Objext Push")); |
|
507 |
|
508 // Add the record into the database |
|
509 theDb->AddRecord(theRec); |
|
510 |
|
511 return theDb; |
|
512 } |
|
513 |
|
514 void BuildContinuationString(CSdpServRecord* aRec, TSdpAttributeID aID, TUint16 aLen) |
|
515 { |
|
516 HBufC8* buf = HBufC8::NewMaxL(aLen+1); //believe it or not printing requires null termination of string |
|
517 TPtr8 bptr = buf->Des(); |
|
518 bptr.SetLength(0); |
|
519 TPtrC8 base(_L8("Rhubarb")); |
|
520 TChar ch; |
|
521 for(TUint i = 0; i<aLen; ++i) |
|
522 { |
|
523 ch = base.Ptr()[i%(base.Length())]; |
|
524 //bptr[i] = ch; //bptr's length already set to aLen |
|
525 bptr.Append(ch); |
|
526 } |
|
527 aRec->BuildUintL(TSdpIntBuf<TUint16>(aID))->BuildStringL(bptr); |
|
528 delete buf; |
|
529 } |
|
530 |
|
531 void BuildContinuationRecord(CSdpDatabase* aDb, TSdpAttributeID aID, TUint16 aStringLen) |
|
532 { |
|
533 CSdpServRecord* theRec = aDb->NewRecordL(); //this will set-up the handle attribute |
|
534 |
|
535 // Set Attr 1 (service class list) to list with one UUID = KSdpContTestUUID |
|
536 // (Single UUID common to all records in a continuation test database) |
|
537 // Add the record into the database |
|
538 theRec->BuildUintL(TSdpIntBuf<TUint16>(1))->BuildDESL() |
|
539 ->StartListL() |
|
540 ->BuildUUIDL(TUUID(KSdpContTestUUID)) |
|
541 ->EndListL(); |
|
542 // Set Attr 0x100 (default Name) to string |
|
543 BuildContinuationString(theRec, aID, aStringLen); |
|
544 } |
|
545 |
|
546 CSdpDatabase* BuildContinuationDbL() |
|
547 { |
|
548 CSdpDatabase *theDb = CSdpDatabase::NewL(); |
|
549 |
|
550 // Record 0 should be used when a server instance is created. |
|
551 // note that attributes 2, 5 and 0x201 should be updated. |
|
552 // also note only English, pas de Francais, keine Deutsch, non Espanol |
|
553 BuildRecordZeroL(theDb); |
|
554 |
|
555 // Build records containing increasingly long strings |
|
556 for(TUint16 i = 1; i<200; ++i) |
|
557 { |
|
558 //5 lines for 1: prevent warnings. |
|
559 TUint16 attrID(i); |
|
560 attrID+=2; |
|
561 TUint16 len(i); |
|
562 len*=5; |
|
563 BuildContinuationRecord(theDb, attrID, len); |
|
564 } |
|
565 |
|
566 return theDb; |
|
567 } |
|
568 |
|
569 CSdpDatabase* BuildNestedListDbL() |
|
570 { |
|
571 CSdpDatabase *theDb = CSdpDatabase::NewL(); |
|
572 |
|
573 // Record 0 should be used when a server instance is created. |
|
574 // note that attributes 2, 5 and 0x201 should be updated. |
|
575 // also note only English, pas de Francais, keine Deutsch, non Espanol |
|
576 BuildRecordZeroL(theDb); |
|
577 |
|
578 // Build records containing increasingly long strings |
|
579 for(TUint16 i = 1; i<200; ++i) |
|
580 { |
|
581 //5 lines for 1: prevent warnings. |
|
582 TUint16 attrID(i); |
|
583 attrID+=2; |
|
584 TUint16 len(i); |
|
585 len*=5; |
|
586 BuildContinuationRecord(theDb, attrID, len); |
|
587 } |
|
588 |
|
589 return theDb; |
|
590 } |
|
591 |
|
592 |
|
593 |
|
594 CSdpDatabase* BuildTBTDbL() |
|
595 { |
|
596 CSdpDatabase* theDb = CSdpDatabase::NewL(); |
|
597 |
|
598 TBuf8<2> attrId; |
|
599 TBuf8<4> val; |
|
600 TBuf8<2> val1; |
|
601 CSdpServRecord* theRec = CSdpServRecord::NewL(); |
|
602 // all attribute IDs are BIG ENDian |
|
603 |
|
604 // First Record DUN service. This record will have a value for each attribute so it |
|
605 // can be used for the attribute queries. |
|
606 |
|
607 attrId.FillZ(2); |
|
608 val.FillZ(4); |
|
609 val1.FillZ(2); |
|
610 // Set Attr 0 (Record handle) to 0x00010000 |
|
611 val[0] = 0x00; |
|
612 val[1] = 0x01; |
|
613 val[2] = 0x00; |
|
614 val[3] = 0x00; |
|
615 theRec->BuildUintL(attrId)->BuildUintL(val); |
|
616 |
|
617 // Set Attr 1 (service class list) to list with Three UUIDs = 0x1103, 0x1201 and 0x1000. |
|
618 attrId[0] = 0x00; |
|
619 attrId[1] = 0x01; |
|
620 theRec->BuildUintL(attrId)->BuildDESL() |
|
621 ->StartListL() |
|
622 ->BuildUUIDL(TUUID(KDialUpNetworkingUUID)) |
|
623 ->BuildUUIDL(TUUID(KGenericNetworkingUUID)) |
|
624 ->BuildUUIDL(TUUID(KServiceDiscoveryServerServiceClassUUID)) |
|
625 ->EndListL(); |
|
626 |
|
627 // Set Attr 2 (service record state) to 0. |
|
628 val.FillZ(4); |
|
629 attrId[0] = 0x00; |
|
630 attrId[1] = 0x02; |
|
631 theRec->BuildUintL(attrId)->BuildUintL(val); |
|
632 |
|
633 // Set attr 3 (service id) to 0x0001 |
|
634 attrId[0] = 0x00; |
|
635 attrId[1] = 0x03; |
|
636 theRec->BuildUintL(attrId)->BuildDESL() |
|
637 ->StartListL() |
|
638 ->BuildUUIDL(TUUID(0x0001)) |
|
639 ->EndListL(); |
|
640 |
|
641 // Set attr 4 (protocol list) to L2CAP, RFCOMM (DLCI=1), no OBEX |
|
642 attrId[0] = 0x00; |
|
643 attrId[1] = 0x04; |
|
644 val1.FillZ(2); |
|
645 val1[1] = 1; |
|
646 theRec->BuildUintL(attrId)->BuildDESL() |
|
647 ->StartListL() |
|
648 ->BuildDESL() |
|
649 ->StartListL() |
|
650 ->BuildUUIDL(TUUID(TUint16(0x0100))) // L2CAP |
|
651 ->EndListL() |
|
652 ->BuildDESL() |
|
653 ->StartListL() |
|
654 ->BuildUUIDL(TUUID(TUint16(0x0003))) // RFCOMM |
|
655 ->BuildUintL(val1) // DLCI = 1 |
|
656 ->EndListL() |
|
657 ->EndListL(); |
|
658 |
|
659 // Set Attr 0x005 (browse group list) to public root |
|
660 attrId[0] = 0x00; |
|
661 attrId[1] = 0x05; |
|
662 theRec->BuildUintL(attrId)->BuildDESL() |
|
663 ->StartListL() |
|
664 ->BuildUUIDL(TUUID(TUint16(0x1002))) // publicBrowseRoot |
|
665 ->EndListL(); |
|
666 |
|
667 // Set Attr 0x006 (language base) |
|
668 attrId[0] = 0x00; |
|
669 attrId[1] = 0x06; |
|
670 val.FillZ(2); |
|
671 val[0] = 0x65; |
|
672 val[1] = 0x6e; |
|
673 TBuf8<2> val2; |
|
674 TBuf8<2> val3; |
|
675 val2.FillZ(2); |
|
676 val3.FillZ(2); |
|
677 val2[1] = 0x6a; |
|
678 val3[0] = 0x01; |
|
679 |
|
680 theRec->BuildUintL(attrId)->BuildDESL() |
|
681 ->StartListL() |
|
682 ->BuildUintL(val) // english |
|
683 ->BuildUintL(val2) // UTF-8 |
|
684 ->BuildUintL(val3) // language base |
|
685 ->EndListL(); |
|
686 |
|
687 |
|
688 // Set Attr 0x007 (service info time to live) to 0x0000 (not used). |
|
689 attrId[0] = 0x00; |
|
690 attrId[1] = 0x07; |
|
691 val.FillZ(4); |
|
692 |
|
693 theRec->BuildUintL(attrId)->BuildUintL(val); |
|
694 |
|
695 // Set Attr 0x008 (service availability) to 0xff (not currently in use). |
|
696 attrId[0] = 0x00; |
|
697 attrId[1] = 0x08; |
|
698 TBuf8<1> ff; |
|
699 ff.FillZ(1); |
|
700 ff[0] = 0xff; |
|
701 |
|
702 theRec->BuildUintL(attrId)->BuildUintL(ff); |
|
703 |
|
704 // Set Attr 0x009 (profile descriptor list) to Dun version 1.00 |
|
705 attrId[0] = 0x00; |
|
706 attrId[1] = 0x09; |
|
707 |
|
708 val.FillZ(2); |
|
709 val[0] = 0x01; |
|
710 |
|
711 theRec->BuildUintL(attrId)->BuildDESL() |
|
712 ->StartListL()->BuildDESL() |
|
713 ->StartListL() |
|
714 ->BuildUUIDL(TUUID(TUint16(KDialUpNetworkingUUID))) |
|
715 ->BuildUintL(val) // version 0x100 |
|
716 ->EndListL() |
|
717 ->EndListL(); |
|
718 |
|
719 // Set Attr 0x00a (Documentation URL) to "http://my.fake/public/documentation/*". |
|
720 attrId[0] = 0x00; |
|
721 attrId[1] = 0x0a; |
|
722 |
|
723 theRec->BuildUintL(attrId)->BuildURLL(_L8("http://my.fake/public/documentation.doc")); |
|
724 |
|
725 // Set Attr 0x00b (Client Executable URL) to "http://my.fake/public/*/client.exe". |
|
726 attrId[0] = 0x00; |
|
727 attrId[1] = 0x0b; |
|
728 |
|
729 theRec->BuildUintL(attrId)->BuildURLL(_L8("http://my.fake/public/*/client.exe")); |
|
730 |
|
731 // Set Attr 0x00c (ICON URL) to "http://my.fake/public/icons/*". |
|
732 attrId[0] = 0x00; |
|
733 attrId[1] = 0x0c; |
|
734 |
|
735 theRec->BuildUintL(attrId)->BuildURLL(_L8("http://my.fake/public/icons/*")); |
|
736 |
|
737 // Set Attr 0x100 (service Name) to string |
|
738 attrId[0] = 0x01; |
|
739 attrId[1] = 0x00; |
|
740 theRec->BuildUintL(attrId)->BuildStringL(_L8("Dial-up networking")); |
|
741 |
|
742 // Set Attr 0x101 (service description) to string |
|
743 attrId[0] = 0x01; |
|
744 attrId[1] = 0x01; |
|
745 theRec->BuildUintL(attrId)->BuildStringL(_L8("Dummy description for dial-up-networking")); |
|
746 |
|
747 // Set Attr 0x102 (provider name) to string |
|
748 attrId[0] = 0x01; |
|
749 attrId[1] = 0x02; |
|
750 theRec->BuildUintL(attrId)->BuildStringL(_L8("PAN team")); |
|
751 |
|
752 // Set attr 0x200 (version number list) to version 1.1 |
|
753 attrId[0]=0x02; |
|
754 attrId[1]=0x00; |
|
755 val1.FillZ(2); |
|
756 val1[0]=0x01; |
|
757 val1[1]=0x01; |
|
758 theRec->BuildUintL(attrId)->BuildDESL() |
|
759 ->StartListL() |
|
760 ->BuildUintL(val1) |
|
761 ->EndListL(); |
|
762 |
|
763 |
|
764 //Set Attr 0x201 (Service database state) to 0 |
|
765 attrId[0]=0x02; |
|
766 attrId[1]=0x01; |
|
767 val.FillZ(4); |
|
768 theRec->BuildUintL(attrId)->BuildUintL(val); |
|
769 |
|
770 // Add the record into the database |
|
771 theDb->AddRecord(theRec); |
|
772 |
|
773 // Second Record Fax |
|
774 theRec = CSdpServRecord::NewL(); |
|
775 |
|
776 attrId.FillZ(2); |
|
777 val.FillZ(4); |
|
778 // Set Attr 0 (Record handle) to 0x00010001 |
|
779 val[0] = 0x00; |
|
780 val[1] = 0x01; |
|
781 val[2] = 0x00; |
|
782 val[3] = 0x01; |
|
783 theRec->BuildUintL(attrId)->BuildUintL(val); |
|
784 |
|
785 // Set Attr 1 (service class list) to list with Two UUID = 0x1111, 0x1204 |
|
786 attrId[0] = 0x00; |
|
787 attrId[1] = 0x01; |
|
788 theRec->BuildUintL(attrId)->BuildDESL() |
|
789 ->StartListL() |
|
790 ->BuildUUIDL(TUUID(KFaxUUID)) |
|
791 ->BuildUUIDL(TUUID(KGenericTelephonyUUID)) |
|
792 ->EndListL(); |
|
793 |
|
794 |
|
795 // Set attr 4 (protocol list) to L2CAP, RFCOMM (DLCI=2), no OBEX |
|
796 attrId[0] = 0x00; |
|
797 attrId[1] = 0x04; |
|
798 val.FillZ(4); |
|
799 val[3] = 2; |
|
800 theRec->BuildUintL(attrId)->BuildDESL() |
|
801 ->StartListL() |
|
802 ->BuildDESL() |
|
803 ->StartListL() |
|
804 ->BuildUUIDL(TUUID(TUint16(0x0100))) // L2CAP |
|
805 ->EndListL() |
|
806 ->BuildDESL() |
|
807 ->StartListL() |
|
808 ->BuildUUIDL(TUUID(TUint16(0x0003))) // RFCOMM |
|
809 ->BuildUintL(val) // DLCI = 2 |
|
810 ->EndListL() |
|
811 ->EndListL(); |
|
812 |
|
813 // Set Attr 0x005 (browse group list) to public root |
|
814 attrId[0] = 0x00; |
|
815 attrId[1] = 0x05; |
|
816 theRec->BuildUintL(attrId)->BuildDESL() |
|
817 ->StartListL() |
|
818 ->BuildUUIDL(TUUID(TUint16(0x1002))) // publicBrowseRoot |
|
819 ->EndListL(); |
|
820 |
|
821 // Set Attr 0x006 (language base) |
|
822 attrId[0] = 0x00; |
|
823 attrId[1] = 0x06; |
|
824 val.FillZ(2); |
|
825 val[0] = 0x65; |
|
826 val[1] = 0x6e; |
|
827 val2.FillZ(2); |
|
828 val3.FillZ(2); |
|
829 val2[1] = 0x6a; |
|
830 val3[0] = 0x01; |
|
831 |
|
832 theRec->BuildUintL(attrId)->BuildDESL() |
|
833 ->StartListL() |
|
834 ->BuildUintL(val) // english |
|
835 ->BuildUintL(val2) // UTF-8 |
|
836 ->BuildUintL(val3) // language base |
|
837 ->EndListL(); |
|
838 |
|
839 // Set Attr 0x009 (profile descriptor list) to Dun version 1.00 |
|
840 attrId[0] = 0x00; |
|
841 attrId[1] = 0x09; |
|
842 |
|
843 val.FillZ(2); |
|
844 val[0] = 0x01; |
|
845 |
|
846 theRec->BuildUintL(attrId)->BuildDESL() |
|
847 ->StartListL()->BuildDESL() |
|
848 ->StartListL() |
|
849 ->BuildUUIDL(TUUID(TUint16(KFaxUUID))) // Fax |
|
850 ->BuildUintL(val) // version 0x100 |
|
851 ->EndListL() |
|
852 ->EndListL(); |
|
853 |
|
854 // Set Attr 0x00a (Documentation URL) to a very long value, for use with continuation |
|
855 attrId[0] = 0x00; |
|
856 attrId[1] = 0x0a; |
|
857 |
|
858 TBuf8<654> urlBuf; |
|
859 urlBuf.Append(_L8("http://")); |
|
860 for(TInt r = 0; r < 160; r ++) |
|
861 { |
|
862 urlBuf.Append(_L8("url/")); |
|
863 } |
|
864 urlBuf.Append(_L8("url.doc")); |
|
865 theRec->BuildUintL(attrId)->BuildURLL(urlBuf); |
|
866 |
|
867 |
|
868 // Set Attr 0x100 (default Name) to string |
|
869 attrId[1] = 0x00; |
|
870 attrId[0] = 0x01; |
|
871 theRec->BuildUintL(attrId)->BuildStringL(_L8("Fax")); |
|
872 |
|
873 // Add the record into the database |
|
874 theDb->AddRecord(theRec); |
|
875 |
|
876 // Third Record Obex |
|
877 theRec = CSdpServRecord::NewL(); |
|
878 |
|
879 attrId.FillZ(2); |
|
880 val.FillZ(4); |
|
881 // Set Attr 0 (Record handle) to 0x00010001 |
|
882 val[0] = 0x00; |
|
883 val[1] = 0x01; |
|
884 val[2] = 0x00; |
|
885 val[3] = 0x02; |
|
886 theRec->BuildUintL(attrId)->BuildUintL(val); |
|
887 |
|
888 // Set Attr 1 (service class list) to list with One UUID = 0x1105 |
|
889 attrId[0] = 0x00; |
|
890 attrId[1] = 0x01; |
|
891 theRec->BuildUintL(attrId)->BuildDESL() |
|
892 ->StartListL() |
|
893 ->BuildUUIDL(TUUID(TUint16(KObexUUID))) // Obex |
|
894 ->EndListL(); |
|
895 |
|
896 // Set attr 4 (protocol list) to L2CAP, RFCOMM (DLCI=3), OBEX |
|
897 attrId[0] = 0x00; |
|
898 attrId[1] = 0x04; |
|
899 val.FillZ(4); |
|
900 val[3] = 3; |
|
901 theRec->BuildUintL(attrId)->BuildDESL() |
|
902 ->StartListL() |
|
903 ->BuildDESL() |
|
904 ->StartListL() |
|
905 ->BuildUUIDL(TUUID(TUint16(0x0100))) // L2CAP |
|
906 ->EndListL() |
|
907 ->BuildDESL() |
|
908 ->StartListL() |
|
909 ->BuildUUIDL(TUUID(TUint16(0x0003))) // RFCOMM |
|
910 ->BuildUintL(val) // DLCI = 3 |
|
911 ->EndListL() |
|
912 ->BuildDESL() |
|
913 ->StartListL() |
|
914 ->BuildUUIDL(TUUID(TUint16(0x0008))) // Obex |
|
915 ->EndListL() |
|
916 ->EndListL(); |
|
917 |
|
918 // Set Attr 0x005 (browse group list) to public root |
|
919 attrId[0] = 0x00; |
|
920 attrId[1] = 0x05; |
|
921 theRec->BuildUintL(attrId)->BuildDESL() |
|
922 ->StartListL() |
|
923 ->BuildUUIDL(TUUID(TUint16(0x1002))) // publicBrowseRoot |
|
924 ->EndListL(); |
|
925 |
|
926 // Set Attr 0x006 (language base) |
|
927 attrId[0] = 0x00; |
|
928 attrId[1] = 0x06; |
|
929 val.FillZ(2); |
|
930 val[0] = 0x65; |
|
931 val[1] = 0x6e; |
|
932 val2.FillZ(2); |
|
933 val3.FillZ(2); |
|
934 val2[1] = 0x6a; |
|
935 val3[0] = 0x01; |
|
936 |
|
937 theRec->BuildUintL(attrId)->BuildDESL() |
|
938 ->StartListL() |
|
939 ->BuildUintL(val) // english |
|
940 ->BuildUintL(val2) // UTF-8 |
|
941 ->BuildUintL(val3) // language base |
|
942 ->EndListL(); |
|
943 |
|
944 // Set Attr 0x009 (profile descriptor list) to Obex version 1.00 |
|
945 attrId[0] = 0x00; |
|
946 attrId[1] = 0x09; |
|
947 |
|
948 val.FillZ(2); |
|
949 val[0] = 0x01; |
|
950 |
|
951 theRec->BuildUintL(attrId)->BuildDESL() |
|
952 ->StartListL()->BuildDESL() |
|
953 ->StartListL() |
|
954 ->BuildUUIDL(TUUID(TUint16(KObexUUID))) // Obex |
|
955 ->BuildUintL(val) // version 0x100 |
|
956 ->EndListL() |
|
957 ->EndListL(); |
|
958 |
|
959 // Set Attr 0x100 (default Name) to string |
|
960 attrId[1] = 0x00; |
|
961 attrId[0] = 0x01; |
|
962 theRec->BuildUintL(attrId)->BuildStringL(_L8("OBEX Objext Push")); |
|
963 |
|
964 // Add the record into the database |
|
965 theDb->AddRecord(theRec); |
|
966 |
|
967 // Now add a load more records to force continuation for the service search |
|
968 // |
|
969 for(TUint8 i = 0; i < 200; i ++) |
|
970 { |
|
971 theRec = CSdpServRecord::NewL(); |
|
972 |
|
973 attrId.FillZ(2); |
|
974 val.FillZ(4); |
|
975 // Set Attr 0 (Record handle) to 0x00010003 |
|
976 val[0] = 0x00; |
|
977 val[1] = 0x01; |
|
978 val[2] = 0x00; |
|
979 val[3] = TUint8(i+3); |
|
980 theRec->BuildUintL(attrId)->BuildUintL(val); |
|
981 // Set Attr 1 (service class list) to list with UUID = 0x1108 |
|
982 attrId[0] = 0x00; |
|
983 attrId[1] = 0x01; |
|
984 theRec->BuildUintL(attrId)->BuildDESL() |
|
985 ->StartListL() |
|
986 ->BuildUUIDL(TUUID(0x1108)) |
|
987 ->EndListL(); |
|
988 // Add the record into the database |
|
989 theDb->AddRecord(theRec); |
|
990 } |
|
991 return theDb; |
|
992 } |
|
993 |
|
994 |
|
995 |
|
996 |
|
997 |
|
998 void AddBrowseGroupRecord(CSdpDatabase& aDb, TUUID aBrowseUUID) |
|
999 { |
|
1000 CSdpServRecord* theRec = aDb.NewRecordL(); |
|
1001 |
|
1002 TBuf8<2> attrId; |
|
1003 TBuf8<4> val; |
|
1004 attrId.FillZ(2); |
|
1005 val.FillZ(4); |
|
1006 |
|
1007 // Set Attr 1 (service class list) to list with One UUID = 0x1001 |
|
1008 attrId[0] = 0x00; |
|
1009 attrId[1] = 0x01; |
|
1010 theRec->BuildUintL(attrId)->BuildDESL() |
|
1011 ->StartListL() |
|
1012 ->BuildUUIDL(TUUID(TUint16(KBrowseGroupDescriptorServiceClassUUID))) // BrowseGroup(DescriptorList) |
|
1013 ->EndListL(); |
|
1014 |
|
1015 // Set Attr 0x005 (browse group list) to public root |
|
1016 attrId[0] = 0x00; |
|
1017 attrId[1] = 0x05; |
|
1018 theRec->BuildUintL(attrId)->BuildDESL() |
|
1019 ->StartListL() |
|
1020 ->BuildUUIDL(TUUID(TUint16(0x1002))) // publicBrowseRoot |
|
1021 ->EndListL(); |
|
1022 |
|
1023 // Set Attr 0x200 (default Name) to string |
|
1024 attrId[1] = 0x00; |
|
1025 attrId[0] = 0x02; |
|
1026 |
|
1027 theRec->BuildUintL(attrId)->BuildUUIDL(aBrowseUUID); |
|
1028 } |
|
1029 |
|
1030 |
|
1031 void AddBrowsableRecord(CSdpDatabase& aDb, TUUID aBrowseUUID) |
|
1032 { |
|
1033 CSdpServRecord* theRec = aDb.NewRecordL(); |
|
1034 |
|
1035 TBuf8<2> attrId; |
|
1036 TBuf8<4> val; |
|
1037 attrId.FillZ(2); |
|
1038 val.FillZ(4); |
|
1039 |
|
1040 // Set Attr 1 (service class list) to list with UUID = 0x1108 |
|
1041 attrId[0] = 0x00; |
|
1042 attrId[1] = 0x01; |
|
1043 theRec->BuildUintL(attrId)->BuildDESL() |
|
1044 ->StartListL() |
|
1045 ->BuildUUIDL(TUUID(0x1108)) |
|
1046 ->EndListL(); |
|
1047 |
|
1048 // Set Attr 0x005 (browse group list) to public root |
|
1049 attrId[0] = 0x00; |
|
1050 attrId[1] = 0x05; |
|
1051 theRec->BuildUintL(attrId)->BuildDESL() |
|
1052 ->StartListL() |
|
1053 ->BuildUUIDL(aBrowseUUID) // publicBrowseRoot |
|
1054 ->EndListL(); |
|
1055 } |
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 |
|
1061 CSdpDatabase* BuildPrequalDbL() |
|
1062 { |
|
1063 CSdpDatabase* theDb = CSdpDatabase::NewL(); |
|
1064 |
|
1065 TInt i; |
|
1066 TBuf8<2> attrId; |
|
1067 TBuf8<4> val; |
|
1068 TBuf8<2> val1; |
|
1069 CSdpServRecord* theRec = theDb->NewRecordL(); |
|
1070 // all attribute IDs are BIG ENDian |
|
1071 |
|
1072 // Prequal Dummy Service Record. Designed to respond to SA tests - |
|
1073 // where, it seems, the initial service search is done using UUIDs 1101 and 0011. |
|
1074 // This record will have a value for each attribute so it |
|
1075 // can be used for the attribute queries. |
|
1076 attrId.FillZ(2); |
|
1077 val.FillZ(4); |
|
1078 val1.FillZ(2); |
|
1079 |
|
1080 // Set Attr 1 (service class list) to list with UUID = 0x1108 |
|
1081 attrId[0] = 0x00; |
|
1082 attrId[1] = 0x01; |
|
1083 MSdpElementBuilder* bdr; |
|
1084 bdr = theRec->BuildUintL(attrId)->BuildDESL() |
|
1085 ->StartListL() |
|
1086 ->BuildUUIDL(TUUID(0x0011)) |
|
1087 ->BuildUUIDL(TUUID(KDialUpNetworkingUUID)); |
|
1088 //TUint16 x = 0x1201; |
|
1089 //while(x<0x120a) |
|
1090 // bdr->BuildUUIDL(TUUID(x++)); |
|
1091 bdr->EndListL(); |
|
1092 |
|
1093 // Set Attr 2 (service record state) to 0. |
|
1094 val.FillZ(4); |
|
1095 attrId[0] = 0x00; |
|
1096 attrId[1] = 0x02; |
|
1097 val[0] = 0xdd; |
|
1098 val[1] = 0xdd; |
|
1099 val[2] = 0xdd; |
|
1100 val[3] = 0xcd; |
|
1101 theRec->BuildUintL(attrId)->BuildUintL(val); |
|
1102 |
|
1103 // Set attr 3 (service id) to 0x0001 |
|
1104 attrId[0] = 0x00; |
|
1105 attrId[1] = 0x03; |
|
1106 theRec->BuildUintL(attrId) |
|
1107 ->BuildUUIDL(TUUID(0xeeee)); |
|
1108 |
|
1109 // Set attr 4 (protocol list) to L2CAP, RFCOMM (DLCI=1), no OBEX |
|
1110 attrId[0] = 0x00; |
|
1111 attrId[1] = 0x04; |
|
1112 val1.FillZ(2); |
|
1113 val1[1] = 1; |
|
1114 theRec->BuildUintL(attrId)->BuildDESL() |
|
1115 ->StartListL() |
|
1116 ->BuildDESL() |
|
1117 ->StartListL() |
|
1118 ->BuildUUIDL(TUUID(TUint16(0x0001))) |
|
1119 ->EndListL() |
|
1120 ->BuildDESL() |
|
1121 ->StartListL() |
|
1122 ->BuildUUIDL(TUUID(TUint16(0x0100))) // L2CAP |
|
1123 ->EndListL() |
|
1124 ->BuildDESL() |
|
1125 ->StartListL() |
|
1126 ->BuildUUIDL(TUUID(TUint16(0x0003))) // RFCOMM |
|
1127 ->BuildUintL(TSdpIntBuf<TUint8>(1)) // DLCI = 1 |
|
1128 ->EndListL() |
|
1129 ->EndListL(); |
|
1130 |
|
1131 // Set Attr 0x005 (browse group list) to public root |
|
1132 attrId[0] = 0x00; |
|
1133 attrId[1] = 0x05; |
|
1134 theRec->BuildUintL(attrId)->BuildDESL() |
|
1135 ->StartListL() |
|
1136 ->BuildUUIDL(TUUID(TUint16(0x1002))) // publicBrowseRoot |
|
1137 ->EndListL(); |
|
1138 |
|
1139 // Set Attr 0x006 (language base) |
|
1140 attrId[0] = 0x00; |
|
1141 attrId[1] = 0x06; |
|
1142 val.FillZ(2); |
|
1143 //val.SetLength(2); |
|
1144 val[0] = 0x65; |
|
1145 val[1] = 0x6e; |
|
1146 TBuf8<2> val2; |
|
1147 TBuf8<2> val3; |
|
1148 val2.FillZ(2); |
|
1149 val3.FillZ(2); |
|
1150 val2[1] = 0x6a; |
|
1151 val3[0] = 0x01; |
|
1152 |
|
1153 theRec->BuildUintL(attrId)->BuildDESL() |
|
1154 ->StartListL() |
|
1155 ->BuildUintL(val) // english |
|
1156 ->BuildUintL(val2) // UTF-8 |
|
1157 ->BuildUintL(val3) // language base |
|
1158 ->EndListL(); |
|
1159 |
|
1160 |
|
1161 // Set Attr 0x007 (service info time to live) to 0x0000 (not used). |
|
1162 attrId[0] = 0x00; |
|
1163 attrId[1] = 0x07; |
|
1164 //val.SetLength(4); |
|
1165 val.FillZ(4); |
|
1166 val[0] = 0xcc; |
|
1167 val[1] = 0xcc; |
|
1168 val[2] = 0xcc; |
|
1169 val[3] = 0xcc; |
|
1170 |
|
1171 theRec->BuildUintL(attrId)->BuildUintL(val); |
|
1172 |
|
1173 // Set Attr 0x008 (service availability) to 0xff (not currently in use). |
|
1174 attrId[0] = 0x00; |
|
1175 attrId[1] = 0x08; |
|
1176 TBuf8<1> ff; |
|
1177 ff.FillZ(1); |
|
1178 ff[0] = 0xbb; |
|
1179 |
|
1180 theRec->BuildUintL(attrId)->BuildUintL(ff); |
|
1181 |
|
1182 // Set Attr 0x009 (profile descriptor list) to Dun version 1.00 |
|
1183 attrId[0] = 0x00; |
|
1184 attrId[1] = 0x09; |
|
1185 val.FillZ(2); |
|
1186 val[0] = 0x01; |
|
1187 val[1] = 0x01; |
|
1188 |
|
1189 theRec->BuildUintL(attrId)->BuildDESL() |
|
1190 ->StartListL()->BuildDESL() |
|
1191 ->StartListL() |
|
1192 ->BuildUUIDL(TUUID(TUint16(KSerialPortUUID))) |
|
1193 ->BuildUintL(val) // version 0x100 |
|
1194 ->EndListL() |
|
1195 ->EndListL(); |
|
1196 |
|
1197 // Set Attr 0x00a (Documentation URL) to "http://www.documentation.url/*". |
|
1198 attrId[0] = 0x00; |
|
1199 attrId[1] = 0x0a; |
|
1200 |
|
1201 theRec->BuildUintL(attrId)->BuildURLL(_L8("http://www.documentation.url")); |
|
1202 |
|
1203 // Set Attr 0x00b (Client Executable URL) to "http://url.i86-microsoft-win2000/". |
|
1204 attrId[0] = 0x00; |
|
1205 attrId[1] = 0x0b; |
|
1206 |
|
1207 theRec->BuildUintL(attrId)->BuildURLL(_L8("http://url.i86-microsoft-win2000/")); |
|
1208 |
|
1209 // Set Attr 0x00c (ICON URL) to "http://url.32x32x8.png/icon". |
|
1210 attrId[0] = 0x00; |
|
1211 attrId[1] = 0x0c; |
|
1212 |
|
1213 theRec->BuildUintL(attrId)->BuildURLL(_L8("http://url.32x32x8.png/icon")); |
|
1214 //theRec->BuildUintL(attrId)->BuildStringL(_L8("http://url.32x32x8.png/icon/")); |
|
1215 |
|
1216 // Set Attr 0x100 (service Name) to string |
|
1217 //BuildContinuationString(theRec, 0x100, 0x200); |
|
1218 attrId[0] = 0x01; |
|
1219 attrId[1] = 0x00; |
|
1220 theRec->BuildUintL(attrId)->BuildStringL(_L8("Indigo_Chat_Security_Mode_1")); |
|
1221 |
|
1222 // Set Attr 0x101 (service description) to string |
|
1223 attrId[0] = 0x01; |
|
1224 attrId[1] = 0x01; |
|
1225 theRec->BuildUintL(attrId)->BuildStringL(_L8("ServiceDescriptionAttributeValue")); |
|
1226 // Set Attr 0x102 (provider name) to string |
|
1227 attrId[0] = 0x01; |
|
1228 attrId[1] = 0x02; |
|
1229 theRec->BuildUintL(attrId)->BuildStringL(_L8("ServiceProviderAttributeValue")); |
|
1230 |
|
1231 // Set attr 0x200 (version number list) to version 1.1 |
|
1232 attrId[0]=0x02; |
|
1233 attrId[1]=0x00; |
|
1234 val1.FillZ(2); |
|
1235 val1[0]=0x01; |
|
1236 val1[1]=0x01; |
|
1237 theRec->BuildUintL(attrId)->BuildDESL() |
|
1238 ->StartListL() |
|
1239 ->BuildUintL(val1) |
|
1240 ->EndListL(); |
|
1241 |
|
1242 |
|
1243 //Set Attr 0x201 (Service database state) to 0 |
|
1244 attrId[0]=0x02; |
|
1245 attrId[1]=0x01; |
|
1246 val.FillZ(4); |
|
1247 val[3] = 0x0e; |
|
1248 theRec->BuildUintL(attrId)->BuildUintL(val); |
|
1249 |
|
1250 // Second Record Fax |
|
1251 theRec = theDb->NewRecordL(); |
|
1252 |
|
1253 attrId.FillZ(2); |
|
1254 val.FillZ(4); |
|
1255 |
|
1256 // Set Attr 1 (service class list) to list with Two UUID = 0x1111, 0x1204 |
|
1257 attrId[0] = 0x00; |
|
1258 attrId[1] = 0x01; |
|
1259 theRec->BuildUintL(attrId)->BuildDESL() |
|
1260 ->StartListL() |
|
1261 ->BuildUUIDL(TUUID(KFaxUUID)) |
|
1262 ->BuildUUIDL(TUUID(KGenericTelephonyUUID)) |
|
1263 ->EndListL(); |
|
1264 |
|
1265 |
|
1266 // Set attr 4 (protocol list) to L2CAP, RFCOMM (DLCI=2), no OBEX |
|
1267 attrId[0] = 0x00; |
|
1268 attrId[1] = 0x04; |
|
1269 val.FillZ(4); |
|
1270 val[3] = 2; |
|
1271 theRec->BuildUintL(attrId)->BuildDESL() |
|
1272 ->StartListL() |
|
1273 ->BuildDESL() |
|
1274 ->StartListL() |
|
1275 ->BuildUUIDL(TUUID(TUint16(0x0100))) // L2CAP |
|
1276 ->EndListL() |
|
1277 ->BuildDESL() |
|
1278 ->StartListL() |
|
1279 ->BuildUUIDL(TUUID(TUint16(0x0003))) // RFCOMM |
|
1280 ->BuildUintL(val) // DLCI = 2 |
|
1281 ->EndListL() |
|
1282 ->EndListL(); |
|
1283 |
|
1284 // Set Attr 0x005 (browse group list) to public root |
|
1285 attrId[0] = 0x00; |
|
1286 attrId[1] = 0x05; |
|
1287 theRec->BuildUintL(attrId)->BuildDESL() |
|
1288 ->StartListL() |
|
1289 ->BuildUUIDL(TUUID(TUint16(0x1002))) // publicBrowseRoot |
|
1290 ->EndListL(); |
|
1291 |
|
1292 // Set Attr 0x006 (language base) |
|
1293 attrId[0] = 0x00; |
|
1294 attrId[1] = 0x06; |
|
1295 val.FillZ(2); |
|
1296 val[0] = 0x65; |
|
1297 val[1] = 0x6e; |
|
1298 val2.FillZ(2); |
|
1299 val3.FillZ(2); |
|
1300 val2[1] = 0x6a; |
|
1301 val3[0] = 0x01; |
|
1302 |
|
1303 theRec->BuildUintL(attrId)->BuildDESL() |
|
1304 ->StartListL() |
|
1305 ->BuildUintL(val) // english |
|
1306 ->BuildUintL(val2) // UTF-8 |
|
1307 ->BuildUintL(val3) // language base |
|
1308 ->EndListL(); |
|
1309 |
|
1310 // Set Attr 0x009 (profile descriptor list) to Dun version 1.00 |
|
1311 attrId[0] = 0x00; |
|
1312 attrId[1] = 0x09; |
|
1313 val.FillZ(2); |
|
1314 val[0] = 0x01; |
|
1315 |
|
1316 theRec->BuildUintL(attrId)->BuildDESL() |
|
1317 ->StartListL()->BuildDESL() |
|
1318 ->StartListL() |
|
1319 ->BuildUUIDL(TUUID(TUint16(KFaxUUID))) // Fax |
|
1320 ->BuildUintL(val) // version 0x100 |
|
1321 ->EndListL() |
|
1322 ->EndListL(); |
|
1323 |
|
1324 // Set Attr 0x00a (Documentation URL) to a very long value, for use with continuation |
|
1325 attrId[0] = 0x00; |
|
1326 attrId[1] = 0x0a; |
|
1327 |
|
1328 TBuf8<654> urlBuf; |
|
1329 urlBuf.Append(_L8("http://")); |
|
1330 for(TInt r = 0; r < 160; r ++) |
|
1331 { |
|
1332 urlBuf.Append(_L8("url/")); |
|
1333 } |
|
1334 urlBuf.Append(_L8("url.doc")); |
|
1335 theRec->BuildUintL(attrId)->BuildURLL(urlBuf); |
|
1336 |
|
1337 |
|
1338 // Set Attr 0x100 (default Name) to string |
|
1339 attrId[1] = 0x00; |
|
1340 attrId[0] = 0x01; |
|
1341 theRec->BuildUintL(attrId)->BuildStringL(_L8("Fax")); |
|
1342 |
|
1343 // Third Record Obex |
|
1344 theRec = theDb->NewRecordL(); |
|
1345 |
|
1346 attrId.FillZ(2); |
|
1347 val.FillZ(4); |
|
1348 |
|
1349 // Set Attr 1 (service class list) to list with One UUID = 0x1105 |
|
1350 attrId[0] = 0x00; |
|
1351 attrId[1] = 0x01; |
|
1352 theRec->BuildUintL(attrId)->BuildDESL() |
|
1353 ->StartListL() |
|
1354 ->BuildUUIDL(TUUID(TUint16(KObexUUID))) // Obex |
|
1355 ->EndListL(); |
|
1356 |
|
1357 // Set attr 4 (protocol list) to L2CAP, RFCOMM (DLCI=3), OBEX |
|
1358 attrId[0] = 0x00; |
|
1359 attrId[1] = 0x04; |
|
1360 val.FillZ(4); |
|
1361 val[3] = 3; |
|
1362 theRec->BuildUintL(attrId)->BuildDESL() |
|
1363 ->StartListL() |
|
1364 ->BuildDESL() |
|
1365 ->StartListL() |
|
1366 ->BuildUUIDL(TUUID(TUint16(0x0100))) // L2CAP |
|
1367 ->EndListL() |
|
1368 ->BuildDESL() |
|
1369 ->StartListL() |
|
1370 ->BuildUUIDL(TUUID(TUint16(0x0003))) // RFCOMM |
|
1371 ->BuildUintL(val) // DLCI = 3 |
|
1372 ->EndListL() |
|
1373 ->BuildDESL() |
|
1374 ->StartListL() |
|
1375 ->BuildUUIDL(TUUID(TUint16(0x0008))) // Obex |
|
1376 ->EndListL() |
|
1377 ->EndListL(); |
|
1378 |
|
1379 // Set Attr 0x005 (browse group list) to public root |
|
1380 attrId[0] = 0x00; |
|
1381 attrId[1] = 0x05; |
|
1382 theRec->BuildUintL(attrId)->BuildDESL() |
|
1383 ->StartListL() |
|
1384 ->BuildUUIDL(TUUID(TUint16(0x1002))) // publicBrowseRoot |
|
1385 ->EndListL(); |
|
1386 |
|
1387 // Set Attr 0x006 (language base) |
|
1388 attrId[0] = 0x00; |
|
1389 attrId[1] = 0x06; |
|
1390 val.FillZ(2); |
|
1391 val[0] = 0x65; |
|
1392 val[1] = 0x6e; |
|
1393 val2.FillZ(2); |
|
1394 val3.FillZ(2); |
|
1395 val2[1] = 0x6a; |
|
1396 val3[0] = 0x01; |
|
1397 |
|
1398 theRec->BuildUintL(attrId)->BuildDESL() |
|
1399 ->StartListL() |
|
1400 ->BuildUintL(val) // english |
|
1401 ->BuildUintL(val2) // UTF-8 |
|
1402 ->BuildUintL(val3) // language base |
|
1403 ->EndListL(); |
|
1404 |
|
1405 // Set Attr 0x009 (profile descriptor list) to Obex version 1.00 |
|
1406 attrId[0] = 0x00; |
|
1407 attrId[1] = 0x09; |
|
1408 val.FillZ(4); |
|
1409 val[0] = 0x01; |
|
1410 |
|
1411 theRec->BuildUintL(attrId)->BuildDESL() |
|
1412 ->StartListL()->BuildDESL() |
|
1413 ->StartListL() |
|
1414 ->BuildUUIDL(TUUID(TUint16(KObexUUID))) // Obex |
|
1415 ->BuildUintL(val) // version 0x100 |
|
1416 ->EndListL() |
|
1417 ->EndListL(); |
|
1418 |
|
1419 // Set Attr 0x100 (default Name) to string |
|
1420 attrId[1] = 0x00; |
|
1421 attrId[0] = 0x01; |
|
1422 theRec->BuildUintL(attrId)->BuildStringL(_L8("OBEX Objext Push")); |
|
1423 |
|
1424 |
|
1425 // Now add browse test stuff |
|
1426 // |
|
1427 AddBrowseGroupRecord(*theDb, TUUID(0xbbcb)); |
|
1428 AddBrowseGroupRecord(*theDb, TUUID(0xbbdb)); |
|
1429 AddBrowseGroupRecord(*theDb, TUUID(0xbbeb)); |
|
1430 AddBrowseGroupRecord(*theDb, TUUID(0xbbfb)); |
|
1431 AddBrowseGroupRecord(*theDb, TUUID(0xccec)); |
|
1432 AddBrowseGroupRecord(*theDb, TUUID(0xccfc)); |
|
1433 AddBrowseGroupRecord(*theDb, TUUID(0xaaba)); |
|
1434 AddBrowseGroupRecord(*theDb, TUUID(0xaaca)); |
|
1435 |
|
1436 AddBrowsableRecord(*theDb, TUUID(0xbbcb)); |
|
1437 AddBrowsableRecord(*theDb, TUUID(0xbbdb)); |
|
1438 AddBrowsableRecord(*theDb, TUUID(0xbbeb)); |
|
1439 AddBrowsableRecord(*theDb, TUUID(0xbbfb)); |
|
1440 AddBrowsableRecord(*theDb, TUUID(0xccec)); |
|
1441 AddBrowsableRecord(*theDb, TUUID(0xccfc)); |
|
1442 AddBrowsableRecord(*theDb, TUUID(0xaaba)); |
|
1443 AddBrowsableRecord(*theDb, TUUID(0xaaca)); |
|
1444 |
|
1445 |
|
1446 |
|
1447 // Now add a load more records to force continuation for the service search |
|
1448 // |
|
1449 for(i = 0; i < 165; i ++) |
|
1450 { |
|
1451 theRec = theDb->NewRecordL(); |
|
1452 |
|
1453 attrId.FillZ(2); |
|
1454 val.FillZ(4); |
|
1455 |
|
1456 // Set Attr 1 (service class list) to list with UUID = 0x1108 |
|
1457 attrId[0] = 0x00; |
|
1458 attrId[1] = 0x01; |
|
1459 theRec->BuildUintL(attrId)->BuildDESL() |
|
1460 ->StartListL() |
|
1461 ->BuildUUIDL(TUUID(0x1101)) |
|
1462 ->EndListL(); |
|
1463 } |
|
1464 return theDb; |
|
1465 } |