Hello, I'm bumping this message up to ask again if the core Iotivity team would add a way to introspect Java OcRepresentation properties.
Thanks, Salvatore On Tue, Feb 9, 2016 at 11:08 PM Salvatore Iovene <salvatore at iovene.com> wrote: > Hello, > I?m implementing a Javascript API on top of Iotivity?s Java API. It?s a > Cordova plugin for Android. > > As per API spec (see [1]), the Javascript equivalent of the > OcRepresentation is an object with a list of properties. Due to dynamic > nature of Javascript it would be easier to simply populate the object with > the correct properties, no need for a getter. In fact, the user of the > Javascript library can simply use the language?s native introspection > capabilities to get the list of properties. > > But I cannot populate my Javascript object unless I have access to the > list of keys in the OcRepresentation. Because as I said, I?m not simply > biding the `getValue` method to a higher API layer. > > Would there be any interest in adding a way to introspect the properties > using the Java API, now that at least there?s a use case? :) > > Thanks! > Salvatore > > [1]: > https://github.com/otcshare/iotivity-node/blob/master/spec/iot-js-spec.md > > > > On 09 Feb 2016, at 21:02, Keane, Erich <erich.keane at intel.com> wrote: > > The C++ API definitely has this introspection available. > > I'm guessing it just didn't bubble up to the Java API. > > On Tue, 2016-02-09 at 18:58 +0000, Light, John J wrote: > > Salvatore, > > Short answer: no. An early version of IoTivity provided minimal > introspection, but it was removed. The story is that you should know > what server you are talking to and what it's resources look like and > contain. > > Long answer: the information can be obtained via the C API and > careful coding. The Java API is built on the C++ API, which doesn't > have the information available. > > I argued we need introspection, to no avail. > > John Light > Intel OTC OIC development > > > -----Original Message----- > From: iotivity-dev-bounces at lists.iotivity.org [mailto:iotivity-dev-bo > unces at lists.iotivity.org] On Behalf Of Salvatore Iovene > Sent: Tuesday, February 09, 2016 12:16 AM > To: iotivity-dev <iotivity-dev at lists.iotivity.org> > Subject: [dev] Java API: how can I get a list of the keys in > OcRepresentation? > > Hi, > when I use OcPlatform.getDeviceInfo, I get a callback "onDeviceFound" > with an OcRepresentation as argument. > > Is there a way to iterate all the keys in the OcRepresentation? > > If not, I'm blind as to what's in there, because I don't know what > keys to use with the "getValue" method. > > Thanks! > Salvatore > > > -- > Salvatore Iovene > > Personal website: http://iovene.com/ > Founder of AstroBin: http://astrobin.com/ ___________________________ > ____________________ > iotivity-dev mailing list > iotivity-dev at lists.iotivity.org > https://lists.iotivity.org/mailman/listinfo/iotivity-dev > _______________________________________________ > iotivity-dev mailing list > iotivity-dev at lists.iotivity.org > https://lists.iotivity.org/mailman/listinfo/iotivity-dev > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20160218/e3b5a96b/attachment.html>
