1 | var Scout = require('zetta-scout');
|
2 | var util = require('util');
|
3 |
|
4 | var HTTPScout = module.exports = function() {
|
5 | this.driverFunctions = {};
|
6 | Scout.call(this);
|
7 | };
|
8 | util.inherits(HTTPScout, Scout);
|
9 |
|
10 | HTTPScout.prototype.init = function(next) {
|
11 | next();
|
12 | };
|
13 |
|
14 | HTTPScout.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 |
|