Hi All,
More questions:
- How can I set an RT value for the device with the API?
e.g. oic.d.x in oic/d
I am doing:
OCResourceHandle handle = OCGetResourceHandleAtUri(OC_RSRVD_DEVICE_URI);
if (handle == NULL)
{
std::cout << "Failed to find resource " << OC_RSRVD_DEVICE_URI <<
std::endl;
return result;
}
result = OCBindResourceTypeToResource(handle, gDeviceType.c_str());
if (result != OC_STACK_OK)
{
std::cout << "Failed to add device type" << std::endl;
return result;
}
But CTT shows no rt value that I insert…
Any pointers to solve the questions below?
Kind Regards,
Wouter
From: Wouter van der Beek (wovander)
Sent: 08 December 2017 12:23
To: 'Poussa, Sakari' <[email protected]>; Fab By
<[email protected]>
Cc: [email protected]
Subject: RE: [dev] Build Iotivity resources with RAML,Swagger, json files
Hi,
Finally had some progress this week.
I can create code, build it, and run it on windows, however I do not know if
the actual code is working.
Next problem: if I have an server, how can I talk to it?
Most examples in IOTivity has an dedicated client that can talk to that
specific server example.
Is there an generic client (on windows) that can be used?
Other (code/knowledge) issues:
- Setting/retrieving values from an request/response is working for
Boolean and integer how are floats, arrays of floats/ints handled?
o Currently floats/arrays are disabled…
- How are interfaces handled?
o No code to handle interfaces
- How can introspection be added?
o I can create an introspection file, but I do not understand how this is
done from stack point of view.
- How can I enable security?
o E.g. what code I need to add.
ð The stack is enabled with security, and I see the flag that needs inserted…
ð But what about the default security file, and what is the contents of that
file?
- What is the windows compile flag to include windows specific code?
- How to deal with observe request..
o What do I need to enable?
ð I have added the flag on the creation of the resource.
ð Is the function
ð sResult = OCPlatform::notifyListOfObservers( m_resourceHandle,
ð
m_interestedObservers,
ð
pResponse);
ð Blocking or is it running in an thread, e.g. should not be used directly in
an entity handler (which is an callback on an request)
When these questions are answered I will create an devicebuilder script so that
one can specify a device and generate the code + introspection, etc for it.
Attached is an example that gets generated when running swagger2x with the
C++IotivityServer template.
The readme also explains what I did to hack into the compile system to get it
compiling under windows
Kind Regards,
Wouter
From: Poussa, Sakari [mailto:[email protected]]
Sent: 24 November 2017 12:02
To: Wouter van der Beek (wovander)
<[email protected]<mailto:[email protected]>>; Fab By
<[email protected]<mailto:[email protected]>>
Cc: [email protected]<mailto:[email protected]>
Subject: Re: [dev] Build Iotivity resources with RAML,Swagger, json files
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,
"[email protected]<mailto:[email protected]>
on behalf of Wouter van der Beek (wovander)"
<[email protected]<mailto:[email protected]>
on behalf of [email protected]<mailto:[email protected]>> 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:
[email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Fab By via
iotivity-dev
Sent: 08 November 2017 09:43
To: [email protected]<mailto:[email protected]>
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
[email protected]
https://lists.iotivity.org/mailman/listinfo/iotivity-dev