DeviceBuilder

Usage of the individual tools

Introduction

The tools are programmed in python3.5.

Tools currently available are:

Table of Contents

DeviceBuilder

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.

Swagger file creation from oic/res

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     

For introspection

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:

For code generation 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:

Options needed to run the tool (oic/res response)

Optional options depended on the wanted output

Simplified oic/res response input format

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:

Options needed to run the tool (deviceBuilder)

Implemented DeviceBuilder features

This is about the DeviceBuilder python code.

Per resource (output file per detected and found resource)

Optimizations (introspection)

How it works

swag2cbor

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.

cbor2include

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.