Getting started with C SDK for Labeeb IoT Devices
The main purpose of this SDK is to provide the simplest way to connect your device to Labeeb IoT Platform.With this C SDK ,connecting to Labeeb will be simply functions calls.
What can be done with Labeeb IoT C SDK for devices
Using this SDK ,you will be able to communicate and publish data to LAbeeb IoT through MQTT protocol.
MQTT connectivity :
Connect to Labeeb IoT server.
Publish data to Labeeb IoT platform.
Close the MQTT connection.
Before you start using this SDK you need to install :
1) libssl :
For Linux , use the following command for Debian/Ubuntu :
sudo apt-get install libssl-dev
2) MQTT paho C :
git clone https://github.com/eclipse/paho.mqtt.c.git cd paho.mqtt.c.git make sudo make install
For more details, check: https://eclipse.org/paho/clients/c/
Hands on Using the SDK to push data to Labeeb through MQTT
In this tutorial, we will take the most common case in IoT devices, which is sending data to Labeeb IoT,to do that , follow the steps :
SDK files :
Extract the compressed file , you will find a folder called CSDK,open the C code file (labeeb.c).
Publish the data to a specific topic :
Use the topic of the device , data model name to publish data :
c_mqtt("demo.labeeb-iot.com","enterprise_device_template_deviceTemplate","password",1); c_connect (); c_publish ("/topic/of/the/device","datamodel","datatype:value",1);
Compile the C code with a linked library :Compile C code
gcc -o push labeeb.c -l paho-mqtt3cs
Run the code :Compile C code
What's next ?
After you push data to your Labeeb IoT account , now you can check the Data on the portal , retrieve it through our Labeeb IoT APIs and Web Services and then use this data in your mobile apps.Check one of our Getting Started.