All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends
Classes | Public Member Functions | Package Attributes | Private Member Functions
ros.zeroconf.jmdns.Zeroconf Class Reference
Inheritance diagram for ros.zeroconf.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< DiscoveredService > listDiscoveredServices ()
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 41 of file Zeroconf.java.


Constructor & Destructor Documentation

Definition at line 54 of file Zeroconf.java.

Definition at line 72 of file Zeroconf.java.


Member Function Documentation

void ros.zeroconf.jmdns.Zeroconf.addListener ( String  service_type,
String  domain 
) [inline]

Definition at line 96 of file Zeroconf.java.

void ros.zeroconf.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 105 of file Zeroconf.java.

void ros.zeroconf.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 145 of file Zeroconf.java.

void ros.zeroconf.jmdns.Zeroconf.display ( DiscoveredService  discovered_service) [inline]

Definition at line 359 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 306 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 331 of file Zeroconf.java.

List<DiscoveredService> ros.zeroconf.jmdns.Zeroconf.listDiscoveredServices ( ) [inline]

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 172 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 227 of file Zeroconf.java.

void ros.zeroconf.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 119 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 243 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 257 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 277 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 292 of file Zeroconf.java.

Definition at line 93 of file Zeroconf.java.

void ros.zeroconf.jmdns.Zeroconf.shutdown ( ) throws IOException [inline]

Definition at line 233 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 298 of file Zeroconf.java.

DiscoveredService ros.zeroconf.jmdns.Zeroconf.toDiscoveredService ( ServiceInfo  service_info) [inline, private]

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 413 of file Zeroconf.java.

String ros.zeroconf.jmdns.Zeroconf.toString ( DiscoveredService  discovered_service) [inline]

Definition at line 372 of file Zeroconf.java.


Member Data Documentation

Definition at line 52 of file Zeroconf.java.

Definition at line 47 of file Zeroconf.java.

Definition at line 51 of file Zeroconf.java.

Definition at line 48 of file Zeroconf.java.

Definition at line 50 of file Zeroconf.java.

Definition at line 49 of file Zeroconf.java.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends


zeroconf_jmdns
Author(s): Daniel Stonier
autogenerated on Tue Nov 6 2012 13:08:27