-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathPeople Count.js
32 lines (28 loc) · 1.13 KB
/
People Count.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// DJ Uittenbogaard - [email protected]
// JW Ruys - [email protected]
//
// v0.1 Info: Count maximum people, show notification when >max nr of people in the room
// v0.2 Changed text display method
// v0.3 Moved maxPeople display to alert header
const xapi = require('xapi');
const maxPeople = 2
const alertDuration = 30
console.log('Debug: init - max = '+maxPeople);
// display text on screen - can also be replaced by play-message, show-image, call-security etc
function displayTextOnScreen(header,text) {
xapi.command('UserInterface Message Alert Display', {
Title: header,
Text: text,
Duration: alertDuration,
});
}
// Process updated STATUS data
function postStatusCall(amount) {
console.log('DEBUG - Detected: ' + amount + ', max: ' + maxPeople);
if (amount > maxPeople) {
console.log('DEBUG - Alerting');
displayTextOnScreen("Current room capacity: " + maxPeople, "To comply with social distancing guidelines this room's capacity is limited." )
}
}
// Get dynamic PEOPLE COUNT STATUS updates
xapi.status.on('RoomAnalytics PeopleCount Current', (numberofpeople) => postStatusCall(numberofpeople));