From 73922d8afca63f59c30f13417b87ec1a0eb5e920 Mon Sep 17 00:00:00 2001 From: Kerboul Date: Wed, 2 Apr 2025 09:28:11 +0200 Subject: [PATCH] =?UTF-8?q?Ajouter=20une=20route=20pour=20r=C3=A9cup=C3=A9?= =?UTF-8?q?rer=20l'=C3=A9tat=20actuel=20de=20la=20cam=C3=A9ra?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/cameraRoutes.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/routes/cameraRoutes.js b/routes/cameraRoutes.js index 237dc1f..7e3b92e 100644 --- a/routes/cameraRoutes.js +++ b/routes/cameraRoutes.js @@ -97,6 +97,46 @@ function isCameraOccupied() { initCamera(); printCameraStatus(); +/** + * @swagger + * /camera/status: + * get: + * summary: Get the current status of the camera + * tags: + * - Camera + * responses: + * 200: + * description: Successfully retrieved the camera status + * content: + * application/json: + * schema: + * type: object + * properties: + * captureInterval: + * type: integer + * description: Capture interval in minutes + * captureProjectID: + * type: integer + * description: ID of the project currently being captured + * captureStatus: + * type: integer + * description: Capture status (0 = stopped, 1 = ongoing) + * maintenance: + * type: integer + * description: Maintenance status (0 = none, 1 = ongoing) + * 500: + * description: Internal server error + */ +router.get('/camera/status', async (req, res) => { + try { + const cameraStatus = getCamera(); + res.status(200).json(cameraStatus); + } catch (err) { + serverError.sendError('Erreur lors de la récupération de l\'état de la caméra:', res, err, 500); + } +} +); + router.post('/procedure/start/', async (req, res) => { const { projectId, interval } = req.body; try {