com.efiAnalytics.plugin.ecu
Class ControllerAccess

java.lang.Object
  extended by com.efiAnalytics.plugin.ecu.ControllerAccess

public class ControllerAccess
extends java.lang.Object

This is a Singleton that acts as a gateway to the Controller for the plugin. It is will be initialized by the host application TunerStudio with valid implementations of ControllerParameterServer and OutputChannelServer.

Author:
Phil Tobin

Method Summary
 double evaluateExpression(java.lang.String configurationName, java.lang.String expression)
          evaluates any mathematical expression made up of numbers, OutputChannel names and Constant/ControllerParameter names.
 ControllerParameterServer getControllerParameterServer()
          Provides access to ControllerParameterServer
 java.lang.String[] getEcuConfigurationNames()
          Provides visibility to the currently loaded Configuration Names.
static ControllerAccess getInstance()
          This will provide add hock access to the ControllerAccess.
 OutputChannelServer getOutputChannelServer()
          Provides access to the OuputChannelServer.
 UiSettingServer getUiComponentServer(java.lang.String configurationName)
           
static void initialize(OutputChannelServer outputServer, ControllerParameterServer parameterServer)
          Initializes this ControllerAccess with valid implementations of ControllerParameterServer and OutputChannelServer.
 void sendBurnCommand(java.lang.String configurationName)
          sends a Burn Command to the named ECU Configuration instructing it to persist setting data from RAM to FLASH
 void setBurnExecutor(BurnExecutor burnExecutor)
           
 void setConfigurationNameProvider(EcuConfigurationNameServer configurationNameProvider)
           
 void setMathExpressionEvaluator(MathExpressionEvaluator mathExpressionEvaluator)
           
 void setUiComponentServerProvider(UiSettingServerProvider uiComponentServer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

initialize

public static void initialize(OutputChannelServer outputServer,
                              ControllerParameterServer parameterServer)
Initializes this ControllerAccess with valid implementations of ControllerParameterServer and OutputChannelServer. This should only be called by the host application, not the plugin Plug ins will access this via getInstance() or as it is passed into ApplicationPlugin initialize.

Parameters:
outputServer - A instance of a OutputChannelServer
parameterServer - An instance of ControllerParameterServer

getInstance

public static ControllerAccess getInstance()
This will provide add hock access to the ControllerAccess. initialize must have been called first by the host application. This would normally happen during application start up.

Returns:
A reference to the Singleton instance of this

getOutputChannelServer

public OutputChannelServer getOutputChannelServer()
Provides access to the OuputChannelServer.

Returns:
An instance of OutputChannelServer for access to the currently loaded controller configuration.

getControllerParameterServer

public ControllerParameterServer getControllerParameterServer()
Provides access to ControllerParameterServer

Returns:
An instance of ControllerParemeterServer that was initialized by the host application

getEcuConfigurationNames

public java.lang.String[] getEcuConfigurationNames()
Provides visibility to the currently loaded Configuration Names. In a typical 1 controller configuration this will be an array length of 1 containing only the loaded project name. However if you have multiple controllers loaded as in a project with CAN devices, all configuration names will be supplied.

Returns:
the names of all loaded configurations.

setConfigurationNameProvider

public void setConfigurationNameProvider(EcuConfigurationNameServer configurationNameProvider)
Parameters:
configurationNameProvider - the configurationNameProvider to set

evaluateExpression

public double evaluateExpression(java.lang.String configurationName,
                                 java.lang.String expression)
                          throws MathException
evaluates any mathematical expression made up of numbers, OutputChannel names and Constant/ControllerParameter names. If you are familiar with the expressions that can be implemented in the ini file, these expressions would follow the same rules and format, but can be generated at runtime. Constant names will be resolved using the current known value OutputChannel names will be resolved to the last known value.

Parameters:
configurationName -
expression -
Returns:
the evaluated expression.
Throws:
MathException

sendBurnCommand

public void sendBurnCommand(java.lang.String configurationName)
                     throws ControllerException
sends a Burn Command to the named ECU Configuration instructing it to persist setting data from RAM to FLASH

Parameters:
configurationName -
Throws:
ControllerException

setMathExpressionEvaluator

public void setMathExpressionEvaluator(MathExpressionEvaluator mathExpressionEvaluator)
Parameters:
mathExpressionEvaluator - the mathExpressionEvaluator to set

getUiComponentServer

public UiSettingServer getUiComponentServer(java.lang.String configurationName)
                                     throws ControllerException
Returns:
the uiComponentServer
Throws:
ControllerException

setUiComponentServerProvider

public void setUiComponentServerProvider(UiSettingServerProvider uiComponentServer)
Parameters:
uiComponentServer - the uiComponentServer to set

setBurnExecutor

public void setBurnExecutor(BurnExecutor burnExecutor)
Parameters:
burnExecutor - the burnExecutor to set