$ sudo apt-get install libgupnp-1.0-dev libgssdp-1.0-dev libboost-regex-dev
$ sudo apt-get install gupnp-tools #optional but recommended
$ sudo dnf install gssdp-devel gupnp-devel
$ sudo dnf install gupnp-tools #optional but recommended
There is currently a bug reported for IoTivity
This can be worked around by changing the following line in iotivity project and rebuilding iotivity.
Find the file /resource/csdk/stack/include/ocstackconfig.h change #define MAX_URI_LENGTH(64) to #define MAX_URI_LENGTH(256)
You will need to copy the setenv.sh.example to setenv.sh then setup the setenv.sh file to reflect your environment. You can then source the setenv.sh to setup the enviroment.
$ cp setenv.sh.example setenv.sh
$ vi setenv.sh
$ source setenv.sh
To build you will need to copy the BuildOptions.txt.example to BuildOptions.txt Open the files and update the change the build variables to reflect your environment.
$ cp BuildOptions.txt.example BuildOptions.txt
$ vi BuildOptions.txt
To build run 'scons'. Variables specified in the BuildOptions.txt can be overwriten by adding them to the scons command at runtime.
$ scons BUILD_TYPE=release
The Client toggles the state of any discovered light and quits after 10 seconds. Alternatively, if given any runtime argument, the Client runs until Control-C toggling the state of any discovered light every 5 seconds.
The ObserveClient runs until Control-C, it writes OBSERVE messages to the console when the state of a light changes.
Navigate to the out/linux/x86_64/<build_type>/bin
directory.
Run the following:
$ gupnp-network-light #requires gupnp-tools
$ ./UpnpBridge
$ ./Observer
$ ./SimpleClient
The gupnp-network-light
is a virtual gupnp light that will only respond to
UPnP. The UpnpBridge
is the code that bridges IoTivity and UPnP. The Observer
finds the UPnP light using IoTivity and observes any changes in the current lights
attributes and reports the change. The SimpleClient
will find the light and
will toggle the light state.
The Android UPnP client app is built along with all of the other IoTivity Android examples. These instructions assume that the system has already been set up for Android development. Follow IoTivity instructions for Android development
$ cd <iotivity>
Copy the Android UPnP client apps into the IoTivity Android example code.
$ cp -rv <iotivity-upnp-bridge>/android/examples/upnpclient/ android/examples
$ cp -rv <iotivity-upnp-bridge>/android/examples/upnpavclient/ android/examples
Edit the settings.gradle file to include the upnpclients.
$ sed -i "/^include / s/$/, ':upnpclient', ':upnpavclient'/" android/examples/settings.gradle
Build for Android.
$ scons TARGET_OS=android TARGET_ARCH=<armeabi|x86|x86_64> TARGET_TRANSPORT=IP
For example, Nexus 7 Table which has arm chipset.
$ scons TARGET_OS=android TARGET_ARCH=armeabi TARGET_TRANSPORT=IP
The UPnP Client Demo Android App, 'upnpclient-debug.apk' is in the 'android/examples/upnpclient/build/outputs/apk' directory. The UPnP AV Client Demo Android App, 'upnpavclient-debug.apk' is in the 'android/examples/upnpavclient/build/outputs/apk' directory.
Follow IoTivity instructions for installing Andriod example apps.
Caveat: This currently requires the UpnpBridge running on a Linux system with UPnP Client Demo Android App