Ajouter une route pour récupérer l'état actuel de la caméra
This commit is contained in:
@@ -97,6 +97,46 @@ function isCameraOccupied() {
|
|||||||
initCamera();
|
initCamera();
|
||||||
printCameraStatus();
|
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) => {
|
router.post('/procedure/start/', async (req, res) => {
|
||||||
const { projectId, interval } = req.body;
|
const { projectId, interval } = req.body;
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user