|
SunSPOT API V4.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.spot.peripheral.ota.OTACommandServer
public class OTACommandServer
This class monitors radiogram communications on port number
8, and responds to commands received. These commands allow flashing the
Spot's config page and/or applications remotely, retrieving the config page
contents, and restarting the Spot.
Applications should never need to create an OTACommandServer explicitly.
OTA is enabled or disabled for a SPOT using the ant command line facility.
To get access to the OTACommandServer use Spot.getInstance().getOTACommandServer()
See IOTACommandServerListener if you want to run an application in a
separate thread concurrently with OTACommandServer, and you need to respond
(for example, suspending) when flash operations start.
| Field Summary |
|---|
| Fields inherited from interface com.sun.spot.peripheral.ota.IOTACommandServer |
|---|
HARDWARE_MAJOR_REV_ESPOT, HELLO_CMD, HELLO_COMMAND_MINOR_VERSION, HELLO_COMMAND_VERSION, PORT, START_OTA_SESSION_CMD |
| Fields inherited from interface com.sun.spot.service.IService |
|---|
PAUSED, PAUSING, RESUMING, RUNNING, STARTING, STOPPED, STOPPING |
| Method Summary | |
|---|---|
void |
addListener(IOTACommandServerListener sml)
Attach a listener to be notified of the start and stop of flash operations. |
String |
getBaseStationAddress()
Answer the IEEE address of the sender of the last command received. |
boolean |
getEnabled()
Return whether service is started automatically on reboot. |
static IOTACommandServer |
getInstance()
|
String |
getServiceName()
Return the name of this service. |
int |
getStatus()
Return the current status of this service. |
boolean |
isRunning()
Return whether the service is currently running. |
boolean |
isSuspended()
|
static void |
main(String[] args)
Startup the OTACommandServer on a SPOT listening for OTA connections. |
boolean |
pause()
Pause the service, and return whether successful. |
boolean |
resume()
Resume the service, and return whether successful. |
void |
run()
Should not be invoked from user code - call initialize() instead. |
void |
setEnabled(boolean enable)
Enable/disable whether service is started automatically. |
void |
setServiceName(String who)
Assign a name to this service. |
void |
setSuspended(boolean suspended)
|
boolean |
start()
Start the service, and return whether successful. |
boolean |
stop()
Stop the service, and return whether successful. |
Date |
timeOfLastMessageFromHost()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void main(String[] args)
args - ignoredpublic static IOTACommandServer getInstance()
IOExceptionpublic void addListener(IOTACommandServerListener sml)
addListener in interface IOTACommandServersml - the listenerpublic String getBaseStationAddress()
getBaseStationAddress in interface IOTACommandServerpublic boolean isSuspended()
isSuspended in interface IOTACommandServerpublic void setSuspended(boolean suspended)
setSuspended in interface IOTACommandServersuspended - Suspends or resumes the server (it is initially running).public Date timeOfLastMessageFromHost()
timeOfLastMessageFromHost in interface IOTACommandServerpublic void run()
initialize() instead.
run in interface RunnableRunnable.run()public boolean start()
start in interface IServicepublic boolean stop()
stop in interface IServicepublic boolean pause()
pause in interface IServicepublic boolean resume()
resume in interface IServicepublic int getStatus()
getStatus in interface IServicepublic boolean isRunning()
isRunning in interface IServicepublic String getServiceName()
getServiceName in interface IServicepublic void setServiceName(String who)
setServiceName in interface IServicewho - the name for this servicepublic boolean getEnabled()
getEnabled in interface IServicepublic void setEnabled(boolean enable)
setEnabled in interface IServiceenable - true if the service should be started automatically on reboot
|
SunSPOT API V4.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||