spinnman.connections.abstract_classes package

Module contents

class spinnman.connections.abstract_classes.AbstractSCPConnection

Bases: Connection

A sender and receiver of SCP messages.

abstract property chip_x: int

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

Return type:

int

abstract property chip_y: int

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

Return type:

int

abstract get_scp_data(scp_request: AbstractSCPRequest) bytes[source]

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

abstract is_ready_to_receive(timeout: float = 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

abstract receive_scp_response(timeout: float | None = 1.0) Tuple[SCPResult, int, bytes, int][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 None, 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:
class spinnman.connections.abstract_classes.Connection

Bases: AbstractContextManager

An abstract connection to the SpiNNaker board over some medium.

abstract close() None[source]

Closes the connection.

abstract is_connected() bool[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

Bases: Generic[T]

An interface for connections that can listen for incoming messages.

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

abstract get_receive_method() Callable[[], T][source]

Get the method that receives for this connection.

abstract is_ready_to_receive(timeout: float = 0) bool[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