chore: modified into req reply socket on 5559

This commit is contained in:
JobvAlewijk
2026-01-17 14:01:32 +01:00
parent 4e9afbaaf5
commit 83099a2810
2 changed files with 60 additions and 47 deletions

View File

@@ -37,28 +37,6 @@ class MainReceiver(ReceiverBase):
:rtype: dict[str, str | list[dict]]
"""
return {"endpoint": "ping", "data": message.get("data")}
@staticmethod
def _handle_face(message):
"""
Handles sending face data to the cb
Sends if it sees a face or not
:param message: face data.
:type message: int
:return: A response to CB containing the amount of faces
:rtype: int
"""
# Poll the FaceDetectionSender status
face_sender = next(
(s for s in state.sockets if isinstance(s, FaceDetectionSender)),
None
)
if face_sender:
return {"endpoint": "face", "data": face_sender.face_detected}
else:
return {"endpoint": "face", "data": False}
@staticmethod
@@ -74,12 +52,7 @@ class MainReceiver(ReceiverBase):
:return: A response dictionary with endpoint descriptions as data.
:rtype: dict[str, list[dict]]
"""
endpoints = [
socket.endpoint_description()
for socket in state.sockets
if socket.endpoint_description() is not None
]
endpoints = [socket.endpoint_description() for socket in state.sockets]
return {"endpoint": "negotiate/ports", "data": endpoints}
@@ -115,8 +88,6 @@ class MainReceiver(ReceiverBase):
"""
if message["endpoint"] == "ping":
return self._handle_ping(message)
elif message["endpoint"] == "face":
return self._handle_face(message)
elif message["endpoint"].startswith("negotiate"):
return self._handle_negotiation(message)