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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
28 #include <e32property.h>
30 //################## EXPORTED CONSTANTS ########################
33 /** IrDA protocol family. */
34 const TUint KIrdaAddrFamily=0x100; // Address of Irda prot family
36 /** IrMUX protocol within the IrDA protocol family. */
37 const TUint KIrmux=88; // Protocol number for Irmux
39 /** IrTinyTP protocol within the IrDA protocol family.. */
40 const TUint KIrTinyTP=89; // Protocol number for IrTinyTP
42 /** An invalid LSAP number--binding to this will select the first unused LSAP. */
43 const TUint KAutoBindLSAP = 0xffff;
46 /** Category used when publishing IrDA status notifications. */
47 const TUid KIrdaPropertyCategory = {KUidSystemCategoryValue};
49 /** Key used when publishing IrDA status notifications. */
50 const TUint KIrdaStatus = 0x100052d1;
53 /** Names used for IrDA status notifications. */
54 namespace TIrdaStatusCodes
68 /** PnP support - first service hint byte. */
69 const TUint8 KIrPnPMask=0x01; // PnP support - FIRST SERVICE HINT BYTE
71 /** PDA/Palmtop - first service hint byte. */
72 const TUint8 KPalmtopMask=0x02; // PDA/Palmtop - FIRST SERVICE HINT BYTE
74 /** Computer - first service hint byte. */
75 const TUint8 KComputerMask=0x04; // Computer - FIRST SERVICE HINT BYTE
77 /** Printer - first service hint byte. */
78 const TUint8 KPrinterMask=0x08; // Printer - FIRST SERVICE HINT BYTE
80 /** IrModem - first service hint byte. */
81 const TUint8 KModemMask=0x10; // IrModem - FIRST SERVICE HINT BYTE
83 /** Fax - first service hint byte. */
84 const TUint8 KFaxMask=0x20; // Fax - FIRST SERVICE HINT BYTE
86 /** LAN Access - first service hint byte. */
87 const TUint8 KLANAccessMask=0x40; // LAN Access - FIRST SERVICE HINT BYTE
89 /** Extension bit - first service hint byte. */
90 const TUint8 KExtensionMask=0x80; // Extension bit - FIRST SERVICE HINT BYTE
92 /** Telephony - second service hint byte. */
93 const TUint8 KTelephonyMask=0x01; // Telephony - SECOND SERVICE HINT BYTE
95 /** File Server - second service hint byte. */
96 const TUint8 KFileServerMask=0x02; // File Server - SECOND SERVICE HINT BYTE
98 /** IrCOMM support - second service hint byte. */
99 const TUint8 KIrCommMask=0x04; // IrCOMM support - SECOND SERVICE HINT BYTE
101 /** IrOBEX support - second service hint byte. */
102 const TUint8 KIrObexMask=0x20; // IrObex support - SECOND SERVICE HINT BYTE
108 /** Completes on receipt of a discovery indication.
110 Returns log entry in a TNameEntry.
112 Ioctl level : KIrdaAddrFamily */
113 const TUint KDiscoveryIndicationIoctl=0;
115 /** Completes on successfully making RSocket EXCLUSIVE else returns error.
117 Completes successfully or returns KErrDisconnected if failed.
119 Ioctl level: KIrdaAddrFamily */
120 const TUint KExclusiveModeIoctl=1;
122 /** Completes on successfully making RSocket MULTIPLEXED else returns error.
124 Completes successfully or returns KErrDisconnected if failed.
126 Ioctl level: KIrdaAddrFamily */
127 const TUint KMultiplexModeIoctl=2;
129 /** Completes on doing a status request on IrMUX layer packets to send.
131 Returns TDes8* holding TUint indicating number of outstanding MUX data requests.
133 Ioctl level: KIrdaAddrFamily */
134 const TUint KIrmuxStatusRequestIoctl=3;
136 /** Completes on doing a status request on IrLAP layer packets to send.
138 Returns TDes8* holding TUint indicating the number of outstanding LAP data
141 Ioctl level: KIrdaAddrFamily */
142 const TUint KIrlapStatusRequestIoctl=4;
144 /** Completes on successfully putting RSocket into IDLE mode.
146 Completes successfully or returns KErrAbort if failed.
148 Ioctl level: KIrdaAddrFamily */
149 const TUint KIdleRequestIoctl=5;
151 /** Completes on successfully taking RSocket out of IDLE mode.
153 Completes successfully or returns KErrAbort if failed.
155 Ioctl level: KIrdaAddrFamily */
156 const TUint KIdleClearRequestIoctl=6;
158 /** Completes on receipt of an IrLAP disconnect indication.
160 Completes successfully on IrLAP or IrMUX disconnect on this connection.
162 Ioctl level: KIrdaAddrFamily */
163 const TUint KDisconnectIndicationIoctl=7;
165 /** Completes on doing a status request on IrLAP layer packets to send.
167 Returns TDes8* holding TUint indicating the number of outstanding LAP data
170 Ioctl level: KIrdaAddrFamily */
171 const TUint KIrlapStatusIndicationIoctl=8;
173 /** Completes on receiving a status indication from IrLAP.
175 Returns TDes8* holding TUint indicating the number of outstanding MUX data
178 Ioctl level: KIrdaAddrFamily */
179 const TUint KIrmuxStatusIndicationIoctl=9;
181 /** Completes on doing an IrLAP link reset.
183 Does an SNRMP-UAF link reset which can be initiated from either primary or
186 Ioctl level: KIrdaAddrFamily */
187 const TUint KIrlapResetRequestIoctl=10;
189 /** Completes on receipt of an IrLAP link reset indication.
191 Completes with error value KErrNone if link is successfully reset.
193 Ioctl level: KIrdaAddrFamily */
194 const TUint KIrlapResetIndicationIoctl=11;
196 /** Completes on doing an IrLAP link reset.
198 Does a DISCP-UAF link disconnect which can be initiated from either primary
201 Ioctl level: KIrdaAddrFamily */
202 const TUint KIrlapDisconnectRequestIoctl=12;
204 const TUint KExclusiveMode=0;
206 const TUint KMultiplexMode=1;
209 //******************** Irda Set/GetOpts ******************************
210 // These two are done on Socket Write
216 Sets transfer mode to be unexpedited (the default).
218 Not recommended for use with SetOpt(). Preferred use is with RSocket::Send()
221 const TUint KUnexpeditedDataOpt = 0; // Default
225 Sets transfer mode to be expedited (urgent).
227 Not recommended for use with SetOpt(). Preferred use is with RSocket::Send()
230 const TUint KExpeditedDataOpt = 1; // Urgent data transfer
236 Sets number of discovery slots.
239 const TUint KDiscoverySlotsOpt = 2;
243 Sets the requested maximum link baud rate.
245 Returns KErrInUse, if the link is already running.
247 Returns with the currently set maximum link baud supported. */
248 const TUint KUserBaudOpt = 3;
252 Sets the requested maximum data packet size that can be received by the host.
254 Returns KErrInUse, if the link is already running.
256 Returns with the currently set value for the maximum receivable data size
257 of the host IrLAP layer. */
258 const TUint KHostMaxDataSizeOpt = 4;
262 Returns KErrNotSupported.
264 Cannot set this value for the remote station.
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
272 Set the maximum link turnaround time for the host IrLAP layer.
274 Returns KErrInUse, if the link is already running.
276 Returns with the currently set value for the host link turnaround time */
277 const TUint KHostMaxTATimeOpt = 5;
281 Disables IrLAP level reset_check/wait states */
282 const TUint KIrlapDisableResetOpt = 9; // This disables Irlap level reset_check/wait states.
286 Allows the client to set local busy in IrLAP. */
287 const TUint KLocalBusyDetectedOpt = 10; // Client can set local busy in Irlap
291 Allows the client to clear local busy in IrLAP */
292 const TUint KLocalBusyClearedOpt = 11; // Client can clear local busy in Irlap
296 Disables discovery response for a short period (typically 3 seconds). */
297 const TUint KDiscoveryResponseDisableOpt = 12;
301 Sets the host's first service hint byte used in XID frames.
303 Retrieves the first hint byte. */
304 const TUint KFirstHintByteOpt = 13; // Hint Bytes
308 Sets the host's second service hint byte used in XID frames.
310 Retrieves the second hint byte */
311 const TUint KSecondHintByteOpt = 14;
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
322 const TUint KTinyTPLocalSegSizeOpt=7; // This value is advertised to the remote machine as the max amount of data we can reassemble
326 Queries the remote machine's segment size. The remote machine is unable
327 to assemble more data than this.
329 Returns the remote machine's segment size. */
330 const TUint KTinyTPRemoteSegSizeOpt=8; // Remote machine is unable to reassemble more data than this
333 Disables TinyTP reassembly of segmented packets. */
334 const TUint KTinyTPDisabledSegmentation=15;
337 Disables TinyTP reassembly of segmented packets. */
338 const TUint KTinyTPDiasbledSegmentation=15;
343 const TUint KIrdaInternalOption=0x4000000;
348 const TUint KTinyTPSetMaxBufferSpace=16 | KIrdaInternalOption;
352 /** The option relates to IrLAP. */
353 const TUint KLevelIrlap=4;
355 /** The option relates to IrMUX. */
356 const TUint KLevelIrmux=5;
358 /** The maximum length of a class name in an IAS entry. */
359 const TUint KIASClassNameMax=60;
361 /** The maximum length of an attribute in an IAS entry. */
362 const TUint KIASAttributeNameMax=60;
364 /** The maximum length of a TIASQuery descriptor. */
365 const TUint KMaxQueryStringLength=128;
367 //################# CLASS DEFINITIONS ########################
369 NONSHARABLE_CLASS(TIrdaSockAddr) : public TSockAddr
370 /** An IrDA socket address.
377 TUint iRemoteDevAddr;
380 TUint8 iIrlapVersion;
381 TUint8 iFirstServiceHintByte;
382 TUint8 iSecondServiceHintByte;
383 TUint8 iCharacterSet;
384 TUint8 iServiceHintByteCount;
385 // Extra stuff for MUX
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.
395 @param aAddr A reference to a general socket address.
396 @return The socket address returned as a reference to an IrDA socket address. */
398 /** Casts a pointer to a general socket address into an IrDA socket address.
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);
404 /** Casts a reference to a general socket address into an IrDA socket address.
406 @param aAddr A reference to a general socket address.
407 @return The socket address returned as a reference to an IrDA socket address. */
409 /** Casts a pointer to a general socket address into an IrDA socket address.
411 @param aAddr A pointer to a general socket address.
412 @return The socket address returned as a reference to an IrDA socket address. */
414 IMPORT_C static TIrdaSockAddr &Cast(const TSockAddr *aAddr);
415 /** Returns the remote device address.
417 @return The remote device address as a 32 bit value. */
419 IMPORT_C TUint GetRemoteDevAddr() const;
420 /** Sets the remote device address.
422 @param aRemote The remote device address as a 32-bit value. */
424 IMPORT_C void SetRemoteDevAddr(const TUint aRemote);
426 /** Returns the host device address.
428 @return The host device address as a 32 bit value. */
429 IMPORT_C TUint GetHostDevAddr() const;
431 /** Sets the host device address.
433 @param aHost The host device address as a 32-bit value. */
434 IMPORT_C void SetHostDevAddr(const TUint aHost);
436 /** Returns the remote device's sniff status, i.e. whether the device is capable
437 of sniffing for IrDA devices.
439 @return True, if the device is capable of sniffing for IrDA devices; false,
441 IMPORT_C TBool GetSniffStatus() const;
443 /** Sets the sniff status for the remote device, i.e. whether the device is capable
444 of sniffing for IrDA devices.
446 @param aSniff True, if the device is capable of sniffing for IrDA devices;
448 IMPORT_C void SetSniffStatus(const TBool aSniff);
450 /** Returns the solicited status.
452 The solicited status indicates whether a discovery was initiated by the host
453 device or a remote device.
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;
459 /** Sets the solicited status. The solicited status indcates whether a discovery
460 was initiated by the host device or a remote device.
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);
466 /** Returns the remote device's IrLAP version number.
468 This should be 0x00 indicating that the device conforms to the IrDA IrLAP
471 @return The device's IrLAP version number. */
472 IMPORT_C TUint8 GetIrlapVersion() const;
474 /** Sets the IrLAP version number for the remote device.
476 This should be 0x00 indicating that the device conforms to the IrDA IrLAP
479 @param aIrlapVersion The device's IrLAP version number. */
480 IMPORT_C void SetIrlapVersion(const TUint8 aIrlapVersion);
482 /** Returns the character set supported by the remote device.
484 @return One of the TIASCharSet enumerator values defining the character set
485 supported by the device. */
486 IMPORT_C TUint8 GetCharacterSet() const;
488 /** Sets the character set supported by the remote device.
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);
494 /** Returns the remote device's first service hint byte. Service hint bytes indicate
495 the level of IrLMP support provided by the device.
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;
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.
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);
512 /** Returns the remote device's first service hint byte. Service hint bytes indicate
513 the level of IrLMP support provided by the device.
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;
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.
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);
530 /** Returns the number of service hint bytes for the remote device.
532 @return The number of service hint bytes. */
533 IMPORT_C TUint8 GetServiceHintByteCount() const;
535 /** Sets the number of service hint bytes for the remote device.
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);
544 SIrdaAddr* addrPtr() const;
548 /** An enumeration whose enumerators define the type of response received from
549 an Information Access Service (IAS) query.
553 /** No response type defined. */
555 /** The response type is an integer. */
557 /** The response type is binary data. */
558 EIASDataOctetSequence=2,
559 /** The response type is a string. */
564 /** The character set encoding of the character string response from an IAS query.
566 @see TIASResponse::GetCharString()
567 @see TIrdaSockAddr::GetCharacterSet() */
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,
593 NONSHARABLE_CLASS(TIASQuery) : public TBuf8<KMaxQueryStringLength>
594 /** An Information Access Service (IAS) query to another device's IAS server.
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);
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
611 NONSHARABLE_CLASS(TIASResponse) : public TBuf8<KMaxQueryStringLength>
612 /** Response from an Information Access Service (IAS) query to another device's
618 public: // But not exported :-)
619 void SetToInteger(TUint anInteger);
620 void SetToCharString(const TDesC8& aCharString);
621 void SetToOctetSeq(const TDesC8& aData);
623 void SetToCharString(const TDesC16& aWideString);
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;
633 /** Returns the type of the response.
635 @return An enumeration identifying the type of response. */
636 IMPORT_C TIASDataType Type() const;
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;
643 /** Gets the response string.
645 This is called if the response type indicates a string.
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
656 @see TIASResponse::Type() */
657 IMPORT_C TInt GetCharString(TDes16 &aResult,TInt anIndex=0) const;
659 IMPORT_C const TPtrC16 GetCharString16(TInt anIndex=0) const;
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
668 NONSHARABLE_CLASS(TIASDatabaseEntryV001)
669 /** The data for an Information Access Service (IAS) record in the network database.
671 An object of this type is contained in a packaged modifiable buffer descriptor.
674 @see TIASDatabaseEntry */
677 IMPORT_C TIASDatabaseEntryV001();
679 /** The class name for the IAS entry
681 This is a template specialisation of a TBuf8<TInt> */
682 TBuf8<KIASClassNameMax> iClassName;
684 /** The attribute for the IAS entry.
686 This is a template specialisation of a TBuf8<TInt> */
687 TBuf8<KIASAttributeNameMax> iAttributeName;
689 /** The response data. */
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
699 NONSHARABLE_CLASS(TIASDatabaseEntry) : public TPckgBuf<TIASDatabaseEntryV001>
700 /** An Information Access Service (IAS) record in the network database.
702 The record data is contained in an object of type TIASDatabaseEntryV001 packaged
703 in a modifiable buffer descriptor.
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);
714 /** Sets the response type corresponding to the class and attribute defined in
715 this record, as binary data.
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);
721 #ifdef _UNICODE //need to be able to enter wide entries in unicode builds
722 IMPORT_C void SetToCharString(const TDesC16& aWideString);//new export
726 #endif // __IR_SOCK_H__