org.lsst.ccs.subsystems.fcs.drivers
Class CanOpenDIO

java.lang.Object
  extended by java.util.Observable
      extended by org.lsst.ccs.framework.Module
          extended by org.lsst.ccs.subsystems.fcs.CompactIOModule
              extended by org.lsst.ccs.subsystems.fcs.drivers.CanOpenDIO
All Implemented Interfaces:
Serializable, Observer, org.lsst.ccs.framework.Configurable, PieceOfHardware, Sensor

public class CanOpenDIO
extends CompactIOModule
implements PieceOfHardware

This is the driver class for the Digital-Input-Output we use in the FCS: CAN-CBX-DIO8. A CAN-CBX-DIO8 has 8 inputs or outputs. At the initialization, it has to be configured to say which are the inputs and which are the ouputs. The outputs for the standby or standback motors of the autochanger are on this device. The sensors to know if a latch on the autochanger is closed or open are also connected to a CAN-CBX-DIO8.

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
 
Nested classes/interfaces inherited from interface org.lsst.ccs.framework.Configurable
org.lsst.ccs.framework.Configurable.Environment
 
Field Summary
 
Fields inherited from class org.lsst.ccs.subsystems.fcs.CompactIOModule
hexaValue
 
Fields inherited from class org.lsst.ccs.framework.Module
environment, log, name, nObserverThreads, registry, tickMillis
 
Constructor Summary
CanOpenDIO()
           
CanOpenDIO(String nodeID, String serial)
           
 
Method Summary
 boolean checkMask()
          This methods checks if the mask of the device is the good one.
 String getNodeID()
           
 String getSerialNB()
           
 void initialize()
           
 void initModule()
           
 boolean isConfigOK()
           
 String readNewHexaValue()
          returns the value in hexa of all the sensors connected on the inputs channels of the device.
 int readNewValue()
          This method reads the current value in decimal measured by the hardware or compute a random value for the simulated sensor, and returns this current value.
 void setNodeID(String nodeID)
           
 void setSerialNB(String serialNB)
           
 String writeDigitalOutput(int outputNB, int value)
          Write a value to the output of the DAC
 String writeMask()
          This methods initialize the CAN-CBX-DIO8 with the mask (value 3) to configure the 2 first channels of the device to be output channel.
 
Methods inherited from class org.lsst.ccs.subsystems.fcs.CompactIOModule
BinaryToHex, getHexaValue, getValue, HexToBinary, updateValue
 
Methods inherited from class org.lsst.ccs.framework.Module
change, checkHardware, dropConfigurationContext, getCheckedValueFromConfiguration, getChildren, getContext, getModule, getName, getNObserverThreads, getObservables, getSubsystem, getTickMillis, init, listens, newConfigurationContext, notifyChange, notifyChangeWithoutPreliminaryChecks, processUpdate, publishData, publishData, publishData, publishData, register, register, sendToReply, sendToStatus, setBeanName, setContext, setEnvironment, setName, setNObserverThreads, setObservables, setStateModularSubsystem, setStateModularSubsystem, setTickMillis, shutdownCommand, shutdownNow, start, startTicking, tick, 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
 
Methods inherited from interface org.lsst.ccs.subsystems.fcs.common.PieceOfHardware
getName
 

Constructor Detail

CanOpenDIO

public CanOpenDIO()

CanOpenDIO

public CanOpenDIO(String nodeID,
                  String serial)
Method Detail

initModule

public void initModule()
Overrides:
initModule in class CompactIOModule

getSerialNB

public String getSerialNB()
Specified by:
getSerialNB in interface PieceOfHardware

getNodeID

public String getNodeID()
Specified by:
getNodeID in interface PieceOfHardware

setSerialNB

public void setSerialNB(String serialNB)
Parameters:
serialNB - the serialNB to set

setNodeID

public void setNodeID(String nodeID)
Parameters:
nodeID - the nodeID to set

isConfigOK

public boolean isConfigOK()
Specified by:
isConfigOK in interface PieceOfHardware
Returns:
true If this piece of hardware is booted and its configuration on the hardware is the same than the one in the Configuration DB.

writeDigitalOutput

public String writeDigitalOutput(int outputNB,
                                 int value)
                          throws SDORequestError,
                                 HardwareNotDetectedException
Write a value to the output of the DAC

Parameters:
outputNB - in 1..8
value - given in decimal format TODO chnage this : it's not so simple !
Throws:
SDORequestError
HardwareNotDetectedException

readNewHexaValue

public String readNewHexaValue()
returns the value in hexa of all the sensors connected on the inputs channels of the device. cf CAN-CBX-DIO8 examples : if returns "80" means that the input 8 is set to 1, the others to 0 if returns "A0" means that the inputs 7 and 5 are set to 1, the others to 0 if returns "FF" all the inputs are set to 1 if returns "00" all the inputs are set to 0

Specified by:
readNewHexaValue in class CompactIOModule
Returns:
a String which is the value in hexa sent by the device.

writeMask

public String writeMask()
                 throws SDORequestError
This methods initialize the CAN-CBX-DIO8 with the mask (value 3) to configure the 2 first channels of the device to be output channel. (3 = 00000011)

Returns:
mask Value as a String (hexa)
Throws:
SDORequestError

checkMask

public boolean checkMask()
                  throws SDORequestError
This methods checks if the mask of the device is the good one. The good one is when the first 2 channels are output channels, that means that the value of the mask is 3 (3= 00000011)

Returns:
true if the mask is OK, false otherwise
Throws:
SDORequestError

initialize

public void initialize()
Specified by:
initialize in interface PieceOfHardware

readNewValue

public int readNewValue()
Description copied from interface: Sensor
This method reads the current value in decimal measured by the hardware or compute a random value for the simulated sensor, and returns this current value.

Specified by:
readNewValue in interface Sensor
Returns:
the current value provided by the real or simulated sensor.


Copyright © 2013 LSST. All Rights Reserved.