spinnman.connections.abstract_classes package

Module contents

class spinnman.connections.abstract_classes.Connection[source]

Bases: spinn_utilities.abstract_context_manager.AbstractContextManager

An abstract connection to the SpiNNaker board over some medium.

close()[source]

Closes the connection.

is_connected()[source]

Determines if the medium is connected at this point in time.

Returns:True if the medium is connected, False otherwise
Return type:bool
Raises:SpinnmanIOException – If there is an error when determining the connectivity of the medium.
class spinnman.connections.abstract_classes.Listenable[source]

Bases: object

An interface for connections that can listen for incoming messages.

Implementing this interface means that the connection can be used with ConnectionListener.

get_receive_method()[source]

Get the method that receives for this connection.

is_ready_to_receive(timeout=0)[source]

Determines if there is an SCP packet to be read without blocking.

Parameters:timeout (int) – The time to wait before returning if the connection is not ready
Returns:True if there is an SCP packet to be read
Return type:bool
class spinnman.connections.abstract_classes.AbstractSCPConnection[source]

Bases: spinnman.connections.abstract_classes.connection.Connection

A sender and receiver of SCP messages.

chip_x

The X-coordinate of the chip at which messages sent down this connection will arrive at first.

Return type:int
chip_y

The Y-coordinate of the chip at which messages sent down this connection will arrive at first.

Return type:int
get_scp_data(scp_request)[source]

Returns the data of an SCP request as it would be sent down this connection.

is_ready_to_receive(timeout=0)[source]

Determines if there is an SCP packet to be read without blocking.

Parameters:timeout (int) – The time to wait before returning if the connection is not ready
Returns:True if there is an SCP packet to be read
Return type:bool
receive_scp_response(timeout=1.0)[source]

Receives an SCP response from this connection. Blocks until a message has been received, or a timeout occurs.

Parameters:

timeout (int) – The time in seconds to wait for the message to arrive; if not specified, will wait forever, or until the connection is closed

Returns:

The SCP result, the sequence number, the data of the response and the offset at which the data starts (i.e., where the SDP header starts).

Return type:

tuple(SCPResult, int, bytes, int)

Raises:
send_scp_request(scp_request)[source]

Sends an SCP request down this connection.

Messages must have the following properties:

  • source_port is None or 7
  • source_cpu is None or 31
  • source_chip_x is None or 0
  • source_chip_y is None 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

Parameters:scp_request (AbstractSCPRequest) – message packet to send
Raises:SpinnmanIOException – If there is an error sending the message