SunSPOT host API V5.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.
 byte[] getData()
          Get data from the input stream.
 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
 void sendFile(Flashable flashable)
          Send file data.
 

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 or null if file not found on the target
Throws:
IOException

sendFile

void sendFile(Flashable flashable)
              throws IOException
Send file data. See IOTACommandHelper.receiveFile(long, java.io.OutputStream) and it's callers for examples of the corresponding SPOT-side code. Progress indications will be generated.

Parameters:
flashable - - the data to be sent
Throws:
IOException

getDataInputStream

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

Returns:
the DataInputStream

getData

byte[] getData()
               throws IOException
Get data from the input stream. It is expected that the data starts with a big-end int that indicates the number of bytes to follow

Returns:
the data
Throws:
IOException

SunSPOT host API V5.0


Copyright © 2006-2008 Sun Microsystems, Inc. All Rights Reserved.