org.lsst.ccs.subsystems.fcs.testbench
Class TestBenchMainModule

java.lang.Object
  extended by java.util.Observable
      extended by org.lsst.ccs.framework.Module
          extended by org.lsst.ccs.subsystems.fcs.testbench.TestBenchMainModule
All Implemented Interfaces:
Serializable, Observer

public class TestBenchMainModule
extends org.lsst.ccs.framework.Module

This is the very first version of the main module for the control software of the APC test bench. When the TestBenchMainModule starts, it starts a a TCP-IP server. the can open wrapper software will connect. Then the TestBenchProxy and the Wrapper will communicate over this TCP connection with a protocol to be define. In a first version : 1- The TCP server is started and waits for a client connection, 2- When the client connects, it sends first a key word "APCTestBench". 3- When the server receives the key word "APCTestBench", it's ready to boot the hardware and receive commands.

Author:
virieux
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.lsst.ccs.framework.Module
org.lsst.ccs.framework.Module.ValueUpdate
 
Field Summary
 
Fields inherited from class org.lsst.ccs.framework.Module
configMethods, log, name, nObserverThreads, registry, tickMillis
 
Constructor Summary
TestBenchMainModule()
           
 
Method Summary
 String getMyClientName()
           
 int getReturnValue(String responseLine, int inputNB)
          Returns the value read on the socket for the input of the ADC given as an argument.
 ApcTcpProxy getTcpProxy()
           
 void initModule()
           
 String listNodes()
          List the can open nodes which are booted.
 String readADC()
          Read the values of the 8 channels of the ADC.
 String readFromSocket(String clientName)
           
 double readTemperature()
          Read the temperature : in the test bench, a thermometer is plugged on the input number 1 of the ADC.
 Object sendCanOpen(String command)
          For engineering mode, this method can be used to send Can Open commands to the Wrapper.
 void setMyClientName(String myClientName)
           
 void setTcpProxy(ApcTcpProxy myTcpProxy)
           
 void stop()
           
 void stopAutomaticMode()
           
 void tick()
           
 void turnOffLED()
           
 void turnOnLED()
           
 
Methods inherited from class org.lsst.ccs.framework.Module
change, checkHardware, dropConfigurationContext, getCheckedValueFromConfiguration, getContext, getModule, getName, getNObserverThreads, getObservables, getSubsystem, getTickMillis, init, listens, newConfigurationContext, notifyChange, notifyChangeWithoutPreliminaryChecks, processUpdate, publishData, publishData, publishData, publishData, register, register, sendToReply, sendToStatus, setBeanName, setContext, setName, setNObserverThreads, setObservables, setStateModularSubsystem, setStateModularSubsystem, setTickMillis, shutdownCommand, shutdownNow, start, startTicking, update
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestBenchMainModule

public TestBenchMainModule()
Method Detail

getTcpProxy

public ApcTcpProxy getTcpProxy()
Returns:
the myTcpProxy

setTcpProxy

public void setTcpProxy(ApcTcpProxy myTcpProxy)
Parameters:
myTcpProxy - the myTcpProxy to set

getMyClientName

public String getMyClientName()
Returns:
the myClientName

setMyClientName

public void setMyClientName(String myClientName)
Parameters:
myClientName - the myClientName to set

initModule

public void initModule()
Overrides:
initModule in class org.lsst.ccs.framework.Module

tick

public void tick()
Overrides:
tick in class org.lsst.ccs.framework.Module

getReturnValue

public int getReturnValue(String responseLine,
                          int inputNB)
                   throws ReadingADCError
Returns the value read on the socket for the input of the ADC given as an argument.

Parameters:
responseLine - A string read on the socket.
inputNB - The numero if the input on the ADC. (1<=inputNB<=8)
Returns:
the value (int) given
Throws:
ReadingADCError

readTemperature

public double readTemperature()
                       throws ReadingADCError
Read the temperature : in the test bench, a thermometer is plugged on the input number 1 of the ADC.

Returns:
Throws:
ReadingADCError

readADC

public String readADC()
               throws ReadingADCError
Read the values of the 8 channels of the ADC. It just send the command "adc" to the Can Open Wrapper and the Can OPen Wrapper sends a SYNC to the ADC node.

Returns:
Throws:
ReadingADCError

readFromSocket

public String readFromSocket(String clientName)
                      throws ProxyTimeoutException
Throws:
ProxyTimeoutException

turnOnLED

public void turnOnLED()

turnOffLED

public void turnOffLED()

stopAutomaticMode

public void stopAutomaticMode()

stop

public void stop()

listNodes

public String listNodes()
List the can open nodes which are booted. It means that we have received a "boot,nodeID" and a "info,nodeID" messages for these nodes.

Returns:
the list of can open nodes and the information stored in this.nodes.

sendCanOpen

public Object sendCanOpen(String command)
For engineering mode, this method can be used to send Can Open commands to the Wrapper. Not very useful as we can send the same command from the console with: invoke apctestbench/tcpProxy call APCTestBench command

Parameters:
command - A Can Open command that the Wrapper should understand.
Returns:
the response from the Wrapper


Copyright © 2012 LSST. All Rights Reserved.