Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.synchrona.jred.irlap
Class ServiceHints  view ServiceHints download ServiceHints.java

java.lang.Object
  extended bycom.synchrona.jred.irlap.ServiceHints

public class ServiceHints
extends java.lang.Object

IrLMP peers exchange service hints during the connection process to describe their capabilities and to provide a human-readable nickname for discovery logs.


Field Summary
static int BYTE_1_EXTENSION
          Signifies the presence of additional bytes of capability information.
static int BYTE_2_EXTENSION
          Declares that additional capability bytes follow the second byte.
static int CHARSET_UNICODE
          Indicates that the information string (the nickname) passed into the constructor is a Unicode string.
static int COMPUTER
          Declares that this device is a computer.
static int FAX
          Declares that this device is a facsimile machine.
static int FILE_SERVER
          Declares that this device is a file server supporting IrOBEX.
static int LAN_ACCESS
          Declares that this device is a TCP/IP LAN access point that supports IrLAN.
private  int m_nCapabilityMask
           
private  UserString m_nickname
           
static int MAX_STRING_LENGTH
          IrLMP allows up to 255 characters in a device hints string, but it also uses a full 16 bits for every Unicode character.
static int MODEM
          Declares that this device is a modem.
static int PDA
          Declares that this device is a PDA.
static int PNP
          Declares support for IR plug-and-play (IrPnP).
static int PRINTER
          Declares that this device supports IrLPT, the infrared printing protocol.
static int TELEPHONY
          Declares that this device supports IR telephony.
static int VALID_BITS
          Used in construction to assert that only capabilities supported by the IrDA standard are declared by a service user.
 
Constructor Summary
ServiceHints(byte[] bytes, int offset, int length)
          Parse service hints out of bytes in an IrLAPFrame.
ServiceHints(int nCapabilityMask, java.lang.String strInfo)
           
 
Method Summary
 int getCapabilities()
           
 int getCharset()
          getCharset() always returns the IrLMP identifier for Unicode character sets.
 UserString getInfo()
           
 byte[] toBytes()
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PNP

public static final int PNP
Declares support for IR plug-and-play (IrPnP).

See Also:
Constant Field Values

PDA

public static final int PDA
Declares that this device is a PDA.

See Also:
Constant Field Values

COMPUTER

public static final int COMPUTER
Declares that this device is a computer.

See Also:
Constant Field Values

PRINTER

public static final int PRINTER
Declares that this device supports IrLPT, the infrared printing protocol.

See Also:
Constant Field Values

MODEM

public static final int MODEM
Declares that this device is a modem.

See Also:
Constant Field Values

FAX

public static final int FAX
Declares that this device is a facsimile machine.

See Also:
Constant Field Values

LAN_ACCESS

public static final int LAN_ACCESS
Declares that this device is a TCP/IP LAN access point that supports IrLAN.

See Also:
Constant Field Values

BYTE_1_EXTENSION

public static final int BYTE_1_EXTENSION
Signifies the presence of additional bytes of capability information. Users of ServiceHints need not set this bit, as the constructor sets it if it is necessary..

See Also:
Constant Field Values

TELEPHONY

public static final int TELEPHONY
Declares that this device supports IR telephony.

See Also:
Constant Field Values

FILE_SERVER

public static final int FILE_SERVER
Declares that this device is a file server supporting IrOBEX.

See Also:
Constant Field Values

BYTE_2_EXTENSION

public static final int BYTE_2_EXTENSION
Declares that additional capability bytes follow the second byte.

See Also:
Constant Field Values

VALID_BITS

public static final int VALID_BITS
Used in construction to assert that only capabilities supported by the IrDA standard are declared by a service user. If you're prototyping something and you just want to create a bogus capability mask, do (ServiceHints.VALID_BITS).

See Also:
Constant Field Values

CHARSET_UNICODE

public static final int CHARSET_UNICODE
Indicates that the information string (the nickname) passed into the constructor is a Unicode string. Note that Java uses UTF-8, in which ASCII characters are encoded as single bytes; IrDA encodes all characters (including the terminating null) as 2-byte entities. Although this has no impact on ServiceHints, it does mean that the byte sequences representing a ServiceHints instance may report lengths that seem incorrect to you, especially if you are printing string lengths in an attempt to debug something.

See Also:
Constant Field Values

MAX_STRING_LENGTH

public static final int MAX_STRING_LENGTH
IrLMP allows up to 255 characters in a device hints string, but it also uses a full 16 bits for every Unicode character. That means you get at most 127 Unicode characters of device information. If you try to create a ServiceHints instance with more than MAX_STRING_LENGTH characters, the constructor warns you via nonfatal assertion and truncates the information.

See Also:
Constant Field Values

m_nCapabilityMask

private int m_nCapabilityMask

m_nickname

private UserString m_nickname
Constructor Detail

ServiceHints

public ServiceHints(int nCapabilityMask,
                    java.lang.String strInfo)

ServiceHints

public ServiceHints(byte[] bytes,
                    int offset,
                    int length)
Parse service hints out of bytes in an IrLAPFrame.

Method Detail

getCapabilities

public int getCapabilities()

getCharset

public int getCharset()
getCharset() always returns the IrLMP identifier for Unicode character sets.


getInfo

public UserString getInfo()

toBytes

public byte[] toBytes()

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).