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
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:
- Determine which code generator needs to be used:
- 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.
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
- C code generation for the IoTivity stack in C.
- see for details here
- usage :
see here for examples of the DeviceBuilder input format and command line options.
- 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
- Test against CTT (see additional instructions that are supplied with the generated code)
The usage of the individual python scripts in this repo can be found here