This module wraps the iotivity csdk and provides the basic functions of the csdk to nodejs.
To use:
- have iotivity checked out and built on your system.
- set the environment variable IOTIVITY_HOME to the root of iotivity
- create a node project if you don't have one (npm init).
- npm install --save git+https://github.com/dwarburt/iotivity_wrapper.git
N.B. tested against the plugfest-1 branch.
prereqs: git and node and iotivity installed.
Example
iot = require("iotivity_wrapper");
function handleRequest(req) {
console.log("Got a request for: " + req.resource);
req.params[0] = "Value for p1";
req.respond();
}
console.log("Booting iotivity");
iot.start(handleRequest, "a/genericdevice");