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.
-
Nested Class Summary
Nested classes/interfaces inherited from class uk.ac.manchester.spinnaker.connections.UDPConnection
UDPConnection.TrafficClass
-
Field Summary
Fields Modifier and Type Field Description Collection<BMPBoard>
boards
The IDs of the specific set of boards managed by the BMPs we can talk to. -
Constructor Summary
Constructors Constructor Description BMPConnection(BMPConnectionData connectionData)
-
Method Summary
Modifier and Type Method Description ChipLocation
getChip()
Defined to satisfy theSCPSenderReceiver
interface.BMPCoords
getCoords()
SDPMessage
receiveMessage(int timeout)
Receives a SpiNNaker message from this connection.SCPResultMessage
receiveSCPResponse(int timeout)
Receives an SCP response from this connection.void
send(ByteBuffer data, int seq)
Send a request that expects a response to be appropriately directed to the thread that is calling this method.void
send(BMPRequest<?> scpRequest)
Send a request on this connection.void
send(SCPRequest<?> scpRequest)
Sends an SCP request down this connection.Methods inherited from class uk.ac.manchester.spinnaker.connections.UDPConnection
close, doReceive, doReceiveWithAddress, doSend, doSendTo, getLocalAddress, getLocalIPAddress, getLocalPort, getRemoteAddress, getRemoteIPAddress, getRemotePort, isClosed, isConnected, receive, receive, receiveMessage, receiveWithAddress, send, send, sendPortTriggerMessage, sendTo, sendTo, sendTo, setReceivePacketSize, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface uk.ac.manchester.spinnaker.connections.model.Connection
convertTimeout, getLocalIPAddress, getLocalPort, getRemoteIPAddress, getRemotePort, isClosed, isConnected, receive, receiveWithAddress, send, sendTo
Methods inherited from interface uk.ac.manchester.spinnaker.connections.model.SCPSenderReceiver
getSCPData, receiveSCPResponse
-
Field Details
-
boards
The IDs of the specific set of boards managed by the BMPs we can talk to. Immutable.
-
-
Constructor Details
-
BMPConnection
- Parameters:
connectionData
- Description of which BMP(s) to talk to.- Throws:
IOException
- If socket creation fails.
-
-
Method Details
-
send
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
sequence in the message is optional; if not set, (sequence number last assigned + 1) % 65536 will be used
- Specified by:
send
in interfaceSCPSenderReceiver
- Parameters:
scpRequest
- message packet to send- Throws:
IOException
- If there is an error sending the message
- sourcePort is
-
send
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 interfaceSCPSenderReceiver
- Parameters:
data
- The message data to send.seq
- The sequence number to come in the response.- See Also:
Connection.send(ByteBuffer)
-
send
Send a request on this connection.- Parameters:
scpRequest
- The request to send.- Throws:
IOException
- If the request can't be sent.
-
getChip
Defined to satisfy theSCPSenderReceiver
interface. Always 0,0 for a BMP.- Specified by:
getChip
in interfaceSCPSenderReceiver
- Returns:
- The chip at which messages sent down this connection will arrive at first.
-
receiveSCPResponse
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 interfaceSCPSenderReceiver
- 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 messageSocketTimeoutException
- If there is a timeout before a message is receivedInterruptedException
- If communications are interrupted.
-
receiveMessage
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 classUDPConnection<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 messageSocketTimeoutException
- If there is a timeout during receivingInterruptedException
- If communications are interrupted.
-
getCoords
- Returns:
- The coordinates of the BMP that this connection talks to.
-