spinnman.messages.scp.abstract_messages package

Module contents

class spinnman.messages.scp.abstract_messages.AbstractSCPRequest(sdp_header: SDPHeader, scp_request_header: SCPRequestHeader, argument_1: int | None = None, argument_2: int | None = None, argument_3: int | None = None, data: bytes | None = None)

Bases: Generic[R]

Represents an Abstract SCP Request.

Parameters:
  • sdp_header – The SDP header of the request

  • scp_request_header – The SCP header of the request

  • argument_1 – The first argument, or None if no first argument

  • argument_2 – The second argument, or None if no second argument

  • argument_3 – The third argument, or None if no third argument

  • data – The optional data, or None if no data

DEFAULT_DEST_X_COORD = 255
DEFAULT_DEST_Y_COORD = 255
property argument_1: int | None

The first argument, or None if no first argument.

property argument_2: int | None

The second argument, or None if no second argument.

property argument_3: int | None

The third argument, or None if no third argument.

property bytestring: bytes

The request as a byte-string.

property data: bytes | None

The data, or None if no data.

abstractmethod get_scp_response() R[source]

Get an SCP response message to be used to process any response received.

Returns:

An SCP response, or None if no response is required

property scp_request_header: SCPRequestHeader

The SCP request header of the message.

property sdp_header: SDPHeader

The SDP header of the message.

class spinnman.messages.scp.abstract_messages.AbstractSCPResponse

Bases: object

Represents an abstract SCP Response.

read_bytestring(data: bytes, offset: int) None[source]

Reads a packet from a byte-string of data.

Parameters:
  • data – The byte-string to be read

  • offset – The offset in the data from which the response should be read

abstractmethod read_data_bytestring(data: bytes, offset: int) None[source]

Reads the remainder of the data following the header.

Parameters:
  • data – The byte-string to read from

  • offset – The offset into the data after the headers

property scp_response_header: SCPResponseHeader

The SCP header from the response.

property sdp_header: SDPHeader

The SDP header from the response.

class spinnman.messages.scp.abstract_messages.BMPOKResponse(operation: str, command: SCPCommand)

Bases: BMPResponse[None]

A BMP response without payload to parse.

Parameters:
  • operation – Operation name

  • command – Command used for which this is the response

class spinnman.messages.scp.abstract_messages.BMPRequest(boards: int | Iterable[int], scp_request_header: SCPRequestHeader, argument_1: int | None = None, argument_2: int | None = None, argument_3: int | None = None, data: bytes | None = None)

Bases: AbstractSCPRequest[R], Generic[R]

An SCP request intended to be sent to a BMP.

Parameters:
  • boards – The board or boards to be addressed by this request

  • scp_request_header – The SCP request header

  • argument_1 – The optional first argument

  • argument_2 – The optional second argument

  • argument_3 – The optional third argument

  • data – The optional data to be sent

static get_board_mask(boards: int | Iterable[int]) int[source]

Get the board mask given a board ID or collection of board IDs.

..note:: This methods is only called by deprecated functions.

Unsure if it will produce the correct result for multiple boards

Returns:

The board ID as a bit mask, or a sum of bitmaps for multiple boards

static get_first_board(boards: int | Iterable[int]) int[source]
Returns:

The first board ID given a board ID or collection of board IDs.

class spinnman.messages.scp.abstract_messages.BMPResponse(operation: str, command: SCPCommand)

Bases: AbstractSCPResponse, Generic[T]

Represents an SCP response that’s tailored for the BMP connection.

Parameters:
  • operation – Operation name

  • command – Command used for which this is the response

read_data_bytestring(data: bytes, offset: int) None[source]

Reads the remainder of the data following the header.

Parameters:
  • data – The byte-string to read from

  • offset – The offset into the data after the headers