platform | device | language |
---|---|---|
fedora |
samsung-artik |
c |
- Introduction
- Step 1: Prerequisites
- Step 2: Prepare your Device
- Step 3: Build and Run the Sample
- Tips
About this document
This document describes how to connect Samsung ARTIK device running Fedora 22 with Azure IoT SDK. This multi-step process includes:
- Configuring Azure IoT Hub
- Registering your IoT device
- Build and deploy Azure IoT SDK on device
You should have the following items ready before beginning the process:
- Computer with Git client installed and access to the azure-iot-sdks GitHub public repository.
- Samsung ARTIK device to certify.
- Setup your IoT hub
- Provision your device and get its credentials
After unboxing your Samsung ARTIK devices, please follow our Getting Started documentations at https://developer.artik.io/documentation/getting-started-beta/ to power up your board, and set up the serial communication between your ARTIK device and your host computer.
ARTIK supports both Ethernet and WiFi. If you want to use WiFi on your ARTIK, please refer to https://developer.artik.io/documentation/developer-guide/configuring-wifi-on-artik-10.html to configure WiFi on your board.
-
Open a PuTTY session and connect to the device.
-
Install the prerequisite packages for the Microsoft Azure IoT Device SDK for C by issuing the following commands from the command line on your board:
dnf check-update -y dnf install libcurl-devel openssl-devel gcc-c++ make cmake git
-
Download the Microsoft Azure IoT Device SDK for C to the board by issuing the following command on the board::
git clone https://github.com/Azure/azure-iot-sdks.git
-
Edit the following file using any text editor of your choice:
For AMQP protocol:
azure-iot-sdks/c/iothub_client/samples/iothub_client_sample_amqp/iothub_client_sample_amqp.c
For HTTPS protocol:
azure-iot-sdks/c/iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.c
-
Find the following place holder for IoT connection string:
static const char* connectionString = "[device connection string]";
-
Replace the above placeholder with device connection string you obtained in Step 1 and save the changes.
-
Build the SDK samples using the following command:
./azure-iot-sdks/c/build_all/linux/build.sh
-
Run the sample by issuing following command:
For AMQP protocol:
~/cmake/iothub_client/samples/iothub_client_sample_amqp/linux/iothub_client_sample_amqp
For HTTPS protocol:
~/cmake/c/iothub\_client/samples/iothub_client_sample_http/linux/iothub_client_sample_http
-
See Manage IoT Hub to learn how to observe the messages IoT Hub receives from the application.
- See Manage IoT Hub to learn how to send cloud-to-device messages to the application.
-
If you just want to build the serializer samples, run the following commands:
cd ./c/serializer/build/linux make -f makefile.linux all