public interface UPnPManagedDevice extends UPnPDevice
UPnPDeviceManager.createDevice
to create a device.
The UPnPManagedDevice corresponds to a single UPnP server
device with a single set of handlers and a single state. This
server may be visible on multiple interfaces and/or multiple
IP addresses, depending upon the list of InetAddresses that
are associated with this server device.
The network representations of this device
(UPnPAdvertisedDevice),
one per InetAddress, are
available for query via the getAdvertisedDevices() method.
Updating a device causes corresponding UPnP device
byebye/alive pairs to be sent. To institute multiple changes
without multiple removals/advertisements, the application
should call the sendByeBye()
method prior to the first change, calling sendAlive()
following the last change.
| Modifier and Type | Method and Description |
|---|---|
UPnPManagedService |
createService(String serviceType,
InputStream description,
UPnPActionHandler handler)
Creates a UPnP service associated with this device.
|
UPnPAdvertisedDevice[] |
getAdvertisedDevices()
Gets the representations of this device on the network interfaces
on which is it advertised.
|
String |
getDeviceType()
Gets the UPnP deviceType of this device.
|
UPnPManagedDevice[] |
getEmbeddedDevices()
Gets any
UPnPManagedDevice embedded devices for
this UPnPManagedDevice. |
String |
getFriendlyName()
Gets the UPnP "friendly name" of this device.
|
UPnPManagedDeviceIcon[] |
getIcons()
Gets the icons for this device.
|
InetAddress[] |
getInetAddresses()
Gets the
InetAddresses that this
UPnPManagedDevice is associated with. |
String |
getManufacturer()
Gets the UPnP manufacturer of this device.
|
String |
getManufacturerURL()
Gets the UPnP manufacturer URL of this device.
|
String |
getModelDescription()
Gets the UPnP model description of this device.
|
String |
getModelName()
Gets the UPnP model name of this device.
|
String |
getModelNumber()
Gets the UPnP model number of this device.
|
String |
getModelURL()
Gets the UPnP model URL of this device.
|
UPnPManagedDevice |
getParentDevice()
Returns the parent device of this
UPnPManagedDevice. |
String |
getSerialNumber()
Gets the UPnP serial number of this device.
|
UPnPManagedService[] |
getServices()
Gets the services supported by this device.
|
String |
getSpecVersion()
Gets the UPnP specVersion major and minor values of this
UPnP device, or of the root UPnP device containing this device.
|
String |
getUDN()
Gets the UPnP Unique Device Name of this device.
|
String |
getUPC()
Gets the UPnP Universal Product Code of this device.
|
boolean |
isAlive()
Gets whether the
UPnPManagedDevice is
active. |
boolean |
isRootDevice()
Reports whether this UPnP device is a UPnP root device.
|
void |
sendAlive()
Sends UPnP ssdp:alive messages from the physical device.
|
void |
sendByeBye()
Sends UPnP ssdp:byebye messages from this device.
|
boolean |
setDeviceType(String type)
Sets the UPnP deviceType of this device.
|
boolean |
setFriendlyName(String friendlyName)
Sets the UPnP friendlyName of this device.
|
UPnPManagedDeviceIcon[] |
setIcons(UPnPManagedDeviceIcon[] icons)
Sets the Icons for this device.
|
InetAddress[] |
setInetAddresses(InetAddress[] addresses)
Sets the InetAddresses that this
UPnPManagedDevice
is associated with. |
boolean |
setManufacturer(String manufacturer)
Sets the UPnP manufacturer of this device.
|
boolean |
setManufacturerURL(String manufacturerURL)
Sets the UPnP manufacturer URL of this device.
|
boolean |
setModelDescription(String modelDescription)
Sets the UPnP model description of this device.
|
boolean |
setModelName(String modelName)
Sets the UPnP model name of this device.
|
boolean |
setModelNumber(String modelNumber)
Sets the UPnP model number of this device.
|
boolean |
setModelURL(String modelURL)
Sets the UPnP model URL of this device.
|
boolean |
setSerialNumber(String serialNumber)
Sets the UPnP serial number of this device.
|
boolean |
setUDN(String UDN)
Sets the UPnP Unique Device Number of this device.
|
boolean |
setUPC(String UPC)
Sets the UPnP Universal Product Code of this device.
|
void sendAlive()
throws SecurityException
UPnPManagedDevice. Enters
the "alive" state once the first advertisements are initiated
on the first InetAddress/interface.
If the UPnPManagedDevice has no associated
InetAddress, no advertisements are sent and the
device does not enter the "alive" state.
If the device is already in the "alive" state, the device still sends advertisements and remains in the "alive" state.
SecurityException - if the calling application has not been
granted MonitorAppPermission("handler.homenetwork").isAlive()void sendByeBye()
throws SecurityException
sendAlive method.
Once the last byebye message has been sent on the last
InetAddress, the device enters the "not alive"
state and is no longer discoverable via
UPnPDeviceManager.getDevices().
At this point, the UPnP implementation holds no internal
references to this UPnPManagedDevice object.
SecurityException - if the calling application has not been
granted MonitorAppPermission("handler.homenetwork").isAlive()InetAddress[] setInetAddresses(InetAddress[] addresses) throws SecurityException
UPnPManagedDevice
is associated with.
The device will send advertisements (and de-advertise) on the most
appropriate interface for each of the addresses specified, and will
respond to actions on each of those interfaces.
The passed array replaces any prior addresses that the device was associated with, including any stack-provided defaults. If the device is already active on one or more addresses, it must de-advertise itself at any addresses that are being removed, and advertise itself at any addresses that are being added.
The device description advertised on each interface will be identical with the exception of the URLs related to the device and its components, which will reflect the IP address on which the device is advertised.
Note that it is the responsibility of the application to
monitor for changes in IP addresses that the host responds
to, and to update the UPnPManagedDevice with any
modifications using this method.
addresses - Array of InetAddress
objects representing the IP addresses
that this device is to advertise as. May be
zero length.UPnPManagedDevice. If there were no
prior addresses, returns a zero-length array.NullPointerException - if addresses or any of its
elements are null.SecurityException - if the calling application has not been
granted MonitorAppPermission("handler.homenetwork").getInetAddresses()InetAddress[] getInetAddresses()
InetAddresses that this
UPnPManagedDevice is associated with.
If setInetAddresses(java.net.InetAddress[])
has not yet been called on this UPnPManagedDevice,
this method will report the default InetAddresses provided by the
stack.InetAddress objects
representing the network interfaces that
this device is to advertise on. If the
device has no associated network
interfaces, returns a zero length array.boolean isAlive()
UPnPManagedDevice is
active. The device is active if it has valid advertisements
on one or more network interfaces.
While the device is in the "alive" state, the device:
UPnPDeviceManager.getDevices().
UPnPManagedDevice has valid
advertisements on one or more network interfaces,
else false.UPnPAdvertisedDevice[] getAdvertisedDevices()
UPnPAdvertisedDevice
objects associated with a single UPnPManagedDevice.
The returned array corresponds to the set of UPnP device descriptions
published for this UPnP device.UPnPManagedDevice.
Returns a zero-length array if this device has not been
advertised on a network interface.UPnPManagedDevice[] getEmbeddedDevices()
UPnPManagedDevice embedded devices for
this UPnPManagedDevice. Returns an array of
UPnPManagedDevices, one per device appearing in this device's
deviceList element. Does not recurse through embedded devices
of this device.UPnPManagedDevice getParentDevice()
UPnPManagedDevice.boolean setDeviceType(String type) throws SecurityException
deviceType element within the device description. Adds
the element if it is not already present. If the device is
currently published on one or more network addresses, this
causes a byebye/alive cycle for this device on all published
addresses.type - The deviceType to be set for this device.SecurityException - if the calling application has not been
granted MonitorAppPermission("handler.homenetwork").boolean setFriendlyName(String friendlyName) throws SecurityException
friendlyName element within the device
description. Adds the element if it is not already present.
If the device is currently published on one or more network
addresses, this causes a byebye/alive cycle for this device
on all published addresses.friendlyName - The friendlyName to set for this deviceSecurityException - if the calling application has not been
granted MonitorAppPermission("handler.homenetwork").boolean setManufacturer(String manufacturer) throws SecurityException
manufacturer element within the device
description. Adds the element if it is not already present.
If the device is currently published on one or more network
addresses, this causes a byebye/alive cycle for this device
on all published addresses.manufacturer - The manufacturer to set for this deviceSecurityException - if the calling application has not been
granted MonitorAppPermission("handler.homenetwork").boolean setManufacturerURL(String manufacturerURL) throws SecurityException
manufacturerURL element within the device
description. Adds the element if it is not already present.
If the device is currently published on one or more network
addresses, this causes a byebye/alive cycle for this device
on all published addresses.manufacturerURL - The manufacturerURL to set for this
deviceSecurityException - if the calling application has not been
granted MonitorAppPermission("handler.homenetwork").boolean setModelDescription(String modelDescription) throws SecurityException
modelDescription element within the device
description. Adds the element if it is not already present.
If the device is currently published on one or more network
addresses, this causes a byebye/alive cycle for this device
on all published addresses.modelDescription - The modelDescription to set for this
deviceSecurityException - if the calling application has not been
granted MonitorAppPermission("handler.homenetwork").boolean setModelName(String modelName) throws SecurityException
modelName element within the device
description. Adds the element if it is not already present.
If the device is currently published on one or more network
addresses, this causes a byebye/alive cycle for this device
on all published addresses.modelName - The modelName to set for this deviceSecurityException - if the calling application has not been
granted MonitorAppPermission("handler.homenetwork").boolean setModelNumber(String modelNumber) throws SecurityException
modelNumber element within the device
description. Adds the element if it is not already present.
If the device is currently published on one or more network
addresses, this causes a byebye/alive cycle for this device
on all published addresses.modelNumber - The modelNumber to set for this device.SecurityException - if the calling application has not been
granted MonitorAppPermission("handler.homenetwork").boolean setModelURL(String modelURL) throws SecurityException
modelURL element within the device description. Adds
the element if it is not already present. If the device is
currently published on one or more network addresses, this
causes a byebye/alive cycle for this device on all published
addresses.modelURL - The modelURL to set for this device.SecurityException - if the calling application has not been
granted MonitorAppPermission("handler.homenetwork").boolean setSerialNumber(String serialNumber) throws SecurityException
serialNumber element within the device
description. Adds the element if it is not already present.
If the device is currently published on one or more network
addresses, this causes a byebye/alive cycle for this device
on all published addresses.serialNumber - The serialNumber to set for this device.SecurityException - if the calling application has not been
granted MonitorAppPermission("handler.homenetwork").boolean setUDN(String UDN) throws SecurityException
UDN - The UDN to set for this device.SecurityException - if the calling application has not been
granted MonitorAppPermission("handler.homenetwork").boolean setUPC(String UPC) throws SecurityException
UPC - The UPC to set for this device.SecurityException - if the calling application has not been
granted MonitorAppPermission("handler.homenetwork").UPnPManagedDeviceIcon[] setIcons(UPnPManagedDeviceIcon[] icons) throws SecurityException
iconList
sub-document of the device. Replaces any previous iconList
for this device. If the array is of zero length, removes any
prior iconList from the device description. If the device is
currently published on one or more network addresses, this
causes a byebye/alive cycle for this device on all published
addresses.icons - An array of UPnPManagedDeviceIcons to be used
for the IconList of this device.
Each icon in the array is copied into the
UPnPManagedDevice; subsequent calls to
getIcons() will return
different instances than those specified by the
icons parameter.
May be a zero-length array to indicate no icons.SecurityException - if the calling application has not
been granted
MonitorAppPermission("handler.homenetwork").UPnPManagedDeviceIcon[] getIcons()
UPnPManagedService[] getServices()
UPnPManagedService objects. If
there are no services associated with this
UPnPManagedDevice, this method returns a zero length
array.UPnPManagedService createService(String serviceType, InputStream description, UPnPActionHandler handler) throws IOException, SecurityException
USN and serviceId elements are generated
by the stack and not provided as parameters.serviceType - The UPnP service type of the service to be
populated in the serviceType element of
the device description.description - The service description as defined by the
UPnP Device Architecture specification.
The InputStream format is an
XML document representing the description.handler - The action handler that will handle action
requests for the service.IllegalArgumentException - if the description
parameter does not comply with a service description as defined by
the UPnP Device Architecture specification.IOException - if an I/O error occurs on the description.SecurityException - if the calling application has not been
granted MonitorAppPermission("handler.homenetwork").String getDeviceType()
deviceType element within the
device description.getDeviceType in interface UPnPDevicegetAdvertisedDevices()[0].getDeviceType().String getFriendlyName()
friendlyName element within the
device description.getFriendlyName in interface UPnPDevicefriendlyName of this device.
If the device has been advertised, this method returns the same value
as getAdvertisedDevices()[0].getFriendlyName().String getManufacturer()
manufacturer element within the
device description.getManufacturer in interface UPnPDevicegetAdvertisedDevices()[0].getManufacturer().String getManufacturerURL()
manufacturerURL element
within the device description.
If the manufacturerURL is empty or not present, returns
the empty String.getManufacturerURL in interface UPnPDevicegetAdvertisedDevices()[0].getManufacturerURL().String getModelDescription()
modelDescription element within the device description.
If the modelDescription is empty or not present, returns
the empty String.getModelDescription in interface UPnPDevicegetAdvertisedDevices()[0].getModelDescription().String getModelName()
modelName element within the device
description.getModelName in interface UPnPDevicemodelName of this device.
If the device has been advertised, this method returns the same value
as getAdvertisedDevices()[0].getModelName().String getModelNumber()
modelNumber element within the
device description.
If the modelNumber is empty or not present, returns the
empty String.getModelNumber in interface UPnPDevicegetAdvertisedDevices()[0].getModelNumber().String getModelURL()
modelURL element within the
device description.
If the modelURL is empty or not present, returns the empty
String.getModelURL in interface UPnPDevicegetAdvertisedDevices()[0].getModelURL().String getSerialNumber()
serialNumber element within the
device description.
If the serialNumber is empty or not present, returns the
empty String.getSerialNumber in interface UPnPDevicegetAdvertisedDevices()[0].getSerialNumber().String getSpecVersion()
specVersion element within the device
description.
The format of the returned String is the <major>
value, followed by '.', followed by the <minor> value.getSpecVersion in interface UPnPDevicegetAdvertisedDevices()[0].getSpecVersion().String getUDN()
UDN element
within the device description.getUDN in interface UPnPDevicegetAdvertisedDevices()[0].getUDN().String getUPC()
UPC element
within the device description.
If the UPC is empty or not present, returns the empty
String.getUPC in interface UPnPDevicegetAdvertisedDevices()[0].getUPC().boolean isRootDevice()
isRootDevice in interface UPnPDevicegetAdvertisedDevices()[0].isRootDevice().Copyright © 2012 CableLabs. All Rights Reserved.