UNPKG

node-red-contrib-iot-virtual-device

Version:

A set of nodes to help you create simulated IoT devices connected to IBM Watson IoT Platform.

42 lines (35 loc) 1.16 kB
/** * Copyright 2014, 2015, 2016 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. **/ module.exports = function(RED) { // "use strict"; var deviceManager = require('./lib/deviceManager.js'); deviceManager(RED); /* * Device Schema configuration node */ function deviceSchema(n){ RED.nodes.createNode(this, n); var node = this; this.deviceType = n.deviceType; this.evts = n.evts; this.props = n.props; deviceManager.addSchema(this); this.on("close", function() { deviceManager.removeSchema(node); }); } RED.nodes.registerType("Device Schema", deviceSchema); };