Project CASUAL
API for CASUAL
 All Classes Namespaces Functions Variables
Public Member Functions | List of all members
CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol Class Referenceabstract
Inheritance diagram for CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol:
CASUAL.communicationstools.adb.ADBTools CASUAL.communicationstools.adb.ADBTools CASUAL.communicationstools.fastboot.FastbootTools CASUAL.communicationstools.fastboot.FastbootTools CASUAL.communicationstools.heimdall.HeimdallTools CASUAL.communicationstools.heimdall.HeimdallTools

Public Member Functions

abstract int numberOfDevicesConnected ()
 
abstract boolean checkErrorMessage (String[] commandRun, String returnValue)
 
abstract boolean installDriver ()
 
abstract String deployBinary (String tempFolder)
 
abstract void restartConnection ()
 
abstract void reset ()
 
abstract void shutdown ()
 
abstract String getBinaryLocation ()
 
boolean isConnected ()
 
void waitForDevice ()
 
String run (String[] parameters, int timeout, boolean silent)
 
boolean fileIsDeployedProperly (String binaryLocation)
 
abstract String getConnectionMethodName ()
 
String toString ()
 
abstract int numberOfDevicesConnected ()
 
abstract boolean checkErrorMessage (String[] commandRun, String returnValue)
 
abstract boolean installDriver ()
 
abstract String deployBinary (String tempFolder)
 
abstract void restartConnection ()
 
abstract void reset ()
 
abstract void shutdown ()
 
abstract String getBinaryLocation ()
 
boolean isConnected ()
 
void waitForDevice ()
 
String run (String[] parameters, int timeout, boolean silent)
 
boolean fileIsDeployedProperly (String binaryLocation)
 
abstract String getConnectionMethodName ()
 
String toString ()
 

Detailed Description

Abstract DeviceCommunicationsProtocol provides a set of methods which allow universal access to various device firmware loading binaries. This class was written with ADB, Fastboot, and Heimdall in mind but is broad enough to encompass many others as well.

Author
adamoutler

Member Function Documentation

abstract boolean CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.checkErrorMessage ( String[]  commandRun,
String  returnValue 
)
abstract

Examines the return values of other commands and determines if action should be taken, then takes it. This method should be called frequently so as to ensure that errors are caught and corrected quickly. The catches may be as simple as notifying the operator to plug in the device or automatically installing drivers should the return value detect that it is required.

Parameters
commandRunCommand which was run including parameters.
returnValuestring to check for errors
Returns
true if no error
abstract boolean CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.checkErrorMessage ( String[]  commandRun,
String  returnValue 
)
abstract

Examines the return values of other commands and determines if action should be taken, then takes it. This method should be called frequently so as to ensure that errors are caught and corrected quickly. The catches may be as simple as notifying the operator to plug in the device or automatically installing drivers should the return value detect that it is required.

Parameters
commandRunCommand which was run including parameters.
returnValuestring to check for errors
Returns
true if no error
abstract String CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.deployBinary ( String  tempFolder)
abstract

Called by the getBinaryLocation method to deploy the binary used by the application. This method is called when there is no known location for the binary. It is in charge of determining which platform's binary to deploy and deploying associated resources.

Parameters
tempFolderLocation to deploy binary.
Returns
location to binary.
abstract String CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.deployBinary ( String  tempFolder)
abstract

Called by the getBinaryLocation method to deploy the binary used by the application. This method is called when there is no known location for the binary. It is in charge of determining which platform's binary to deploy and deploying associated resources.

Parameters
tempFolderLocation to deploy binary.
Returns
location to binary.
boolean CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.fileIsDeployedProperly ( String  binaryLocation)

Verfies file was deployed.

Parameters
binaryLocationlocation to file
Returns
true if file is present.
boolean CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.fileIsDeployedProperly ( String  binaryLocation)

Verfies file was deployed.

Parameters
binaryLocationlocation to file
Returns
true if file is present.
abstract String CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.getBinaryLocation ( )
abstract

Deploys the binary and returns its location. This method should check the binaryLocation, and if the called location is null, it should deploy the binary using the deployBinary(TempFolder) method. This is the primary method used by this class.

Returns
location to binary being called.
abstract String CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.getBinaryLocation ( )
abstract

Deploys the binary and returns its location. This method should check the binaryLocation, and if the called location is null, it should deploy the binary using the deployBinary(TempFolder) method. This is the primary method used by this class.

Returns
location to binary being called.
abstract String CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.getConnectionMethodName ( )
abstract

returns a mode of operation. This allows the toString method to display more information about the current operation. eg. ADB, Heimdall, Fastboot.

Returns
Name of connection method, eg. ADB, Heimdall or Fastboot
abstract String CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.getConnectionMethodName ( )
abstract

returns a mode of operation. This allows the toString method to display more information about the current operation. eg. ADB, Heimdall, Fastboot.

Returns
Name of connection method, eg. ADB, Heimdall or Fastboot
abstract boolean CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.installDriver ( )
abstract

This method is used by checkErrorMessage to install drivers when required. There should never be a reason to call this independently.

Returns
true if drivers were installed. false indicates a problem.
abstract boolean CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.installDriver ( )
abstract

This method is used by checkErrorMessage to install drivers when required. There should never be a reason to call this independently.

Returns
true if drivers were installed. false indicates a problem.
boolean CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.isConnected ( )

returns true if 1 device is connected. Will return false if more than one or less than one is connected. This method should use the numberOfDevicesConnected() method to get the number of devices connected and determine if it is a single device.

Returns
true if connected.
boolean CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.isConnected ( )

returns true if 1 device is connected. Will return false if more than one or less than one is connected. This method should use the numberOfDevicesConnected() method to get the number of devices connected and determine if it is a single device.

Returns
true if connected.
abstract int CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.numberOfDevicesConnected ( )
abstract

returns and integer representing the number of devices connected. This may or may not be possible depending upon the tool used. This method will use the getBinaryLocation method.

Returns
results from the wait command.
abstract int CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.numberOfDevicesConnected ( )
abstract

returns and integer representing the number of devices connected. This may or may not be possible depending upon the tool used. This method will use the getBinaryLocation method.

Returns
results from the wait command.
abstract void CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.reset ( )
abstract

reset is used to clear the binary location from outside the package and stop the service if required. This is useful for when the temp folder is changed or when the system is shutting down. This should also trigger the getBinaryLocation() to create a new binary upon the next call. This is a method to destroy the private static location of the binary in memory. This will reset the binaryLocation and call the shudown() method;

abstract void CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.reset ( )
abstract

reset is used to clear the binary location from outside the package and stop the service if required. This is useful for when the temp folder is changed or when the system is shutting down. This should also trigger the getBinaryLocation() to create a new binary upon the next call. This is a method to destroy the private static location of the binary in memory. This will reset the binaryLocation and call the shudown() method;

abstract void CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.restartConnection ( )
abstract

Restarts the connection to the device. This may be a simple call or a complex one. This call is intended to fix problems detected by checkErrorMessage. Depending on the situation, it may be beneficial to keep a counter and try various troubleshooting steps for various operating systems here.

abstract void CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.restartConnection ( )
abstract

Restarts the connection to the device. This may be a simple call or a complex one. This call is intended to fix problems detected by checkErrorMessage. Depending on the situation, it may be beneficial to keep a counter and try various troubleshooting steps for various operating systems here.

String CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.run ( String[]  parameters,
int  timeout,
boolean  silent 
)

provides a safe method to run the binary with parameters. this method should execute a Shell.timeOutShell command and allow for a method of calling the binary with a timeout so as to never allow the method to hang.

Parameters
parametersparameters used to operate the binary. Eg.. adb DETECT, or heimdall FLASH. The binary is to be specified in the run() and only the parameters are supplied.
timeouttime in ms before timeout will occur and the command will return;
silenttrue will cause this method to keep information out of the logs so as not to clutter with every-second-pings of a device or the such.
Returns
value from command. if result begins with "Timeout!!! " the command has exceeded the set timeout value.
String CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.run ( String[]  parameters,
int  timeout,
boolean  silent 
)

provides a safe method to run the binary with parameters. this method should execute a Shell.timeOutShell command and allow for a method of calling the binary with a timeout so as to never allow the method to hang.

Parameters
parametersparameters used to operate the binary. Eg.. adb DETECT, or heimdall FLASH. The binary is to be specified in the run() and only the parameters are supplied.
timeouttime in ms before timeout will occur and the command will return;
silenttrue will cause this method to keep information out of the logs so as not to clutter with every-second-pings of a device or the such.
Returns
value from command. if result begins with "Timeout!!! " the command has exceeded the set timeout value.
abstract void CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.shutdown ( )
abstract

Commands used to shutdown the application as a part of reset. This may be called at any time so it should account for various operating conditions.

abstract void CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.shutdown ( )
abstract

Commands used to shutdown the application as a part of reset. This may be called at any time so it should account for various operating conditions.

void CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.waitForDevice ( )

Waits for isConnected() to return true. If the device is not connected, this method will continue blocking. The purpose of this method is to halt progress until a device is connected and usable. waitForDevice() may use any tools it can to determine the ready status of the device.

void CASUAL.communicationstools.AbstractDeviceCommunicationsProtocol.waitForDevice ( )

Waits for isConnected() to return true. If the device is not connected, this method will continue blocking. The purpose of this method is to halt progress until a device is connected and usable. waitForDevice() may use any tools it can to determine the ready status of the device.


The documentation for this class was generated from the following file: