Download this file

driverTemplate.js    29 lines (25 with data), 1.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Specific driver
// it covers the mappings to specific protocols
// the methods will be used by devices
// require libraries that you are using
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 = [];
//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
}
}
}