C# Integration with Alibaba Cloud IoT Platform | Demo

2019年12月15日 78点热度 5人点赞 3条评论
内容目录

1. Introduction

(Copy of Zhang's Dragon Ball)

The 5G era is approaching, and the development of IOT will be like a tiger with wings. The cross-platform .NET Core is showing more and more implementation examples in various aspects. This example by the author demonstrates a direct connection to the Alibaba Cloud IOT platform implemented on a Raspberry Pi running Linux.

Background Information:

Reasons for Using Alibaba Cloud:

【Alibaba Cloud】The IOT platform invites you to try it for free. You can now receive 1 million traffic messages every month: http://tb.cn/NzsIUHw
【Convenient】Supports various access methods, including open-source MQTT, Alibaba Cloud official SDK, AliOS Things, etc., enabling device development on the cloud in as fast as 10 minutes
【Powerful】Capable of maintaining long connections for hundreds of millions of devices, supports millions of concurrent connections, with service availability at 99.9%, and automatic migration in case of single point failures
【Open】Data flow is autonomous and controllable, capable of seamlessly connecting with a rich variety of cloud products to quickly build IOT applications
【Secure】Leading security capabilities cover all aspects of cloud, edge, and endpoint

2. Development of Device Dynamic Link Library in C Language

C# cannot directly control sensors, much like no one uses SQL to develop Android apps. Only C language can directly operate, receive, and send data to sensors. If C# could directly communicate with those microelectronic devices in embedded Linux, it would be remarkable...

Here, I develop a dynamic link library (.so) for use in Linux using C language, which is then called by C# to implement the integration between the device and the IOT platform.

In C, I simulate a temperature sensor with on/off functionality that can transmit temperature data (non-real sensor).

Then, I generate the dynamic link library, place it in the .NET Core project, and set up a class for integration.

Here, I use a simulated sensor, and once I receive my salary, I’ll buy a set to get started.

3. Creating IOT Products and Devices on Alibaba Cloud

Go to the Alibaba Cloud IOT console to create the corresponding products, add devices, and add custom Topics.

4. Integrating Development Console and Transmitting Data

This is divided into three parts:

Integrating Devices

Integrating with Alibaba Cloud IOT

Receiving and Sending Subscriptions, Callbacks

The general code structure of the project is as follows:

痴者工良

高级程序员劝退师

文章评论