Gateway SDK
This topic describes how to quickly integrate gateway devices using the Alibaba Cloud gateway software development kit (SDK). This process connects the gateway device to the Alibaba Cloud Link WAN platform and helps gateway device vendors understand the integration flow.
Download the code
Log on to the official website using your Alibaba Cloud account and submit a ticket to obtain the Link WAN gateway SDK.
The modules/pktfwd folder in the SDK is based on the official Semtech LoRaWAN protocol stack. It includes a patch that contains modifications from Alibaba Cloud. You can merge the relevant code into the SDK for your platform as needed.
Modify the configuration file
make.settings is the compilation configuration script. The configuration options are described below. Modify the following two configurations based on your local toolchain path and the corresponding host.
export __PATH__=\$(pwd)/toolchain/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09\_linux/bin:\$PATH
export __BUILDHOST__=arm-linux-gnueabihfCompile
./build.sh all
The files generated after compilation are located in the out folder.
Configure the gateway device certificate
auth\_key.json is the configuration file for the gateway device certificate. Encrypt the gateway device certificate that you obtained, and then modify the corresponding configuration items in this file.
You can purchase and obtain gateway device certificates from the Link WAN Key Management console.
Run
The following Message Queuing Telemetry Transport (MQTT) log output indicates that the gateway uplink and downlink are connected.
mqtt.c-publish\_gwmp\_msg\_uplink:356__publish mqtt gwmp msg__
mqtt.c-event\_handle:156__publish success__, packet-id=16checkCnt=1
mqtt.c-callback\_gwmp\_msg\_downlink:469__received mqtt gwmp msg__
mqtt.c-callback\_gwmp\_msg\_downlink:477__send gwmp msg__ Architecture overview

The architecture consists of the following layers, from bottom to top:
Hardware layer: Provided by the vendor's gateway hardware.
OS layer: Based on the Linux system.
Hardware Abstraction Layer (HAL): SX1301/1308 driver (libloragw).
Upper layer: Includes the LoRaWAN protocol stack packet_forwarder, Inter-Process Communication (IPC), system services, and system applications.
Folder structure
Folder name | Description |
external | Third-party open source libraries used by the SDK, including cJSON, dbus, hiredis, and libexpat. |
libraries | Libraries provided by Alibaba Cloud, including iotx-sdk-c and ipc-bus. |
modules | LoRa gateway feature modules, including mqtt and pktfwd. |
packages | Precompiled feature modules. |
make.settings | SDK compilation configuration script. |
build.sh | Command script to compile the SDK. |
docs | SDK documents, including the gateway integration specification document and the SDK user manual. |
README.md | Compilation instructions. |
SDK usage instructions
For more information, see the SDK user manual at docs/loragw_sdk_manual_vX.X.X.pdf.
Gateway integration requirements
For more information, see the gateway integration specification document at docs/Alibaba Cloud Link WAN Gateway Integration Specification vX.X.X.pdf.