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 "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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
26 #include <e32property.h>
28 //################## EXPORTED CONSTANTS ########################
31 /** IrDA protocol family. */
32 const TUint KIrdaAddrFamily=0x100; // Address of Irda prot family
34 /** IrMUX protocol within the IrDA protocol family. */
35 const TUint KIrmux=88; // Protocol number for Irmux
37 /** IrTinyTP protocol within the IrDA protocol family.. */
38 const TUint KIrTinyTP=89; // Protocol number for IrTinyTP
40 /** An invalid LSAP number--binding to this will select the first unused LSAP. */
41 const TUint KAutoBindLSAP = 0xffff;
44 /** Category used when publishing IrDA status notifications. */
45 const TUid KIrdaPropertyCategory = {KUidSystemCategoryValue};
47 /** Key used when publishing IrDA status notifications. */
48 const TUint KIrdaStatus = 0x100052d1;
51 /** Names used for IrDA status notifications. */
52 namespace TIrdaStatusCodes
66 /** PnP support - first service hint byte. */
67 const TUint8 KIrPnPMask=0x01; // PnP support - FIRST SERVICE HINT BYTE
69 /** PDA/Palmtop - first service hint byte. */
70 const TUint8 KPalmtopMask=0x02; // PDA/Palmtop - FIRST SERVICE HINT BYTE
72 /** Computer - first service hint byte. */
73 const TUint8 KComputerMask=0x04; // Computer - FIRST SERVICE HINT BYTE
75 /** Printer - first service hint byte. */
76 const TUint8 KPrinterMask=0x08; // Printer - FIRST SERVICE HINT BYTE
78 /** IrModem - first service hint byte. */
79 const TUint8 KModemMask=0x10; // IrModem - FIRST SERVICE HINT BYTE
81 /** Fax - first service hint byte. */
82 const TUint8 KFaxMask=0x20; // Fax - FIRST SERVICE HINT BYTE
84 /** LAN Access - first service hint byte. */
85 const TUint8 KLANAccessMask=0x40; // LAN Access - FIRST SERVICE HINT BYTE
87 /** Extension bit - first service hint byte. */
88 const TUint8 KExtensionMask=0x80; // Extension bit - FIRST SERVICE HINT BYTE
90 /** Telephony - second service hint byte. */
91 const TUint8 KTelephonyMask=0x01; // Telephony - SECOND SERVICE HINT BYTE
93 /** File Server - second service hint byte. */
94 const TUint8 KFileServerMask=0x02; // File Server - SECOND SERVICE HINT BYTE
96 /** IrCOMM support - second service hint byte. */
97 const TUint8 KIrCommMask=0x04; // IrCOMM support - SECOND SERVICE HINT BYTE
99 /** IrOBEX support - second service hint byte. */
100 const TUint8 KIrObexMask=0x20; // IrObex support - SECOND SERVICE HINT BYTE
106 /** Completes on receipt of a discovery indication.
108 Returns log entry in a TNameEntry.
110 Ioctl level : KIrdaAddrFamily */
111 const TUint KDiscoveryIndicationIoctl=0;
113 /** Completes on successfully making RSocket EXCLUSIVE else returns error.
115 Completes successfully or returns KErrDisconnected if failed.
117 Ioctl level: KIrdaAddrFamily */
118 const TUint KExclusiveModeIoctl=1;
120 /** Completes on successfully making RSocket MULTIPLEXED else returns error.
122 Completes successfully or returns KErrDisconnected if failed.
124 Ioctl level: KIrdaAddrFamily */
125 const TUint KMultiplexModeIoctl=2;
127 /** Completes on doing a status request on IrMUX layer packets to send.
129 Returns TDes8* holding TUint indicating number of outstanding MUX data requests.
131 Ioctl level: KIrdaAddrFamily */
132 const TUint KIrmuxStatusRequestIoctl=3;
134 /** Completes on doing a status request on IrLAP layer packets to send.
136 Returns TDes8* holding TUint indicating the number of outstanding LAP data
139 Ioctl level: KIrdaAddrFamily */
140 const TUint KIrlapStatusRequestIoctl=4;
142 /** Completes on successfully putting RSocket into IDLE mode.
144 Completes successfully or returns KErrAbort if failed.
146 Ioctl level: KIrdaAddrFamily */
147 const TUint KIdleRequestIoctl=5;
149 /** Completes on successfully taking RSocket out of IDLE mode.
151 Completes successfully or returns KErrAbort if failed.
153 Ioctl level: KIrdaAddrFamily */
154 const TUint KIdleClearRequestIoctl=6;
156 /** Completes on receipt of an IrLAP disconnect indication.
158 Completes successfully on IrLAP or IrMUX disconnect on this connection.
160 Ioctl level: KIrdaAddrFamily */
161 const TUint KDisconnectIndicationIoctl=7;
163 /** Completes on doing a status request on IrLAP layer packets to send.
165 Returns TDes8* holding TUint indicating the number of outstanding LAP data
168 Ioctl level: KIrdaAddrFamily */
169 const TUint KIrlapStatusIndicationIoctl=8;
171 /** Completes on receiving a status indication from IrLAP.
173 Returns TDes8* holding TUint indicating the number of outstanding MUX data
176 Ioctl level: KIrdaAddrFamily */
177 const TUint KIrmuxStatusIndicationIoctl=9;
179 /** Completes on doing an IrLAP link reset.
181 Does an SNRMP-UAF link reset which can be initiated from either primary or
184 Ioctl level: KIrdaAddrFamily */
185 const TUint KIrlapResetRequestIoctl=10;
187 /** Completes on receipt of an IrLAP link reset indication.
189 Completes with error value KErrNone if link is successfully reset.
191 Ioctl level: KIrdaAddrFamily */
192 const TUint KIrlapResetIndicationIoctl=11;
194 /** Completes on doing an IrLAP link reset.
196 Does a DISCP-UAF link disconnect which can be initiated from either primary
199 Ioctl level: KIrdaAddrFamily */
200 const TUint KIrlapDisconnectRequestIoctl=12;
202 const TUint KExclusiveMode=0;
204 const TUint KMultiplexMode=1;
207 //******************** Irda Set/GetOpts ******************************
208 // These two are done on Socket Write
214 Sets transfer mode to be unexpedited (the default).
216 Not recommended for use with SetOpt(). Preferred use is with RSocket::Send()
219 const TUint KUnexpeditedDataOpt = 0; // Default
223 Sets transfer mode to be expedited (urgent).
225 Not recommended for use with SetOpt(). Preferred use is with RSocket::Send()
228 const TUint KExpeditedDataOpt = 1; // Urgent data transfer
234 Sets number of discovery slots.
237 const TUint KDiscoverySlotsOpt = 2;
241 Sets the requested maximum link baud rate.
243 Returns KErrInUse, if the link is already running.
245 Returns with the currently set maximum link baud supported. */
246 const TUint KUserBaudOpt = 3;
250 Sets the requested maximum data packet size that can be received by the host.
252 Returns KErrInUse, if the link is already running.
254 Returns with the currently set value for the maximum receivable data size
255 of the host IrLAP layer. */
256 const TUint KHostMaxDataSizeOpt = 4;
260 Returns KErrNotSupported.
262 Cannot set this value for the remote station.
264 Returns with the currently set value for the maximum transmissible data size
265 to remote IrLAP layer. */
266 const TUint KRemoteMaxDataSizeOpt = 6; // Remote packet size
270 Set the maximum link turnaround time for the host IrLAP layer.
272 Returns KErrInUse, if the link is already running.
274 Returns with the currently set value for the host link turnaround time */
275 const TUint KHostMaxTATimeOpt = 5;
279 Disables IrLAP level reset_check/wait states */
280 const TUint KIrlapDisableResetOpt = 9; // This disables Irlap level reset_check/wait states.
284 Allows the client to set local busy in IrLAP. */
285 const TUint KLocalBusyDetectedOpt = 10; // Client can set local busy in Irlap
289 Allows the client to clear local busy in IrLAP */
290 const TUint KLocalBusyClearedOpt = 11; // Client can clear local busy in Irlap
294 Disables discovery response for a short period (typically 3 seconds). */
295 const TUint KDiscoveryResponseDisableOpt = 12;
299 Sets the host's first service hint byte used in XID frames.
301 Retrieves the first hint byte. */
302 const TUint KFirstHintByteOpt = 13; // Hint Bytes
306 Sets the host's second service hint byte used in XID frames.
308 Retrieves the second hint byte */
309 const TUint KSecondHintByteOpt = 14;
315 Turns on transport layer segmentation with the segment size specified. This
316 value is advertised to the remote machine as the maximum amount of data we
320 const TUint KTinyTPLocalSegSizeOpt=7; // This value is advertised to the remote machine as the max amount of data we can reassemble
324 Queries the remote machine's segment size. The remote machine is unable
325 to assemble more data than this.
327 Returns the remote machine's segment size. */
328 const TUint KTinyTPRemoteSegSizeOpt=8; // Remote machine is unable to reassemble more data than this
331 Disables TinyTP reassembly of segmented packets. */
332 const TUint KTinyTPDisabledSegmentation=15;
335 Disables TinyTP reassembly of segmented packets. */
336 const TUint KTinyTPDiasbledSegmentation=15;
341 const TUint KIrdaInternalOption=0x4000000;
346 const TUint KTinyTPSetMaxBufferSpace=16 | KIrdaInternalOption;
350 /** The option relates to IrLAP. */
351 const TUint KLevelIrlap=4;
353 /** The option relates to IrMUX. */
354 const TUint KLevelIrmux=5;
356 /** The maximum length of a class name in an IAS entry. */
357 const TUint KIASClassNameMax=60;
359 /** The maximum length of an attribute in an IAS entry. */
360 const TUint KIASAttributeNameMax=60;
362 /** The maximum length of a TIASQuery descriptor. */
363 const TUint KMaxQueryStringLength=128;
365 //################# CLASS DEFINITIONS ########################
367 NONSHARABLE_CLASS(TIrdaSockAddr) : public TSockAddr
368 /** An IrDA socket address.
375 TUint iRemoteDevAddr;
378 TUint8 iIrlapVersion;
379 TUint8 iFirstServiceHintByte;
380 TUint8 iSecondServiceHintByte;
381 TUint8 iCharacterSet;
382 TUint8 iServiceHintByteCount;
383 // Extra stuff for MUX
389 IMPORT_C TIrdaSockAddr();
390 IMPORT_C TIrdaSockAddr(const TSockAddr &aAddr);
391 /** Casts a reference to a general socket address into an IrDA socket address.
393 @param aAddr A reference to a general socket address.
394 @return The socket address returned as a reference to an IrDA socket address. */
396 /** Casts a pointer to a general socket address into an IrDA socket address.
398 @param aAddr A pointer to a general socket address.
399 @return The socket address returned as a reference to an IrDA socket address. */
400 IMPORT_C static TIrdaSockAddr &Cast(const TSockAddr &aAddr);
402 /** Casts a reference to a general socket address into an IrDA socket address.
404 @param aAddr A reference to a general socket address.
405 @return The socket address returned as a reference to an IrDA socket address. */
407 /** Casts a pointer to a general socket address into an IrDA socket address.
409 @param aAddr A pointer to a general socket address.
410 @return The socket address returned as a reference to an IrDA socket address. */
412 IMPORT_C static TIrdaSockAddr &Cast(const TSockAddr *aAddr);
413 /** Returns the remote device address.
415 @return The remote device address as a 32 bit value. */
417 IMPORT_C TUint GetRemoteDevAddr() const;
418 /** Sets the remote device address.
420 @param aRemote The remote device address as a 32-bit value. */
422 IMPORT_C void SetRemoteDevAddr(const TUint aRemote);
424 /** Returns the host device address.
426 @return The host device address as a 32 bit value. */
427 IMPORT_C TUint GetHostDevAddr() const;
429 /** Sets the host device address.
431 @param aHost The host device address as a 32-bit value. */
432 IMPORT_C void SetHostDevAddr(const TUint aHost);
434 /** Returns the remote device's sniff status, i.e. whether the device is capable
435 of sniffing for IrDA devices.
437 @return True, if the device is capable of sniffing for IrDA devices; false,
439 IMPORT_C TBool GetSniffStatus() const;
441 /** Sets the sniff status for the remote device, i.e. whether the device is capable
442 of sniffing for IrDA devices.
444 @param aSniff True, if the device is capable of sniffing for IrDA devices;
446 IMPORT_C void SetSniffStatus(const TBool aSniff);
448 /** Returns the solicited status.
450 The solicited status indicates whether a discovery was initiated by the host
451 device or a remote device.
453 @return True, if the discovery was initiated by the host device; false if
454 the discovery was initiated by the remote device. */
455 IMPORT_C TBool GetSolicitedStatus() const;
457 /** Sets the solicited status. The solicited status indcates whether a discovery
458 was initiated by the host device or a remote device.
460 @param aSolicited ETrue, if the discovery was initiated by the host device;
461 EFalse, if discovery was initiated by the remote device. */
462 IMPORT_C void SetSolicitedStatus(const TBool aSolicited);
464 /** Returns the remote device's IrLAP version number.
466 This should be 0x00 indicating that the device conforms to the IrDA IrLAP
469 @return The device's IrLAP version number. */
470 IMPORT_C TUint8 GetIrlapVersion() const;
472 /** Sets the IrLAP version number for the remote device.
474 This should be 0x00 indicating that the device conforms to the IrDA IrLAP
477 @param aIrlapVersion The device's IrLAP version number. */
478 IMPORT_C void SetIrlapVersion(const TUint8 aIrlapVersion);
480 /** Returns the character set supported by the remote device.
482 @return One of the TIASCharSet enumerator values defining the character set
483 supported by the device. */
484 IMPORT_C TUint8 GetCharacterSet() const;
486 /** Sets the character set supported by the remote device.
488 @param aCharacterSet One of the TIASCharSet enumerator values defining the
489 character set supported by the device */
490 IMPORT_C void SetCharacterSet(const TUint8 aCharacterSet);
492 /** Returns the remote device's first service hint byte. Service hint bytes indicate
493 the level of IrLMP support provided by the device.
495 @return The first service hint byte. The individual bits have the following
496 meaning: Bit 0 (0x01) - PnP Compatible Bit 1 (0x02) - PDA/Palmtop Bit 2 (0x04)
497 - Computer Bit 3 (0x08) - Printer Bit 4 (0x10) - Modem Bit 5 (0x20) - Fax
498 Bit 6 (0x40) - LAN Access Bit 7 (0x80) - Extension */
499 IMPORT_C TUint8 GetFirstServiceHintByte() const;
501 /** Sets the first service hint byte for the remote device. The service hint bytes
502 indicate the level of IrLMP support provided by the device.
504 @param aFirstServiceHintByte The first service hint byte. The individual bits
505 have the following meaning: Bit 0 (0x01) - PnP Compatible Bit 1 (0x02) - PDA/Palmtop
506 Bit 2 (0x04) - Computer Bit 3 (0x08) - Printer Bit 4 (0x10) - Modem Bit 5
507 (0x20) - Fax Bit 6 (0x40) - LAN Access Bit 7 (0x80) - Extension */
508 IMPORT_C void SetFirstServiceHintByte(const TUint8 aFirstServiceHintByte);
510 /** Returns the remote device's first service hint byte. Service hint bytes indicate
511 the level of IrLMP support provided by the device.
513 @return The second service hint byte. The individual bits have the following
514 meaning: Bit 0 (0x01) - Telephony Bit 1 (0x02) - File Server Bit 2 (0x04)
515 - IrCOMM Bit 3 (0x08) - reserved Bit 4 (0x10) - reserved Bit 5 (0x20) - IrOBEX
516 Bit 6 (0x40) - reserved Bit 7 (0x80) - Extension */
517 IMPORT_C TUint8 GetSecondServiceHintByte() const;
519 /** Sets the second service hint byte for the remote device. The service hint bytes
520 indicate the level of IrLMP support provided by the device.
522 @param aSecondServiceHintByte The second service hint byte. The individual
523 bits have the following meaning: Bit 0 (0x01) - Telephony Bit 1 (0x02) - File
524 Server Bit 2 (0x04) - IrCOMM Bit 3 (0x08) - reserved Bit 4 (0x10) - reserved
525 Bit 5 (0x20) - IrOBEX Bit 6 (0x40) - reserved Bit 7 (0x80) - Extension */
526 IMPORT_C void SetSecondServiceHintByte(const TUint8 aSecondServiceHintByte);
528 /** Returns the number of service hint bytes for the remote device.
530 @return The number of service hint bytes. */
531 IMPORT_C TUint8 GetServiceHintByteCount() const;
533 /** Sets the number of service hint bytes for the remote device.
535 @param aServiceHintByteCount The number of service hint bytes. */
536 IMPORT_C void SetServiceHintByteCount(const TUint8 aServiceHintByteCount);
537 IMPORT_C TUint8 GetHomePort() const;
538 IMPORT_C void SetHomePort(const TUint8 aHomePort);
539 IMPORT_C TUint8 GetRemotePort() const;
540 IMPORT_C void SetRemotePort(const TUint8 aRemotePort);
542 SIrdaAddr* addrPtr() const;
546 /** An enumeration whose enumerators define the type of response received from
547 an Information Access Service (IAS) query.
551 /** No response type defined. */
553 /** The response type is an integer. */
555 /** The response type is binary data. */
556 EIASDataOctetSequence=2,
557 /** The response type is a string. */
562 /** The character set encoding of the character string response from an IAS query.
564 @see TIASResponse::GetCharString()
565 @see TIrdaSockAddr::GetCharacterSet() */
567 /** String is standard ASCII. */
568 EIASCharSetUserStringASCII =0x00,
569 /** String is ISO Latin-1. */
570 EIASCharSetUserStringISO_8859_1=0x01,
571 /** String is ISO Latin-2. */
572 EIASCharSetUserStringISO_8859_2=0x02,
573 /** String is ISO Latin-3. */
574 EIASCharSetUserStringISO_8859_3=0x03,
575 /** String is ISO Latin-4. */
576 EIASCharSetUserStringISO_8859_4=0x04,
577 /** String is ISO-8859-5 (Cyrillic). */
578 EIASCharSetUserStringISO_8859_5=0x05,
579 /** String is ISO-8859-6 (Arabic). */
580 EIASCharSetUserStringISO_8859_6=0x06,
581 /** String is ISO-8859-7 (Greek). */
582 EIASCharSetUserStringISO_8859_7=0x07,
583 /** String is ISO-8859-8 (Hebrew). */
584 EIASCharSetUserStringISO_8859_8=0x08,
585 /** String is ISO Latin-5. */
586 EIASCharSetUserStringISO_8859_9=0x09,
587 /** String is UNICODE. */
588 EIASCharSetUserStringUnicode=0xFF,
591 NONSHARABLE_CLASS(TIASQuery) : public TBuf8<KMaxQueryStringLength>
592 /** An Information Access Service (IAS) query to another device's IAS server.
598 IMPORT_C TIASQuery(const TDesC8& aClass,const TDesC8& aAttribute,TUint aRemoteDevAddr);
599 IMPORT_C TIASQuery();
600 IMPORT_C void Set(const TDesC8& aClass,const TDesC8& aAttribute,TUint aRemoteDevAddr);
601 IMPORT_C void Get(TDes8& aClass,TDes8& aAttribute,TUint& aRemoteDevAddr);
603 // This data padding has been added to help prevent future binary compatibility breaks
604 // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
609 NONSHARABLE_CLASS(TIASResponse) : public TBuf8<KMaxQueryStringLength>
610 /** Response from an Information Access Service (IAS) query to another device's
616 public: // But not exported :-)
617 void SetToInteger(TUint anInteger);
618 void SetToCharString(const TDesC8& aCharString);
619 void SetToOctetSeq(const TDesC8& aData);
621 void SetToCharString(const TDesC16& aWideString);
625 IMPORT_C TIASResponse();
626 /** Indicates the response contains a list. */
627 IMPORT_C TBool IsList() const;
628 /** Indicates the number of items in the response. */
629 IMPORT_C TInt NumItems() const;
631 /** Returns the type of the response.
633 @return An enumeration identifying the type of response. */
634 IMPORT_C TIASDataType Type() const;
636 IMPORT_C TInt GetInteger(TInt &aResult,TInt anIndex=0) const;
637 IMPORT_C TInt GetOctetSeq(TDes8 &aResult,TInt anIndex=0) const;
638 IMPORT_C TInt GetCharString(TDes8 &aResult,TInt anIndex=0) const;
639 IMPORT_C const TPtrC8 GetCharString8(TInt anIndex=0) const;
641 /** Gets the response string.
643 This is called if the response type indicates a string.
645 @param aResult On return, an 8 bit modifiable descriptor containing the response
646 string. The length of the response string can never be greater than the value
647 of (KMaxQueryStringLength - 3).
648 @param anIndex Reserved for future use. This argument must be allowed to default
649 to 0 and must not be overriden.
650 @return If successful, one of the TIASCharSet enumerator values defining the
651 character set encoding of the response string. KErrNotSupported, if a non-zero
652 value has been specified for anIndex. KErrCorrupt, if the response type is
654 @see TIASResponse::Type() */
655 IMPORT_C TInt GetCharString(TDes16 &aResult,TInt anIndex=0) const;
657 IMPORT_C const TPtrC16 GetCharString16(TInt anIndex=0) const;
660 // This data padding has been added to help prevent future binary compatibility breaks
661 // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
666 NONSHARABLE_CLASS(TIASDatabaseEntryV001)
667 /** The data for an Information Access Service (IAS) record in the network database.
669 An object of this type is contained in a packaged modifiable buffer descriptor.
672 @see TIASDatabaseEntry */
675 IMPORT_C TIASDatabaseEntryV001();
677 /** The class name for the IAS entry
679 This is a template specialisation of a TBuf8<TInt> */
680 TBuf8<KIASClassNameMax> iClassName;
682 /** The attribute for the IAS entry.
684 This is a template specialisation of a TBuf8<TInt> */
685 TBuf8<KIASAttributeNameMax> iAttributeName;
687 /** The response data. */
691 // This data padding has been added to help prevent future binary compatibility breaks
692 // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
697 NONSHARABLE_CLASS(TIASDatabaseEntry) : public TPckgBuf<TIASDatabaseEntryV001>
698 /** An Information Access Service (IAS) record in the network database.
700 The record data is contained in an object of type TIASDatabaseEntryV001 packaged
701 in a modifiable buffer descriptor.
707 IMPORT_C void SetClassName(const TDesC8& aClassName);
708 IMPORT_C void SetAttributeName(const TDesC8& anAttributeName);
709 IMPORT_C void SetToInteger(const TUint anInteger);
710 IMPORT_C void SetToCharString(const TDesC8& aCharString);
712 /** Sets the response type corresponding to the class and attribute defined in
713 this record, as binary data.
715 @param aData The response binary data. The length of this data can never be
716 greater than (KMaxQueryStringLength - 3). */
717 IMPORT_C void SetToOctetSeq(const TDesC8& aData);
719 #ifdef _UNICODE //need to be able to enter wide entries in unicode builds
720 IMPORT_C void SetToCharString(const TDesC16& aWideString);//new export
724 #endif // __IR_SOCK_H__