Difference between revisions of "How to implement a new plugin"
From AMTech WikiDocs
Line 1: | Line 1: | ||
− | |||
− | |||
*Create a thing type XXXThing (See [[Activities#Thing types|Thing types]]) | *Create a thing type XXXThing (See [[Activities#Thing types|Thing types]]) | ||
*Create the observations type the thing XXXThing produces or consumes, example XXXThingObserv1 (See [[Sensor's network#Observations and observation types|Observations and observation types]]) | *Create the observations type the thing XXXThing produces or consumes, example XXXThingObserv1 (See [[Sensor's network#Observations and observation types|Observations and observation types]]) |
Revision as of 19:24, 13 October 2017
- 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;