public class CanOpenDevice extends Object implements PieceOfHardware, org.lsst.ccs.framework.HasLifecycle
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
booted |
protected org.lsst.ccs.services.DataProviderDictionaryService |
dataProviderDictionaryService |
protected int[] |
errorHistory |
protected String |
errorRegister |
protected boolean |
inError |
protected boolean |
initialized |
protected int |
lastErrorCode |
protected String |
lastErrorName |
protected String |
name |
protected int |
nodeID |
protected String |
path |
protected String |
serialNB |
protected org.lsst.ccs.Subsystem |
subs |
protected CanOpenProxy |
tcpProxy |
alertSeparator| Constructor and Description |
|---|
CanOpenDevice() |
| Modifier and Type | Method and Description |
|---|---|
void |
build() |
void |
configAsHeartbeatConsumer(int nodeID,
int producerNodeID,
int heartbeatTime)
Configure a node as a hearbeat consumer.
|
void |
configAsHeartbeatProducer(int nodeID,
int heartbeatTime)
Configure a node as a hearbeat producer.
|
StatusDataPublishedByCanOpenDevice |
createStatusDataPublishedByCanOpenDevice()
Creates an object to be published on the STATUS bus by a CanOpenDevice.
|
String |
displayError(int err)
read an error table to return an error name corresponding to the error code
given as argument.
|
String |
displayErrorHistory()
Read error history on the device and return its String representation.
|
String |
displayErrorRegister()
Read Error Register on the controller (index 1001), retrieve error name and
return a String representation of the error register.
|
void |
doInitializePDOs()
Do nothing if this device doesn't send PDOs except log for debug purpose.
|
org.lsst.ccs.services.alert.AlertService |
getAlertService()
return alertService
|
int[] |
getErrorHistory()
For the GUI
|
int |
getErrorHistoryNB() |
String |
getErrorRegister()
For the GUI
|
int |
getLastErrorCode() |
String |
getLastErrorName() |
String |
getName()
Return name.
|
int |
getNodeID() |
String |
getPath() |
String |
getSerialNB() |
org.lsst.ccs.Subsystem |
getSubsystem() |
CanOpenProxy |
getTcpProxy()
Return tcpProxy
|
void |
init() |
void |
initializeAndCheckHardware()
This methods has to be overridden if there is some initialization to do for
the device.
|
boolean |
isBooted()
Returns true if this CANopen node is booted.
|
boolean |
isInError()
For the GUI
|
boolean |
isInitialized()
Returns true if this CANopen node is initialized.
|
void |
onEmergencyMessage(EmergencyMessage emcyMsg)
This method is to be used when receiving an EmergencyMessage from the CANbus
for this device.
|
String |
printSerialNumber()
return a Hexadecimal String representation of serial number.
|
void |
publishData()
Publish Data on status bus for trending data base and GUIs.
|
int |
readDeviceType() |
int |
readErrorRegister()
Read Error Register on the controller (index 1001).
|
int |
readNumberOfErrors()
Read and return the number of errors registred in the Error History of the
device.
|
long |
readSDO(int index,
int subindex)
Sends a readSDO request to the CANopen device.
|
void |
resetError()
Reset fields which contains error messages.
|
void |
saveParameters()
End of methods to read errors on the device
/***********************************************************************************
/** This method saves the parameters in the device memory.
|
void |
setBooted(boolean isBooted)
set boolean isBooted in INITIALIZATION phase.
|
String |
toString() |
void |
updateDeviceInfo() |
void |
updateErrorHistory()
read error history on the device and update error history fields :
errorHistory, lastErrorCode, lastErrorName.
|
void |
updateFromPDO(org.lsst.ccs.drivers.canopenjni.PDOData pdo)
Do nothing if this device doesn't send PDOs except log for debug purpose.
|
void |
writeSDO(int index,
int subindex,
int size,
int newValue)
Sends a writeSDO request to the CANopen device.
|
protected void |
writeTransmissionTypeToDevice(int transmissionType)
This methods writes the transmission type given as argument on the device.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcheckBooted, checkId, checkInitialized, createStatusDataPublishedByHardware, initializePDOs, printState, raiseAlarmIfMissing, raiseWarningIfMissingonFault, onFaultResetclearAlarm, getAlertSeparator, raiseAlarm, raiseAlarm, raiseAlarm, raiseAlarm, raiseAlarmOnlyIfNew, raiseAlertOnlyEveryTenMinutes, raiseAlertOnlyEveryTenMinutes, raiseAlertOnlyIfNew, raiseWarning, raiseWarning, raiseWarning, raiseWarning, raiseWarningOnlyEveryTenMinutes, raiseWarningOnlyIfNew@ConfigurationParameter(isFinal=true,
description="CANOpen node ID of this CANOpen device",
units="unitless",
category="nodeID")
protected volatile int nodeID
@ConfigurationParameter(description="serial number of this CANOpen device",
units="unitless",
category="serialNB")
protected volatile String serialNB
@LookupField(strategy=TREE) protected org.lsst.ccs.services.DataProviderDictionaryService dataProviderDictionaryService
@LookupField(strategy=ANCESTORS) protected CanOpenProxy tcpProxy
protected boolean initialized
protected volatile boolean booted
protected boolean inError
protected int[] errorHistory
protected int lastErrorCode
protected String lastErrorName
protected String errorRegister
@LookupName protected String name
@LookupPath protected String path
@LookupField(strategy=TOP) protected org.lsst.ccs.Subsystem subs
public void build()
build in interface org.lsst.ccs.framework.HasLifecyclepublic void init()
init in interface org.lsst.ccs.framework.HasLifecyclepublic org.lsst.ccs.services.alert.AlertService getAlertService()
AlertRaisergetAlertService in interface AlertRaiserpublic String getName()
getName in interface NamedComponentgetName in interface PieceOfHardwarepublic String getPath()
getPath in interface NamedComponentgetPath in interface PieceOfHardwarepublic org.lsst.ccs.Subsystem getSubsystem()
getSubsystem in interface AlertRaiser@Command(type=QUERY,
level=1,
description="Returns this CANopen device\'s serial number.")
public String getSerialNB()
getSerialNB in interface PieceOfHardware@Command(type=QUERY,
level=1,
description="Returns this CANopen device\'s node ID and print it in decimal format.")
public int getNodeID()
getNodeID in interface PieceOfHardware@Command(type=QUERY,
level=1,
description="Returns true if this CANopen node is booted.")
public boolean isBooted()
isBooted in interface PieceOfHardwarepublic void setBooted(boolean isBooted)
PieceOfHardwaresetBooted in interface PieceOfHardware@Command(type=QUERY,
level=1,
description="Returns true if this CANopen node is initialized.")
public boolean isInitialized()
isInitialized in interface PieceOfHardwarepublic int getErrorHistoryNB()
public int getLastErrorCode()
public String getLastErrorName()
public CanOpenProxy getTcpProxy()
public int[] getErrorHistory()
public String getErrorRegister()
public boolean isInError()
@Command(type=QUERY,
level=1,
description="Check if device is booted and update device info.")
public void updateDeviceInfo()
updateDeviceInfo in interface PieceOfHardwarepublic void onEmergencyMessage(EmergencyMessage emcyMsg)
onEmergencyMessage in interface EmergencyMessageListeneremcyMsg - the emergency message to be processed.public void resetError()
@Command(type=ACTION,
level=1,
description="Initialize the device.")
public void initializeAndCheckHardware()
initializeAndCheckHardware in interface PieceOfHardware@Command(type=ACTION,
level=3,
description="Write transmission type to the device.")
protected void writeTransmissionTypeToDevice(int transmissionType)
transmissionType - FcsHardwareException@Command(type=ACTION,
level=3,
description="Write on the Can Open Device with a command wsdo.")
public void writeSDO(int index,
int subindex,
int size,
int newValue)
index - subindex - size - newValue - FcsHardwareException@Command(type=QUERY,
level=3,
description="Read Can Open Device with a command rsdo.")
public long readSDO(int index,
int subindex)
index - subindex - FcsHardwareExceptionpublic int readDeviceType()
readDeviceType in interface PieceOfHardware@Command(type=QUERY,
level=3,
description="return a Hexadecimal representation of serial number.")
public String printSerialNumber()
@Command(type=QUERY,
level=3,
description="Reads Error Register on the controller (index 1001).")
public int readErrorRegister()
SDORequestException@Command(type=QUERY,
level=3,
description="Display Error Register on the controller (index 1001).")
public String displayErrorRegister()
public void updateErrorHistory()
@Command(type=QUERY,
level=1,
description="Display Error History for this device (index 1003).")
public String displayErrorHistory()
public String displayError(int err)
err - @Command(type=QUERY,
level=1,
description="Read and returns the number of errors registred in the Error History.")
public int readNumberOfErrors()
SDORequestException@Command(type=ACTION,
level=3,
description="This method saves the parameters in the device memory.")
public void saveParameters()
SDORequestException@Command(type=ACTION,
level=3,
description="Configure a CANopen device as a heartbeat producer.")
public void configAsHeartbeatProducer(int nodeID,
int heartbeatTime)
nodeID - node IDheartbeatTime - heartbeat in millisecondsSDORequestExceptionpublic void configAsHeartbeatConsumer(int nodeID,
int producerNodeID,
int heartbeatTime)
nodeID - node ID in decimalproducerNodeID - heartbeatTime - FORMAT=decimal UNIT=millisecondsSDORequestExceptionpublic void doInitializePDOs()
throws org.lsst.ccs.drivers.commons.DriverException
doInitializePDOs in interface PieceOfHardwareorg.lsst.ccs.drivers.commons.DriverExceptionpublic void updateFromPDO(org.lsst.ccs.drivers.canopenjni.PDOData pdo)
updateFromPDO in interface PieceOfHardwarepdo - @Command(type=QUERY,
level=1,
description="Print CANopen device.")
public String toString()
public StatusDataPublishedByCanOpenDevice createStatusDataPublishedByCanOpenDevice()
@Command(type=QUERY,
level=1,
alias="refreshGUI",
description="Publish data for the device on the status bus.")
public void publishData()
publishData in interface PieceOfHardwareCopyright © 2022 LSST. All rights reserved.