Integrate detection service

This commit is contained in:
2025-12-31 12:15:59 +01:00
parent 98c4aeeba1
commit 01594d02ed
6 changed files with 109 additions and 35 deletions

View File

@@ -9,6 +9,7 @@ from hardware.rfid.reader import RfidReader
from services.clock_service import ClockService
from services.detection_service import DetectionService
from services.forwarder_service import ForwarderService
from services.game_service import GameService
from services.mqtt_service import MQTTService
load_dotenv()
@@ -30,9 +31,6 @@ app = Flask(__name__)
rfid_reader = RfidReader("/dev/serial0", 9600)
light_sensor_reader = LoraLightSensorReader("/dev/ttyUSB1", 9600)
detection_service = DetectionService()
clock_service = ClockService()
local_broker = MQTTService(
local_broker_address,
local_broker_port,
@@ -50,6 +48,7 @@ api_broker = MQTTService(
)
forward_service = ForwarderService(local_broker, api_broker)
game_service = GameService()
@app.route("/command/party/start", methods=['POST'])
def start_party():
@@ -61,9 +60,9 @@ def start_party():
return jsonify({"status": "error", "message": f"An error occurred : {e}"}), 500
@app.route("/command/party/play", methods=['POST'])
def party_play():
def make_move():
try:
print("Move received started!")
game_service.make_move()
return jsonify({"status": "ok", "message": "Party started"}), 200
except Exception as ex:
print(e)
@@ -84,7 +83,6 @@ if __name__ == "__main__":
rfid_reader.start()
light_sensor_reader.start()
clock_service.start(600, 0)
print("App started...")
app.run(host="0.0.0.0", port=5000, debug=False)