add: edge template

This commit is contained in:
Toolf
2024-02-12 18:21:08 +02:00
parent 173a61d117
commit 9a179e09e9
12 changed files with 398 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
from abc import ABC, abstractmethod
class AgentGateway(ABC):
"""
Abstract class representing the Agent Gateway interface.
All agent gateway adapters must implement these methods.
"""
@abstractmethod
def on_message(self, client, userdata, msg):
"""
Method to handle incoming messages from the agent.
Parameters:
client: MQTT client instance.
userdata: Any additional user data passed to the MQTT client.
msg: The MQTT message received from the agent.
"""
pass
@abstractmethod
def connect(self):
"""
Method to establish a connection to the agent.
"""
pass
@abstractmethod
def start(self):
"""
Method to start listening for messages from the agent.
"""
pass
@abstractmethod
def stop(self):
"""
Method to stop the agent gateway and clean up resources.
"""
pass

View File

@@ -0,0 +1,20 @@
from abc import ABC, abstractmethod
from app.entities.processed_agent_data import ProcessedAgentData
class HubGateway(ABC):
"""
Abstract class representing the Store Gateway interface.
All store gateway adapters must implement these methods.
"""
@abstractmethod
def save_data(self, processed_data: ProcessedAgentData) -> bool:
"""
Method to save the processed agent data in the database.
Parameters:
processed_data (ProcessedAgentData): The processed agent data to be saved.
Returns:
bool: True if the data is successfully saved, False otherwise.
"""
pass