If only MQTT agreement, it may be difficult to support the IoT building ali. The emergence of Alink protocol is not only about data moving from the sensor end to the cloud, but also like genetic mapping, which Outlines the skeleton of a building. With it, IoT Studio, big data analysis and all subsequent possibilities are possible.
MQTT, from my point of view, is equivalent to the process-oriented programming thought in the past, and the emergence of Alink brings the programming thought from the original process-oriented to the object-oriented era.
I first learned about Alink protocol at the end of 2017. At that time, Alink protocol was only version 0.6, with only core functions and some protocols described, which were not fully supported on the platform at that time. But in less than a year, the Alink protocol is getting better and more powerful.
The latest Alink protocol is described in more detail on the help page of Aliyun iot platform: help.aliyun.com/document_de…
For the convenience of those who are new to the Alink protocol, I will briefly explain it here.
In the official document, Alink has a clear definition: Alink protocol is a data exchange specification designed for the development field of the Internet of Things. The data format is JSON. It is used for two-way communication between the device end and the Internet of Things platform, and it more conveniently realizes and standardizates the business data interaction between the device end and the Internet of Things platform.
There are several important concepts and contents to familiarize yourself with about the Alink protocol.
The first and most important concept is triples. If we create an object model on Ali platform, and upload the data to the corresponding instance. Our first step is to create a “product.” Products contain properties, events, and services (we’ll cover this in more detail in a future article). The product has a name, as well as an automatically generated string called the ProductKey. With this product, we can create several devices. The device has a name (DeviceName) and a DeviceSecret key (DeviceSecret). The relationship between products and devices is similar to the relationship between classes and class instances in object-oriented programming languages.
Among them, ProductKey, DeviceName and DeviceSecret are the famous triples. The triplet corresponds to an actual physical device. In the event that there are several triples of devices in the real world, the device that comes after the Internet will take the previous device offline. Only one such device is online at a time.
Now that we know the concept of a triple, we have two nouns to explain.
The first is “one machine, one secret”, which, as the name implies, is a device (machine) and a secret key. That is, a device embedded with a unique triplet of information. The product key identifies the product type. The device name and device key correspond to a cloud device. This mode is safe, and each device corresponds to a unique secret key. The disadvantage is that each device must pre-write the unique triplet information, which brings inconvenience to the mass production of the device.
For mass-produced devices, it is not necessary to write the corresponding triplet information one by one in order to facilitate the production of a large number of devices. Put forward the second term “one type one secret”, similarly, as the name implies, one type one secret, is a kind of product model a secret key. At this time, as long as it is a product, just write the product secret key. A large number of devices write the same information, which facilitates the mass production of devices.
“Type a” data upload a bit of trouble when you need some equipment, the name of the device must be relatively unique, you can customize the information, such as MAC address or ID number of MCU, uploaded to the device name ali cloud IoT platform, the server will automatically issued secret key equipment, the process is called “dynamic registration”, In fact, the dynamic registration value needs to be once. You can save the obtained information, and the next power-on does not need dynamic registration. Finally, the device collects the triplet information and logs in normally.
The second more important concept is “transparent transport”. Why “transparent transmission” as the second more important concept, in fact, in the future lightweight devices or other heterogeneous devices, it is difficult to directly support the Alink protocol. Transparent transmission + cloud script together constitute a bridge to complete the transmutation to Alink protocol. The advantage is that the hardware level of the problem into the cloud script, in addition to transparent transmission is mostly binary protocol, the amount of communication data is relatively small, relatively fast communication, but also save traffic.
The third concept is “properties, events, and services.” These are actually three concepts, but we’ll cover them all together here, and we’ll cover them in more detail in future articles. Properties, events, and services correspond exactly to the concept of properties, events, and methods of a class.
Properties include upload and delivery. The device can upload various sensor data collected in the device to the cloud IoT platform, and also operate some properties on the IoT platform, such as some relay properties, to remotely control the closing and opening of the relay.
Events are relatively simple and can be customized to upload from the device based on necessary conditions, such as low battery, or other alarm information, etc.
A service actually corresponds to a series of methods, including input parameters (that is, several input parameters) and output parameters (several returned parameters). After the service is sent to the device remotely, the device executes the corresponding method (which can be executed according to the parameters) and returns the necessary data after execution.
Another important concept to understand is “synchronous” and “asynchronous”. When configuring a service, you can configure whether the service operates in “synchronous” or “asynchronous” mode.
If you want to experience alibaba Cloud IoT platform, you can click the following link:
Dev.iot.aliyun.com/sale?source…