DeviceBuilder icon indicating copy to clipboard operation
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 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.

Tool Chain

The tool chain script implements the following tool chain to generate code: ToolChain

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:

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)

Individual python tools

The usage of the individual python scripts in this repo can be found here