/iot-cpp

Client libraries and samples for connecting to IBM Watson IoT using C++ https://internetofthings.ibmcloud.com

Primary LanguageC++Eclipse Public License 1.0EPL-1.0

C++ Client Library - Introduction

This C++ Client Library can be used to simplify interactions with the IBM Watson IoT Platform. Supported platforms are OSX and Linux.

Supported Features

Feature Supported? Description
Device connectivity Connect your device(s) to Watson IoT Platform with ease using this library. Click here for detailed information on how devices can publish events and handle commands.
Gateway connectivity Connect your gateway(s) to Watson IoT Platform with ease using this library. Click here for detailed information on how gateways can publish events and handle commands for itself and for the attached devices.
Device Management Connects your device/gateway as managed device/gateway to Watson IoT Platform. Click here for more information on how to perform device management operations like firmware update, reboot, location update and diagnostics update for a device.
Event/Command publish using MQTT Enables device/gateway/application to publish messages using MQTT. Refer to Device and Gateway section for more information.
SSL/TLS support Enables Device/Gateway Client to connect to Watson IoT Platform securely using SSL/TLS feature.
Client side Certificate based authentication Support to be added in the near future
Device Management Extension(DME) Support to be added in the near future
Auto reconnect Support to be added in the near future

Dependencies

  1. Paho MQTT C++ Client
  1. Paho MQTT C Client
  1. A C++ library for interacting with JSON - jsoncpp
  1. Log library for C++ - log4cpp
  1. A C++ Unit Testing Framework - CppTest

  2. CMake Build Tool

Installing the Dependencies

Run the setup.sh file in the iot-cpp directory. This script installs the required dependencies and copies the dependencies into the lib directory after making necessary changes.

Note: If the dependencies were not able to be installed with the script on the device, manually pull the dependencies from the links mentioned in setup.sh and follow the steps for making the necessary changes.

Build Instructions

  1. Install CMake and CppTest
  2. git clone https://github.com/ibm-watson-iot/iot-cpp.git
  3. cd iot-cpp
  4. sh setup.sh
  5. mkdir build ; cd build
  6. cmake ..
  7. make

All the output files will be created under the build directory.

Running samples

  1. cp iot-cpp/src/log4cpp.properties iot-cpp/build
  2. Update device.cfg and gateway.cfg properties files present in iot-cpp/samples
  3. cd iot-cpp/build
  4. Execute Device Sample: ./samples/sampleDevice
  5. Execute Gateway Sample: ./samples/sampleGateway

Detailed Documentation

  • The Devices section contains information on how Device Client connect, publish events and handle commands using the C++ ibmiotf Client Library.
  • The Gateway section contains information on how Gateway Client connect, publish events and handle commands for itself and for the attached devices using the C++ ibmiotf Client Library.

License

The library is shipped with Eclipse Public License. For more information about the public licensing, see the License file.