public class GatewayDevice extends Object
Constructor and Description |
---|
GatewayDevice()
Creates a new instance of GatewayDevice
|
Modifier and Type | Method and Description |
---|---|
boolean |
addPortMapping(int externalPort,
int internalPort,
String internalClient,
String protocol,
String description)
Adds a new port mapping to the GatewayDevices using the supplied
parameters.
|
boolean |
deletePortMapping(int externalPort,
String protocol)
Deletes the port mapping associated to externalPort and
protocol
|
String |
getControlURL() |
String |
getControlURLCIF() |
String |
getDeviceType() |
String |
getDeviceTypeCIF() |
String |
getEventSubURL() |
String |
getEventSubURLCIF() |
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
|
String |
getFriendlyName() |
boolean |
getGenericPortMappingEntry(int index,
PortMappingEntry portMappingEntry)
Returns a specific port mapping entry, depending on a the supplied index.
|
InetAddress |
getLocalAddress()
Gets the local address to connect the gateway through
|
String |
getLocation() |
String |
getManufacturer() |
String |
getModelDescription() |
String |
getModelName() |
String |
getModelNumber() |
Integer |
getPortMappingNumberOfEntries()
Retrieves the number of port mappings that are registered on the
GatewayDevice.
|
String |
getPresentationURL() |
String |
getSCPDURL() |
String |
getSCPDURLCIF() |
String |
getServiceType() |
String |
getServiceTypeCIF() |
boolean |
getSpecificPortMappingEntry(int externalPort,
String protocol,
PortMappingEntry portMappingEntry)
Queries the GatewayDevice to retrieve a specific port mapping entry,
corresponding to specified criteria, if present.
|
String |
getSt() |
String |
getURLBase() |
boolean |
isConnected()
Retrieves the connection status of this device
|
void |
loadDescription()
Retrieves the properties and description of the GatewayDevice.
|
void |
setControlURL(String controlURL) |
void |
setControlURLCIF(String controlURLCIF) |
void |
setDeviceType(String deviceType) |
void |
setDeviceTypeCIF(String deviceTypeCIF) |
void |
setEventSubURL(String eventSubURL) |
void |
setEventSubURLCIF(String eventSubURLCIF) |
void |
setFriendlyName(String friendlyName) |
void |
setLocalAddress(InetAddress localAddress)
Sets the
localAddress |
void |
setLocation(String location) |
void |
setManufacturer(String manufacturer) |
void |
setModelDescription(String modelDescription) |
void |
setModelName(String modelName) |
void |
setModelNumber(String modelNumber) |
void |
setPresentationURL(String presentationURL) |
void |
setSCPDURL(String sCPDURL) |
void |
setSCPDURLCIF(String sCPDURLCIF) |
void |
setServiceType(String serviceType) |
void |
setServiceTypeCIF(String serviceTypeCIF) |
void |
setSt(String st) |
void |
setURLBase(String uRLBase) |
static Map<String,String> |
simpleUPnPcommand(String url,
String service,
String action,
Map<String,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 SAXException, IOException
location
and parses the response
using a GatewayDeviceHandler
to populate the fields of this
classSAXException
- if an error occurs while parsing the requestIOException
- on communication errorsGatewayDeviceHandler
public static Map<String,String> simpleUPnPcommand(String url, String service, String action, Map<String,String> args) throws IOException, SAXException
url
- the url to use to contact the deviceservice
- the service to invokeaction
- the specific action to performargs
- the command argumentsIOException
- on communication errorsSAXException
- if errors occur while parsing the responsepublic boolean isConnected() throws IOException, SAXException
IOException
SAXException
simpleUPnPcommand(java.lang.String, java.lang.String,
java.lang.String, java.util.Map)
public String getExternalIPAddress() throws IOException, SAXException
IOException
SAXException
simpleUPnPcommand(java.lang.String, java.lang.String,
java.lang.String, java.util.Map)
public boolean addPortMapping(int externalPort, int internalPort, String internalClient, String protocol, String description) throws IOException, 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 descriptionIOException
SAXException
simpleUPnPcommand(java.lang.String, java.lang.String,
java.lang.String, java.util.Map)
,
PortMappingEntry
public boolean getSpecificPortMappingEntry(int externalPort, String protocol, PortMappingEntry portMappingEntry) throws IOException, 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)IOException
SAXException
simpleUPnPcommand(java.lang.String, java.lang.String,
java.lang.String, java.util.Map)
,
PortMappingEntry
public boolean getGenericPortMappingEntry(int index, PortMappingEntry portMappingEntry) throws IOException, SAXException
index
- the index of the desired port mappingportMappingEntry
- the entry containing the details, in any is
present, null otherwise. (used as return value)IOException
SAXException
simpleUPnPcommand(java.lang.String, java.lang.String,
java.lang.String, java.util.Map)
,
PortMappingEntry
public Integer getPortMappingNumberOfEntries() throws IOException, SAXException
IOException
SAXException
public boolean deletePortMapping(int externalPort, String protocol) throws IOException, SAXException
externalPort
- the external portprotocol
- the protocolIOException
SAXException
public InetAddress getLocalAddress()
localAddress
public void setLocalAddress(InetAddress localAddress)
localAddress
localAddress
- the address to setpublic String getSt()
public void setSt(String st)
public String getLocation()
public void setLocation(String location)
public String getServiceType()
public void setServiceType(String serviceType)
public String getServiceTypeCIF()
public void setServiceTypeCIF(String serviceTypeCIF)
public String getControlURL()
public void setControlURL(String controlURL)
public String getControlURLCIF()
public void setControlURLCIF(String controlURLCIF)
public String getEventSubURL()
public void setEventSubURL(String eventSubURL)
public String getEventSubURLCIF()
public void setEventSubURLCIF(String eventSubURLCIF)
public String getSCPDURL()
public void setSCPDURL(String sCPDURL)
public String getSCPDURLCIF()
public void setSCPDURLCIF(String sCPDURLCIF)
public String getDeviceType()
public void setDeviceType(String deviceType)
public String getDeviceTypeCIF()
public void setDeviceTypeCIF(String deviceTypeCIF)
public String getURLBase()
public void setURLBase(String uRLBase)
public String getFriendlyName()
public void setFriendlyName(String friendlyName)
public String getManufacturer()
public void setManufacturer(String manufacturer)
public String getModelDescription()
public void setModelDescription(String modelDescription)
public String getPresentationURL()
public void setPresentationURL(String presentationURL)
public String getModelName()
public void setModelName(String modelName)
public String getModelNumber()
public void setModelNumber(String modelNumber)
Copyright © 2014. All rights reserved.