How to implement a new plugin
From AMTech WikiDocs
- Clone git repository (https://github.com/AMTechMX/M2MBridge.git)
- at /.../M2MBridge/plugins create a directory that matched with the Thing type name to bridge example SNMPDevice (See Thing types)
- Create a thing type XXXThing (See Thing types)
- Create the observations type the thing XXXThing produces or consumes, example XXXThingObserv1 (See Observations and observation types)
- Associate the observation XXXThingObserv1 type to the XXXThing
- Implement a nodejs module with the following interface
function XXXThing() {
}
XXXThing.prototype.start = function ( complete) {
try {
complete(null);
} catch (e) {
complete(e);
}
};
XXXThing.prototype.stop = function (complete) {
try {
complete(null);
} catch (e) {
complete(e);
}
};
XXXThing.prototype.command = function (observation, complete) {
try {
complete(null);
} catch (e) {
complete(e);
}
};
module.exports.XXXThing = XXXThing;