UNPKG

683 BJavaScriptView Raw
1var Scout = require('zetta-scout');
2var util = require('util');
3
4var HTTPScout = module.exports = function() {
5 this.driverFunctions = {};
6 Scout.call(this);
7};
8util.inherits(HTTPScout, Scout);
9
10HTTPScout.prototype.init = function(next) {
11 next();
12};
13
14HTTPScout.prototype.createHTTPDevice = function(type, id, name) {
15 var constructor = this.driverFunctions[type];
16 var deviceObject = { id: id, name: name};
17 if(constructor) {
18 if(id) {
19 this.provision(deviceObject, constructor);
20 } else {
21 this.discover(constructor, arguments);
22 }
23 return true;
24 } else {
25 this.server.log('Constructor for type: ' + type + ' not found.');
26 return false;
27 }
28};
29