User Tools

Site Tools


webos

webOS OSE build instructions

This section explains the steps to build the IoTivity project for webOS OSE (Open Source Edition). webOS OSE 1.0 has been released to the public on 18 March, 2018. It offers a strong development environment that enables easy collaboration with other platform developers, as well as distinctive built-in user features. For more information on webOS OSE can be found here:

Please note that webOS OSE includes IoTivity and iotivity-node (current version 1.2.1). Below instruction can be used to apply the other available versions (1.3.1 and master) of IoTivity to your webOS OSE device.

Prerequisites for building IoTivity for webOS

  • Ubuntu 14.04 (64 bit) or higher
  • webOS OSE build system 1.0 or later. For installation instructions, please refer to http://webosose.org/discover/setting/building-webos-ose/
  • Target device: Raspberry Pi 3
    • To test sample app and service on Raspberry Pi 3, we recommend that you prepare the following set of hardware and peripherals.
      • microSD card (8 GB or larger) and microSD card reader device
      • HDMI-compliant monitor and cable
      • Input devices such as a keyboard and a mouse
      • Ethernet cable and internet connection

Build Instructions

Step 1: Build and Flash the webOS OSE

Set up a webOS OSE build as explained at:

Next, flash the build image to your Raspberry Pi 3 by the webOS flash instruction:

After going through webOS OSE build and flash instruction, you are ready to start building IoTivity and iotivity-node.

In the rest of the section,

  • ${ROOT_PATH_OF_YOUR_WEBOS_BUILD} refers to “${YOUR_HOME}/build-webos”.
  • ${ROOT_PATH_OF_YOUR_IOTIVITY_LOCAL_SRC} refers to “${YOUR_HOME}/iotivity”.

Step 2: Add IoTivity recipe and patches in the webOS build layer

webOS OSE uses OpenEmbedded build system to support a wide range of platform architectures easily. Here is a list of available IoTivity recipes and patches for webOS OSE (click the link to download):

Copy the downloaded file to your webOS build root directory.

$ cp iotivity_<version>_for_webos.tar.gz ${ROOT_PATH_OF_YOUR_WEBOS_BUILD}
$ tar xvfz iotivity_<version>_for_webos.tar.gz

Step 2.1: Set up build environment to build upstream master branch

Check out the upstream master branch.

$ cd ${YOUR_HOME}
$ git clone ssh://gerrit.iotivity.org:29418/iotivity

Fetch other build dependencies.

$ cd ${ROOT_PATH_OF_YOUR_IOTIVITY_LOCAL_SRC}
$ git clone https://github.com/intel/tinycbor.git extlibs/tinycbor/tinycbor -b v0.5.1
$ git clone https://github.com/ARMmbed/mbedtls.git extlibs/mbedtls/mbedtls -b mbedtls-2.4.2

Create webos-local.conf in your build root for building local source.

$ cd {ROOT_PATH_OF_YOUR_WEBOS_BUILD}
$ vi webos-local.conf
INHERIT += "externalsrc"
 
EXTERNALSRC_pn-iotivity = "${ROOT_PATH_OF_YOUR_IOTIVITY_SOURCE}/"
EXTERNALSRC_BUILD_pn-iotivity = "${ROOT_PATH_OF_YOUR_IOTIVITY_SOURCE}/"

Get the checksum of LICENSE.md.

$ cd ${ROOT_PATH_OF_YOUR_IOTIVITY_LOCAL_SRC}
$ md5sum LICENSE.md
86d3f3a95c324c9479bd8986968f4327 LICENSE.md

Update LIC_FILES_CHKSUM value with the checksum of master branch in IoTivity recipe (.bb) of ${ROOT_PATH_OF_YOUR_WEBOS_BUILD}/meta-webosose/meta-webos/recipes-core/iotivity/ directory, as follows:

$ SECTION = "libs"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE.md;md5=86d3f3a95c324c9479bd8986968f4327"

Fix the install source path according to latest folder structure

$ cd {ROOT_PATH_OF_YOUR_WEBOS_BUILD}
$ sed -i 's/release\/include/release\/deploy\/include/g' meta-webosose/meta-webos/recipes-core/iotivity/iotivity_1.3.1.bb

Step 3: Build IoTivity for webOS

Trigger the build by executing below commands.

$ cd ${ROOT_PATH_OF_YOUR_WEBOS_BUILD}
$ source oe-init-build-env
$ bitbake iotivity -c cleanall;bitbake iotivity
$ bitbake iotivity-node -c cleanall;bitbake iotivity-node

Upon successful execution of above commands, resource library and sample applications archived as ipk extension will be generated at the path below.

IoTivity resource library:
<ROOT_PATH_OF_YOUR_WEBOS_BUILD>/BUILD/work/raspberrypi3-webos-linux-gnueabi/iotivity/<version>-<PN>/deploy-ipks/raspberrypi3/iotivity-resource_
<version>-<PN>_raspberrypi3.ipk

iotivity-node add-ons:
<ROOT_PATH_OF_YOUR_WEBOS_BUILD>/BUILD/work/raspberrypi3-webos-linux-gnueabi/iotivity-node/<version>-<PN>/deploy-ipks/raspberrypi3/iotivity-node_
<version>-<PN>_raspberrypi3.ipk

webOS sample native application:
<ROOT_PATH_OF_YOUR_WEBOS_BUILD>/BUILD/work/raspberrypi3-webos-linux-gnueabi/iotivity/<version>-<PN>/deploy-ipks/raspberrypi3/iotivity-resource-samples_
<version>-<PN>_raspberrypi3.ipk

webOS sample web application:
<ROOT_PATH_OF_YOUR_WEBOS_BUILD>/BUILD/work/raspberrypi3-webos-linux-gnueabi/iotivity/<version>-<PN>/deploy-ipks/raspberrypi3/iotivity-node-app_
<version>-<PN>_raspberrypi3.ipk 

Step 4: Install IoTivity to webOS device

Copy the generated ipk packages to Raspberry Pi 3 device where webOS OSE is flashed.

$ scp iotivity-resource_<version>-<PN>_raspberrypi3.ipk iotivity-node_<version>-<PN>_raspberrypi3.ipk iotivity-resource-samples_<version>-<PN>_raspberrypi3.ipk iotivity-node-app_<version>-<PN>_raspberrypi3.ipk root@<IP_OF_YOUR_RASPBERRYPI_DEVICE>:/home 

Install the ipk packages.

$ ssh root@<IP_OF_YOUR_RASPBERRYPI_DEVICE>
# cd /home
# opkg install iotivity-resource_<version>-<PN>_raspberrypi3.ipk
# opkg install iotivity-resource-samples_<version>-<PN>_raspberrypi3.ipk
# opkg install iotivity-node-app_<version>-<PN>_raspberrypi3.ipk
# opkg install iotivity-node_<version>-<PN>_raspberrypi3.ipk
# reboot 

ipk will be installed under:

  • IoTivity resource library: /usr/lib
  • iotivity-node add-ons: /usr/lib/node_modules/iotivity-node
  • webOS sample native application
    • /usr/palm/services/org.ocf.webossample.ocserverbasicops
    • /usr/palm/services/org.ocf.webossample.occlientbasicops
    • /user/palm/services/org.ocf.webossample.ocserver
    • /user/palm/services/org.ocf.webossample.occlient
  • webOS sample web application: /usr/palm/applications/com.example.app.iotivity

webOS Sample Apps

Execute sample native app (Secured)

Open the webOS log by below commands. (In below command, OCSERVERBASICOPS & OCCLIENTBASICSOPS is the log context of sample app)

# tail -F /var/log/messages | egrep 'OCSERVERBASICOPS|OCCLIENTBASICOPS'

Execute the server app by below commands.

# cd /usr/palm/services/org.ocf.webossample.ocserverbasicops
# ./ocserverbasicops [For Server sample]

Below message indicates that server runs successfully.

user.info ocserverbasicops [] OCSERVERBASICOPS ocserverbasicops {} OCServer is starting...
user.info ocserverbasicops [] OCSERVERBASICOPS ocserverbasicops {} Created LED resource with result: OC_STACK_OK
user.info ocserverbasicops [] OCSERVERBASICOPS ocserverbasicops {} Entering ocserver main loop...
user.info ocserverbasicops [] OCSERVERBASICOPS ocserverbasicops {} Entering serverStarter main loop...

In another terminal, execute the client app by below commands.

# cd /usr/palm/services/org.ocf/webossample.occlientbasicops

# ./occlientbasicops

Usage : occlient -u <0|1> -t <1|2|3> -c <0|1>
-u <0|1> : Perform multicast/unicast discovery of resources
-t 1 : Discover Resources
-t 2 : Discover Resources and Initiate Nonconfirmable Get/Put/Post Requests
-t 3 : Discover Resources and Initiate Confirmable Get/Put/Post Requests
-c 0 : Default auto-selection
-c 1 : IP Connectivity Type
-d 0 : Client as Non Device Owner
-d 1 : Client as Device Owner
-p 0 : Use UDP protocol
-p 1 : Use TCP protocol

# ./occlientbasicops -t 2 [For Client sample]

Completion of 'GET', 'PUT', and 'POST' query successfully indicates success!

user.info occlientbasicops [] OCCLIENTBASICOPS occlientbasicops {} StackResult: OC_STACK_OK
user.info occlientbasicops [] OCCLIENTBASICOPS occlientbasicops {} SEQUENCE NUMBER: 16777216
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {} Payload Type: Representation
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}     Resource #1
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}     URI:/a/led
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}     Values:
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}         state(bool):false
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}         power(int):0
user.info occlientbasicops [] OCCLIENTBASICOPS occlientbasicops {} =============> Get Response
user.info occlientbasicops [] OCCLIENTBASICOPS occlientbasicops {} Callback Context for PUT recvd successfully
user.info occlientbasicops [] OCCLIENTBASICOPS occlientbasicops {} StackResult: OC_STACK_RESOURCE_CHANGED
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {} Payload Type: Representation
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}     Resource #1
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}     URI:/a/led
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}     Values:
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}         state(bool):true
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}         power(int):15
user.info occlientbasicops [] OCCLIENTBASICOPS occlientbasicops {} =============> Put Response
user.info occlientbasicops [] OCCLIENTBASICOPS occlientbasicops {} Callback Context for PUT recvd successfully
user.info occlientbasicops [] OCCLIENTBASICOPS occlientbasicops {} StackResult: OC_STACK_RESOURCE_CHANGED
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {} Payload Type: Representation
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}     Resource #1
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}     URI:/a/led
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}     Values:
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}         state(bool):true
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}         power(int):15
user.info occlientbasicops [] OCCLIENTBASICOPS occlientbasicops {} =============> Put Response
user.info occlientbasicops [] OCCLIENTBASICOPS occlientbasicops {} Callback Context for PUT recvd successfully
user.info occlientbasicops [] OCCLIENTBASICOPS occlientbasicops {} StackResult: OC_STACK_RESOURCE_CHANGED
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {} Payload Type: Representation
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}     Resource #1
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}     URI:/a/led
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}     Values:
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}         state(bool):true
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}         power(int):15
user.info occlientbasicops [] OCCLIENTBASICOPS occlientbasicops {} =============> Put Response
user.info occlientbasicops [] OCCLIENTBASICOPS occlientbasicops {} Callback Context for POST recvd successfully
user.info occlientbasicops [] OCCLIENTBASICOPS occlientbasicops {} StackResult: OC_STACK_RESOURCE_CHANGED
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {} Payload Type: Representation
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}     Resource #1
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}     URI:/a/led
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}     Values:
user.info occlientbasicops [] OCCLIENTBASICOPS PayloadLog {}         createduri(string):/a/led/0
user.info occlientbasicops [] OCCLIENTBASICOPS occlientbasicops {} =============> Post Response

Execute sample native app (Unsecured)

Execute the server app by below commands.

# cd /usr/palm/services/org.ocf.webossample.ocserver
# ./ocserver
Usage : ocserver -o <0|1>
-o 0 : Notify all observers
-o 1 : Notify list of observers
-e 0 : Display supported endpoint flags
-e 1 : Create resource without endpoint flags
-e 2 : Create resource with endpoint flag OC_COAP

# ./ocserver -o 0 [For Server sample]

Below message indicates that server runs successfully.

user.info ocserver [] OCSERVER ocserver {} OCServer is starting...
user.info ocserver [] OCSERVER ocserver {} Device information initialized successfully.
user.info ocserver [] OCSERVER ocserver {} Created Light resource with result: OC_STACK_OK
user.info ocserver [] OCSERVER ocserver {} Entering ocserver main loop...
user.info ocserver [] OCSERVER ocserver {} Will send out presence in 10 seconds
user.info ocserver [] OCSERVER ocserver {} Entering ocserver main loop...

In another terminal, execute the client app by below commands.

# cd /usr/palm/services/org.ocf.webossample.occlient

# ./occlient

Usage : occlient -u <0|1> -t <1..24> -c <0|1> -i <0|1> -s <0|1>
-u <0|1> : Perform multicast/unicast discovery of resources
-c 0 : Use Default connectivity(IP)
-c 1 : IP Connectivity Type
-t 1 : Discover Resources
-t 2 : Discover Resources and Initiate Nonconfirmable Get Request
-t 3 : Discover Resources and Initiate Nonconfirmable Get Request with query filter.
-t 4 : Discover Resources and Initiate Nonconfirmable Put Requests
-t 5 : Discover Resources and Initiate Nonconfirmable Post Requests
-t 6 : Discover Resources and Initiate Nonconfirmable Delete Requests
-t 7 : Discover Resources and Initiate Nonconfirmable Observe Requests
-t 8 : Discover Resources and Initiate Nonconfirmable Get Request for a resource which is unavailable
-t 9 : Discover Resources and Initiate Confirmable Get Request
-t 10 : Discover Resources and Initiate Confirmable Post Request
-t 11 : Discover Resources and Initiate Confirmable Delete Requests
-t 12 : Discover Resources and Initiate Confirmable Observe Requests and cancel with Low QoS
-t 13 : Discover Resources and Initiate Nonconfirmable presence
-t 14 : Discover Resources and Initiate Nonconfirmable presence with filter
-t 15 : Discover Resources and Initiate Nonconfirmable presence with 2 filters
-t 16 : Discover Resources and Initiate Nonconfirmable multicast presence.
-t 17 : Discover Resources and Initiate Nonconfirmable Observe Requests then cancel immediately with High QOS
-t 18 : Discover Resources and Initiate Nonconfirmable Get Request and add vendor specific header options
-t 19 : Discover Platform
-t 20 : Discover Devices
-t 21 : Discover Resources and Display endpoints of the server information
-t 22 : Discover Resources and Perform Get Requests by IPv4 + COAP + UDP using server's endpoints information
-t 23 : Discover Resources and Perform Get Requests by IPv4 + COAP + TCP using server's endpoints information
-t 24 : Discover Introspection Resources and Perform Get Request
-s 0 : Specify the device spec version as core.0.0.0
-s 1 : Specify the device spec version as ocf.1.1.0

# ./occlient -t 2 [For Client sample]

Completion of 'GET' query successfully indicates success!

user.info occlient [] OCCLIENT occlient {} Executing InitGetRequest with query /a/light
user.info ocserver [] OCSERVER ocserver {} Inside entity handler - flags: 0x2
user.info ocserver [] OCSERVER ocserver {} Flag includes OC_REQUEST_FLAG
user.info ocserver [] OCSERVER ocserver {} Received OC_REST_GET from client
user.info ocserver [] OCSERVER ocserver {} Received vendor specific options
user.info ocserver [] OCSERVER ocserver {} Received option with OC_COAP_ID and ID 17 with
user.info ocserver [] OCSERVER ocserver {} Received option with OC_COAP_ID and ID 2049 with
user.info ocserver [] OCSERVER ocserver {} accept version option exists
user.info ocserver [] OCSERVER ocserver {} accept version equals to default OC_SPEC_VERSION_VALUE.
user.info occlient [] OCCLIENT occlient {} Callback Context for GET query recvd successfully
user.info occlient [] OCCLIENT occlient {} StackResult: OC_STACK_OK
user.info occlient [] OCCLIENT occlient {} SEQUENCE NUMBER: 16777216
user.info occlient [] OCCLIENT PayloadLog {} Payload Type: Representation
user.info occlient [] OCCLIENT PayloadLog {} Resource #1
user.info occlient [] OCCLIENT PayloadLog {} URI:/a/light
user.info occlient [] OCCLIENT PayloadLog {} Values:
user.info occlient [] OCCLIENT PayloadLog {} state(bool):false
user.info occlient [] OCCLIENT PayloadLog {} power(int):0
user.info occlient [] OCCLIENT occlient {} =============> Get Response
user.info occlient [] OCCLIENT occlient {} Received vendor specific options
user.info occlient [] OCCLIENT occlient {} Received option with OC_COAP_ID and ID 12 with
user.info occlient [] OCCLIENT occlient {} Received format value of 10000
user.info occlient [] OCCLIENT occlient {} Received option with OC_COAP_ID and ID 2053 with
user.info occlient [] OCCLIENT occlient {} Received version value of 2048

Execute sample web app

Execute the sample app by below command.

# luna-send -n 1 -f luna://com.webos.applicationManager/launch '{"id":"com.example.app.iotivity"}' 

If the command returns true, then sample app is launched.

Start server with START SERVER button.

Create new resources to fill input items and to click CREAT RESOURCE button. Notes: this sample app includes a cbor format file for sample server. It has 2 resources such as /a/fan and /a/light. In order to create the other resources with this app, the included cbor file should be replaced with your own new cbor file.

Discover resources with DISCOVER RESOURCE button in UI for client role. The devices including the discovered resources will be listed by address and port like:

Check the detailed resources information to select a device from the list. You can get, delete, and observe a resource with the resource URI and question.

The response from the server is displayed in the UI as follows: Result of GET RESOURCE Result of OBSERVE RESOURCE

Customize Build Option

The following argument options can be passed to the yocto recipe to build IoTivity for webOS:

TARGET_TRANSPORT Supported transport types:
ALL (default)
IP
RELEASE Supported release modes:
1 (release mode) (default)
0 (debug mode)
SECURED Supported security modes: DTLS (Datagram Transport Layer Security)
1 (DTLS enabled) (default)
0 (DTLS disabled)
VERBOSE Supported verbose modes:
1 (show compilation)
0 (do not show compilation) (default)
RD_MODE Supported directory modes:
SERVER (build resource directory server)
CLIENT (build resource directory client) (default)
all (build both resource directory server and client)
LOGGING Supported logging modes:
true (enable stack logging)
false (disable stack logging) (default)
LOG_LEVEL Supported logging types: valid when LOGGING is true
DEBUG (default)
INFO
ERROR
WARNING
FATAL

ADDITIONAL NOTICE ABOUT SECURED OPTION:

Compilation flag regarding security for iotivity-node should be alligned with the "SECURED" option for iotivity .

You can modify the security compile flag at "<ROOT_PATH_OF_YOUR_WEBOS_BUILD>/meta-lg-webos/meta-webos/recipes-connectivity/iotivity-node/iotivity-node_git.bb".

When "SECURED" is set to 1 in iotivity, "-D__WITH_DTLS" should be included in iotivity-node recipe.
When "SECURED" is set to 0 in iotivity, "-D__WITH_DTLS" should be removed in iotivity-node recipe.

You can modify the build option of IoTivity for webOS at below recipe.

<ROOT_PATH_OF_YOUR_WEBOS_BUILD>/meta-webosose/meta-webos/recipes-core/iotivity/iotivity_<version>.bb 

Below is a part of iotivty_1.3.1.bb. You can add/remove/modify the build option by manipulating “EXTRA_OESCONS” variable.

............
............
............
python () {
    EXTRA_OESCONS = d.getVar("EXTRA_OESCONS", True)
    EXTRA_OESCONS += " TARGET_OS=webos TARGET_TRANSPORT=IP RELEASE=1"
    EXTRA_OESCONS += " VERBOSE=1"
    EXTRA_OESCONS += " SECURED=1"
    EXTRA_OESCONS += " RD_MODE=all"
    EXTRA_OESCONS += " LOGGING=true LOG_LEVEL=INFO"
    d.setVar("EXTRA_OESCONS", EXTRA_OESCONS)
}
............
............
............ 

MISC

webos.txt · Last modified: 2018/06/19 23:46 by Seokhee Lee