Interface SCPSenderReceiver
- All Superinterfaces:
- AutoCloseable,- Closeable,- Connection
- All Known Implementing Classes:
- BMPConnection,- DelegatingSCPConnection,- SCPConnection
Sends an SCP request and receives a response to it.
- Author:
- Donal Fellows
- 
Method SummaryModifier and TypeMethodDescriptiongetChip()default ByteBuffergetSCPData(SCPRequest<?> scpRequest) Returns the data of an SCP request as it would be sent down this connection.receiveSCPResponse(int timeout) Receives an SCP response from this connection.default SCPResultMessagereceiveSCPResponse(Integer timeout) Receives an SCP response from this connection.voidsend(ByteBuffer requestData, int seq) Send a request that expects a response to be appropriately directed to the thread that is calling this method.default voidsend(SCPRequest<?> request) Sends an SCP request down this connection.Methods inherited from interface uk.ac.manchester.spinnaker.connections.model.ConnectionconvertTimeout, getLocalIPAddress, getLocalPort, getRemoteIPAddress, getRemotePort, isClosed, isConnected, receive, receiveWithAddress, send, sendTo
- 
Method Details- 
getSCPDataReturns the data of an SCP request as it would be sent down this connection.- Parameters:
- scpRequest- message packet to serialise
- Returns:
- The buffer holding the data. The data should be written into the start of the buffer and should end at the position.
 
- 
sendSends 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 - Parameters:
- request- message packet to send
- Throws:
- IOException- If there is an error sending the message
 
- sourcePort is 
- 
getChipChipLocation getChip()- Returns:
- The chip at which messages sent down this connection will arrive at first.
 
- 
receiveSCPResponsedefault SCPResultMessage receiveSCPResponse(Integer timeout) throws SocketTimeoutException, IOException, InterruptedException Receives an SCP response from this connection. Blocks until a message has been received, or a timeout occurs.- Parameters:
- timeout- The time in milliseconds to wait for the message to arrive; if- null, will wait forever, 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.
 
- 
receiveSCPResponseSCPResultMessage receiveSCPResponse(int timeout) throws SocketTimeoutException, IOException, InterruptedException Receives an SCP response from this connection. Blocks until a message has been received, or a timeout occurs.- 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.
 
- 
sendSend a request that expects a response to be appropriately directed to the thread that is calling this method.- Parameters:
- requestData- The message data to send.
- seq- The sequence number to come in the response.
- Throws:
- IOException- If there is an error sending the message
- See Also:
 
 
-