org.bitlet.weupnp
public class GatewayDevice extends java.lang.Object
Constructor and Description |
---|
GatewayDevice()
Creates a new instance of GatewayDevice
|
Modifier and Type | Method and Description |
---|---|
boolean |
addPortMapping(int externalPort,
int internalPort,
java.lang.String internalClient,
java.lang.String protocol,
java.lang.String description)
Adds a new port mapping to the GatewayDevices using the supplied
parameters.
|
boolean |
deletePortMapping(int externalPort,
java.lang.String protocol)
Deletes the port mapping associated to externalPort and
protocol
|
java.lang.String |
getControlURL() |
java.lang.String |
getControlURLCIF() |
java.lang.String |
getDeviceType() |
java.lang.String |
getDeviceTypeCIF() |
java.lang.String |
getEventSubURL() |
java.lang.String |
getEventSubURLCIF() |
java.lang.String |
getExternalIPAddress()
Retrieves the external IP address associated with this device
The external address is the address that can be used to connect to the
GatewayDevice from the external network
|
java.lang.String |
getFriendlyName() |
boolean |
getGenericPortMappingEntry(int index,
PortMappingEntry portMappingEntry)
Returns a specific port mapping entry, depending on a the supplied index.
|
java.net.InetAddress |
getLocalAddress()
Gets the local address to connect the gateway through
|
java.lang.String |
getLocation() |
java.lang.String |
getManufacturer() |
java.lang.String |
getModelDescription() |
java.lang.String |
getModelName() |
java.lang.String |
getModelNumber() |
java.lang.Integer |
getPortMappingNumberOfEntries()
Retrieves the number of port mappings that are registered on the
GatewayDevice.
|
java.lang.String |
getPresentationURL() |
java.lang.String |
getSCPDURL() |
java.lang.String |
getSCPDURLCIF() |
java.lang.String |
getServiceType() |
java.lang.String |
getServiceTypeCIF() |
boolean |
getSpecificPortMappingEntry(int externalPort,
java.lang.String protocol,
PortMappingEntry portMappingEntry)
Queries the GatewayDevice to retrieve a specific port mapping entry,
corresponding to specified criteria, if present.
|
java.lang.String |
getSt() |
java.lang.String |
getURLBase() |
boolean |
isConnected()
Retrieves the connection status of this device
|
void |
loadDescription()
Retrieves the properties and description of the GatewayDevice.
|
void |
setControlURL(java.lang.String controlURL) |
void |
setControlURLCIF(java.lang.String controlURLCIF) |
void |
setDeviceType(java.lang.String deviceType) |
void |
setDeviceTypeCIF(java.lang.String deviceTypeCIF) |
void |
setEventSubURL(java.lang.String eventSubURL) |
void |
setEventSubURLCIF(java.lang.String eventSubURLCIF) |
void |
setFriendlyName(java.lang.String friendlyName) |
void |
setLocalAddress(java.net.InetAddress localAddress)
Sets the
localAddress |
void |
setLocation(java.lang.String location) |
void |
setManufacturer(java.lang.String manufacturer) |
void |
setModelDescription(java.lang.String modelDescription) |
void |
setModelName(java.lang.String modelName) |
void |
setModelNumber(java.lang.String modelNumber) |
void |
setPresentationURL(java.lang.String presentationURL) |
void |
setSCPDURL(java.lang.String sCPDURL) |
void |
setSCPDURLCIF(java.lang.String sCPDURLCIF) |
void |
setServiceType(java.lang.String serviceType) |
void |
setServiceTypeCIF(java.lang.String serviceTypeCIF) |
void |
setSt(java.lang.String st) |
void |
setURLBase(java.lang.String uRLBase) |
static java.util.Map<java.lang.String,java.lang.String> |
simpleUPnPcommand(java.lang.String url,
java.lang.String service,
java.lang.String action,
java.util.Map<java.lang.String,java.lang.String> args)
Issues UPnP commands to a GatewayDevice that can be reached at the
specified url
The command is identified by a service and an action
and can receive arguments
|
public void loadDescription() throws org.xml.sax.SAXException, java.io.IOException
location
and parses the response
using a GatewayDeviceHandler
to populate the fields of this
classorg.xml.sax.SAXException
- if an error occurs while parsing the requestjava.io.IOException
- on communication errorsGatewayDeviceHandler
public static java.util.Map<java.lang.String,java.lang.String> simpleUPnPcommand(java.lang.String url, java.lang.String service, java.lang.String action, java.util.Map<java.lang.String,java.lang.String> args) throws java.io.IOException, org.xml.sax.SAXException
url
- the url to use to contact the deviceservice
- the service to invokeaction
- the specific action to performargs
- the command argumentsjava.io.IOException
- on communication errorsorg.xml.sax.SAXException
- if errors occur while parsing the responsepublic boolean isConnected() throws java.io.IOException, org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXException
simpleUPnPcommand(java.lang.String, java.lang.String,
java.lang.String, java.util.Map)
public java.lang.String getExternalIPAddress() throws java.io.IOException, org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXException
simpleUPnPcommand(java.lang.String, java.lang.String,
java.lang.String, java.util.Map)
public boolean addPortMapping(int externalPort, int internalPort, java.lang.String internalClient, java.lang.String protocol, java.lang.String description) throws java.io.IOException, org.xml.sax.SAXException
externalPort
- the external associated with the new mappinginternalPort
- the internal port associated with the new mappinginternalClient
- the internal client associated with the new mappingprotocol
- the protocol associated with the new mappingdescription
- the mapping descriptionjava.io.IOException
org.xml.sax.SAXException
simpleUPnPcommand(java.lang.String, java.lang.String,
java.lang.String, java.util.Map)
,
PortMappingEntry
public boolean getSpecificPortMappingEntry(int externalPort, java.lang.String protocol, PortMappingEntry portMappingEntry) throws java.io.IOException, org.xml.sax.SAXException
externalPort
- the external portprotocol
- the protocol (TCP or UDP)portMappingEntry
- the entry containing the details, in any is
present, null otherwise. (used as return value)java.io.IOException
org.xml.sax.SAXException
simpleUPnPcommand(java.lang.String, java.lang.String,
java.lang.String, java.util.Map)
,
PortMappingEntry
public boolean getGenericPortMappingEntry(int index, PortMappingEntry portMappingEntry) throws java.io.IOException, org.xml.sax.SAXException
index
- the index of the desired port mappingportMappingEntry
- the entry containing the details, in any is
present, null otherwise. (used as return value)java.io.IOException
org.xml.sax.SAXException
simpleUPnPcommand(java.lang.String, java.lang.String,
java.lang.String, java.util.Map)
,
PortMappingEntry
public java.lang.Integer getPortMappingNumberOfEntries() throws java.io.IOException, org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXException
public boolean deletePortMapping(int externalPort, java.lang.String protocol) throws java.io.IOException, org.xml.sax.SAXException
externalPort
- the external portprotocol
- the protocoljava.io.IOException
org.xml.sax.SAXException
public java.net.InetAddress getLocalAddress()
localAddress
public void setLocalAddress(java.net.InetAddress localAddress)
localAddress
localAddress
- the address to setpublic java.lang.String getSt()
public void setSt(java.lang.String st)
public java.lang.String getLocation()
public void setLocation(java.lang.String location)
public java.lang.String getServiceType()
public void setServiceType(java.lang.String serviceType)
public java.lang.String getServiceTypeCIF()
public void setServiceTypeCIF(java.lang.String serviceTypeCIF)
public java.lang.String getControlURL()
public void setControlURL(java.lang.String controlURL)
public java.lang.String getControlURLCIF()
public void setControlURLCIF(java.lang.String controlURLCIF)
public java.lang.String getEventSubURL()
public void setEventSubURL(java.lang.String eventSubURL)
public java.lang.String getEventSubURLCIF()
public void setEventSubURLCIF(java.lang.String eventSubURLCIF)
public java.lang.String getSCPDURL()
public void setSCPDURL(java.lang.String sCPDURL)
public java.lang.String getSCPDURLCIF()
public void setSCPDURLCIF(java.lang.String sCPDURLCIF)
public java.lang.String getDeviceType()
public void setDeviceType(java.lang.String deviceType)
public java.lang.String getDeviceTypeCIF()
public void setDeviceTypeCIF(java.lang.String deviceTypeCIF)
public java.lang.String getURLBase()
public void setURLBase(java.lang.String uRLBase)
public java.lang.String getFriendlyName()
public void setFriendlyName(java.lang.String friendlyName)
public java.lang.String getManufacturer()
public void setManufacturer(java.lang.String manufacturer)
public java.lang.String getModelDescription()
public void setModelDescription(java.lang.String modelDescription)
public java.lang.String getPresentationURL()
public void setPresentationURL(java.lang.String presentationURL)
public java.lang.String getModelName()
public void setModelName(java.lang.String modelName)
public java.lang.String getModelNumber()
public void setModelNumber(java.lang.String modelNumber)
Copyright © 2014. All Rights Reserved.