C SDK has provided adaptation for Ubuntu Linux based on gcc. Developers install the corresponding software and quickly integrate Tencent Cloud IoT Explorer based on the instructions.
SDK Acquisition
The SDK is hosted on Github and can be accessed on Github to download the latest version of the device-side C SDK.
Access Guide
The integration of the Linux platform with Tencent Cloud IoT Explorer can be divided into the following 3 steps.
Development Environment Installation
Note:
This article demonstrates the usage of Ubuntu version v16.04.
The SDK requires a cmake version of v3.5 or higher. The default installed cmake version is low. If the compilation fails, click Download and refer to Installation Instruction to download and install a specified version of cmake.
$ sudo apt-get install -y build-essential make git gcc cmake
Application Development
Compilation and Running
1. Configuration Modification
Modify the CMakeLists.txt file in the root directory of the SDK and ensure the following options exist (taking the key authentication device as an example):
set(BUILD_TYPE "release")set(COMPILE_TOOLS "gcc")set(PLATFORM "linux")set(FEATURE_MQTT_COMM_ENABLED ON)set(FEATURE_AUTH_MODE "KEY")set(FEATURE_AUTH_WITH_NOTLS OFF)set(FEATURE_DEBUG_DEV_INFO_USED OFF)
2. Execute Script Compilation
Compilation library and sample code
./cmake_build.sh
Compile samples only (after complete compilation)
./cmake_build.sh samples
The output library files, header files, and examples are in the
output/release folder.3. Fill in the Device Information
Fill in the device information (taking the key authentication device as an example) of the device created on Tencent Cloud IoT Platform into device_info.json in the SDK root directory. Sample code is as follows:
"auth_mode":"KEY","productId":"S3ExxxxxAZW","deviceName":"test_device","key_deviceinfo":{"deviceSecret":"vX6PQqa1****6f5SMfs6OA6y"}
4. Run the Demo
The example output is located in the
output/release/bin folder. For example, to run the data_template_sample example, just input ./output/release/bin/data_template_sample.