How to implement a new plugin

From AMTech WikiDocs
Revision as of 19:14, 23 April 2016 by Carlos (Talk | contribs) (Created page with "*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 SNMPDe...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
  • 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 XXXDevice (See Thing types)
  • Create the observations type the thing XXXDevice produces or consumes, example XXXDeviceObserv1 (See Observations and observation types)
  • Associate the observation XXXDeviceObserv1 type to the XXXDevice
  • 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;