Class SCPRequest<T extends SCPResponse>

java.lang.Object
uk.ac.manchester.spinnaker.messages.sdp.SpinnakerRequest
uk.ac.manchester.spinnaker.messages.scp.SCPRequest<T>
Type Parameters:
T - The type of response expected to the request, if any.
All Implemented Interfaces:
SerializableMessage
Direct Known Subclasses:
ApplicationRun, ApplicationStop, BMPRequest, CountState, FECRequest, FillRequest, FixedRouteInitialise, FixedRouteRead, FloodFillData, FloodFillEnd, FloodFillStart, GetChipInfo, GetVersion, IPTagClear, IPTagGet, IPTagGetInfo, IPTagSet, IPTagSetTTO, ReadLink, ReadMemory, ReinjectorRequest, ReverseIPTagSet, RouterAlloc, RouterClear, RouterInit, RouterTableRequest, SDRAMAlloc, SDRAMDeAlloc, SendSignal, SetLED, WriteLink, WriteMemory

public abstract class SCPRequest<T extends SCPResponse>
extends SpinnakerRequest
Represents an Abstract SCP Request.
  • Field Details

    • BOOT_MONITOR_CORE

      public static final CoreLocation BOOT_MONITOR_CORE
      The location of the default SCAMP.
    • BOOT_CHIP

      public static final ChipLocation BOOT_CHIP
      The pseudo-location of the default chip.
    • argument1

      public final int argument1
      The first argument.
    • argument2

      public final int argument2
      The second argument.
    • argument3

      public final int argument3
      The third argument.
    • data

      public final ByteBuffer data
      The payload data as a buffer, or null if no payload data.
    • scpRequestHeader

      public final SCPRequestHeader scpRequestHeader
      The SCP request header of the message.
    • NO_DATA

      protected static final ByteBuffer NO_DATA
      The constant value used to indicate that no payload data is in the message.
  • Constructor Details

    • SCPRequest

      protected SCPRequest​(HasCoreLocation core, SCPCommand command)
      Create a new request that goes to the default port and needs a reply.
      Parameters:
      core - The core to send the request to.
      command - The command ID.
    • SCPRequest

      protected SCPRequest​(HasCoreLocation core, SCPCommand command, int argument1)
      Create a new request that goes to the default port and needs a reply.
      Parameters:
      core - The core to send the request to.
      command - The command ID.
      argument1 - The first argument.
    • SCPRequest

      protected SCPRequest​(HasCoreLocation core, SCPCommand command, int argument1, int argument2)
      Create a new request that goes to the default port and needs a reply.
      Parameters:
      core - The core to send the request to.
      command - The command ID.
      argument1 - The first argument.
      argument2 - The second argument.
    • SCPRequest

      protected SCPRequest​(HasCoreLocation core, SCPCommand command, int argument1, int argument2, int argument3)
      Create a new request that goes to the default port and needs a reply.
      Parameters:
      core - The core to send the request to.
      command - The command ID.
      argument1 - The first argument.
      argument2 - The second argument.
      argument3 - The third argument.
    • SCPRequest

      protected SCPRequest​(HasCoreLocation core, SCPCommand command, int argument1, int argument2, int argument3, ByteBuffer data)
      Create a new request that goes to the default port and needs a reply.
      Parameters:
      core - The core to send the request to.
      command - The command ID.
      argument1 - The first argument.
      argument2 - The second argument.
      argument3 - The third argument.
      data - The additional data. Starts at the position and goes to the limit. The position and limit of the buffer will not be updated by this constructor.
    • SCPRequest

      protected SCPRequest​(SDPHeader sdpHeader, CommandCode command, int argument1, int argument2, int argument3, ByteBuffer data)
      Create a new request.
      Parameters:
      sdpHeader - The header.
      command - The command ID.
      argument1 - The first argument.
      argument2 - The second argument.
      argument3 - The third argument.
      data - The additional data. Starts at the position and goes to the limit. The position and limit of the buffer will not be updated by this constructor.
  • Method Details

    • addToBuffer

      public void addToBuffer​(ByteBuffer buffer)
      Description copied from interface: SerializableMessage
      Writes this message into the given buffer as a contiguous range of bytes. This is so that a message can be sent. Implementors may assume that the buffer has been configured to be little-endian and that its position is at the point where they should begin writing. Once it has finished, the position should be immediately after the last byte written by this method.

      Calling this method should not update the internal state of the message. It should be possible to add the message to multiple buffers without special precautions by the caller.

      Parameters:
      buffer - The buffer to write into.
    • getSCPResponse

      public abstract T getSCPResponse​(ByteBuffer buffer) throws Exception
      Parse the response to this message.
      Parameters:
      buffer - The buffer to parse.
      Returns:
      The message response.
      Throws:
      Exception - If anything goes wrong with parsing.