generator-vfos-io/templates/drivers/empty-driver/files/drivercomponent/driverTemplate.js Diff Switch to side-by-side view
generator/generators
File was removed.
generator/generators/test
File was removed.
generator/generators/test/test-iotoolkit.js to generator-vfos-io/generators/app/templates/drivercomponent/driverTemplate.js
--- a/generator/generators/test/test-iotoolkit.js +++ b/generator-vfos-io/templates/drivers/empty-driver/files/drivercomponent/driverTemplate.js @@ -1,41 +1,29 @@ -const path = require('path'); -const helpers = require('yeoman-test'); -const assert = require('yeoman-assert'); +// Specific driver +// it covers the mappings to specific protocols +// the methods will be used by devices +// require libraries that you are using -describe('vfos-io:app', () => { - describe('Test Driver', () => { - before(done => { - helpers.run(path.join(__dirname, '../app')) - .withOptions({ foo: 'bar' }) // Mock options passed in - .withArguments(['name-x']) // Mock the arguments - .withPrompts({ coffee: false }) // Mock the prompt answers - .on('end', done); - }); +module.exports = function(){ + //attributes and private methods of the driver + // propietaryParameters is a list of string that will be force when creating instances + let propietaryParameters = []; - it('generates a driver', function () { - createDriver().then(function (dir) { - // assert something about the stuff in `dir` - // assert the file exist - }); - }); - describe('Test Driver', () => { - before(done => { - helpers.run(path.join(__dirname, '../app')) - .withOptions({ name: 'project', io_type: 'api' }) // Mock options passed in - .withArguments(['name-x']) // Mock the arguments - .withPrompts({ coffee: false }) // Mock the prompt answers - .on('end', done); - }); - - it('generates an API connector ', function () { - createAPI().then(function (dir) { - // assert something about the stuff in `dir` - // assert the file exist assert.file(['Gruntfile.js', 'app/router.js', 'app/views/main.js']); - // assert the file content exist assert.fileContent('controllers/user.js', /App\.UserController = Ember\.ObjectController\.extend/); - }); - }); - }); - - }); -});+ //methods of a driver + return { + // public API offered by a driver + readSensorData: function(sensorConf, callback){ + let result=0; + //write your code here and return a number + + callback(null, result); + }, + storeSensorData: function(data){ + // receives propietary data and transforms it to agnostic data + // ?? it has to call to specific protocol libraries such as OPC_UA, MQTT, etc + }, + sendCommand: function(command){ + // gets an object to the command and calls a library specific to the protocol to send it + } + } +}