aliyun - AliYun Alibaba Cloud IoT Platform#
Adaptation status unknown
Note
This page document is automatically generated by this file. If there is any error, please submit issue or help modify pr, thank you!
Tip
This library has its own demo,click this link to view the demo example of aliyun
Example
-- Please consult demo
aliyun.setup(tPara)#
Configure product information and device information for Alibaba Cloud IoT Suite
Parameters
Incoming Value Type |
Explanation |
---|---|
table |
Product information and device information of Alibaba Cloud IoT Suite |
return |
nil |
Return Value
None
Examples
aliyun.setup(tPara)
-- Parameter Description
When the one-machine-one-secret authentication scheme is used, the ProductSecret parameter is passed in.nil
When a type-one-secret authentication scheme is used, the ProductSecret parameter is passed into the real product key.
Registration Whether pre-registration is pre-registered is false, not pre-registered is true
DeviceName Equipment Name
ProductKey Products key
ProductSecret Product secret, according to this information to determine whether it is one machine, one secret or one type, one secret
DeviceSecret Equipment secret
InstanceId if you do not need to fill in the instance id, on the instance details page
mqtt_port mqtt Port
mqtt_isssl whether to use ssl to encrypt the connection. true indicates the simplest encryption without a certificate.
aliyun.subscribe(topic,qos)#
Subscribe to a topic
Parameters
Incoming Value Type |
Explanation |
---|---|
string |
Subject content is UTF8 encoded |
number |
qos Number type (0/1, default 0) |
return |
nil |
Return Value
None
Examples
aliyun.subscribe("/b0FMK1Ga5cp/862991234567890/get", 0)
aliyun.publish(topic,qos,payload,cbFnc,cbPara)#
Publish a message
Parameters
Incoming Value Type |
Explanation |
---|---|
string |
UTF8 The subject of coding |
number |
qos Quality level, 0/1, default 0 |
string |
payload Payload content, UTF8 encoding |
function |
cbFnc The callback function of the message publishing result. The callback function is called in the form of cbFnc(result,cbPara). Result is true to indicate that the publication was successful, false or nil to indicate that the subscription failed. CbPara is the fifth parameter in this interface. |
param |
cbPara Callback parameters of the message publishing result callback function |
return |
nil |
Return Value
None
Examples
aliyun.publish("/b0FMK1Ga5cp/862991234567890/update",0,"test")
aliyun.publish("/b0FMK1Ga5cp/862991234567890/update",1,"test",cbFnc,"cbFncPara")
aliyun.on(evt,cbFnc)#
Register handler for event
Parameters
Incoming Value Type |
Explanation |
---|---|
string |
evt Event, |
Return Value
None
Examples
None