
public class CanOpenProxy extends Object implements org.lsst.ccs.framework.HardwareController, org.lsst.ccs.framework.ClearAlertHandler, BridgeToHardware, org.lsst.ccs.framework.HasLifecycle, AlertRaiser, CanOpenEventListener
| Modifier and Type | Field and Description |
|---|---|
protected int |
bootedDeviceNB |
protected boolean |
hardwareBootProcessEnded |
protected Map<String,PieceOfHardware> |
hardwareMapByName |
protected Map<Integer,PieceOfHardware> |
hardwareMapByNodeID
This map of PieceOfHardware which key is CANopen masterNodeID of the hardware
represents the list of pieces of hardware (CANopen devices) this
CanOpenProxy manages.
|
protected String |
name |
alertSeparater| Constructor and Description |
|---|
CanOpenProxy(long hardwareBootTimeout)
Creates a CanOpenProxy with a tcpip port number to start the tcp server
on, a client name, and a hardware booting process timeout.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addReceivedPDO(int cobId) |
boolean |
allDevicesBooted()
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.
|
void |
bootProcess()
Check if all pieces of hardware in the configuration are booted with the corect serial number.
|
org.lsst.ccs.framework.ClearAlertHandler.ClearAlertCode |
canClearAlert(org.lsst.ccs.bus.data.Alert alert)
Overridden method from ClearAlertHandler interface to define conditions
when Alerts can be cleared.
|
void |
checkNodeID(int nodeID)
Check that a nodeID entered by an end user at the console is a valid one:
nodeID should be in the hardwareMapByNodeID.
|
void |
checkStarted() |
void |
connectHardware()
This method is used when the loader CANbus is connected.
|
void |
disconnectHardware()
***********************************************************************************************
******************** END OF SETTERS AND GETTERS
**********************************************
***********************************************************************************************
/**
/**
This methods stops the CWrapper client, and the TCP server.
|
org.lsst.ccs.AlertService |
getAlertService()
return alertService
|
org.lsst.ccs.drivers.canopenjni.CanOpenInterface |
getCanInterface() |
String |
getName() |
String |
getNodeName(int aNodeID)
For a piece of hardware that this tcpProxy manages, this methods returns
the name of the device when the CANopen node id is given as argument.
|
org.lsst.ccs.drivers.canopenjni.PDOData |
getPdoData()
for simulation and tests
|
org.lsst.ccs.Subsystem |
getSubsystem() |
String |
info(int nodeID) |
void |
init() |
void |
init(int master,
String baud,
String busName,
int nodeID) |
void |
initializePDOs()
Used with JNI interface to initialize canInterface to be able to received PDOs.
|
boolean |
isReady()
This method should return true when connection to hardware is effective
and all devices connected to that bridge have been correctly identified.
|
String |
listBootedNodes()
List the can open bootedNodes which are in the bootedNodes table.
|
List<String> |
listHardwareNames()
For the GUI : Return an Array containing hardware names handled by this
component.
|
void |
onBootMessage(int nodeID) |
void |
onEmergencyMessage(int nodeID,
int errCode,
int errReg)
Process an emergency message received from a CANopen device on the status
bus : - ALARM or WARNING Alert is raised, - a message is logged, -
Observers are notified.
|
void |
postStart()
check that all pieces of hardware is booted.
|
String |
printHardwareList()
Return a String with the list of hardware expected in this subsystem.
|
String |
printHardwareState()
Return a printed list of hardware with the initialization state.
|
void |
publishData()
Publish Data on status bus for trending data base and GUIs.
|
void |
quit() |
void |
readDevicesInfo()
This method is called in the checkHardware method during the
initialization process.
|
long |
readSDO(int nodeID,
int index,
int subindex)
Send a rsdo command to can interface and throw Exceptions or raise Alarms in case of something
went wrong.
|
void |
reset(int nodeId) |
void |
retrieveHardwareInfo()
Identification of the hardware : we want to retrieve the information
stored in the hardware of the booted bootedNodes and update the array of
bootedNodes with this information.
|
long |
rsdo(int nodeId,
int index,
int subindex) |
int |
scan() |
void |
shutdownNow()
This shutdowns the scheduler.
|
void |
ssta(int nodeId) |
void |
ssto(int nodeId) |
void |
start() |
org.lsst.ccs.drivers.canopenjni.PDOData |
sync()
Send a command sync to CAN bus to read sensors by PDO.
|
String |
toString() |
org.lsst.ccs.drivers.canopenjni.PDOData |
updatePDOData()
Update pdoData in sending a sync command.
|
String |
writeSDO(int nodeID,
int index,
int subindex,
int size,
int value)
Command to be used by the end user at the console.
|
void |
wsdo(int nodeId,
int index,
int subindex,
int size,
long data) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcheckHardware, checkStoppedbuild, postBuild, postInit, postStop, stopclearAlarm, raiseAlarm, raiseAlarm, raiseAlarm, raiseAlarm, raiseAlarm, raiseAlarm, raiseWarning, raiseWarning, raiseWarning, raiseWarning, raiseWarning@LookupName protected String name
protected final Map<Integer,PieceOfHardware> hardwareMapByNodeID
@LookupField(strategy=CHILDREN) protected final Map<String,PieceOfHardware> hardwareMapByName
protected boolean hardwareBootProcessEnded
protected int bootedDeviceNB
public CanOpenProxy(long hardwareBootTimeout)
hardwareBootTimeout - public String getName()
getName in interface AlertRaiserpublic org.lsst.ccs.Subsystem getSubsystem()
getSubsystem in interface AlertRaiserpublic org.lsst.ccs.drivers.canopenjni.CanOpenInterface getCanInterface()
@Command public org.lsst.ccs.drivers.canopenjni.PDOData getPdoData()
public void disconnectHardware()
disconnectHardware in interface BridgeToHardwarepublic void connectHardware()
BridgeToHardwareconnectHardware in interface BridgeToHardwarepublic void init()
init in interface org.lsst.ccs.framework.HasLifecycle@Command(type=ACTION, description="Check if all pieces of hardware are booted with the corect serial number.") public void bootProcess()
bootProcess in interface BridgeToHardware@Command(type=QUERY, description="Initialize PDO for all my devices.") public void initializePDOs()
public org.lsst.ccs.drivers.canopenjni.PDOData updatePDOData()
updatePDOData in interface BridgeToHardwarepublic void start()
start in interface org.lsst.ccs.framework.HasLifecyclepublic void postStart()
postStart in interface org.lsst.ccs.framework.HasLifecyclepublic void readDevicesInfo()
public void checkStarted()
checkStarted in interface org.lsst.ccs.framework.HardwareControllerpublic void shutdownNow()
shutdownNow in interface org.lsst.ccs.framework.HasLifecyclepublic String getNodeName(int aNodeID)
aNodeID - @Command(type=QUERY, level=3, description="Print the list of CANopen nodes which are booted on the CAN bus. (values are in HEXA)") public String listBootedNodes()
public void checkNodeID(int nodeID)
nodeID - @Command(type=ACTION, level=3, description="Send a CanOpen writeSDO command to the Can Bus. \nValues of the argument are to be given in hexadecimal format for: index and subindex\n and in decimal format for size and value.\n size represents the number of bytes on which the value is encoded. See device documentation.") public String writeSDO(int nodeID, int index, int subindex, int size, int value)
nodeID - FORMAT=hexaindex - FORMAT=HEXAsubindex - FORMAT=HEXAsize - FORMAT=decimal between 0 and 4.value - FORMAT=decimalFcsHardwareExceptionpublic long readSDO(int nodeID,
int index,
int subindex)
nodeID - index - subindex - @Command(type=QUERY, level=3, description="Send a command sync to CAN bus to read sensors by PDO.") public org.lsst.ccs.drivers.canopenjni.PDOData sync() throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(type=QUERY, level=3, description=" init CAN interface.") public void init(int master, String baud, String busName, int nodeID) throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(type=QUERY, level=3, description="add a receive PDO to canInterface.") public void addReceivedPDO(int cobId) throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(type=QUERY, level=3, description="Scan CAN bus.") public int scan() throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(type=QUERY, level=3, description="Send a command info to CAN bus for nodeID to retrieve device information.") public String info(int nodeID) throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(type=QUERY, level=3, description="Send a command wsdo to device.") public void wsdo(int nodeId, int index, int subindex, int size, long data) throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(type=QUERY, level=3, description="Send a command rsdo to device.") public long rsdo(int nodeId, int index, int subindex) throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(type=QUERY, level=3, description="Send a command ssta (slave start) to device.") public void ssta(int nodeId) throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(type=QUERY, level=3, description="Send a command ssto (slave stop) to device.") public void ssto(int nodeId) throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(type=QUERY, level=3, description="Send a command reset to device.") public void reset(int nodeId) throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(type=QUERY, level=3, description="Send a command quit to canInterface to device.") public void quit() throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(type=QUERY, level=0, description="Identification of the hardware : we want to retrieve the information stored in the hardware of the CANopen devices") public void retrieveHardwareInfo()
@Command(type=QUERY, level=0, description="Return true if all CANopen devices are booted and identified.Identified means that the serial numbers match the CANopen nodeID which reside inconfiguration.") public boolean allDevicesBooted()
allDevicesBooted in interface BridgeToHardwarepublic void onBootMessage(int nodeID)
onBootMessage in interface CanOpenEventListenerpublic void onEmergencyMessage(int nodeID,
int errCode,
int errReg)
onEmergencyMessage in interface CanOpenEventListenernodeID - errCode - errReg - @Command(type=QUERY, level=1, description="Return a printed list of hardware expected in this subsystem.") public String printHardwareList()
printHardwareList in interface BridgeToHardware@Command(type=QUERY, level=1, description="Return a printed list of hardware with the initialization state.") public String printHardwareState()
printHardwareState in interface BridgeToHardware@Command(type=QUERY, level=1, description="Return an Array containing hardware names handled by this component.") public List<String> listHardwareNames()
listHardwareNames in interface BridgeToHardwarepublic org.lsst.ccs.framework.ClearAlertHandler.ClearAlertCode canClearAlert(org.lsst.ccs.bus.data.Alert alert)
canClearAlert in interface org.lsst.ccs.framework.ClearAlertHandleralert - @Command(type=QUERY, level=1, description="Publish booting information for all CANopen devices.") public void publishData()
publishData in interface BridgeToHardwarepublic boolean isReady()
BridgeToHardwareisReady in interface BridgeToHardwarepublic org.lsst.ccs.AlertService getAlertService()
AlertRaisergetAlertService in interface AlertRaiserCopyright © 2018 LSST. All rights reserved.