com.symbian.et.jstat
Class JStat

java.lang.Object
  extended bycom.symbian.et.jstat.JStat

public class JStat
extends java.lang.Object

Author:
EngineeringTools

Field Summary
static int CREATE_FOLDER
          Creates a folder on the Symbian device.
static int DELETE
          Deletes a file from the Symbian device.
static int GET_SCREEN_CAPTURE
          Gets a screen capture from the Symbian device.
private static java.lang.String iDeviceLogFile
          Location of the Java Log File.
static int INSTALL_FILE
          Installs a SIS file on the Symbian device.
private static java.io.PrintStream iPrintStream
          The output stream for JStat.
private static java.lang.String iTransport
          The transport used by JStat.
static int KILL
          Kills a process on the Symbian device.
static int LIST_DRIVES
          Lists the drivers on the Symbian device.
static int LIST_FILES
          Lists the files at a specific directory on the Symbian device.
static int POLL
          Polls a process on the Symbian device.
static int REMOVE_FOLDER
          Removes a folder on the Symbian device.
static int RETRIEVE_FILE
          Retrieves a file from the Symbian device to the host machine.
static int RUN
          Runs a program/application on the Symbian device.
static int SEND_FILE
          Sends a file from the host machine to the Symbian device.
private static boolean sIsBusy
          JStat busy flag.
static int START_LOGGING
          Starts logging on the Symbian device.
private static java.lang.String STAT_WORK
           
static int STOP_LOGGING
          Stops logging on the Symbian device.
static int UNINSTALL_FILE
          Uninstalls a SIS file on the
 
Constructor Summary
JStat()
           
 
Method Summary
static JStatResult checkLocation(java.lang.String aLocation)
          Checks a location for the existance of a file.
private static int connect(java.lang.String parameter)
          C Native method to connect to a Symbian device.
static JStatResult createFolder(java.lang.String aLocation)
          Creates a directory on the Symbian device.
static JStatResult delete(java.lang.String aLocation)
          Deletes a file from the Symbian device.
private static int disconnect(int handle)
          C Native method to disconnect from a Symbian device.
private static int doCommand(int handle, java.lang.String command)
          C Native method to do a command on the Symbian device.
private static JStatResult doCommand(java.lang.String aCommand)
          Runs a command on the device.
static java.lang.String getDeviceLogFile()
          Returns the device log file
private static java.lang.String getError(int handle)
          C Native method to get the error code from JStat
static JStatResult getInfo()
          Gets the Symbian device information
private static java.lang.String getReceivedData(int handle)
          C Native method to get the returned data from the Symbian device.
static JStatResult getScreenCapture()
          Gets a screen capture of the Symbian device.
private static java.lang.String getStatVersion()
          C Native method to get the current version of STAT.
static java.lang.String getVersion()
          Returns the current version of Stat.
static JStatResult installFile(java.lang.String aFile)
          Install a SIS file on the Symbian device.
static boolean isLogging()
          Checks wheather the Symbian devices is logging.
static JStatResult kill(int aPid)
          Kills a process on the Symbian device.
static JStatResult kill(java.lang.String aPid)
          Kills a process on the Symbian device.
static JStatResult listDrives()
          Lists all availbe drives on the Symbian device.
static JStatResult listFiles(java.lang.String aLocation)
          Lists all files in a directory on the Symbian devices.
static JStatResult poll(int aPid)
          Polls a process on the Symbian device.
static JStatResult poll(java.lang.String aPid)
          Polls a process on the Symbian device.
static JStatResult removeFolder(java.lang.String aLocation)
          Removes a folder from the Symbian device.
static JStatResult rename(java.lang.String aArg0, java.lang.String aArg1)
          Renames a file on the Symbian device.
static void restartBoard()
          Does a software restart of the board.
static JStatResult retrieveFile(java.lang.String aOriginPathFile)
          Retrieves a file from the device side to the Stat Work directory.
static JStatResult retrieveFile(java.lang.String aOriginPathFile, java.io.File aDestPathFile)
          Retrieves a file from the device side to the PC.
static JStatResult retrieveFile(java.lang.String aOriginPathFile, java.lang.String aDestFolder)
          Retrieves a file from the device side to the PC.
static JStatResult run(java.lang.String aExecutable)
          Runs a Symbian executable on the Symbain device.
static JStatResult run(java.lang.String aExecutable, java.lang.String aArgs)
          Runs a Symbian executable on the Symbian device.
static JStatResult runSwitch(int aStatCommand)
          Switch to run a command with no paramters.
static JStatResult runSwitch(int aStatCommand, java.lang.String aFirstParam)
           
static JStatResult runSwitch(int aStatCommand, java.lang.String aFirstParam, java.lang.String aSecondParam)
           
static JStatResult sendFile(java.lang.String aOriginFile, java.lang.String aDestPathFile)
          Copies a file from the PC to the Symbian device.
static void setPrintStream(java.io.PrintStream aPrintStream)
          Sets the output stream for JStat.
static void setSerial(java.lang.String aPort)
          Sets the port for JStat.
static void setTCP(java.lang.String aIp)
          Sets the IP address for JStat.
static void setTransport(java.lang.String aTransport)
          Sets the transport for JStat.
static void setUSB(java.lang.String aPort)
          Sets the USB port for Jstat.
static JStatResult startLogging(java.lang.String aAbsoluteLogFile)
          Starts the logger on the Symbian device.
static JStatResult stopLogging()
          Stops the logger on the Symbian device.
static JStatResult uninstallFile(java.lang.String aUid)
          Uninstall a SIS file on the Symbian device.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RETRIEVE_FILE

public static final int RETRIEVE_FILE
Retrieves a file from the Symbian device to the host machine.

See Also:
Constant Field Values

SEND_FILE

public static final int SEND_FILE
Sends a file from the host machine to the Symbian device.

See Also:
Constant Field Values

GET_SCREEN_CAPTURE

public static final int GET_SCREEN_CAPTURE
Gets a screen capture from the Symbian device.

See Also:
Constant Field Values

INSTALL_FILE

public static final int INSTALL_FILE
Installs a SIS file on the Symbian device.

See Also:
Constant Field Values

UNINSTALL_FILE

public static final int UNINSTALL_FILE
Uninstalls a SIS file on the

See Also:
Constant Field Values

LIST_DRIVES

public static final int LIST_DRIVES
Lists the drivers on the Symbian device.

See Also:
Constant Field Values

LIST_FILES

public static final int LIST_FILES
Lists the files at a specific directory on the Symbian device.

See Also:
Constant Field Values

DELETE

public static final int DELETE
Deletes a file from the Symbian device.

See Also:
Constant Field Values

CREATE_FOLDER

public static final int CREATE_FOLDER
Creates a folder on the Symbian device.

See Also:
Constant Field Values

REMOVE_FOLDER

public static final int REMOVE_FOLDER
Removes a folder on the Symbian device.

See Also:
Constant Field Values

RUN

public static final int RUN
Runs a program/application on the Symbian device.

See Also:
Constant Field Values

KILL

public static final int KILL
Kills a process on the Symbian device.

See Also:
Constant Field Values

POLL

public static final int POLL
Polls a process on the Symbian device.

See Also:
Constant Field Values

START_LOGGING

public static final int START_LOGGING
Starts logging on the Symbian device.

See Also:
Constant Field Values

STOP_LOGGING

public static final int STOP_LOGGING
Stops logging on the Symbian device.

See Also:
Constant Field Values

iPrintStream

private static java.io.PrintStream iPrintStream
The output stream for JStat.


sIsBusy

private static boolean sIsBusy
JStat busy flag.


iTransport

private static java.lang.String iTransport
The transport used by JStat.


iDeviceLogFile

private static java.lang.String iDeviceLogFile
Location of the Java Log File.


STAT_WORK

private static final java.lang.String STAT_WORK
Constructor Detail

JStat

public JStat()
Method Detail

connect

private static int connect(java.lang.String parameter)
C Native method to connect to a Symbian device.

Parameters:
parameter - The connection parameters
Returns:
The result code.

disconnect

private static int disconnect(int handle)
C Native method to disconnect from a Symbian device.

Parameters:
handle - The handle to the connection.
Returns:
The result code.

doCommand

private static int doCommand(int handle,
                             java.lang.String command)
C Native method to do a command on the Symbian device.

Parameters:
handle -
command -
Returns:
The result code.

getError

private static java.lang.String getError(int handle)
C Native method to get the error code from JStat

Parameters:
handle - The handle to the connection.
Returns:
The result code.

getReceivedData

private static java.lang.String getReceivedData(int handle)
C Native method to get the returned data from the Symbian device.

Parameters:
handle - The handle to the connection.
Returns:
The result code.

getStatVersion

private static java.lang.String getStatVersion()
C Native method to get the current version of STAT.

Returns:
The result code.

runSwitch

public static JStatResult runSwitch(int aStatCommand)
                             throws JStatException
Switch to run a command with no paramters.

Parameters:
aStatCommand - The stat command. Use the JStat constants to choice which command to run.
Returns:
The result of the JStat command.
Throws:
JStatException - If the command run is incorrect or does not have the correct number of parameters.

runSwitch

public static JStatResult runSwitch(int aStatCommand,
                                    java.lang.String aFirstParam)
                             throws JStatException
Parameters:
aStatCommand - The stat command. Use the JStat constants to choice which command to run.
aFirstParam - The parameter for this command.
Returns:
The result of the JStat command.
Throws:
JStatException - If the command run is incorrect or does not have the correct number of parameters.

runSwitch

public static JStatResult runSwitch(int aStatCommand,
                                    java.lang.String aFirstParam,
                                    java.lang.String aSecondParam)
                             throws JStatException
Parameters:
aStatCommand - The stat command. Use the JStat constants to choice which command to run.
aFirstParam - The first parameter for this command.
aSecondParam - The second parameter for this command.
Returns:
The result of the JStat command.
Throws:
JStatException - If the command run is incorrect or does not have the correct number of parameters.

setPrintStream

public static void setPrintStream(java.io.PrintStream aPrintStream)
Sets the output stream for JStat.

Parameters:
aPrintStream - The ouput stream of JStat.

setTransport

public static void setTransport(java.lang.String aTransport)
Sets the transport for JStat. This can be any of the following:

Parameters:
aTransport - The transport of JStat.

setTCP

public static void setTCP(java.lang.String aIp)
Sets the IP address for JStat. This must be a valid ip address. This is similar to the using setTransport(String) with "tcp:\".

Parameters:
aIp - The IP address for JStat.

setSerial

public static void setSerial(java.lang.String aPort)
Sets the port for JStat. This must be a valid port address. This is similar to the using setTransport(String) with "serial\".

Parameters:
aPort - The port to set for JStat.

setUSB

public static void setUSB(java.lang.String aPort)
Sets the USB port for Jstat. This must be a valid port address. This is similar to the using setTransport(String) with "usb\".

Parameters:
aPort - The USB port to use. Currently only 1 is valid.

sendFile

public static JStatResult sendFile(java.lang.String aOriginFile,
                                   java.lang.String aDestPathFile)
                            throws JStatException
Copies a file from the PC to the Symbian device.

Parameters:
aOriginFile - The location of the PC side file to copy from.
aDestPathFile - The location of the Device side file to copy to.
Returns:
The result of the JStat send file command.
Throws:
JStatException - If JStat is busy.

retrieveFile

public static JStatResult retrieveFile(java.lang.String aOriginPathFile)
                                throws JStatException
Retrieves a file from the device side to the Stat Work directory.

Parameters:
aOriginPathFile - The location of the Device side file to retrieve.
Returns:
The result of the JStat retrieve file command.
Throws:
JStatException - If JStat is busy.

retrieveFile

public static JStatResult retrieveFile(java.lang.String aOriginPathFile,
                                       java.lang.String aDestFolder)
                                throws JStatException
Retrieves a file from the device side to the PC.

Parameters:
aOriginPathFile - The location of the Device side file to retrieve.
aDestFolder - The folder of where to place the recieved file.
Returns:
The result of the JStat retrieve file command.
Throws:
JStatException - If the stat command fails.

retrieveFile

public static JStatResult retrieveFile(java.lang.String aOriginPathFile,
                                       java.io.File aDestPathFile)
                                throws JStatException
Retrieves a file from the device side to the PC.

Parameters:
aOriginPathFile - The location of the Device side file to retrieve.
aDestPathFile - The location of where to place the recieved file.
Returns:
The result of the JStat retrieve file command.
Throws:
JStatException - If JStat is busy.

getScreenCapture

public static JStatResult getScreenCapture()
                                    throws JStatException
Gets a screen capture of the Symbian device.

Returns:
The result of the JStat get screen capture command.
Throws:
JStatException - If JStat is busy.

installFile

public static JStatResult installFile(java.lang.String aFile)
                               throws JStatException
Install a SIS file on the Symbian device.

Parameters:
aFile - The SIS file to install.
Returns:
The result of the JStat install command.
Throws:
JStatException - If JStat is busy.

uninstallFile

public static JStatResult uninstallFile(java.lang.String aUid)
                                 throws JStatException
Uninstall a SIS file on the Symbian device.

Parameters:
aUid - The UID of the SIS file to uninstall.
Returns:
The result of the JStat uninstall command.
Throws:
JStatException - If JStat is busy.

listDrives

public static JStatResult listDrives()
                              throws JStatException
Lists all availbe drives on the Symbian device.

Returns:
The result of the JStat list drivers command. The format of the results is as follows:
Throws:
JStatException - If JStat is busy.

listFiles

public static JStatResult listFiles(java.lang.String aLocation)
                             throws JStatException
Lists all files in a directory on the Symbian devices.

Parameters:
aLocation - The folder to list the contents.
Returns:
The result of the JStat list files command. The format of the results is as follows:
Throws:
JStatException - If JStat is busy.

delete

public static JStatResult delete(java.lang.String aLocation)
                          throws JStatException
Deletes a file from the Symbian device.

Parameters:
aLocation - The file to delete.
Returns:
The result of the JStat command.
Throws:
JStatException - If JStat is busy.

createFolder

public static JStatResult createFolder(java.lang.String aLocation)
                                throws JStatException
Creates a directory on the Symbian device.

Parameters:
aLocation - The directory to create.
Returns:
The result of the JStat create folder command.
Throws:
JStatException - If JStat is busy.

removeFolder

public static JStatResult removeFolder(java.lang.String aLocation)
                                throws JStatException
Removes a folder from the Symbian device.

Parameters:
aLocation - The folder to delete.
Returns:
The result of the JStat command.
Throws:
JStatException - If JStat is busy.

run

public static JStatResult run(java.lang.String aExecutable,
                              java.lang.String aArgs)
                       throws JStatException
Runs a Symbian executable on the Symbian device.

Parameters:
aExecutable - The executable to run.
aArgs - The arguments to that executable.
Returns:
The result of the JStat run command.
Throws:
JStatException - If JStat is busy.

run

public static JStatResult run(java.lang.String aExecutable)
                       throws JStatException
Runs a Symbian executable on the Symbain device.

Parameters:
aExecutable - The executable to run.
Returns:
The result of the JStat run command.
Throws:
JStatException - If JStat is busy.

kill

public static JStatResult kill(int aPid)
                        throws JStatException
Kills a process on the Symbian device.

Parameters:
aPid - The Process IDentfication number (PID) of the process to kill.
Returns:
The result of the JStat kill command.
Throws:
JStatException - If JStat is busy.

kill

public static JStatResult kill(java.lang.String aPid)
                        throws JStatException
Kills a process on the Symbian device.

Parameters:
aPid - The Process IDentfication number (PID) of the process to kill.
Returns:
The result of the JStat kill command.
Throws:
JStatException - If JStat is busy.

poll

public static JStatResult poll(int aPid)
                        throws JStatException
Polls a process on the Symbian device.

Parameters:
aPid - The Process IDentfication number (PID) of the process to poll.
Returns:
The result of the JStat poll command.
Throws:
JStatException - If JStat is busy.

poll

public static JStatResult poll(java.lang.String aPid)
                        throws JStatException
Polls a process on the Symbian device.

Parameters:
aPid - The Process IDentfication number (PID) of the process to poll.
Returns:
The result of the JStat poll command.
Throws:
JStatException - If JStat is busy.

startLogging

public static JStatResult startLogging(java.lang.String aAbsoluteLogFile)
                                throws JStatException
Starts the logger on the Symbian device.

Parameters:
aAbsoluteLogFile - The absolute path for the logger to place the log.
Returns:
The result of the JStat start logging command.
Throws:
JStatException - If JStat is busy.

stopLogging

public static JStatResult stopLogging()
                               throws JStatException
Stops the logger on the Symbian device.

Returns:
The result of the JStat stop command.
Throws:
JStatException - If JStat is busy.

isLogging

public static boolean isLogging()
Checks wheather the Symbian devices is logging.

Returns:
The result of the JStat is logging command. The format is as follows:

getDeviceLogFile

public static java.lang.String getDeviceLogFile()
Returns the device log file

Returns:
The string location of the device log file.

rename

public static JStatResult rename(java.lang.String aArg0,
                                 java.lang.String aArg1)
                          throws JStatException
Renames a file on the Symbian device.

Parameters:
aArg0 - The current name of the file.
aArg1 - The new name of the file.
Returns:
The result of the JStat rename command.
Throws:
JStatException - If JStat is busy.

checkLocation

public static JStatResult checkLocation(java.lang.String aLocation)
                                 throws JStatException
Checks a location for the existance of a file.

Parameters:
aLocation - The location to check
Returns:
The result of the JStat check location command.
Throws:
JStatException - If JStat is busy.

restartBoard

public static void restartBoard()
                         throws JStatException
Does a software restart of the board. Note that this command cannot do a hardware restart of the board.

Throws:
JStatException - If JStat is busy.

getVersion

public static java.lang.String getVersion()
Returns the current version of Stat.

Returns:
The version of Stat running.

getInfo

public static JStatResult getInfo()
                           throws JStatException
Gets the Symbian device information

Returns:
The result of the JStat info command. The result is as follows:
Throws:
JStatException - If JStat is busy.

doCommand

private static JStatResult doCommand(java.lang.String aCommand)
                              throws JStatException
Runs a command on the device.

Parameters:
aCommand - The command to run on the device.
Returns:
The result of the JStat command.
Throws:
JStatException - If JStat is busy.