Files
DRB-CnC/Client/routes/radio.js
2023-05-20 14:31:43 -04:00

31 lines
1.1 KiB
JavaScript

// Controllers
const radioController = require("../controllers/radioController");
// Debug
const { DebugBuilder } = require("../utilities/debugBuilder.js");
const log = new DebugBuilder("client", "clientController");
// Modules
const express = require('express');
const router = express.Router();
/**
* POST Open a new radio session
* This will open OP25 to the current specified radio settings
*/
router.post('/start', radioController.openRadioSession);
/**
* POST Close the current radio session
* Response from the radio: 200: closed; 204: not connected
*/
router.post('/stop', radioController.closeRadioSession);
/** POST change current radio preset
* This will change the bot to the preset specified (if different from what is currently playing)
* @param req The request sent from the master
* @param {string} req.body.presetName The name of the system to be updated
* The status of the bot: 200 = no change, 202 = changed successfully, 500 + JSON = encountered error
* @returns status
*/
router.post('/changeConfig', radioController.changeCurrentConfig);
module.exports = router;