public final class DeviceDescription extends java.lang.Object implements ISerializable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ABBREVIATION
The abbreviation used for this class during serialization.
|
static int |
EVENT_SERVICE_ADDED
Event constant that defines that a new known service has been added.
|
static int |
EVENT_SERVICE_REMOVED
Event constant that defines that a known service has been removed.
|
static short |
TYPE_DESKTOP
The device type constant for desktop personal computers.
|
static short |
TYPE_LAPTOP
The device type constant for notebook personal computers.
|
static short |
TYPE_MAINFRAME
The device type constant for servers.
|
static short |
TYPE_PDA
The device type constant for personal digital assistants.
|
static short |
TYPE_PHONE
The device type constant for mobile phones.
|
static short |
TYPE_SENSOR
The device type constant for embedded sensors.
|
static short |
TYPE_TABLET
The device type constant for tablet personal computers.
|
static short |
TYPE_UNKOWN
The device type constant that signals that the device type is unknown.
|
static short |
TYPE_WRT
The device type constant for access points.
|
Constructor and Description |
---|
DeviceDescription()
Creates a new uninitialized device description.
|
DeviceDescription(SystemID systemID,
java.lang.String name,
short type)
Creates a new device description for the specified device.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(int type,
IListener listener)
Registers a listener for the specified type of event.
|
void |
addService(ObjectID id)
Adds the id of a well known service and sends a notification to the
registered listeners.
|
java.lang.String |
getName()
Returns the device name.
|
ObjectID[] |
getServices()
Returns the well known object ids of well known services of
the device.
|
SystemID |
getSystemID()
Returns the system id of the device description.
|
short |
getType()
Returns the type of the device.
|
boolean |
hasService(ObjectID id)
Determines whether the service description contains the specified
well known service.
|
void |
readObject(IObjectInput input)
Reads a description from a stream.
|
boolean |
removeListener(int type,
IListener listener)
Unregisters the specified listener from the specified set of
event types.
|
void |
removeService(ObjectID id)
Removes the specified id from the description and sends a notification
to all registered listeners.
|
java.lang.String |
toString()
Returns a string representation of the device description.
|
void |
writeObject(IObjectOutput output)
Writes a description to a stream.
|
public static final java.lang.String ABBREVIATION
public static final short TYPE_UNKOWN
public static final short TYPE_LAPTOP
public static final short TYPE_DESKTOP
public static final short TYPE_MAINFRAME
public static final short TYPE_PHONE
public static final short TYPE_PDA
public static final short TYPE_TABLET
public static final short TYPE_SENSOR
public static final short TYPE_WRT
public static final int EVENT_SERVICE_ADDED
public static final int EVENT_SERVICE_REMOVED
public DeviceDescription()
public DeviceDescription(SystemID systemID, java.lang.String name, short type)
systemID
- The system id of the device.name
- The name of the device used in user interfaces.type
- The type of the device used in user interfaces.public java.lang.String getName()
public short getType()
public SystemID getSystemID()
public void addListener(int type, IListener listener)
type
- The type to register for. At the present time EVENT_SERVICE_REMOVED
and EVENT_SERVICE_ADDED events are emitted for changed object ids.listener
- The listener to add.public boolean removeListener(int type, IListener listener)
type
- The types to unregister for.listener
- The listener to unregister.public ObjectID[] getServices()
public boolean hasService(ObjectID id)
id
- The object id of the well known service to lookup.public void addService(ObjectID id)
id
- The id of the object to add.public void removeService(ObjectID id)
id
- The id of the object to remove.public void readObject(IObjectInput input) throws java.io.IOException
readObject
in interface ISerializable
input
- The stream to read from.java.io.IOException
- Thrown by the stream.public void writeObject(IObjectOutput output) throws java.io.IOException
writeObject
in interface ISerializable
output
- The stream to write to.java.io.IOException
- Thrown by the stream.public java.lang.String toString()
toString
in class java.lang.Object