SunSPOT host API V3.0


com.sun.spot.client
Interface IAdminTarget


public interface IAdminTarget

IAdminTarget allows data to be sent to and from the admin command processor on a SPOT, either locally via USB or remotely via the radio. It should be used in the context of executing an ISpotClientCommand and obtained via ISpotClientCommandHelper.getAdminTarget().


Method Summary
 void checkResponse()
          Wait for a response from the target, and then check whether an error occurred.
 void flashFile(Flashable flashable, String flashCommand, byte[] params)
          Send data with flow control, so that data is not sent faster than the target can handle it.
 DataInputStream getDataInputStream()
          Answer a DataInputStream over the stream of input from the target.
 IFlashFileInfo getFileInfo(String filename)
          Get information describing an flashmanagement.FlashFile on the target.
 void sendAdminCommand(String command)
          Send the command to the target
 void sendAdminCommand(String command, byte[] params)
          Send the command to the target with any params as a byte array
 

Method Detail

sendAdminCommand

void sendAdminCommand(String command)
                      throws SpotClientUnknownCommandException,
                             IOException
Send the command to the target

Parameters:
command -
Throws:
SpotClientUnknownCommandException
IOException

sendAdminCommand

void sendAdminCommand(String command,
                      byte[] params)
                      throws SpotClientUnknownCommandException,
                             IOException
Send the command to the target with any params as a byte array

Parameters:
command -
params -
Throws:
SpotClientUnknownCommandException
IOException

checkResponse

void checkResponse()
                   throws IOException,
                          SpotClientFailureException,
                          SpotClientUnknownCommandException
Wait for a response from the target, and then check whether an error occurred.

Throws:
SpotClientUnknownCommandException - if the remote SPOT doesn't recognise the command
SpotClientFailureException - if either the remote SPOT didn't verify the command or the remote SPOT reported some other error (specified in the exception message)
IOException

getFileInfo

IFlashFileInfo getFileInfo(String filename)
                           throws IOException
Get information describing an flashmanagement.FlashFile on the target.

Parameters:
filename - The name of the flashmanagement.FlashFile
Returns:
the read-only file information
Throws:
IOException

flashFile

void flashFile(Flashable flashable,
               String flashCommand,
               byte[] params)
               throws IOException
Send data with flow control, so that data is not sent faster than the target can handle it. Should be used for all large data transfers to ensure that excessive memory is not used in buffering received data. See IOTACommandHelper.receiveDataWithFlowControl(long, java.io.OutputStream) and it's callers for examples of the corresponding SPOT-side code.

Parameters:
flashable - - the data to be sent
flashCommand - - the admin ISpotClientCommand associated with this data
params - - any parameters for the flashCommand
Throws:
IOException

getDataInputStream

DataInputStream getDataInputStream()
Answer a DataInputStream over the stream of input from the target.

Returns:
the DataInputStream

SunSPOT host API V3.0


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