|
SunSPOT API V4.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.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()
IOException
public void addListener(IOTACommandServerListener sml)
addListener
in interface IOTACommandServer
sml
- the listenerpublic String getBaseStationAddress()
getBaseStationAddress
in interface IOTACommandServer
public boolean isSuspended()
isSuspended
in interface IOTACommandServer
public void setSuspended(boolean suspended)
setSuspended
in interface IOTACommandServer
suspended
- Suspends or resumes the server (it is initially running).public Date timeOfLastMessageFromHost()
timeOfLastMessageFromHost
in interface IOTACommandServer
public void run()
initialize()
instead.
run
in interface Runnable
Runnable.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
- the name for this servicepublic boolean getEnabled()
getEnabled
in interface IService
public void setEnabled(boolean enable)
setEnabled
in interface IService
enable
- 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 |