Iotivity-node not working
Closed this issue · 7 comments
I installed "ostro-image-swupd-all-intel-quark.dsk.xz" image on my intel galileo and I am not able to run sample code for iotivity-node
const device = require("iotivity-node")("server");
device.register({
id: { path: "/a/temperature" },
resourceTypes: [ "oic.r.temperature" ],
interfaces: [ "oic.if.baseline" ],
discoverable: true,
properties: { temperature: 0}
})
I get TypeError: device.register is not a function
, i can run the same code on my ubuntu machine with iotivity-node@1.1.1-3 .
I am asking this question on ostro-os repo because i am not able to figure out what version of iotivity-node the ostro-os is running.
The package.json
file is missing in /usr/lib/node_modules/iotivity-node
folder, which leads me to believe that there is something wrong with how the package is assembled in the image.
Ostro os v1.0.0 has the old version of iotivity-node v1.0.1-1. The sample code based on the latest version of iotivity-node might be failing on the device due to the API change in iotivity-node versions.
Try with the old API like below:
const device = require("iotivity-node")();
device.configure({role: "server"}).then(
function() {
device.registerResource({
id: { path: "/a/temperature" },
resourceTypes: [ "oic.r.temperature" ],
interfaces: [ "oic.if.baseline" ],
discoverable: true,
properties: { temperature: 0}
})
})
Missing package.json issue has already been fixed in the latest Ostro os code base.
thanks @nagineni , do you plan to update iotivity-node to latest version in ostro os. also do you have any links to api documentation for v1.0.1-1 of iotivity-node.
Labeled as 'help wanted' as this does not look like a bug.
The link of the Ostro OS Download page [1] leads us to the milestone
releases which havn't been updated since May, but the download link [2] in
the quick start guide [3] actually points to the regular builds which
contains images with more recent iotivity and iotivity-node 1.1.0 packages.
Though the current build #497 works for me, do we have plan to label some
of them as milestone releases as they have integrated the newer iotivity
stuffs?
Best Regards,
Tonny
[1] https://ostroproject.org/#downloads
[2] https://download.ostroproject.org/
[3] https://ostroproject.org/documentation/quick_start/quick_start.html
On Wed, Sep 14, 2016 at 2:31 AM, Mikko Ylinen notifications@github.com
wrote:
Labeled as 'help wanted' as this does not look like a bug.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#182 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABroZ-HSgGNJk7AcAOpFC7vBF30wqBQ0ks5qpuwJgaJpZM4J7tNn
.
@KunalSaini We have PRs pending to update to iotivity 1.1.1 and iotivity-node that works with 1.1.1.
Closing.