org.cybergarage.upnp

## Class Device

- java.lang.Object
- - org.cybergarage.upnp.Device

- All Implemented Interfaces:
    HTTPRequestListener, SearchListener

      public class Device
      extends Object
      implements HTTPRequestListener, SearchListener

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_DESCRIPTION_URI`
    `static int` | `DEFAULT_DISCOVERY_WAIT_TIME`
    `static int` | `DEFAULT_LEASE_TIME`
    `static int` | `DEFAULT_STARTUP_WAIT_TIME`
    `static String` | `ELEM_NAME`
    `static int` | `HTTP_DEFAULT_PORT`
    `static String` | `UPNP_ROOTDEVICE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Device()`
    `Device(File descriptionFile)`
    `Device(Node device)`
    `Device(Node root, Node device)`
    `Device(String descriptionFileName)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `announce()`
    `void` | `announce(String bindAddr)`
    `void` | `byebye()`
    `void` | `byebye(String bindAddr)`
    `void` | `deviceSearchReceived(SSDPPacket ssdpPacket)`
    `void` | `deviceSearchResponse(SSDPPacket ssdpPacket)`
    `Action` | `getAction(String name)`
    `File` | `getDescriptionFile()`
    `String` | `getDescriptionFilePath()`
    `Device` | `getDevice(String name)`
    `Device` | `getDeviceByDescriptionURI(String uri)`
    `DeviceList` | `getDeviceList()`
    `Node` | `getDeviceNode()`
    `String` | `getDeviceType()`
    `long` | `getElapsedTime()`
    `String` | `getFriendlyName()`
    `int` | `getHTTPPort()`
    `Icon` | `getIcon(int n)`
    `IconList` | `getIconList()`
    `String` | `getInterfaceAddress()`
    `int` | `getLeaseTime()`
    `String` | `getLocation()`
    `String` | `getLocationURL(String host)`
    `String` | `getManufacture()`
    `String` | `getManufactureURL()`
    `String` | `getModelDescription()`
    `String` | `getModelName()`
    `String` | `getModelNumber()`
    `String` | `getModelURL()`
    `Device` | `getParentDevice()`
    `String` | `getPresentationURL()`
    `Device` | `getRootDevice()`
    `Node` | `getRootNode()`
    `String` | `getSerialNumber()`
    `Service` | `getService(String name)`
    `Service` | `getServiceByControlURL(String searchUrl)`
    `Service` | `getServiceByEventSubURL(String searchUrl)`
    `Service` | `getServiceBySCPDURL(String searchUrl)`
    `ServiceList` | `getServiceList()`
    `int` | `getSSDPAnnounceCount()`
    `SSDPPacket` | `getSSDPPacket()`
    `StateVariable` | `getStateVariable(String name)`
    `StateVariable` | `getStateVariable(String serviceType, String name)`
    `Service` | `getSubscriberService(String uuid)`
    `long` | `getTimeStamp()`
    `String` | `getUDN()`
    `String` | `getUPC()`
    `String` | `getURLBase()`
    `boolean` | `hasUDN()`
    `void` | `httpRequestRecieved(HTTPRequest httpReq)`
    `boolean` | `isDevice(String name)`
    `static boolean` | `isDeviceNode(Node node)`
    `boolean` | `isDeviceType(String value)`
    `boolean` | `isExpired()`
    `boolean` | `isNMPRMode()`
    `boolean` | `isRootDevice()`
    `boolean` | `isWirelessMode()`
    `boolean` | `loadDescription(File file)`
    `boolean` | `loadDescription(String descString)`
    `void` | `lock()`
    `static void` | `notifyWait()`
    `boolean` | `postSearchResponse(SSDPPacket ssdpPacket, String st, String usn)`
    `void` | `setActionListener(ActionListener listener)`
    `void` | `setActionListener(ActionListener listener, boolean includeSubDevices)`
    `void` | `setDeviceNode(Node node)`
    `void` | `setDeviceType(String value)`
    `void` | `setFriendlyName(String value)`
    `void` | `setHTTPPort(int port)`
    `void` | `setLeaseTime(int value)`
    `void` | `setLocation(String value)`
    `void` | `setManufacture(String value)`
    `void` | `setManufactureURL(String value)`
    `void` | `setModelDescription(String value)`
    `void` | `setModelName(String value)`
    `void` | `setModelNumber(String value)`
    `void` | `setModelURL(String value)`
    `void` | `setNMPRMode(boolean flag)`
    `void` | `setPresentationURL(String value)`
    `void` | `setQueryListener(QueryListener listener)`
    `void` | `setQueryListener(QueryListener listener, boolean includeSubDevices)`
    `void` | `setRootNode(Node node)`
    `void` | `setSerialNumber(String value)`
    `void` | `setSSDPPacket(SSDPPacket packet)`
    `void` | `setUDN(String value)`
    `void` | `setUPC(String value)`
    `void` | `setWirelessMode(boolean flag)`
    `boolean` | `start()`
    `boolean` | `stop()`
    `void` | `unlock()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ELEM_NAME

          public static final String ELEM_NAME

      See Also:
        Constant Field Values

    - #### UPNP_ROOTDEVICE

          public static final String UPNP_ROOTDEVICE

      See Also:
        Constant Field Values

    - #### DEFAULT_STARTUP_WAIT_TIME

          public static final int DEFAULT_STARTUP_WAIT_TIME

      See Also:
        Constant Field Values

    - #### DEFAULT_DISCOVERY_WAIT_TIME

          public static final int DEFAULT_DISCOVERY_WAIT_TIME

      See Also:
        Constant Field Values

    - #### DEFAULT_LEASE_TIME

          public static final int DEFAULT_LEASE_TIME

      See Also:
        Constant Field Values

    - #### HTTP_DEFAULT_PORT

          public static final int HTTP_DEFAULT_PORT

      See Also:
        Constant Field Values

    - #### DEFAULT_DESCRIPTION_URI

          public static final String DEFAULT_DESCRIPTION_URI

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Device

          public Device(Node root,
                Node device)

    - #### Device

          public Device()

    - #### Device

          public Device(Node device)

    - #### Device

          public Device(File descriptionFile)
                 throws InvalidDescriptionException

      Throws:
        `InvalidDescriptionException`

    - #### Device

          public Device(String descriptionFileName)
                 throws InvalidDescriptionException

      Throws:
        `InvalidDescriptionException`

  - ### Method Detail

    - #### getRootNode

          public Node getRootNode()

    - #### getDeviceNode

          public Node getDeviceNode()

    - #### setRootNode

          public void setRootNode(Node node)

    - #### setDeviceNode

          public void setDeviceNode(Node node)

    - #### lock

          public void lock()

    - #### unlock

          public void unlock()

    - #### setNMPRMode

          public void setNMPRMode(boolean flag)

    - #### isNMPRMode

          public boolean isNMPRMode()

    - #### setWirelessMode

          public void setWirelessMode(boolean flag)

    - #### isWirelessMode

          public boolean isWirelessMode()

    - #### getSSDPAnnounceCount

          public int getSSDPAnnounceCount()

    - #### getRootDevice

          public Device getRootDevice()

    - #### getParentDevice

          public Device getParentDevice()

    - #### getDescriptionFile

          public File getDescriptionFile()

    - #### getDescriptionFilePath

          public String getDescriptionFilePath()

    - #### loadDescription

          public boolean loadDescription(String descString)
                                  throws InvalidDescriptionException

      Throws:
        `InvalidDescriptionException`

    - #### loadDescription

          public boolean loadDescription(File file)
                                  throws InvalidDescriptionException

      Throws:
        `InvalidDescriptionException`

    - #### isDeviceNode

          public static boolean isDeviceNode(Node node)

    - #### isRootDevice

          public boolean isRootDevice()

    - #### setSSDPPacket

          public void setSSDPPacket(SSDPPacket packet)

    - #### getSSDPPacket

          public SSDPPacket getSSDPPacket()

    - #### setLocation

          public void setLocation(String value)

    - #### getLocation

          public String getLocation()

    - #### setLeaseTime

          public void setLeaseTime(int value)

    - #### getLeaseTime

          public int getLeaseTime()

    - #### getTimeStamp

          public long getTimeStamp()

    - #### getElapsedTime

          public long getElapsedTime()

    - #### isExpired

          public boolean isExpired()

    - #### getURLBase

          public String getURLBase()

    - #### setDeviceType

          public void setDeviceType(String value)

    - #### getDeviceType

          public String getDeviceType()

    - #### isDeviceType

          public boolean isDeviceType(String value)

    - #### setFriendlyName

          public void setFriendlyName(String value)

    - #### getFriendlyName

          public String getFriendlyName()

    - #### setManufacture

          public void setManufacture(String value)

    - #### getManufacture

          public String getManufacture()

    - #### setManufactureURL

          public void setManufactureURL(String value)

    - #### getManufactureURL

          public String getManufactureURL()

    - #### setModelDescription

          public void setModelDescription(String value)

    - #### getModelDescription

          public String getModelDescription()

    - #### setModelName

          public void setModelName(String value)

    - #### getModelName

          public String getModelName()

    - #### setModelNumber

          public void setModelNumber(String value)

    - #### getModelNumber

          public String getModelNumber()

    - #### setModelURL

          public void setModelURL(String value)

    - #### getModelURL

          public String getModelURL()

    - #### setSerialNumber

          public void setSerialNumber(String value)

    - #### getSerialNumber

          public String getSerialNumber()

    - #### setUDN

          public void setUDN(String value)

    - #### getUDN

          public String getUDN()

    - #### hasUDN

          public boolean hasUDN()

    - #### setUPC

          public void setUPC(String value)

    - #### getUPC

          public String getUPC()

    - #### setPresentationURL

          public void setPresentationURL(String value)

    - #### getPresentationURL

          public String getPresentationURL()

    - #### getDeviceList

          public DeviceList getDeviceList()

    - #### isDevice

          public boolean isDevice(String name)

    - #### getDevice

          public Device getDevice(String name)

    - #### getDeviceByDescriptionURI

          public Device getDeviceByDescriptionURI(String uri)

    - #### getServiceList

          public ServiceList getServiceList()

    - #### getService

          public Service getService(String name)

    - #### getServiceBySCPDURL

          public Service getServiceBySCPDURL(String searchUrl)

    - #### getServiceByControlURL

          public Service getServiceByControlURL(String searchUrl)

    - #### getServiceByEventSubURL

          public Service getServiceByEventSubURL(String searchUrl)

    - #### getSubscriberService

          public Service getSubscriberService(String uuid)

    - #### getStateVariable

          public StateVariable getStateVariable(String serviceType,
                                       String name)

    - #### getStateVariable

          public StateVariable getStateVariable(String name)

    - #### getAction

          public Action getAction(String name)

    - #### getIconList

          public IconList getIconList()

    - #### getIcon

          public Icon getIcon(int n)

    - #### getLocationURL

          public String getLocationURL(String host)

    - #### notifyWait

          public static final void notifyWait()

    - #### announce

          public void announce(String bindAddr)

    - #### announce

          public void announce()

    - #### byebye

          public void byebye(String bindAddr)

    - #### byebye

          public void byebye()

    - #### postSearchResponse

          public boolean postSearchResponse(SSDPPacket ssdpPacket,
                                   String st,
                                   String usn)

    - #### deviceSearchResponse

          public void deviceSearchResponse(SSDPPacket ssdpPacket)

    - #### deviceSearchReceived

          public void deviceSearchReceived(SSDPPacket ssdpPacket)

      Specified by:
        `deviceSearchReceived` in interface `SearchListener`

    - #### setHTTPPort

          public void setHTTPPort(int port)

    - #### getHTTPPort

          public int getHTTPPort()

    - #### httpRequestRecieved

          public void httpRequestRecieved(HTTPRequest httpReq)

      Specified by:
        `httpRequestRecieved` in interface `HTTPRequestListener`

    - #### start

          public boolean start()

    - #### stop

          public boolean stop()

    - #### getInterfaceAddress

          public String getInterfaceAddress()

    - #### setActionListener

          public void setActionListener(ActionListener listener)

    - #### setQueryListener

          public void setQueryListener(QueryListener listener)

    - #### setActionListener

          public void setActionListener(ActionListener listener,
                               boolean includeSubDevices)

    - #### setQueryListener

          public void setQueryListener(QueryListener listener,
                              boolean includeSubDevices)