
public class CanOpenProxy
extends org.lsst.ccs.framework.Module
implements org.lsst.ccs.framework.HardwareController
| Modifier and Type | Class and Description |
|---|---|
static class |
CanOpenProxy.PDOStorage
To store the values returned by the PDO.
|
protected static class |
FcsTcpProxy.ClientContext |
| Modifier and Type | Field and Description |
|---|---|
Map<String,CanOpenNode> |
bootedNodesMap |
protected FcsTcpProxy.ClientContext |
clientContext |
protected static Logger |
fcslog |
protected Condition |
hardwareBooted |
PieceOfHardware[] |
hardwareList |
protected Lock |
lock |
protected boolean |
stopped |
protected boolean |
stopping |
protected boolean |
tcpServerStarted |
| Constructor and Description |
|---|
CanOpenProxy(String aName,
int aTickMillis,
int portNumber,
String aClientName,
long hardwareBootTimeout) |
| Modifier and Type | Method and Description |
|---|---|
Object |
call(String clientName,
String command)
This methods send a command to the tcp client.
|
void |
checkCanOpenNodes()
Check if the list of the booted CANopen devices on the CANbus is identical to
the hardware list we have in the description.
|
org.lsst.ccs.framework.TreeWalkerDiag |
checkHardware() |
void |
checkHardwareID(PieceOfHardware pieceOfHardware)
When the hardware is booted and we have retrieve the information (serial number),
we want to check for each piece of hardware that we have the good node ID
and the good serial number: so we compare the serial number found on the
CANopen bus with the serial number in the configuration file.
|
void |
checkNewHardware()
checkNewHardware is called by command checkStarted() in higher level Modules and
is executed when a command completeInitialization is sent to the subsystem.
|
void |
checkStarted() |
void |
checkStopped() |
String |
configAsHeartbeatConsumer(int nodeID,
int producerNodeID,
int heartbeat_time)
Configure a node as a hearbeat consumer.
|
String |
configAsHeartbeatProducer(int nodeID,
int heartbeat_time)
Command to be used by the end users.
|
String |
configAsHeartbeatProducer(String nodeID,
String heartbeat_time)
Configure a node as a hearbeat producer.
|
void |
connectHardware() |
void |
disconnectHardware()
This methods stops the CWrapper client, and the TCP server.
|
String |
displayReadPDOs() |
Map<String,CanOpenNode> |
getBootedNodesMap() |
int |
getBootedNodesNB() |
CanOpenNode |
getDetectedNodeForSerialNumber(String aSerialNB)
This method returns the can open detected on the can open network
for a piece of hardware identified by its serial number.
|
int |
getExpectedNodesNB() |
long |
getHardwareBootTimeout() |
PieceOfHardware[] |
getHardwareList() |
String |
getMyClientName() |
String |
getNodeName(String aNodeID) |
ArrayList<CanOpenNode> |
getNodes() |
CanOpenProxy.PDOStorage |
getPdoStorage() |
int |
getPortNumber() |
void |
identifieHardware_old()
Deprecated.
|
void |
identifyHardware()
Identification of the hardware : we want to retrieve the information
stored in the hardware of the booted nodes and update the array of nodes
with this information.
|
void |
initModule() |
boolean |
isBooted(String aNodeID) |
boolean |
isHardwareIdentified() |
boolean |
isHardwareReady()
This method returns true if : all the hardware items are booted and identified
and the hardware have the node ID expected within the configuration
and the hardware is initialized.
|
boolean |
isReady(String clientName) |
boolean |
isTcpServerStarted() |
String |
listHardware() |
String |
listNodes()
List the can open nodes which are in the nodes table.
|
void |
publishData()
Publish Data on status bus for trending data base and GUIs.
|
void |
publishHardwareData(PieceOfHardware device)
Publish Data on status bus for trending data base and GUIs.
|
CanOpenProxy.PDOStorage |
readPDOs()
This method sends a sync command to the can open stack and returns the reply.
|
String |
readSDO(int nodeID,
String index,
String subindex)
Command to be used by the end user at the console in engineering mode.
|
String |
readSDO(String nodeID,
String index,
String subindex)
Read a SDO with the given index and subindex
RETURNS the value read in hexa (String) if no error occured
or returns the error code if a error was detected.
|
String |
sendCanOpen(String command)
For engineering mode, this method can be used to send Can Open commands
to the Wrapper.
|
void |
setExpectedNodesNB(int nodeNB) |
void |
setHardwareBootTimeout(int hardwareBootTimeout) |
void |
setHardwareBootTimeout(long hardwareBootTimeout) |
void |
shutdownNow() |
void |
start() |
void |
startServer()
Starts the server tcp on the port portNumber.
|
void |
startThreadReader()
Starts a thread which read on the tcp socket, waiting for messages coming
from tcp proxy.
|
void |
stopServer()
Stops the tcp server.
|
void |
tick() |
String |
toString() |
String |
writeSDO(int nodeID,
String index,
String subindex,
int size,
int value)
Command to be used by the end user at the console.
|
String |
writeSDO(String nodeID,
String index,
String subindex,
String size,
String value)
Write a SDO request and send it to the can open stack, then analyses the response
or throws an exception if the request failed.
|
alias, getComponentDictionariesTree, getComponentTree, getContext, getEnvironment, getMainDictionary, getModule, getName, getNObserverThreads, getObservables, getSubsystem, getTickMillis, init, listens, percolateSignal, postStart, processUpdate, publishData, publishData, publishData, publishData, publishData, publishData, publishData, sendSignal, sendSignal, sendSignalWithTimeLimit, sendToReply, sendToStatus, setBeanName, setContext, setEnvironment, setName, setNObserverThreads, setObservables, setStateModularSubsystem, setStateModularSubsystem, setTickMillis, signal, startTicking, updateaddObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChangedclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitchange, getCheckedValueFromConfiguration, getChildren, getComponentByName, getDictionary, getParent, getParentObject, injectResources, listChildren, notifyChange, notifyChangeWithoutPreliminaryChecks, proceduralWalk, publish, publish, publish, publish, publish, publish, treeWalkpublic PieceOfHardware[] hardwareList
public Map<String,CanOpenNode> bootedNodesMap
protected volatile boolean stopped
protected volatile boolean stopping
protected volatile boolean tcpServerStarted
protected FcsTcpProxy.ClientContext clientContext
protected static final Logger fcslog
protected final Lock lock
protected final Condition hardwareBooted
public int getExpectedNodesNB()
public void setExpectedNodesNB(int nodeNB)
nodeNB - public long getHardwareBootTimeout()
@ConfigChanger public void setHardwareBootTimeout(long hardwareBootTimeout)
@ConfigChanger public void setHardwareBootTimeout(int hardwareBootTimeout)
public PieceOfHardware[] getHardwareList()
public int getBootedNodesNB()
public String getMyClientName()
public ArrayList<CanOpenNode> getNodes()
public Map<String,CanOpenNode> getBootedNodesMap()
public CanOpenProxy.PDOStorage getPdoStorage()
public boolean isHardwareIdentified()
public void disconnectHardware()
public void connectHardware()
throws org.lsst.ccs.HardwareException
org.lsst.ccs.HardwareExceptionpublic void initModule()
public void tick()
tick in class org.lsst.ccs.framework.Modulepublic org.lsst.ccs.framework.TreeWalkerDiag checkHardware()
throws org.lsst.ccs.HardwareException
checkHardware in interface org.lsst.ccs.framework.HardwareControllerorg.lsst.ccs.HardwareExceptionpublic void checkNewHardware()
throws org.lsst.ccs.HardwareException
org.lsst.ccs.HardwareExceptionpublic void checkStarted()
throws org.lsst.ccs.HardwareException
checkStarted in interface org.lsst.ccs.framework.HardwareControllerorg.lsst.ccs.HardwareExceptionpublic void checkStopped()
throws org.lsst.ccs.HardwareException
checkStopped in interface org.lsst.ccs.framework.HardwareControllerorg.lsst.ccs.HardwareExceptionpublic boolean isBooted(String aNodeID)
public String listNodes()
@Command(type=ACTION, level=3, description="Send a CanOpen command to the Can Bus.") public String sendCanOpen(String command) throws CanOpenCallTimeoutException, org.lsst.ccs.bus.BadCommandException
command - A Can Open command that the Wrapper should understand.CanOpenCallTimeoutExceptionorg.lsst.ccs.bus.BadCommandExceptionpublic String writeSDO(String nodeID, String index, String subindex, String size, String value) throws SDORequestException
nodeID - FORMAT=HEXAindex - FORMAT=HEXAsubindex - FORMAT=HEXAsize - FORMAT=HEXAvalue - FORMAT=HEXASDORequestException@Command(type=ACTION, level=3, description="Send a CanOpen writeSDO command to the Can Bus.") public String writeSDO(int nodeID, String index, String subindex, int size, int value) throws SDORequestException, org.lsst.ccs.bus.BadCommandException
nodeID - FORMAT=decimalindex - FORMAT=HEXAsubindex - FORMAT=HEXAsize - FORMAT=decimalvalue - FORMAT=decimalSDORequestExceptionorg.lsst.ccs.bus.BadCommandExceptionpublic String readSDO(String nodeID, String index, String subindex) throws SDORequestException, ShortResponseToSDORequestException
nodeID - index - subindex - SDORequestExceptionShortResponseToSDORequestException@Command(type=ACTION, level=3, description="Send a CanOpen readSDO command to the Can Bus.") public String readSDO(int nodeID, String index, String subindex) throws SDORequestException, org.lsst.ccs.bus.BadCommandException, ShortResponseToSDORequestException
nodeID - FORMAT=decimalindex - FORMAT=hexasubindex - FORMAT=hexaSDORequestExceptionorg.lsst.ccs.bus.BadCommandExceptionShortResponseToSDORequestExceptionpublic CanOpenProxy.PDOStorage readPDOs() throws FcsHardwareException, org.lsst.ccs.bus.BadCommandException
FcsHardwareExceptionorg.lsst.ccs.bus.BadCommandExceptionpublic String displayReadPDOs() throws FcsHardwareException, org.lsst.ccs.bus.BadCommandException
FcsHardwareExceptionorg.lsst.ccs.bus.BadCommandException@Deprecated public void identifieHardware_old() throws org.lsst.ccs.HardwareException
org.lsst.ccs.HardwareExceptionpublic void identifyHardware()
throws org.lsst.ccs.HardwareException
org.lsst.ccs.HardwareException@Command(type=QUERY, level=0, description="Return true if all hardware is booted and identified.") public boolean isHardwareReady()
public CanOpenNode getDetectedNodeForSerialNumber(String aSerialNB)
aSerialNB - public void checkCanOpenNodes()
throws org.lsst.ccs.HardwareException
org.lsst.ccs.HardwareExceptionpublic void checkHardwareID(PieceOfHardware pieceOfHardware) throws org.lsst.ccs.HardwareException
pieceOfHardware - org.lsst.ccs.HardwareException@Command(type=QUERY, level=1, description="Return a String with the list of hardware.") public String listHardware()
public String configAsHeartbeatProducer(String nodeID, String heartbeat_time) throws SDORequestException, TimeoutException, org.lsst.ccs.bus.BadCommandException
nodeID - node ID in hexaheartbeat_time - FORMAT=hexa UNIT=millisecondsSDORequestExceptionTimeoutExceptionorg.lsst.ccs.bus.BadCommandExceptionpublic String configAsHeartbeatProducer(int nodeID, int heartbeat_time) throws SDORequestException, TimeoutException, org.lsst.ccs.bus.BadCommandException
nodeID - FORMAT=decimalheartbeat_time - FORMAT=decimal UNIT=millisecondsSDORequestExceptionTimeoutExceptionorg.lsst.ccs.bus.BadCommandExceptionpublic String configAsHeartbeatConsumer(int nodeID, int producerNodeID, int heartbeat_time) throws SDORequestException, TimeoutException, org.lsst.ccs.bus.BadCommandException
nodeID - node ID in decimalproducerNodeID - heartbeat_time - FORMAT=decimal UNIT=millisecondsSDORequestExceptionTimeoutExceptionorg.lsst.ccs.bus.BadCommandExceptionpublic void publishData()
public void publishHardwareData(PieceOfHardware device)
device - public String toString()
public boolean isTcpServerStarted()
public int getPortNumber()
public void start()
@Command(type=ACTION, level=1, description="Starts the tcp server.") public void startServer()
@Command(type=ACTION, level=1, description="Starts to listen to the tcp client.") public void startThreadReader()
public void shutdownNow()
shutdownNow in interface org.lsst.ccs.framework.ConfigurableshutdownNow in class org.lsst.ccs.framework.Modulepublic void stopServer()
public boolean isReady(String clientName)
public Object call(String clientName, String command) throws CWrapperNotConnected, CanOpenCallTimeoutException
clientName - command - CWrapperNotConnectedCanOpenCallTimeoutExceptionCopyright © 2015 LSST. All rights reserved.