public class CanOpenDevice extends Object implements PieceOfHardware, org.lsst.ccs.framework.HasLifecycle
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
booted |
protected int[] |
errorHistory |
protected String |
errorRegister |
protected boolean |
inError |
protected boolean |
initialized |
protected String |
name |
protected int |
nodeID |
protected String |
serialNB |
protected org.lsst.ccs.Subsystem |
subs |
protected CanOpenProxy |
tcpProxy |
alertSeparater| Constructor and Description |
|---|
CanOpenDevice(int nodeID,
String serialNB)
Create a new CanOpenDevice with a node ID and a serial number.
|
| Modifier and Type | Method and Description |
|---|---|
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 |
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
|
String |
getErrorRegister()
For the GUI
|
String |
getName()
Return name.
|
int |
getNodeID() |
String |
getSerialNB() |
org.lsst.ccs.Subsystem |
getSubsystem() |
CanOpenProxy |
getTcpProxy()
Return tcpProxy
|
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[] |
readErrorHistory()
read error history on the device and return a list of device error code.
|
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 controller memory.
|
void |
setBooted(boolean isBooted)
set boolean isBooted in INITIALIZATION phase.
|
String |
toString() |
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcheckBooted, checkId, checkInitialized, createStatusDataPublishedByHardware, initializePDOs, printState, raiseAlarmIfMissingonFault, onFaultResetclearAlarm, raiseAlarm, raiseAlarm, raiseAlarm, raiseAlarm, raiseWarning, raiseWarning@ConfigurationParameter(isFinal=true,
description="CANOpen node ID of this CANOpen device")
protected int nodeID
@ConfigurationParameter(description="serial number of this CANOpen device") protected String serialNB
@LookupField(strategy=ANCESTORS) protected CanOpenProxy tcpProxy
protected boolean initialized
protected boolean booted
protected boolean inError
protected int[] errorHistory
protected String errorRegister
@LookupName protected String name
@LookupField(strategy=TOP) protected org.lsst.ccs.Subsystem subs
public CanOpenDevice(int nodeID,
String serialNB)
nodeID - serialNB - public org.lsst.ccs.services.alert.AlertService getAlertService()
AlertRaisergetAlertService in interface AlertRaiserpublic String getName()
getName in interface AlertRaisergetName 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 CanOpenProxy getTcpProxy()
public int[] getErrorHistory()
public String getErrorRegister()
public boolean isInError()
public 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 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 - FcsHardwareException@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 int[] readErrorHistory()
@Command(type=QUERY,
level=1,
description="Display Error Register on the controller (index 1001).")
public String displayErrorHistory()
@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 controller 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)
throws org.lsst.ccs.drivers.commons.DriverException
updateFromPDO in interface PieceOfHardwarepdo - org.lsst.ccs.drivers.commons.DriverException@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 © 2018 LSST. All rights reserved.