Hi,

The DeviceBuilder is a great tool. Thanks for doing it and sharing the info, 
Wouter. You can generate JavaScript code from the json input file and run it 
with the iotivity-node [1]. That setup should also work on rasberry pi.

For example:

# ./DeviceBuilder_NodeIotivityServer.sh 
./test/input_define_device/input-lightdevice.json ./out3
# iotivity-node out3/code/Server.js

The Server.js exposes all the resources defined in the .json. It is using the 
oneiot.org data models.

Creating an OCF server can’t be easier than that.

Sakari

1 https://github.com/otcshare/iotivity-node


On 11/9/17, 4:35 AM, 
"iotivity-dev-boun...@lists.iotivity.org<mailto:iotivity-dev-boun...@lists.iotivity.org>
 on behalf of Wouter van der Beek (wovander)" 
<iotivity-dev-boun...@lists.iotivity.org<mailto:iotivity-dev-boun...@lists.iotivity.org>
 on behalf of wovan...@cisco.com<mailto:wovan...@cisco.com>> wrote:

Hi Fab,

Please take a look at
https://github.com/openconnectivityfoundation/DeviceBuilder
especially the script
https://github.com/openconnectivityfoundation/DeviceBuilder/blob/master/DeviceBuilder_NodeIotivityServer.sh
this uses
https://github.com/openconnectivityfoundation/swagger2x
to do code generation.
This is not doing C/C++ code yet, but that is in the works…
You can help out by sharing an good example of what needs to be generated.

Kind Regards,
Wouter



From: iotivity-dev-boun...@lists.iotivity.org 
[mailto:iotivity-dev-boun...@lists.iotivity.org] On Behalf Of Fab By via 
iotivity-dev
Sent: 08 November 2017 09:43
To: iotivity-dev@lists.iotivity.org
Subject: [dev] Build Iotivity resources with RAML,Swagger, json files

Hey guys,

I’m working on an iotivity application running on a raspberry pi. I created my 
resources and added values/properties on my server the simple way with 
OCRepresentation::setValue(). But I think the better way to do this is with 
RAML, Swagger or json files, so I can use those files on 
oneiota.org<http://oneiota.org> and my application is more dynamic.

The problem is I can’t find a solution, how to create resources with those 
RAML, Swagger or json files. I read everywhere that it is possible, but how can 
I do this?
I can only find the solution with the Iotivity Simulator, but I don’t want to 
simulate these resources, I want to attach those files to my real application 
and build my resources from those files.

I hope some of you can help me.

Thanks and best regards
Fabian
_______________________________________________
iotivity-dev mailing list
iotivity-dev@lists.iotivity.org
https://lists.iotivity.org/mailman/listinfo/iotivity-dev

Reply via email to