feat: abstract base classes for endpoints
Introduces EndpointBase and ReceiverBase abstract base classes. Implements a ReceiverBase with the MainReceiver. ref: N25B-168
This commit is contained in:
21
src/robot_interface/endpoints/receiver_base.py
Normal file
21
src/robot_interface/endpoints/receiver_base.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from abc import ABCMeta, abstractmethod
|
||||
|
||||
from robot_interface.endpoints.endpoint_base import EndpointBase
|
||||
|
||||
|
||||
class ReceiverBase(EndpointBase, object):
|
||||
"""Associated with a ZeroMQ socket."""
|
||||
__metaclass__ = ABCMeta
|
||||
|
||||
@abstractmethod
|
||||
def handle_message(self, message):
|
||||
"""
|
||||
Handle a message with the receiver.
|
||||
|
||||
:param message: The message to handle.
|
||||
:type message: dict
|
||||
|
||||
:return: A response message.
|
||||
:rtype: dict
|
||||
"""
|
||||
return {"endpoint": "error", "data": "The requested receiver is not implemented."}
|
||||
Reference in New Issue
Block a user