Scripts that are intended for usage after initial setup or more info of the internals.
Typical folder layout to start from (e.g. create the iot folder in the home folder)
~/iot
clone in this folder:
git clone https://github.com/openconnectivity/IOTivity-setup.git
This command will give the next folder structure :
~/iot
|-IOTivity-setup
From the IOTivity-setup folder run the scripts (in order):
- install_IOTivity.sh (1.3.1) or install_IOTivity2.0.sh (2.0.0)
- install_DeviceBuilder.sh
- install_MRAA.sh
e.g. exectute in the ~/IOT/IOTivity-setup folder: sh install_<>.sh
The update_repos.sh script updates the:
- tooling repos
- datamodels repos
The script does NOT update the code repos:
- iotivity
- mraa The code repo iotivity is pulled at start up with a specific version. To get a fresh copy, delete the folder and rerun the install_IOTivity.sh script.
svr2cbor.sh
This script is run once during setup by install_DeviceBuilder.sh. It converts the SVR-OCF1.3-Server.json security json file into cbor. This file contains the default settings for the SVRs for an OCF1.3 device.
When running the script the result (server_security.dat) will be placed in ../device_output/code. The script can also be used to convert the ../device_output/code/server_security.dat file back to json. When converting the dat back to json the result will be placed ../device_output/code/server_security.dat.json (appending .json). This is done to avoid overwriting the default SVR settings.
Note that one has to edit the SVR-OCF1.3-Server.json to get a different file installed.
The commands to do the conversions: (to be excuted in the IOTivity-setup folder)
to convert SVR-OCF1.3-Server.json to cbor: sh svr2cbor.sh tocbor
to convert ../device_output/code/security.dat to json: sh svr2cbor.sh tojson
action per script
script | source | action | destination |
---|---|---|---|
install_DeviceBuilder.sh | IOTivity-setup/SVR-OCF1.3-Server.json | NA (convert disabled) | ../device_output/code/server_security.dat |
install_DeviceBuilder.sh | ../iotivity/resource/csdk/security/provisioning/sample/oic_svr_db_server_justworks.dat | copy | ../device_output/code/server_security.dat |
install_DeviceBuilder.sh | ../device_output/code/server_security.dat | copy | ../device_output/code/server_security.dat |
gen.sh | ../device_output/code/server_security.dat | copy | ../iotivity/out/linux/${ARCH}/release/examples/${code_path}/server_security.dat |
reset.sh | cbor conversion for IOTivity Security | https://github.com/alshafi/iotivity-tool.git | |
svr2cbor.sh tocbor | IOTivity-setup/SVR-OCF1.3-Server.json | converts | ../device_output/code/server_security.dat |
svr2cbor.sh tojson | ../device_output/code/server_security.dat | converts | ../device_output/code/server_security.dat.json |
more info about security:
more about provisioning
https://github.com/iotivity/iotivity/tree/master/resource/csdk/security/provisioning
security sample files:
https://github.com/iotivity/iotivity/tree/master/resource/csdk/security/provisioning/sample
SConstruct
Sconstruct is the main build file. An addition is made to add the example/OCFDeviceBuilder target.
SConscript
The scon script to build the (generated) server it the folder:
iotivity/examples/OCFDeviceBuilder
This build script will:
- have all includes to build the C++ server code
- MRAA linkage