|
SunSPOT API V5.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.spot.service.Heartbeat
public class Heartbeat
A simple service that blinks the SPOT processor board green LED in a heartbeat pattern. When the green & red LEDs are used to signal events (e.g. radio packets received & sent) the heartbeat thread can be used to periodically turn them off. Used by the basestation.
Field Summary |
---|
Fields inherited from interface com.sun.spot.service.IService |
---|
PAUSED, PAUSING, READY, RESUMING, RUNNING, STARTING, STOPPED, STOPPING |
Constructor Summary | |
---|---|
Heartbeat()
Display basic heartbeat every 10 seconds. |
|
Heartbeat(long period)
Display basic heartbeat using specified period. |
|
Heartbeat(long period,
long activityDecayPeriod)
Display basic heartbeat using specified period. |
Method Summary | |
---|---|
boolean |
getEnabled()
Return whether service is started automatically on reboot. |
String |
getServiceName()
Return the name of the heartbeat service. |
int |
getStatus()
Return the current status of the heartbeat service. |
boolean |
isRunning()
Return whether the heartbeat service is currently running. |
boolean |
pause()
Same as calling stop(). |
boolean |
resume()
Same as calling start(). |
void |
run()
Heartbeat display loop |
void |
setEnabled(boolean enable)
Enable/disable whether service is started automatically. |
void |
setServiceName(String who)
Assign a new name to this service. |
boolean |
start()
Start the heartbeat service, if not already running. |
boolean |
stop()
Stop the heartbeat service, if it is currently running. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Heartbeat()
public Heartbeat(long period)
period
- time in milliseconds for heartbeat patternpublic Heartbeat(long period, long activityDecayPeriod)
period
- time in milliseconds for heartbeat patternactivityDecayPeriod
- how often (in milliseconds) to clear activity LEDs
(zero means do not clear LEDs)Method Detail |
---|
public void run()
run
in interface Runnable
Thread.run()
public boolean start()
start
in interface IService
public boolean stop()
stop
in interface IService
public boolean pause()
pause
in interface IService
public boolean resume()
resume
in interface IService
public int getStatus()
getStatus
in interface IService
public boolean isRunning()
isRunning
in interface IService
public String getServiceName()
getServiceName
in interface IService
public void setServiceName(String who)
setServiceName
in interface IService
who
- ignoredpublic boolean getEnabled()
getEnabled
in interface IService
public void setEnabled(boolean enable)
setEnabled
in interface IService
enable
- ignored
|
SunSPOT API V5.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |