spinnman.messages.scp.abstract_messages package

Module contents

class spinnman.messages.scp.abstract_messages.AbstractSCPRequest(sdp_header, scp_request_header, argument_1=None, argument_2=None, argument_3=None, data=None)[source]

Bases: object

Represents an Abstract SCP Request.

Parameters:
  • sdp_header (SDPHeader) – The SDP header of the request

  • scp_request_header (SCPRequestHeader) – The SCP header of the request

  • argument_1 (int) – The first argument, or None if no first argument

  • argument_2 (int) – The second argument, or None if no second argument

  • argument_3 (int) – The third argument, or None if no third argument

  • data (bytearray or bytes or None) – The optional data, or None if no data

DEFAULT_DEST_X_COORD = 255
DEFAULT_DEST_Y_COORD = 255
property argument_1

The first argument, or None if no first argument.

Return type:

int

property argument_2

The second argument, or None if no second argument.

Return type:

int

property argument_3

The third argument, or None if no third argument.

Return type:

int

property bytestring

The request as a byte-string.

Return type:

bytes

property data

The data, or None if no data.

Return type:

bytearray

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

Return type:

AbstractSCPResponse

property scp_request_header

The SCP request header of the message.

Return type:

SCPRequestHeader

property sdp_header

The SDP header of the message.

Return type:

SDPHeader

class spinnman.messages.scp.abstract_messages.AbstractSCPResponse[source]

Bases: object

Represents an abstract SCP Response.

read_bytestring(data, offset)[source]

Reads a packet from a byte-string of data.

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

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

abstract read_data_bytestring(data, offset)[source]

Reads the remainder of the data following the header.

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

  • offset (int) – The offset into the data after the headers

property scp_response_header

The SCP header from the response.

Return type:

SCPResponseHeader

property sdp_header

The SDP header from the response.

Return type:

SDPHeader

class spinnman.messages.scp.abstract_messages.BMPRequest(boards, scp_request_header, argument_1=None, argument_2=None, argument_3=None, data=None)[source]

Bases: AbstractSCPRequest

An SCP request intended to be sent to a BMP.

Parameters:
  • boards (int or list(int) or tuple(int)) – The board or boards to be addressed by this request

  • scp_request_header (SCPRequestHeader) – The SCP request header

  • argument_1 (int) – The optional first argument

  • argument_2 (int) – The optional second argument

  • argument_3 (int) – The optional third argument

  • data (bytes) – The optional data to be sent

static get_board_mask(boards)[source]

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

static get_first_board(boards)[source]

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

class spinnman.messages.scp.abstract_messages.BMPResponse[source]

Bases: AbstractSCPResponse

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