Skip to content

Commit

Permalink
final clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Yakhnin authored and Alex Yakhnin committed Dec 20, 2016
1 parent 6499f08 commit 8d8e561
Showing 1 changed file with 1 addition and 51 deletions.
52 changes: 1 addition & 51 deletions motiondetector.js
Expand Up @@ -20,57 +20,7 @@ Module.register('motiondetector',{
if (notification === "USER_PRESENCE"){
this.sendNotification(notification, payload)
}
},


notificationReceived: function (notification, payload, sender) {

var _this = self;

// if (notification === "DOM_OBJECTS_CREATED") {
// var video = document.createElement('video');
// var cameraPreview = document.createElement("div");
// cameraPreview.id = "cameraPreview";
// cameraPreview.style = "visibility:hidden;"
// cameraPreview.appendChild(video);

// var canvas = document.createElement('canvas');

// DiffCamEngine.init({
// video: video,
// motionCanvas: canvas,
// initSuccessCallback: function () {
// DiffCamEngine.start();
// },
// initErrorCallback: function () {
// console.log('error init cam engine');
// },
// captureCallback: _this.onCapture
// });
// }
},

onCapture: function (payload) {
var _this = this;
var score = payload.score;
if (score > 20) {
_this.lastTimeMotionDetected = new Date();
if (_this.poweredOff) {
_this.poweredOff = false;
_this.sendSocketNotification('MOTION_DETECTED', _this.config);
}
}
else {
var currentDate = new Date();
var time = currentDate.getTime() - _this.lastTimeMotionDetected;
if ((time > _this.config.timeout) && (!_this.poweredOff)) {
_this.sendSocketNotification('DEACTIVATE_MONITOR', _this.config);
_this.sendNotification('DEACTIVATE_MONITOR', _this.config);
_this.poweredOff = true;
}
}
console.log('score:' + score);
},
},

start: function() {
Log.info('Starting module: ' + this.name);
Expand Down

0 comments on commit 8d8e561

Please sign in to comment.