The Azure Internet of Things?team has recently open sourced?the gateway SDKs?that can be used to build and deploy applications for Azure IoT.
There are two classes of SDKs that have been made available. The device SDK that allows developers to connect client devices to the Azure IoT Hub and the service SDK that enables management of the IoT service instances in your hub. The device SDK supports a range of OSes running on low fidelity devices that typically support network communication, have the ability to establish a secure communication channel with the IoT Hub, are able to generate secure tokens for authentication and have a minimum of 64 KB RAM as the memory footprint.
The device SDK is available in C, .NET, Java, Node.js, and Python, while the service SDK is currently available in .NET, Node.js, and Java. In order to register clients using the device SDK, you will first create an IoT Hub instance in Azure using the management portal and then use the connection string of your IoT Hub to register a new device. If you reference the .NET SDK, you can use the
Microsoft.Azure.Devices.Client?library that exposes various methods to interact with the gateway such as the
Create?method to create a
SendEventAsync?to send an event to the device hub. The
Microsoft.Azure.Devices.Client?library supports both AMQP and HTTPS protocols. The messages can also be sent in batches using the
SendEventBatchAsync?method that will send a collection of
Message?to the device hub.
The services SDK is available as the
Microsoft.Azure.Devices?library. You can use the
RegistryManager?class to register a device:
To receive device-to-cloud messages, you can create a receiver using the
EventHubClient?class and use the
ReceiveAsync?method to start receiving event data asynchronously.
You can clone the IoT Gateway SDKs repository from GitHub?and customize it for your own gateway solutions using Azure IoT.
The Azure IoT Gateway is promising because, while developers can connect their devices to IoT platforms, there are many scenarios that require edge intelligence, e.g. sensors that cannot connect to the cloud on their own. The IoT Gateway SDKs make it simple for developers to develop on-premise custom computation wherever a standard solution doesn’t work.