Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove send_scp_request #393

Merged
merged 3 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions spinnman/connections/abstract_classes/abstract_scp_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,29 +66,6 @@ def get_scp_data(self, scp_request: AbstractSCPRequest) -> bytes:
"""
raise NotImplementedError

@abstractmethod
def send_scp_request(self, scp_request: AbstractSCPRequest):
"""
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

:param AbstractSCPRequest scp_request: message packet to send
:raise SpinnmanIOException:
If there is an error sending the message
"""
raise NotImplementedError

@property
@abstractmethod
def chip_x(self) -> int:
Expand Down
4 changes: 0 additions & 4 deletions spinnman/connections/udp_packet_connections/bmp_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@ def receive_scp_response(self, timeout: Optional[float] = 1.0) -> Tuple[
result, sequence = _TWO_SHORTS.unpack_from(data, 10)
return SCPResult(result), sequence, data, 2

@overrides(AbstractSCPConnection.send_scp_request)
def send_scp_request(self, scp_request: AbstractSCPRequest):
self.send(self.get_scp_data(scp_request))

def __repr__(self):
return (
f"BMPConnection("
Expand Down
18 changes: 0 additions & 18 deletions spinnman/connections/udp_packet_connections/scamp_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,24 +114,6 @@ def receive_scp_response_with_address(
result, sequence = _TWO_SHORTS.unpack_from(data, 10)
return SCPResult(result), sequence, data, 2, addr, port

@overrides(AbstractSCPConnection.send_scp_request)
def send_scp_request(self, scp_request: AbstractSCPRequest):
self.send(self.get_scp_data(scp_request))

def send_scp_request_to(
self, scp_request: AbstractSCPRequest,
x: int, y: int, ip_address: str):
"""

:param AbstractSCPRequest scp_request:
:param int x:
:param int y:
:param str ip_address:
"""
self.send_to(
self.get_scp_data(scp_request, x, y),
(str(ip_address), SCP_SCAMP_PORT))

def __repr__(self) -> str:
return (
f"SCAMPConnection(chip_x={self._chip_x}, chip_y={self._chip_y}, "
Expand Down
29 changes: 0 additions & 29 deletions spinnman/extended/extended_transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import io
import os
import logging
import random
import struct
import time
from typing import Optional
Expand Down Expand Up @@ -89,34 +88,6 @@ def scamp_connection_selector(self) -> ConnectionSelector:
"""
raise NotImplementedError

def send_scp_message(self, message, connection=None):
"""
Sends an SCP message, without expecting a response.

:param message: The message to send
:type message:
spinnman.messages.scp.abstract_messages.AbstractSCPRequest
:param SCAMPConnection connection:
The connection to use (omit to pick a random one)
:raise SpinnmanTimeoutException:
If there is a timeout before a message is received
:raise SpinnmanInvalidParameterException:
If one of the fields of the received message is invalid
:raise SpinnmanInvalidPacketException:
* If the message is not a recognised packet type
* If a packet is received that is not a valid response
:raise SpinnmanUnsupportedOperationException:
If no connection can send the type of message given
:raise SpinnmanIOException:
If there is an error sending the message or receiving the response
:raise SpinnmanUnexpectedResponseCodeException:
If the response is not one of the expected codes
"""
if connection is None:
connection = self.scamp_connections[random.randint(
0, len(self.scamp_connections) - 1)]
connection.send_scp_request(message)

def is_connected(self, connection=None):
"""
Determines if the board can be contacted via SCAMP
Expand Down
4 changes: 0 additions & 4 deletions spinnman/spalloc/spalloc_scp_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ def receive_scp_response(self, timeout: Optional[float] = 1.0) -> Tuple[
result, sequence = _TWO_SHORTS.unpack_from(data, 10)
return SCPResult(result), sequence, data, 2

@overrides(SCAMPConnection.send_scp_request)
def send_scp_request(self, scp_request: AbstractSCPRequest):
self.send(self.get_scp_data(scp_request))

@overrides(SCAMPConnection.get_scp_data)
def get_scp_data(
self, scp_request: AbstractSCPRequest,
Expand Down
84 changes: 0 additions & 84 deletions unittests/connection_tests/test_udp_connection.py

This file was deleted.

Loading