Skip to content
Snippets Groups Projects
Verified Commit 6b58e90e authored by Erick Hitter's avatar Erick Hitter
Browse files

Disconnect endpoint

parent 9d433092
Branches
No related tags found
No related merge requests found
...@@ -110,6 +110,21 @@ app.get( '/api/:lock_action(lock|unlock)/:lock_name', cache( '5 seconds' ), func ...@@ -110,6 +110,21 @@ app.get( '/api/:lock_action(lock|unlock)/:lock_name', cache( '5 seconds' ), func
} ); } );
} ); } );
// Endpoint to disconnect a lock's BLE connections
app.get( '/api/disconnect/:lock_name', function( req, res ) {
// Parse allowed request arguments
var lock = app.get( 'lock' + req.params.lock_name );
if ( ! lock ) {
clear_caches( req.params.lock_name );
res.sendStatus( 400 );
return;
}
lock.disconnect();
clear_caches( req.params.lock_name );
res.sendStatus( 204 );
} );
// Convert named status to integer representation // Convert named status to integer representation
function statusStringtoInt( status ) { function statusStringtoInt( status ) {
var statusInt = -1; var statusInt = -1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment