Class Discover
- All Implemented Interfaces:
Runnable
Discover is a Runnable tool implementation allowing a user to do KNXnet/IP discovery and
self-description of KNXnet/IP capable devices. As the protocol name already implies, this is done
using the IP protocol. This tool shows the necessary interaction with the Calimero 2 API for
discovering KNXnet/IP capable devices and query descriptions. The main part of this tool
implementation interacts with the type Discoverer in the library, which implements the
necessary discovery and self-description features.
When running this tool from the console, the main- method of this class is invoked,
otherwise use it in the context appropriate to a Runnable.
To cancel a running discovery/description request on the console, use a user interrupt for
termination, for example, ^C.
In console mode, discovery and self-description responses, as well as errors and problems during
discovery/description are written to System.out.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new Discover instance using the supplied options; seemain(String[])for a list of options. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidEntry point for running Discover.protected voidonCompletion(Exception thrown, boolean canceled) Called by this tool on completion.protected voidonDescriptionReceived(tuwien.auto.calimero.knxnetip.Discoverer.Result<tuwien.auto.calimero.knxnetip.servicetype.DescriptionResponse> result) Invoked by this tool immediately after receiving a description response.protected voidonEndpointReceived(tuwien.auto.calimero.knxnetip.Discoverer.Result<tuwien.auto.calimero.knxnetip.servicetype.SearchResponse> result) Invoked by this tool immediately after receiving a search response.voidrun()
-
Constructor Details
-
Discover
Creates a new Discover instance using the supplied options; seemain(String[])for a list of options.- Parameters:
args- list with options
-
-
Method Details
-
main
Entry point for running Discover.To show usage message of the tool on the console, supply the command line option --help (or -h).
Command line arguments are treated case-sensitive; if no command is given, the tool only shows a short description and version info. Available commands and options for discovery/self-description:search [host]start a discovery search--withDescriptionquery self description for each search result--netif -iinterface name | IP address local multicast network interface--unicast -urequest unicast responses--macaddress extended search requesting the specified MAC address--progmodeextended search requesting devices in programming mode
describe hostquery self description from host--netif -iinterface name | IP address local network interface for sending description request--serverport -pnumber server UDP/TCP port (defaults to port 3671)
sdshortcut forsearch --withDescription
--help -hshow help message--versionshow tool/library version and exit--localportnumber local UDP/TCP port (default system assigned)--nat -nenable Network Address Translation--timeout -tdiscovery/self description response timeout in seconds--tcprequest TCP communication--udprequest UDP communication
- Parameters:
args- command line options for discovery or self-description
-
run
public void run() -
onEndpointReceived
protected void onEndpointReceived(tuwien.auto.calimero.knxnetip.Discoverer.Result<tuwien.auto.calimero.knxnetip.servicetype.SearchResponse> result) Invoked by this tool immediately after receiving a search response.This default implementation writes the endpoint information to standard output.
- Parameters:
result- the search result containing the received search response with information about a KNXnet/IP endpoint
-
onDescriptionReceived
protected void onDescriptionReceived(tuwien.auto.calimero.knxnetip.Discoverer.Result<tuwien.auto.calimero.knxnetip.servicetype.DescriptionResponse> result) Invoked by this tool immediately after receiving a description response.This default implementation extracts the information and writes it to the standard output.
- Parameters:
result- the description result containing the received description response
-
onCompletion
Called by this tool on completion.- Parameters:
thrown- the thrown exception if operation completed due to a raised exception,nullotherwisecanceled- whether the operation got canceled before its planned end
-