Package org.bitlet.weupnp
Class GatewayDiscover
java.lang.Object
org.bitlet.weupnp.GatewayDiscover
Handles the discovery of GatewayDevices, via the
discover()
method.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Constructor of the gateway discover service.GatewayDiscover
(String[] types) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiondiscover()
Discovers Gateway Devices on the network(s) the executing machine is connected to.Returns list of all discovered gateways.int
Gets the timeout for socket connections of the initial broadcast request.Gets the first connected gatewayvoid
setTimeout
(int milliseconds) Sets the timeout for socket connections of the initial broadcast request.
-
Field Details
-
PORT
public static final int PORTThe SSDP port- See Also:
-
IP
The broadcast address to use when trying to contact UPnP devices- See Also:
-
-
Constructor Details
-
GatewayDiscover
public GatewayDiscover()Constructor. By default it's looking for 3 types of gateways. -
GatewayDiscover
Constructor of the gateway discover service.- Parameters:
st
- The search type you are looking for
-
GatewayDiscover
Constructor.- Parameters:
types
- The search types the discover have to look for
-
-
Method Details
-
getTimeout
public int getTimeout()Gets the timeout for socket connections of the initial broadcast request.- Returns:
- timeout in milliseconds
-
setTimeout
public void setTimeout(int milliseconds) Sets the timeout for socket connections of the initial broadcast request.- Parameters:
milliseconds
- the new timeout in milliseconds
-
discover
public Map<InetAddress,GatewayDevice> discover() throws SocketException, UnknownHostException, IOException, SAXException, ParserConfigurationExceptionDiscovers Gateway Devices on the network(s) the executing machine is connected to. The host may be connected to different networks via different network interfaces. Assumes that each network interface has a different InetAddress and returns a map associating every GatewayDevice (responding to a broadcast discovery message) with the InetAddress it is connected to.- Returns:
- a map containing a GatewayDevice per InetAddress
- Throws:
SocketException
UnknownHostException
IOException
SAXException
ParserConfigurationException
-
getValidGateway
Gets the first connected gateway- Returns:
- the first GatewayDevice which is connected to the network, or null if none present
-
getAllGateways
Returns list of all discovered gateways. Is empty when no gateway is found.
-