DeviceBuilder
DeviceBuilder copied to clipboard
DeviceBuilder, assemble device swagger representation from oneIOTa resource types.
DeviceBuilder
Description
This Tool has various functions to work with OCF swagger type definitions. The base function of DeviceBuilder is to:
- create a single Swagger2.0 file from OCF swagger type definitions (IoTDataModels, Core,...)
The single Swagger definition file of a full device (application level resources) can be used for:
- code generation (as input of swagger2x)
- generation of the introspection file.
This tool is part of the tool chain.
Table of Contents
-
DeviceBuilder
- Description
- Table of Contents
- Installation
-
Usage
- Flow
- Tool Chain
- Available scripts
- Manual steps
- Individual python tools
Installation
Installation of DeviceBuilder is making a clone of the repository and use the tool relative of where the repository is located on your system. To install the dependencies:
run pip3 install -U -r requirements.txt
to install the dependencies.
The full installation of all tools and repos can be achieved via setup.
Usage
Flow
Typical flow to create an OCF device using DeviceBuilder is:
- Create the input file for the DeviceBuilder
- Determine device type :
- see for list of OCF Devices the Device specification or use the interactive webpage
- choosing an OCF Device Type determines the mandatory resources that has to be implemented.
- Add optional resources to the device:
- This can be any resource described in IoTDataModels or from the Resource Type specification.
- Alternatively one can search interactively
- This can be any resource described in IoTDataModels or from the Resource Type specification.
- Add optional resources to the device:
- Determine device type :
- see for list of OCF Devices the Device specification or use the interactive webpage
- choosing an OCF Device Type determines the mandatory resources that has to be implemented.
- Determine which code generator needs to be used:
- IoTivity-Lite: C code (for Linux, Windows,..)
- Run one of the toolchain scripts
- scripts in the main directory of the DeviceBuilder repo.
- scripts are written in BASH, e.g. requiring a Linux command prompt.
- scripts in the main directory of the DeviceBuilder repo.
Tool Chain
The tool chain script implements the following tool chain to generate code:
The generated code depends on the available code generation templates in swagger2x.
Available scripts
Currently available DeviceBuilder script:
- DeviceBuilder_IotivityLiteServer.sh
- Note: there are more scripts but those will not use IoTivity as stack.
The DeviceBuilder script installs the following components:
- github repos:
- installs needed python (3.5) packages. Note that setup script only works if one has already downloaded/cloned the DeviceBuilder github repo.
Manual steps
Manual steps to build the generated code:
- Download IoTivity
- Edit build files in IoTivity
- see additional instructions that are supplied with generated with the code.
- Build
- Instructions vary according the used platform
- See read me file with the generated code
- Instructions vary according the used platform
- Test against CTT (see additional instructions that are supplied with the generated code)
Individual python tools
The usage of the individual python scripts in this repo can be found here