Ajouter une route pour récupérer l'état actuel de la caméra

This commit is contained in:
2025-04-02 09:28:11 +02:00
parent 293245d457
commit 73922d8afc

View File

@@ -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 {