/
node_helper.js
37 lines (35 loc) · 1.07 KB
/
node_helper.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
33
34
35
36
37
/******************************
* node_helper for EXT-Motion *
* BuGsounet ©03/24 *
*******************************/
var log = (...args) => { /* do nothing */ };
const NodeHelper = require("node_helper");
module.exports = NodeHelper.create({
socketNotificationReceived (notification, payload) {
switch(notification) {
case "INIT":
this.config = payload;
if (this.config.debug) log = (...args) => { console.log("[MOTION]", ...args); };
console.log("[MOTION] EXT-Motion Version:", require("./package.json").version, "rev:", require("./package.json").rev);
break;
case "INITIALIZED":
log("Initialized!");
break;
case "DETECTED":
log("Detected Motion, score:", payload);
break;
case "STARTED":
log("Started!");
break;
case "STOPPED":
log("Stopped!");
break;
case "DESTROYED":
log("Destroyed!");
break;
case "ERROR":
console.error(`[MOTION] DiffCamEngine initialize failed: ${ payload}`);
break;
}
}
});