Sun SPOT Telemetry Demo -- SPOT-side
v1.1

org.sunspotworld.demo.util
Class LocateService

java.lang.Object
  extended by org.sunspotworld.demo.util.LocateService

public class LocateService
extends java.lang.Object

Helper class to handle locating a remote service.

Broadcasts a service request periodically and listens for a response. When found calls back to report the IEEE address where the service can be found.

Author:
Ron Goldman
Date: July 31, 2007
See Also:
LocateServiceListener

Constructor Summary
LocateService(LocateServiceListener listener, java.lang.String port, long checkInterval, byte requestCmd, byte replyCmd)
          Creates a new instance of LocateService.
LocateService(LocateServiceListener listener, java.lang.String port, long checkInterval, byte requestCmd, byte replyCmd, int numHops)
          Creates a new instance of LocateService.
 
Method Summary
 void setStatusLed(com.sun.spot.sensorboard.peripheral.ITriColorLED led)
          Specify an LED to use to display status of search.
 void start()
          Start searching for a service
 void stop()
          Stop searching for a service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocateService

public LocateService(LocateServiceListener listener,
                     java.lang.String port,
                     long checkInterval,
                     byte requestCmd,
                     byte replyCmd)
Creates a new instance of LocateService.

Parameters:
listener - class to callback when the service is found
port - the port to broadcast & listen on
checkInterval - how long to wait between checking
requestCmd - the command requesting a connection with the service
replyCmd - the command the service replys with to indicate it is available

LocateService

public LocateService(LocateServiceListener listener,
                     java.lang.String port,
                     long checkInterval,
                     byte requestCmd,
                     byte replyCmd,
                     int numHops)
Creates a new instance of LocateService.

Parameters:
listener - class to callback when the service is found
port - the port to broadcast & listen on
checkInterval - how long to wait between checking
requestCmd - the command requesting a connection with the service
replyCmd - the command the service replys with to indicate it is available
numHops - the number of hops the broadcast command should traverse
Method Detail

setStatusLed

public void setStatusLed(com.sun.spot.sensorboard.peripheral.ITriColorLED led)
Specify an LED to use to display status of search.

Parameters:
led - the LED to use to show the search status

start

public void start()
Start searching for a service


stop

public void stop()
Stop searching for a service


Sun SPOT Telemetry Demo -- SPOT-side
v1.1

Copyright © 2006, 2007 Sun Microsystems, Inc. All Rights Reserved.