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 {