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
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
FieldsModifier and TypeFieldDescriptionfinal Collection<BMPBoard>The IDs of the specific set of boards managed by the BMPs we can talk to. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetChip()Defined to satisfy theSCPSenderReceiverinterface.receiveMessage(int timeout) Receives a SpiNNaker message from this connection.receiveSCPResponse(int timeout) Receives an SCP response from this connection.final voidsend(ByteBuffer data, int seq) Send a request that expects a response to be appropriately directed to the thread that is calling this method.voidsend(BMPRequest<?> scpRequest) Send a request on this connection.final voidsend(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, setInUse, setNotInUse, setReceivePacketSize, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface uk.ac.manchester.spinnaker.connections.model.Connection
convertTimeout, getLocalIPAddress, getLocalPort, getRemoteIPAddress, getRemotePort, isClosed, isConnected, receive, receiveWithAddress, send, sendToMethods 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:SCPSenderReceiverSends an SCP request down this connection.Messages must have the following properties:
- sourcePort is
nullor 7 - sourceCpu is
nullor 31 - sourceChipX is
nullor 0 - sourceChipY is
nullor 0
sequence in the message is optional; if not set, (sequence number last assigned + 1) % 65536 will be used
- Specified by:
sendin interfaceSCPSenderReceiver- Parameters:
scpRequest- message packet to send- Throws:
IOException- If there is an error sending the message
- sourcePort is
-
send
Description copied from interface:SCPSenderReceiverSend a request that expects a response to be appropriately directed to the thread that is calling this method.- Specified by:
sendin interfaceSCPSenderReceiver- Parameters:
data- The message data to send.seq- The sequence number to come in the response.- See Also:
-
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 theSCPSenderReceiverinterface. Always 0,0 for a BMP.- Specified by:
getChipin interfaceSCPSenderReceiver- Returns:
- The chip at which messages sent down this connection will arrive at first.
-
receiveSCPResponse
Description copied from interface:SCPSenderReceiverReceives an SCP response from this connection. Blocks until a message has been received, or a timeout occurs.- Specified by:
receiveSCPResponsein 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:UDPConnectionReceives a SpiNNaker message from this connection. Blocks until a message has been received, or a timeout occurs.- Specified by:
receiveMessagein 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.
-