Hi Max,

  Yes, developers should use only CBOR-encoded introspection data.  They may 
use the json2cbor utility which support swagger files as well.  The reason is 
that on small devices that have storage restrictions, CBOR file is much smaller 
than the JSON file and if it is static, spending time converting it at run time 
using more memory and processor time for every request does not make sense.  
For devices that update introspection on the fly, they should do so using CBOR 
natively to update their CBOR payloads.  There is no reason to convert it 
to/from JSON if the client/server support working with CBOR natively.

I am working on a client sample that uses direct calls via CoAP stack to 
retrieve the payload.  It is not ready to be pushed to gerrit yet.  I have 
considered a new API that would allow retrieval of introspection payload, but 
that requires more investment than I can make right now.  An API like this also 
has other implications such as needing HTTP support in IoTivity since other 
implementations of OCF might host their payload on a HTTP server in which case 
the API has to retrieve it using HTTP and not CoAP.

Thanks,
Sri

From: Max Kholmyansky [mailto:max...@gmail.com]
Sent: Thursday, October 5, 2017 12:30 PM
To: Srikrishna Gurugubelli <srikg...@microsoft.com>; Nash, George 
<george.n...@intel.com>; IoTivity Developer List 
<iotivity-dev@lists.iotivity.org>
Subject: Re: [dev] Adding introspection to samples

Hello Srikrishna (and colleagues):

Do you mean that the application developers should expose CBOR-encoded 
introspection data?
Why cannot the APIs support Swagger format (i.e. JSON), and the encoding will 
be done by the infrastructure?

I understand there is 'json2cbor' utility built in Linux secure build, is it 
intended to be used for Swagger data as well? Does it support Swagger?

Another consideration: developers may need to update per-device introspection 
information "on the fly" (for example, resources may be added or removed, and 
this should be reflected). So it may not be a one-time conversion to CBOR.

Re: samples, I think we should provide the client code actually retrieving the 
server introspection data, in a prasable format.
In this context, I wasn't able to figure out how to do that, so I opened this 
issue in JIRA:
https://jira.iotivity.org/browse/IOT-2498
<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fjira.iotivity.org%2Fbrowse%2FIOT-2498&data=02%7C01%7Csrikguru%40microsoft.com%7Cce9ce92e54c14eda0ee508d50c277fb0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636428286138562940&sdata=fjQzO6sTqmyEd3qtmloIYyHE3rirnaZkSS9yqP7GwjE%3D&reserved=0>
May be there is a solution for this already? Or we need to enhance the APIs, 
and not just to provide the sample code?

Best regards,

Max





On Thu, Oct 5, 2017 at 9:37 PM, Srikrishna Gurugubelli via iotivity-dev 
<iotivity-dev@lists.iotivity.org<mailto:iotivity-dev@lists.iotivity.org>> wrote:
Yes, all introspection data should be cbor encoded.  If there is a place where 
json file is returned, it is a bug.

From: 
iotivity-dev-boun...@lists.iotivity.org<mailto:iotivity-dev-boun...@lists.iotivity.org>
 
[mailto:iotivity-dev-boun...@lists.iotivity.org<mailto:iotivity-dev-boun...@lists.iotivity.org>]
 On Behalf Of Nash, George
Sent: Thursday, October 5, 2017 10:51 AM
To: Nash, George <george.n...@intel.com<mailto:george.n...@intel.com>>; 
IoTivity Developer List 
<iotivity-dev@lists.iotivity.org<mailto:iotivity-dev@lists.iotivity.org>>
Subject: Re: [dev] Adding introspection to samples

I did not see my typo yesterday.

That should be `light_introspection.json` not `light_intropection.java` sorry 
for confusion.


One sample is using the json file the other is using the cbor file. As Mats 
pointed out to me in a direct email the spec apparently says.



"suitable encoding as defined in OCF Core Specification"


From: 
iotivity-dev-boun...@lists.iotivity.org<mailto:iotivity-dev-boun...@lists.iotivity.org>
 [mailto:iotivity-dev-boun...@lists.iotivity.org] On Behalf Of Nash, George
Sent: Wednesday, October 4, 2017 4:33 PM
To: IoTivity Developer List 
<iotivity-dev@lists.iotivity.org<mailto:iotivity-dev@lists.iotivity.org>>
Subject: [dev] Adding introspection to samples

I am looking at adding Introspection to Java see IOT-2773 
(https://jira.iotivity.org/browse/IOT-2773<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fjira.iotivity.org%2Fbrowse%2FIOT-2773&data=02%7C01%7Csrikguru%40microsoft.com%7C6c63f5a75e9149a46f1108d50c19a09f%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636428226641237401&sdata=6LqNVppx9i%2F%2B0fXrzbiuyLAPX0sUqgO0OzC6tozYk6w%3D&reserved=0>)

The CPP samples that add introspection are inconsistent:

In the lightserver.cpp example the ‘light_introspection.dat’ is returned for 
the introspect request
In the simpleserver.cpp example the ‘light_instrospection.java’ is returned for 
the introspect request.

I thought that introspect requests returned CBOR formatted files so I think the 
lightserver.cpp sample is the correct one. Could anyone verify this for me?

Thanks,

George


_______________________________________________
iotivity-dev mailing list
iotivity-dev@lists.iotivity.org<mailto:iotivity-dev@lists.iotivity.org>
https://lists.iotivity.org/mailman/listinfo/iotivity-dev<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.iotivity.org%2Fmailman%2Flistinfo%2Fiotivity-dev&data=02%7C01%7Csrikguru%40microsoft.com%7Cce9ce92e54c14eda0ee508d50c277fb0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636428286138562940&sdata=QkYTIUf0f%2BJi%2BFopaBuW%2B5rVCc6wG51YbrRVBUuwXHA%3D&reserved=0>

_______________________________________________
iotivity-dev mailing list
iotivity-dev@lists.iotivity.org
https://lists.iotivity.org/mailman/listinfo/iotivity-dev

Reply via email to