[L4] Remove excessive library import and clean up edge codebase

This commit is contained in:
2026-03-24 13:58:32 +02:00
parent 1b42be264d
commit a8e50d0386
3 changed files with 10 additions and 50 deletions

View File

@@ -52,27 +52,5 @@ class AgentMQTTAdapter(AgentGateway):
self.client.on_message = self.on_message
self.client.connect(self.broker_host, self.broker_port, 60)
def start(self):
self.client.loop_start()
def stop(self):
self.client.loop_stop()
# Usage example:
if __name__ == "__main__":
broker_host = "localhost"
broker_port = 1883
topic = "agent_data_topic"
# Assuming you have implemented the StoreGateway and passed it to the adapter
store_gateway = HubGateway()
adapter = AgentMQTTAdapter(broker_host, broker_port, topic, store_gateway)
adapter.connect()
adapter.start()
try:
# Keep the adapter running in the background
while True:
pass
except KeyboardInterrupt:
adapter.stop()
logging.info("Adapter stopped.")
def loop_forever(self):
self.client.loop_forever()

View File

@@ -26,15 +26,8 @@ class AgentGateway(ABC):
pass
@abstractmethod
def start(self):
def loop_forever(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.
Method to await for new messages.
"""
pass