Classes | Public Member Functions | Package Attributes | Private Member Functions
com.github.rosjava.zeroconf_jmdns_suite.jmdns.Zeroconf Class Reference
Inheritance diagram for com.github.rosjava.zeroconf_jmdns_suite.jmdns.Zeroconf:
Inheritance graph
[legend]

List of all members.

Classes

class  DefaultLogger

Public Member Functions

void addListener (String service_type, String domain)
void addListener (String service_type, String domain, ZeroconfDiscoveryHandler listener_callback)
void addService (String name, String type, String domain, int port, String description)
void display (DiscoveredService discovered_service)
void inetAddressAdded (NetworkTopologyEvent event)
void inetAddressRemoved (NetworkTopologyEvent event)
List< DiscoveredServicelistDiscoveredServices ()
void removeAllServices ()
void removeListener (String service_type, String domain)
void serviceAdded (ServiceEvent event)
void serviceRemoved (ServiceEvent event)
void serviceResolved (ServiceEvent event)
void serviceTypeAdded (ServiceEvent event)
void setDefaultDiscoveryCallback (ZeroconfDiscoveryHandler listener_callback)
void shutdown () throws IOException
void subTypeForServiceTypeAdded (ServiceEvent event)
String toString (DiscoveredService discovered_service)
 Zeroconf ()
 Zeroconf (ZeroconfLogger logger)

Package Attributes

ZeroconfDiscoveryHandler default_listener_callback
JmmDNS jmmdns
Map< String,
ZeroconfDiscoveryHandler
listener_callbacks
Set< String > listeners
ZeroconfLogger logger
Set< ServiceInfoservices

Private Member Functions

DiscoveredService toDiscoveredService (ServiceInfo service_info)

Detailed Description

This is a wrapper around the jmmdns (multi-homed) part of the jmdns library.

On the surface it does not look as if we need this wrapper since jmdns has quite a nice api, but it turned out to be quite awkward to use. There are some broken api, others that need some black magic, and also the ouput (in ServiceInfo types) is fixed - you can't modify, or merge them to simplify the output list of discovered services.

Currently working with the jmdns guy and merging convenient additions here upstream but its a gradual process that needs alot of testing.

In summary, this is a nice, simple api for publishing services and doing service discovery (either via polling or via callback).

Definition at line 57 of file Zeroconf.java.


Constructor & Destructor Documentation

Definition at line 70 of file Zeroconf.java.

Definition at line 88 of file Zeroconf.java.


Member Function Documentation

void com.github.rosjava.zeroconf_jmdns_suite.jmdns.Zeroconf.addListener ( String  service_type,
String  domain 
) [inline]

Definition at line 112 of file Zeroconf.java.

void com.github.rosjava.zeroconf_jmdns_suite.jmdns.Zeroconf.addListener ( String  service_type,
String  domain,
ZeroconfDiscoveryHandler  listener_callback 
) [inline]

If you call this early in your program, the jmmdns.addServiceListener will often do nothing as it hasn't discovered the interfaces yet. In this case, we save the listener data (listeners.add(service) and add them when the network interfaces come up.

Definition at line 121 of file Zeroconf.java.

void com.github.rosjava.zeroconf_jmdns_suite.jmdns.Zeroconf.addService ( String  name,
String  type,
String  domain,
int  port,
String  description 
) [inline]

Publish a zeroconf service.

Should actually provide a return value here, so the user can see the actually published name.

Parameters:
name: english readable name for the service
type: zeroconf service type, e.g. _ros-master._tcp
domain: domain to advertise on (usually 'local')
port: port number
description:

Definition at line 161 of file Zeroconf.java.

Definition at line 375 of file Zeroconf.java.

A network address has been added.

Parameters:
eventThe NetworkTopologyEvent providing the name and fully qualified type of the service.

Implements javax.jmdns.NetworkTopologyListener.

Definition at line 322 of file Zeroconf.java.

A network address has been removed.

Parameters:
eventThe NetworkTopologyEvent providing the name and fully qualified type of the service.

Implements javax.jmdns.NetworkTopologyListener.

Definition at line 347 of file Zeroconf.java.

If you try calling this immediately after a service added callback occurred, you probably wont see anything - it needs some time to resolve.

It will block if it needs to resolve services (and aren't in its cache yet).

Definition at line 188 of file Zeroconf.java.

This should be called when your application shuts down to remove all services so you don't pollute the zeroconf namespace with hanging, unresolvable services.

Definition at line 243 of file Zeroconf.java.

void com.github.rosjava.zeroconf_jmdns_suite.jmdns.Zeroconf.removeListener ( String  service_type,
String  domain 
) [inline]

Removes a single listener - though we're not likely to use this much.

Definition at line 135 of file Zeroconf.java.

A service has been added.
Note:This event is only the service added event. The service info associated with this event does not include resolution information.
To get the full resolved information you need to listen to serviceResolved(ServiceEvent) or call JmDNS#getServiceInfo(String, String, long)

  ServiceInfo info = event.getDNS().getServiceInfo(event.getType(), event.getName())
 

Please note that service resolution may take a few second to resolve.

Parameters:
eventThe ServiceEvent providing the name and fully qualified type of the service.

Implements javax.jmdns.ServiceListener.

Definition at line 259 of file Zeroconf.java.

A service has been removed.

Parameters:
eventThe ServiceEvent providing the name and fully qualified type of the service.

Implements javax.jmdns.ServiceListener.

Definition at line 273 of file Zeroconf.java.

This implements service resolved in a very simple way. If the user has callbacks, then it just directly resolves the service info to a ros service info. Note that if you have multiple interfaces (e.g. eth0, wlan0) then this won't provide the resolved artifact for all interfaces. It might be worth adding a check for that service across all interfaces here and providing a fully updated (with regards to addresses) ros service info artifact to the user's callback here.

Implements javax.jmdns.ServiceListener.

Definition at line 293 of file Zeroconf.java.

A new service type was discovered.

Parameters:
eventThe service event providing the fully qualified type of the service.

Implements javax.jmdns.ServiceTypeListener.

Definition at line 308 of file Zeroconf.java.

Definition at line 109 of file Zeroconf.java.

Definition at line 249 of file Zeroconf.java.

A new subtype for the service type was discovered.

 <sub>._sub.<app>.<protocol>.<servicedomain>.<parentdomain>.
 
Parameters:
eventThe service event providing the fully qualified type of the service with subtype.
Since:
3.2.0

Implements javax.jmdns.ServiceTypeListener.

Definition at line 314 of file Zeroconf.java.

If you try calling this immediately after a service added callback occurred, you probably wont see anything - it needs some time to resolve.

It will block if it needs to resolve services (and aren't in its cache yet).

See also:
listDiscoveredServices
Returns:
service_infos : an array of discovered ServiceInfo objects.

Definition at line 429 of file Zeroconf.java.

Definition at line 388 of file Zeroconf.java.


Member Data Documentation

Definition at line 68 of file Zeroconf.java.

Definition at line 63 of file Zeroconf.java.

Definition at line 67 of file Zeroconf.java.

Definition at line 64 of file Zeroconf.java.

Definition at line 66 of file Zeroconf.java.

Definition at line 65 of file Zeroconf.java.


The documentation for this class was generated from the following file:


zeroconf_jmdns_suite
Author(s): Daniel Stonier
autogenerated on Thu Aug 27 2015 15:50:27