Class SimCANBoard

java.lang.Object
com.tccc.kos.ext.freestyle.sim.can.board.SimCANBoard

public class SimCANBoard extends Object
This represents a single board on the simulated CAN bus.
Version:
2023-12-17
  • Field Details

  • Constructor Details

    • SimCANBoard

      public SimCANBoard(CANSimulator sim, String type, int instanceId, int serialNum)
      Create a new base CAN board
      Parameters:
      type - the board type
  • Method Details

    • add

      public void add(SimCANSubNode node)
      Register a node with the board.
      Parameters:
      node - the node to register
    • getSubNode

      public SimCANSubNode getSubNode(int subNodeId)
      Get the sub node for the specified subNodeId.
      Parameters:
      subNodeId - the sub-node to return
      Returns:
      the matching sub-node or null
    • setOperational

      public void setOperational()
      Switch the node to operational mode.
    • activate

      public void activate()
      Activate the board.
    • reset

      public void reset()
      Reset the board.
    • getSuperPumpSubNode

      public SimCANSubNode getSuperPumpSubNode(int group)
      Returns the super pump subNode on this board given the group number. This is in support of dynamically defined super pumps. The board must define a super pump with the corresponding group in order to support dynamic super pumps.
      Parameters:
      group - superpump group number (starting at 1)
    • writeSDOInt

      public void writeSDOInt(int index, int subIndex, int data)
      Process SDO write. This is called from the simulator in response to an operation from the target. All writes are ints but the client code will mask the data to the specified size before calling this.
    • readSDOInt

      public int readSDOInt(int index, int subIndex)
      Process SDO read. This is called from the simulator in response to an operation from the target. All reads return int data.
    • readBytes

      public byte[] readBytes(String name, byte[] def)
      Return the contents of the named file for the board. If persistence isn't available, the file doesn't exist, or there is an error, return the def value.
      Parameters:
      name - name of the file
      def - default value to return if file can't be read
    • readStr

      public String readStr(String name, String def)
      Return the contents of the named file for the board. If persistence isn't available, the file doesn't exist, or there is an error, return the def value.
      Parameters:
      name - name of the file
      def - default value to return if file can't be read
    • writeBytes

      public void writeBytes(String name, byte[] bytes)
      Write the specified bytes to a file with the specified name for the board. If persistence isn't available the file will not be written. If bytes is null then the file will be deleted.
      Parameters:
      name - name of the file
      bytes - the bytes to write or null to delete
    • writeStr

      public void writeStr(String name, String str)
      Write the specified string to a file with the specified name for the board. If persistence isn't available the file will not be written. If str is null then the file will be deleted.
      Parameters:
      name - name of the file
      str - the string to write or null to delete
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getType

      public CANBoardType getType()
    • getModel

      public CANModel getModel()
    • getInstanceId

      public int getInstanceId()
    • getSerialNum

      public int getSerialNum()
    • getHexSerialNum

      public String getHexSerialNum()
    • getNodeId

      public int getNodeId()
    • setNodeId

      public void setNodeId(int nodeId)
    • isPreOperational

      public boolean isPreOperational()
    • getSim

      public CANSimulator getSim()
    • getName

      public String getName()
    • getDiagAddress

      public int getDiagAddress()