The tools are programmed in python3.5.
Tools currently available are:
run the tool(s) from the commandline in the src directory (DeviceBuilder):
python3 DeviceBuilder.py -h
Running the above command lists all command line options available.
Running DeviceBuilder gives the 2 swagger files:
Tool chain:
__________
| |
| oneIOTa |
|__________|
|
resource|descriptions
|
_______v________ ___________ _______________
oic/res | | introspection data(swagger.json) | | cbor | |
description | |--------------------------------->| swag2cbor | ------->| |
--------------->| DeviceBuilder | ___________ |___________| | actual device |
| | code | | | |
| |---------->| /dev/null | | |
|________________| data |___________| |_______________|
(swagger)
Note that swag2cbor is only needed if the device read cbor as introspection format and not the swagger.json
create introspection file from an oic/res (json) input file. The oic/res file can be used “as is” from an implementation. This swagger data:
create code generation file from an oic/res (json) input file. The oic/res file can be used “as is” from an implementation. This swagger data includes:
The advantage of this input format is:
The simple input format
is an stripped down version of oic/res json file.
It still has all needed data to create an introspection file.
The intention is that if you do not have an implementation yet, this file format can be used to create an introspection file.
see for example: input/binaryswitch-brightness-minimal.json
where it differs from oic/res json file:
note that the generation works for:
This is about the DeviceBuilder python code.
Per resource (output file per detected and found resource)
This tool converts swagger (e.g. read json) into cbor. also the tool can convert the cbor back to json.
python3 swag2cbor.py -h
Running the above command lists all command line options available.
This tool converts cbor (e.g. a binary file) into a c-style include file. The binary data is presented as a array with hex values. This file can be included in C/C++ code. The name of the output file is “<inputfilename>.h” e.g. suffixed with “.h”
python3 cbor2include.py -h
Running the above command lists all command line options available.