1 ir_sock.h |
1 // Copyright (c) 1997-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 /** |
|
19 @file |
|
20 @publishedAll |
|
21 @released |
|
22 */ |
|
23 |
|
24 #ifndef __IR_SOCK_H__ |
|
25 #define __IR_SOCK_H__ |
|
26 |
|
27 #include "es_sock.h" |
|
28 #include <e32property.h> |
|
29 |
|
30 //################## EXPORTED CONSTANTS ######################## |
|
31 |
|
32 |
|
33 /** IrDA protocol family. */ |
|
34 const TUint KIrdaAddrFamily=0x100; // Address of Irda prot family |
|
35 |
|
36 /** IrMUX protocol within the IrDA protocol family. */ |
|
37 const TUint KIrmux=88; // Protocol number for Irmux |
|
38 |
|
39 /** IrTinyTP protocol within the IrDA protocol family.. */ |
|
40 const TUint KIrTinyTP=89; // Protocol number for IrTinyTP |
|
41 |
|
42 /** An invalid LSAP number--binding to this will select the first unused LSAP. */ |
|
43 const TUint KAutoBindLSAP = 0xffff; |
|
44 |
|
45 |
|
46 /** Category used when publishing IrDA status notifications. */ |
|
47 const TUid KIrdaPropertyCategory = {KUidSystemCategoryValue}; |
|
48 |
|
49 /** Key used when publishing IrDA status notifications. */ |
|
50 const TUint KIrdaStatus = 0x100052d1; |
|
51 |
|
52 |
|
53 /** Names used for IrDA status notifications. */ |
|
54 namespace TIrdaStatusCodes |
|
55 { |
|
56 enum |
|
57 { |
|
58 EIrLoaded, |
|
59 EIrDiscoveredPeer, |
|
60 EIrLostPeer, |
|
61 EIrConnected, |
|
62 EIrBlocked, |
|
63 EIrDisconnected, |
|
64 EIrUnloaded, |
|
65 }; |
|
66 } |
|
67 |
|
68 /** PnP support - first service hint byte. */ |
|
69 const TUint8 KIrPnPMask=0x01; // PnP support - FIRST SERVICE HINT BYTE |
|
70 |
|
71 /** PDA/Palmtop - first service hint byte. */ |
|
72 const TUint8 KPalmtopMask=0x02; // PDA/Palmtop - FIRST SERVICE HINT BYTE |
|
73 |
|
74 /** Computer - first service hint byte. */ |
|
75 const TUint8 KComputerMask=0x04; // Computer - FIRST SERVICE HINT BYTE |
|
76 |
|
77 /** Printer - first service hint byte. */ |
|
78 const TUint8 KPrinterMask=0x08; // Printer - FIRST SERVICE HINT BYTE |
|
79 |
|
80 /** IrModem - first service hint byte. */ |
|
81 const TUint8 KModemMask=0x10; // IrModem - FIRST SERVICE HINT BYTE |
|
82 |
|
83 /** Fax - first service hint byte. */ |
|
84 const TUint8 KFaxMask=0x20; // Fax - FIRST SERVICE HINT BYTE |
|
85 |
|
86 /** LAN Access - first service hint byte. */ |
|
87 const TUint8 KLANAccessMask=0x40; // LAN Access - FIRST SERVICE HINT BYTE |
|
88 |
|
89 /** Extension bit - first service hint byte. */ |
|
90 const TUint8 KExtensionMask=0x80; // Extension bit - FIRST SERVICE HINT BYTE |
|
91 |
|
92 /** Telephony - second service hint byte. */ |
|
93 const TUint8 KTelephonyMask=0x01; // Telephony - SECOND SERVICE HINT BYTE |
|
94 |
|
95 /** File Server - second service hint byte. */ |
|
96 const TUint8 KFileServerMask=0x02; // File Server - SECOND SERVICE HINT BYTE |
|
97 |
|
98 /** IrCOMM support - second service hint byte. */ |
|
99 const TUint8 KIrCommMask=0x04; // IrCOMM support - SECOND SERVICE HINT BYTE |
|
100 |
|
101 /** IrOBEX support - second service hint byte. */ |
|
102 const TUint8 KIrObexMask=0x20; // IrObex support - SECOND SERVICE HINT BYTE |
|
103 |
|
104 // |
|
105 // IrDA Ioctls |
|
106 // |
|
107 |
|
108 /** Completes on receipt of a discovery indication. |
|
109 |
|
110 Returns log entry in a TNameEntry. |
|
111 |
|
112 Ioctl level : KIrdaAddrFamily */ |
|
113 const TUint KDiscoveryIndicationIoctl=0; |
|
114 |
|
115 /** Completes on successfully making RSocket EXCLUSIVE else returns error. |
|
116 |
|
117 Completes successfully or returns KErrDisconnected if failed. |
|
118 |
|
119 Ioctl level: KIrdaAddrFamily */ |
|
120 const TUint KExclusiveModeIoctl=1; |
|
121 |
|
122 /** Completes on successfully making RSocket MULTIPLEXED else returns error. |
|
123 |
|
124 Completes successfully or returns KErrDisconnected if failed. |
|
125 |
|
126 Ioctl level: KIrdaAddrFamily */ |
|
127 const TUint KMultiplexModeIoctl=2; |
|
128 |
|
129 /** Completes on doing a status request on IrMUX layer packets to send. |
|
130 |
|
131 Returns TDes8* holding TUint indicating number of outstanding MUX data requests. |
|
132 |
|
133 Ioctl level: KIrdaAddrFamily */ |
|
134 const TUint KIrmuxStatusRequestIoctl=3; |
|
135 |
|
136 /** Completes on doing a status request on IrLAP layer packets to send. |
|
137 |
|
138 Returns TDes8* holding TUint indicating the number of outstanding LAP data |
|
139 requests. |
|
140 |
|
141 Ioctl level: KIrdaAddrFamily */ |
|
142 const TUint KIrlapStatusRequestIoctl=4; |
|
143 |
|
144 /** Completes on successfully putting RSocket into IDLE mode. |
|
145 |
|
146 Completes successfully or returns KErrAbort if failed. |
|
147 |
|
148 Ioctl level: KIrdaAddrFamily */ |
|
149 const TUint KIdleRequestIoctl=5; |
|
150 |
|
151 /** Completes on successfully taking RSocket out of IDLE mode. |
|
152 |
|
153 Completes successfully or returns KErrAbort if failed. |
|
154 |
|
155 Ioctl level: KIrdaAddrFamily */ |
|
156 const TUint KIdleClearRequestIoctl=6; |
|
157 |
|
158 /** Completes on receipt of an IrLAP disconnect indication. |
|
159 |
|
160 Completes successfully on IrLAP or IrMUX disconnect on this connection. |
|
161 |
|
162 Ioctl level: KIrdaAddrFamily */ |
|
163 const TUint KDisconnectIndicationIoctl=7; |
|
164 |
|
165 /** Completes on doing a status request on IrLAP layer packets to send. |
|
166 |
|
167 Returns TDes8* holding TUint indicating the number of outstanding LAP data |
|
168 requests. |
|
169 |
|
170 Ioctl level: KIrdaAddrFamily */ |
|
171 const TUint KIrlapStatusIndicationIoctl=8; |
|
172 |
|
173 /** Completes on receiving a status indication from IrLAP. |
|
174 |
|
175 Returns TDes8* holding TUint indicating the number of outstanding MUX data |
|
176 requests. |
|
177 |
|
178 Ioctl level: KIrdaAddrFamily */ |
|
179 const TUint KIrmuxStatusIndicationIoctl=9; |
|
180 |
|
181 /** Completes on doing an IrLAP link reset. |
|
182 |
|
183 Does an SNRMP-UAF link reset which can be initiated from either primary or |
|
184 secondary. |
|
185 |
|
186 Ioctl level: KIrdaAddrFamily */ |
|
187 const TUint KIrlapResetRequestIoctl=10; |
|
188 |
|
189 /** Completes on receipt of an IrLAP link reset indication. |
|
190 |
|
191 Completes with error value KErrNone if link is successfully reset. |
|
192 |
|
193 Ioctl level: KIrdaAddrFamily */ |
|
194 const TUint KIrlapResetIndicationIoctl=11; |
|
195 |
|
196 /** Completes on doing an IrLAP link reset. |
|
197 |
|
198 Does a DISCP-UAF link disconnect which can be initiated from either primary |
|
199 or secondary. |
|
200 |
|
201 Ioctl level: KIrdaAddrFamily */ |
|
202 const TUint KIrlapDisconnectRequestIoctl=12; |
|
203 |
|
204 const TUint KExclusiveMode=0; |
|
205 |
|
206 const TUint KMultiplexMode=1; |
|
207 |
|
208 |
|
209 //******************** Irda Set/GetOpts ****************************** |
|
210 // These two are done on Socket Write |
|
211 // |
|
212 |
|
213 |
|
214 /** KLevelIrlap. |
|
215 |
|
216 Sets transfer mode to be unexpedited (the default). |
|
217 |
|
218 Not recommended for use with SetOpt(). Preferred use is with RSocket::Send() |
|
219 |
|
220 Returns KErrNone */ |
|
221 const TUint KUnexpeditedDataOpt = 0; // Default |
|
222 |
|
223 /** KLevelIrlap |
|
224 |
|
225 Sets transfer mode to be expedited (urgent). |
|
226 |
|
227 Not recommended for use with SetOpt(). Preferred use is with RSocket::Send() |
|
228 |
|
229 Returns KErrNone */ |
|
230 const TUint KExpeditedDataOpt = 1; // Urgent data transfer |
|
231 |
|
232 // On KLevelIrlap |
|
233 |
|
234 /** KLevelIrlap |
|
235 |
|
236 Sets number of discovery slots. |
|
237 |
|
238 Returns KErrNone */ |
|
239 const TUint KDiscoverySlotsOpt = 2; |
|
240 |
|
241 /** KLevelIrlap |
|
242 |
|
243 Sets the requested maximum link baud rate. |
|
244 |
|
245 Returns KErrInUse, if the link is already running. |
|
246 |
|
247 Returns with the currently set maximum link baud supported. */ |
|
248 const TUint KUserBaudOpt = 3; |
|
249 |
|
250 /** KLevelIrlap |
|
251 |
|
252 Sets the requested maximum data packet size that can be received by the host. |
|
253 |
|
254 Returns KErrInUse, if the link is already running. |
|
255 |
|
256 Returns with the currently set value for the maximum receivable data size |
|
257 of the host IrLAP layer. */ |
|
258 const TUint KHostMaxDataSizeOpt = 4; |
|
259 |
|
260 /** KLevelIrlap |
|
261 |
|
262 Returns KErrNotSupported. |
|
263 |
|
264 Cannot set this value for the remote station. |
|
265 |
|
266 Returns with the currently set value for the maximum transmissible data size |
|
267 to remote IrLAP layer. */ |
|
268 const TUint KRemoteMaxDataSizeOpt = 6; // Remote packet size |
|
269 |
|
270 /** KLevelIrlap |
|
271 |
|
272 Set the maximum link turnaround time for the host IrLAP layer. |
|
273 |
|
274 Returns KErrInUse, if the link is already running. |
|
275 |
|
276 Returns with the currently set value for the host link turnaround time */ |
|
277 const TUint KHostMaxTATimeOpt = 5; |
|
278 |
|
279 /** KLevelIrlap |
|
280 |
|
281 Disables IrLAP level reset_check/wait states */ |
|
282 const TUint KIrlapDisableResetOpt = 9; // This disables Irlap level reset_check/wait states. |
|
283 |
|
284 /** KLevelIrlap |
|
285 |
|
286 Allows the client to set local busy in IrLAP. */ |
|
287 const TUint KLocalBusyDetectedOpt = 10; // Client can set local busy in Irlap |
|
288 |
|
289 /** KLevelIrlap |
|
290 |
|
291 Allows the client to clear local busy in IrLAP */ |
|
292 const TUint KLocalBusyClearedOpt = 11; // Client can clear local busy in Irlap |
|
293 |
|
294 /** KLevelIrlap |
|
295 |
|
296 Disables discovery response for a short period (typically 3 seconds). */ |
|
297 const TUint KDiscoveryResponseDisableOpt = 12; |
|
298 |
|
299 /** KLevelIrlap |
|
300 |
|
301 Sets the host's first service hint byte used in XID frames. |
|
302 |
|
303 Retrieves the first hint byte. */ |
|
304 const TUint KFirstHintByteOpt = 13; // Hint Bytes |
|
305 |
|
306 /** KLevelIrlap |
|
307 |
|
308 Sets the host's second service hint byte used in XID frames. |
|
309 |
|
310 Retrieves the second hint byte */ |
|
311 const TUint KSecondHintByteOpt = 14; |
|
312 |
|
313 // On KLevelIrmux |
|
314 |
|
315 /** KLevelIrmux |
|
316 |
|
317 Turns on transport layer segmentation with the segment size specified. This |
|
318 value is advertised to the remote machine as the maximum amount of data we |
|
319 can reassemble. |
|
320 |
|
321 Returns KErrNone */ |
|
322 const TUint KTinyTPLocalSegSizeOpt=7; // This value is advertised to the remote machine as the max amount of data we can reassemble |
|
323 |
|
324 /** KLevelIrmux |
|
325 |
|
326 Queries the remote machine's segment size. The remote machine is unable |
|
327 to assemble more data than this. |
|
328 |
|
329 Returns the remote machine's segment size. */ |
|
330 const TUint KTinyTPRemoteSegSizeOpt=8; // Remote machine is unable to reassemble more data than this |
|
331 |
|
332 /** |
|
333 Disables TinyTP reassembly of segmented packets. */ |
|
334 const TUint KTinyTPDisabledSegmentation=15; |
|
335 /** |
|
336 @deprecated |
|
337 Disables TinyTP reassembly of segmented packets. */ |
|
338 const TUint KTinyTPDiasbledSegmentation=15; |
|
339 |
|
340 /** |
|
341 @internalComponent |
|
342 */ |
|
343 const TUint KIrdaInternalOption=0x4000000; |
|
344 |
|
345 /** |
|
346 @internalTechnology |
|
347 */ |
|
348 const TUint KTinyTPSetMaxBufferSpace=16 | KIrdaInternalOption; |
|
349 |
|
350 |
|
351 |
|
352 /** The option relates to IrLAP. */ |
|
353 const TUint KLevelIrlap=4; |
|
354 |
|
355 /** The option relates to IrMUX. */ |
|
356 const TUint KLevelIrmux=5; |
|
357 |
|
358 /** The maximum length of a class name in an IAS entry. */ |
|
359 const TUint KIASClassNameMax=60; |
|
360 |
|
361 /** The maximum length of an attribute in an IAS entry. */ |
|
362 const TUint KIASAttributeNameMax=60; |
|
363 |
|
364 /** The maximum length of a TIASQuery descriptor. */ |
|
365 const TUint KMaxQueryStringLength=128; |
|
366 |
|
367 //################# CLASS DEFINITIONS ######################## |
|
368 |
|
369 NONSHARABLE_CLASS(TIrdaSockAddr) : public TSockAddr |
|
370 /** An IrDA socket address. |
|
371 @publishedAll |
|
372 @released */ |
|
373 { |
|
374 struct SIrdaAddr |
|
375 { |
|
376 TUint iHostDevAddr; |
|
377 TUint iRemoteDevAddr; |
|
378 TBool iSniff; |
|
379 TBool iSolicited; |
|
380 TUint8 iIrlapVersion; |
|
381 TUint8 iFirstServiceHintByte; |
|
382 TUint8 iSecondServiceHintByte; |
|
383 TUint8 iCharacterSet; |
|
384 TUint8 iServiceHintByteCount; |
|
385 // Extra stuff for MUX |
|
386 TUint8 iHomePort; |
|
387 TUint8 iRemotePort; |
|
388 TUint8 iSpare; |
|
389 }; |
|
390 public: |
|
391 IMPORT_C TIrdaSockAddr(); |
|
392 IMPORT_C TIrdaSockAddr(const TSockAddr &aAddr); |
|
393 /** Casts a reference to a general socket address into an IrDA socket address. |
|
394 |
|
395 @param aAddr A reference to a general socket address. |
|
396 @return The socket address returned as a reference to an IrDA socket address. */ |
|
397 |
|
398 /** Casts a pointer to a general socket address into an IrDA socket address. |
|
399 |
|
400 @param aAddr A pointer to a general socket address. |
|
401 @return The socket address returned as a reference to an IrDA socket address. */ |
|
402 IMPORT_C static TIrdaSockAddr &Cast(const TSockAddr &aAddr); |
|
403 |
|
404 /** Casts a reference to a general socket address into an IrDA socket address. |
|
405 |
|
406 @param aAddr A reference to a general socket address. |
|
407 @return The socket address returned as a reference to an IrDA socket address. */ |
|
408 |
|
409 /** Casts a pointer to a general socket address into an IrDA socket address. |
|
410 |
|
411 @param aAddr A pointer to a general socket address. |
|
412 @return The socket address returned as a reference to an IrDA socket address. */ |
|
413 |
|
414 IMPORT_C static TIrdaSockAddr &Cast(const TSockAddr *aAddr); |
|
415 /** Returns the remote device address. |
|
416 |
|
417 @return The remote device address as a 32 bit value. */ |
|
418 |
|
419 IMPORT_C TUint GetRemoteDevAddr() const; |
|
420 /** Sets the remote device address. |
|
421 |
|
422 @param aRemote The remote device address as a 32-bit value. */ |
|
423 |
|
424 IMPORT_C void SetRemoteDevAddr(const TUint aRemote); |
|
425 |
|
426 /** Returns the host device address. |
|
427 |
|
428 @return The host device address as a 32 bit value. */ |
|
429 IMPORT_C TUint GetHostDevAddr() const; |
|
430 |
|
431 /** Sets the host device address. |
|
432 |
|
433 @param aHost The host device address as a 32-bit value. */ |
|
434 IMPORT_C void SetHostDevAddr(const TUint aHost); |
|
435 |
|
436 /** Returns the remote device's sniff status, i.e. whether the device is capable |
|
437 of sniffing for IrDA devices. |
|
438 |
|
439 @return True, if the device is capable of sniffing for IrDA devices; false, |
|
440 otherwise. */ |
|
441 IMPORT_C TBool GetSniffStatus() const; |
|
442 |
|
443 /** Sets the sniff status for the remote device, i.e. whether the device is capable |
|
444 of sniffing for IrDA devices. |
|
445 |
|
446 @param aSniff True, if the device is capable of sniffing for IrDA devices; |
|
447 false, otherwise. */ |
|
448 IMPORT_C void SetSniffStatus(const TBool aSniff); |
|
449 |
|
450 /** Returns the solicited status. |
|
451 |
|
452 The solicited status indicates whether a discovery was initiated by the host |
|
453 device or a remote device. |
|
454 |
|
455 @return True, if the discovery was initiated by the host device; false if |
|
456 the discovery was initiated by the remote device. */ |
|
457 IMPORT_C TBool GetSolicitedStatus() const; |
|
458 |
|
459 /** Sets the solicited status. The solicited status indcates whether a discovery |
|
460 was initiated by the host device or a remote device. |
|
461 |
|
462 @param aSolicited ETrue, if the discovery was initiated by the host device; |
|
463 EFalse, if discovery was initiated by the remote device. */ |
|
464 IMPORT_C void SetSolicitedStatus(const TBool aSolicited); |
|
465 |
|
466 /** Returns the remote device's IrLAP version number. |
|
467 |
|
468 This should be 0x00 indicating that the device conforms to the IrDA IrLAP |
|
469 1.00 specification. |
|
470 |
|
471 @return The device's IrLAP version number. */ |
|
472 IMPORT_C TUint8 GetIrlapVersion() const; |
|
473 |
|
474 /** Sets the IrLAP version number for the remote device. |
|
475 |
|
476 This should be 0x00 indicating that the device conforms to the IrDA IrLAP |
|
477 1.00 specification. |
|
478 |
|
479 @param aIrlapVersion The device's IrLAP version number. */ |
|
480 IMPORT_C void SetIrlapVersion(const TUint8 aIrlapVersion); |
|
481 |
|
482 /** Returns the character set supported by the remote device. |
|
483 |
|
484 @return One of the TIASCharSet enumerator values defining the character set |
|
485 supported by the device. */ |
|
486 IMPORT_C TUint8 GetCharacterSet() const; |
|
487 |
|
488 /** Sets the character set supported by the remote device. |
|
489 |
|
490 @param aCharacterSet One of the TIASCharSet enumerator values defining the |
|
491 character set supported by the device */ |
|
492 IMPORT_C void SetCharacterSet(const TUint8 aCharacterSet); |
|
493 |
|
494 /** Returns the remote device's first service hint byte. Service hint bytes indicate |
|
495 the level of IrLMP support provided by the device. |
|
496 |
|
497 @return The first service hint byte. The individual bits have the following |
|
498 meaning: Bit 0 (0x01) - PnP Compatible Bit 1 (0x02) - PDA/Palmtop Bit 2 (0x04) |
|
499 - Computer Bit 3 (0x08) - Printer Bit 4 (0x10) - Modem Bit 5 (0x20) - Fax |
|
500 Bit 6 (0x40) - LAN Access Bit 7 (0x80) - Extension */ |
|
501 IMPORT_C TUint8 GetFirstServiceHintByte() const; |
|
502 |
|
503 /** Sets the first service hint byte for the remote device. The service hint bytes |
|
504 indicate the level of IrLMP support provided by the device. |
|
505 |
|
506 @param aFirstServiceHintByte The first service hint byte. The individual bits |
|
507 have the following meaning: Bit 0 (0x01) - PnP Compatible Bit 1 (0x02) - PDA/Palmtop |
|
508 Bit 2 (0x04) - Computer Bit 3 (0x08) - Printer Bit 4 (0x10) - Modem Bit 5 |
|
509 (0x20) - Fax Bit 6 (0x40) - LAN Access Bit 7 (0x80) - Extension */ |
|
510 IMPORT_C void SetFirstServiceHintByte(const TUint8 aFirstServiceHintByte); |
|
511 |
|
512 /** Returns the remote device's first service hint byte. Service hint bytes indicate |
|
513 the level of IrLMP support provided by the device. |
|
514 |
|
515 @return The second service hint byte. The individual bits have the following |
|
516 meaning: Bit 0 (0x01) - Telephony Bit 1 (0x02) - File Server Bit 2 (0x04) |
|
517 - IrCOMM Bit 3 (0x08) - reserved Bit 4 (0x10) - reserved Bit 5 (0x20) - IrOBEX |
|
518 Bit 6 (0x40) - reserved Bit 7 (0x80) - Extension */ |
|
519 IMPORT_C TUint8 GetSecondServiceHintByte() const; |
|
520 |
|
521 /** Sets the second service hint byte for the remote device. The service hint bytes |
|
522 indicate the level of IrLMP support provided by the device. |
|
523 |
|
524 @param aSecondServiceHintByte The second service hint byte. The individual |
|
525 bits have the following meaning: Bit 0 (0x01) - Telephony Bit 1 (0x02) - File |
|
526 Server Bit 2 (0x04) - IrCOMM Bit 3 (0x08) - reserved Bit 4 (0x10) - reserved |
|
527 Bit 5 (0x20) - IrOBEX Bit 6 (0x40) - reserved Bit 7 (0x80) - Extension */ |
|
528 IMPORT_C void SetSecondServiceHintByte(const TUint8 aSecondServiceHintByte); |
|
529 |
|
530 /** Returns the number of service hint bytes for the remote device. |
|
531 |
|
532 @return The number of service hint bytes. */ |
|
533 IMPORT_C TUint8 GetServiceHintByteCount() const; |
|
534 |
|
535 /** Sets the number of service hint bytes for the remote device. |
|
536 |
|
537 @param aServiceHintByteCount The number of service hint bytes. */ |
|
538 IMPORT_C void SetServiceHintByteCount(const TUint8 aServiceHintByteCount); |
|
539 IMPORT_C TUint8 GetHomePort() const; |
|
540 IMPORT_C void SetHomePort(const TUint8 aHomePort); |
|
541 IMPORT_C TUint8 GetRemotePort() const; |
|
542 IMPORT_C void SetRemotePort(const TUint8 aRemotePort); |
|
543 private: |
|
544 SIrdaAddr* addrPtr() const; |
|
545 }; |
|
546 |
|
547 enum TIASDataType |
|
548 /** An enumeration whose enumerators define the type of response received from |
|
549 an Information Access Service (IAS) query. |
|
550 |
|
551 @see TIASResponse */ |
|
552 { |
|
553 /** No response type defined. */ |
|
554 EIASDataMissing=0, |
|
555 /** The response type is an integer. */ |
|
556 EIASDataInteger=1, |
|
557 /** The response type is binary data. */ |
|
558 EIASDataOctetSequence=2, |
|
559 /** The response type is a string. */ |
|
560 EIASDataUserString=3 |
|
561 }; |
|
562 |
|
563 enum TIASCharSet |
|
564 /** The character set encoding of the character string response from an IAS query. |
|
565 |
|
566 @see TIASResponse::GetCharString() |
|
567 @see TIrdaSockAddr::GetCharacterSet() */ |
|
568 { |
|
569 /** String is standard ASCII. */ |
|
570 EIASCharSetUserStringASCII =0x00, |
|
571 /** String is ISO Latin-1. */ |
|
572 EIASCharSetUserStringISO_8859_1=0x01, |
|
573 /** String is ISO Latin-2. */ |
|
574 EIASCharSetUserStringISO_8859_2=0x02, |
|
575 /** String is ISO Latin-3. */ |
|
576 EIASCharSetUserStringISO_8859_3=0x03, |
|
577 /** String is ISO Latin-4. */ |
|
578 EIASCharSetUserStringISO_8859_4=0x04, |
|
579 /** String is ISO-8859-5 (Cyrillic). */ |
|
580 EIASCharSetUserStringISO_8859_5=0x05, |
|
581 /** String is ISO-8859-6 (Arabic). */ |
|
582 EIASCharSetUserStringISO_8859_6=0x06, |
|
583 /** String is ISO-8859-7 (Greek). */ |
|
584 EIASCharSetUserStringISO_8859_7=0x07, |
|
585 /** String is ISO-8859-8 (Hebrew). */ |
|
586 EIASCharSetUserStringISO_8859_8=0x08, |
|
587 /** String is ISO Latin-5. */ |
|
588 EIASCharSetUserStringISO_8859_9=0x09, |
|
589 /** String is UNICODE. */ |
|
590 EIASCharSetUserStringUnicode=0xFF, |
|
591 }; |
|
592 |
|
593 NONSHARABLE_CLASS(TIASQuery) : public TBuf8<KMaxQueryStringLength> |
|
594 /** An Information Access Service (IAS) query to another device's IAS server. |
|
595 @publishedAll |
|
596 @released |
|
597 @see TIASResponse */ |
|
598 { |
|
599 public: |
|
600 IMPORT_C TIASQuery(const TDesC8& aClass,const TDesC8& aAttribute,TUint aRemoteDevAddr); |
|
601 IMPORT_C TIASQuery(); |
|
602 IMPORT_C void Set(const TDesC8& aClass,const TDesC8& aAttribute,TUint aRemoteDevAddr); |
|
603 IMPORT_C void Get(TDes8& aClass,TDes8& aAttribute,TUint& aRemoteDevAddr); |
|
604 private: |
|
605 // This data padding has been added to help prevent future binary compatibility breaks |
|
606 // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used |
|
607 TUint32 iPadding1; |
|
608 TUint32 iPadding2; |
|
609 }; |
|
610 |
|
611 NONSHARABLE_CLASS(TIASResponse) : public TBuf8<KMaxQueryStringLength> |
|
612 /** Response from an Information Access Service (IAS) query to another device's |
|
613 IAS server. |
|
614 @publishedAll |
|
615 @released |
|
616 @see TIASQuery */ |
|
617 { |
|
618 public: // But not exported :-) |
|
619 void SetToInteger(TUint anInteger); |
|
620 void SetToCharString(const TDesC8& aCharString); |
|
621 void SetToOctetSeq(const TDesC8& aData); |
|
622 #ifdef _UNICODE |
|
623 void SetToCharString(const TDesC16& aWideString); |
|
624 #endif |
|
625 |
|
626 public: |
|
627 IMPORT_C TIASResponse(); |
|
628 /** Indicates the response contains a list. */ |
|
629 IMPORT_C TBool IsList() const; |
|
630 /** Indicates the number of items in the response. */ |
|
631 IMPORT_C TInt NumItems() const; |
|
632 |
|
633 /** Returns the type of the response. |
|
634 |
|
635 @return An enumeration identifying the type of response. */ |
|
636 IMPORT_C TIASDataType Type() const; |
|
637 |
|
638 IMPORT_C TInt GetInteger(TInt &aResult,TInt anIndex=0) const; |
|
639 IMPORT_C TInt GetOctetSeq(TDes8 &aResult,TInt anIndex=0) const; |
|
640 IMPORT_C TInt GetCharString(TDes8 &aResult,TInt anIndex=0) const; |
|
641 IMPORT_C const TPtrC8 GetCharString8(TInt anIndex=0) const; |
|
642 |
|
643 /** Gets the response string. |
|
644 |
|
645 This is called if the response type indicates a string. |
|
646 |
|
647 @param aResult On return, an 8 bit modifiable descriptor containing the response |
|
648 string. The length of the response string can never be greater than the value |
|
649 of (KMaxQueryStringLength - 3). |
|
650 @param anIndex Reserved for future use. This argument must be allowed to default |
|
651 to 0 and must not be overriden. |
|
652 @return If successful, one of the TIASCharSet enumerator values defining the |
|
653 character set encoding of the response string. KErrNotSupported, if a non-zero |
|
654 value has been specified for anIndex. KErrCorrupt, if the response type is |
|
655 not a string. |
|
656 @see TIASResponse::Type() */ |
|
657 IMPORT_C TInt GetCharString(TDes16 &aResult,TInt anIndex=0) const; |
|
658 |
|
659 IMPORT_C const TPtrC16 GetCharString16(TInt anIndex=0) const; |
|
660 |
|
661 private: |
|
662 // This data padding has been added to help prevent future binary compatibility breaks |
|
663 // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used |
|
664 TUint32 iPadding1; |
|
665 TUint32 iPadding2; |
|
666 }; |
|
667 |
|
668 NONSHARABLE_CLASS(TIASDatabaseEntryV001) |
|
669 /** The data for an Information Access Service (IAS) record in the network database. |
|
670 |
|
671 An object of this type is contained in a packaged modifiable buffer descriptor. |
|
672 @publishedAll |
|
673 @released |
|
674 @see TIASDatabaseEntry */ |
|
675 { |
|
676 public: |
|
677 IMPORT_C TIASDatabaseEntryV001(); |
|
678 |
|
679 /** The class name for the IAS entry |
|
680 |
|
681 This is a template specialisation of a TBuf8<TInt> */ |
|
682 TBuf8<KIASClassNameMax> iClassName; |
|
683 |
|
684 /** The attribute for the IAS entry. |
|
685 |
|
686 This is a template specialisation of a TBuf8<TInt> */ |
|
687 TBuf8<KIASAttributeNameMax> iAttributeName; |
|
688 |
|
689 /** The response data. */ |
|
690 TIASResponse iData; |
|
691 |
|
692 private: |
|
693 // This data padding has been added to help prevent future binary compatibility breaks |
|
694 // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used |
|
695 TUint32 iPadding1; |
|
696 TUint32 iPadding2; |
|
697 }; |
|
698 |
|
699 NONSHARABLE_CLASS(TIASDatabaseEntry) : public TPckgBuf<TIASDatabaseEntryV001> |
|
700 /** An Information Access Service (IAS) record in the network database. |
|
701 |
|
702 The record data is contained in an object of type TIASDatabaseEntryV001 packaged |
|
703 in a modifiable buffer descriptor. |
|
704 @publishedAll |
|
705 @released |
|
706 @see RNetDatabase */ |
|
707 { |
|
708 public: |
|
709 IMPORT_C void SetClassName(const TDesC8& aClassName); |
|
710 IMPORT_C void SetAttributeName(const TDesC8& anAttributeName); |
|
711 IMPORT_C void SetToInteger(const TUint anInteger); |
|
712 IMPORT_C void SetToCharString(const TDesC8& aCharString); |
|
713 |
|
714 /** Sets the response type corresponding to the class and attribute defined in |
|
715 this record, as binary data. |
|
716 |
|
717 @param aData The response binary data. The length of this data can never be |
|
718 greater than (KMaxQueryStringLength - 3). */ |
|
719 IMPORT_C void SetToOctetSeq(const TDesC8& aData); |
|
720 |
|
721 #ifdef _UNICODE //need to be able to enter wide entries in unicode builds |
|
722 IMPORT_C void SetToCharString(const TDesC16& aWideString);//new export |
|
723 #endif |
|
724 }; |
|
725 |
|
726 #endif // __IR_SOCK_H__ |