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 org.lsst.ccs.utilities.logging.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.
|
boolean |
checkCanOpenNodeConfiguration(PieceOfHardware pieceOfHardware)
When the hardware is booted and we have retrieve the information,
we want to check for each piece of hardware that the node ID stored
in the Configuration data base is the same than the node ID which is stored
on the hardware with a switch : so we compare the serial number found on the can open bus
for the piece of hardware node id with the serial number of the harwdare configuration.
|
boolean |
checkCanOpenNodes() |
org.lsst.ccs.framework.TreeWalkerDiag |
checkHardware() |
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() |
String |
getMyClientName() |
ArrayList<CanOpenNode> |
getNodes() |
CanOpenProxy.PDOStorage |
getPdoStorage() |
void |
identifieHardware()
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.
|
String |
initializeHardware() |
void |
initModule() |
boolean |
isBooted(PieceOfHardware piece) |
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 |
isNodeIdBootedAndOK(PieceOfHardware piece)
Check if a piece of hardware is booted
and if its can open node ID is correct.
|
boolean |
isReady(String clientName) |
boolean |
isTcpServerStarted() |
String |
listHardware() |
String |
listNodes()
List the can open nodes which are in the nodes table.
|
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, change, dropConfigurationContext, getCheckedValueFromConfiguration, getChildren, getComponentByName, getComponentDictionariesTree, getComponentTree, getContext, getDictionary, getEnvironment, getMainDictionary, getModule, getName, getNObserverThreads, getObservables, getParent, getSubsystem, getTickMillis, init, injectResources, listens, newConfigurationContext, notifyChange, notifyChangeWithoutPreliminaryChecks, percolateSignal, processUpdate, publish, publish, publish, publish, publish, publish, publishData, publishData, publishData, publishData, publishData, publishData, publishData, register, sendSignal, sendSignal, sendToReply, sendToStatus, setBeanName, setContext, setEnvironment, setName, setNObserverThreads, setObservables, setStateModularSubsystem, setStateModularSubsystem, setTickMillis, shutdownCommand, signal, startTicking, updateaddObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChangedpublic 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 org.lsst.ccs.utilities.logging.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 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 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 boolean isBooted(PieceOfHardware piece)
public boolean isNodeIdBootedAndOK(PieceOfHardware piece)
piece - 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=HEXASDORequestExceptionpublic 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 - SDORequestExceptionShortResponseToSDORequestExceptionpublic 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.BadCommandExceptionpublic void identifieHardware()
throws org.lsst.ccs.HardwareException
org.lsst.ccs.HardwareExceptionpublic boolean isHardwareReady()
public CanOpenNode getDetectedNodeForSerialNumber(String aSerialNB)
aSerialNB - public boolean checkCanOpenNodes()
throws org.lsst.ccs.bus.BadCommandException,
org.lsst.ccs.HardwareException
org.lsst.ccs.bus.BadCommandExceptionorg.lsst.ccs.HardwareExceptionpublic boolean checkCanOpenNodeConfiguration(PieceOfHardware pieceOfHardware) throws org.lsst.ccs.bus.BadCommandException, org.lsst.ccs.HardwareException
pieceOfHardware - org.lsst.ccs.bus.BadCommandExceptionorg.lsst.ccs.HardwareExceptionpublic String listHardware()
public String initializeHardware() throws org.lsst.ccs.bus.BadCommandException, org.lsst.ccs.HardwareException
org.lsst.ccs.bus.BadCommandExceptionorg.lsst.ccs.HardwareExceptionpublic 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 String toString()
public boolean isTcpServerStarted()
public void start()
start in class org.lsst.ccs.framework.Module@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 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 © 2014 LSST. All rights reserved.