net.tomp2p.upnp
Class Device

java.lang.Object
  extended by net.tomp2p.upnp.Device
Direct Known Subclasses:
RootDevice

public class Device
extends Object

This class represents an UPNP device, this device contains a set of services that will be needed to access the device functionalities.

Version:
1.0
Author:
SuperBonBon

Field Summary
 Device[] childDevices
           
 String deviceType
           
 String friendlyName
           
 String manufacturer
           
 URL manufacturerURL
           
 String modelDescription
           
 String modelName
           
 String modelNumber
           
 String modelURL
           
 Device parent
           
 URL presentationURL
           
 String serialNumber
           
 Service[] services
           
 String UDN
           
 long UPC
           
 String USN
           
 
Constructor Summary
Device(Node deviceCtx, Device parent, URL urlBase)
           
 
Method Summary
 Device getChildDevice(String deviceURI)
          Looks for a child UPNP device definition file, the whole devices tree will be searched, starting from the current device node.
 List<Device> getChildDevices()
          Generates a list of all the child ( not only top level, full childrens hierarchy included ) UPNPDevice objects for this device.
 Device getDirectParent()
          Return the parent UPNPDevice, null if the device is an UPNPRootDevice
 Service getService(String serviceURI)
          Looks for a UPNP device service definition object for the given service URI (Type)
 Service getServiceByID(String serviceID)
          Looks for a UPNP device service definition object for the given service ID
 List<Service> getServices(String serviceURI)
          Looks for the all the UPNP device service definition object for the current UPNP device object.
static URL getURL(String url, URL baseURL)
          Parsing an URL from the descriptionXML file
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

deviceType

public final String deviceType

friendlyName

public final String friendlyName

manufacturer

public final String manufacturer

manufacturerURL

public final URL manufacturerURL

presentationURL

public final URL presentationURL

modelDescription

public final String modelDescription

modelName

public final String modelName

modelNumber

public final String modelNumber

modelURL

public final String modelURL

serialNumber

public final String serialNumber

UDN

public final String UDN

USN

public final String USN

UPC

public final long UPC

services

public final Service[] services

childDevices

public final Device[] childDevices

parent

public final Device parent
Constructor Detail

Device

public Device(Node deviceCtx,
              Device parent,
              URL urlBase)
Parameters:
deviceCtx -
parent -
urlBase -
Method Detail

getURL

public static final URL getURL(String url,
                               URL baseURL)
                        throws MalformedURLException
Parsing an URL from the descriptionXML file

Parameters:
url - the string representation fo the URL
baseURL - the base device URL, needed if the url param is relative
Returns:
an URL object defining the url param
Throws:
MalformedURLException - if the url param or baseURL.toExternalForm() + url cannot be parsed to create an URL object

getChildDevices

public List<Device> getChildDevices()
Generates a list of all the child ( not only top level, full childrens hierarchy included ) UPNPDevice objects for this device.

Returns:
the generated list or null if no child devices bound

getDirectParent

public Device getDirectParent()
Return the parent UPNPDevice, null if the device is an UPNPRootDevice

Returns:
the parent device instance

getChildDevice

public Device getChildDevice(String deviceURI)
Looks for a child UPNP device definition file, the whole devices tree will be searched, starting from the current device node.

Parameters:
deviceURI - the device URI to search
Returns:
An UPNPDevice if anything matches or null

getService

public Service getService(String serviceURI)
Looks for a UPNP device service definition object for the given service URI (Type)

Parameters:
serviceURI - the URI of the service
Returns:
A matching UPNPService object or null

getServiceByID

public Service getServiceByID(String serviceID)
Looks for a UPNP device service definition object for the given service ID

Parameters:
serviceID - the ID of the service
Returns:
A matching UPNPService object or null

getServices

public List<Service> getServices(String serviceURI)
Looks for the all the UPNP device service definition object for the current UPNP device object. This method can be used to retrieve multiple same kind ( same service type ) of services with different services id on a device

Parameters:
serviceURI - the URI of the service
Returns:
A matching List of UPNPService objects or null

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.