Class BMPConnection

java.lang.Object
uk.ac.manchester.spinnaker.connections.UDPConnection<SDPMessage>
uk.ac.manchester.spinnaker.connections.BMPConnection
All Implemented Interfaces:
Closeable, AutoCloseable, Connection, SCPSenderReceiver

public class BMPConnection
extends UDPConnection<SDPMessage>
implements SCPSenderReceiver
A connection for talking to one or more Board Management Processors (BMPs). A particular connection can only talk to the BMPs of a single frame of a single cabinet.
  • Field Details

    • boards

      public final Collection<BMPBoard> boards
      The IDs of the specific set of boards managed by the BMPs we can talk to. Immutable.
  • Constructor Details

  • Method Details

    • send

      public final void send​(SCPRequest<?> scpRequest) throws IOException
      Description copied from interface: SCPSenderReceiver
      Sends an SCP request down this connection.

      Messages must have the following properties:

      • sourcePort is null or 7
      • sourceCpu is null or 31
      • sourceChipX is null or 0
      • sourceChipY is null or 0
      tag in the message is optional; if not set, the default set in the constructor will be used.

      sequence in the message is optional; if not set, (sequence number last assigned + 1) % 65536 will be used

      Specified by:
      send in interface SCPSenderReceiver
      Parameters:
      scpRequest - message packet to send
      Throws:
      IOException - If there is an error sending the message
    • send

      public final void send​(ByteBuffer data, int seq)
      Description copied from interface: SCPSenderReceiver
      Send a request that expects a response to be appropriately directed to the thread that is calling this method.
      Specified by:
      send in interface SCPSenderReceiver
      Parameters:
      data - The message data to send.
      seq - The sequence number to come in the response.
      See Also:
      Connection.send(ByteBuffer)
    • send

      public void send​(BMPRequest<?> scpRequest) throws IOException
      Send a request on this connection.
      Parameters:
      scpRequest - The request to send.
      Throws:
      IOException - If the request can't be sent.
    • getChip

      public ChipLocation getChip()
      Defined to satisfy the SCPSenderReceiver interface. Always 0,0 for a BMP.
      Specified by:
      getChip in interface SCPSenderReceiver
      Returns:
      The chip at which messages sent down this connection will arrive at first.
    • receiveSCPResponse

      public SCPResultMessage receiveSCPResponse​(int timeout) throws IOException, InterruptedException
      Description copied from interface: SCPSenderReceiver
      Receives an SCP response from this connection. Blocks until a message has been received, or a timeout occurs.
      Specified by:
      receiveSCPResponse in interface SCPSenderReceiver
      Parameters:
      timeout - The time in milliseconds to wait for the message to arrive, or until the connection is closed.
      Returns:
      The SCP result, the sequence number, and the data of the response. The buffer pointer will be positioned at the point where the payload starts.
      Throws:
      IOException - If there is an error receiving the message
      SocketTimeoutException - If there is a timeout before a message is received
      InterruptedException - If communications are interrupted.
    • receiveMessage

      public SDPMessage receiveMessage​(int timeout) throws IOException, InterruptedException
      Description copied from class: UDPConnection
      Receives a SpiNNaker message from this connection. Blocks until a message has been received, or a timeout occurs.
      Specified by:
      receiveMessage in class UDPConnection<SDPMessage>
      Parameters:
      timeout - The time in seconds to wait for the message to arrive, or until the connection is closed.
      Returns:
      the received message
      Throws:
      IOException - If there is an error receiving the message
      SocketTimeoutException - If there is a timeout during receiving
      InterruptedException - If communications are interrupted.
    • getCoords

      public BMPCoords getCoords()
      Returns:
      The coordinates of the BMP that this connection talks to.