Changes for page 01 Lua Functions
Last modified by Theodore Xu on 2023/10/26 10:51
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,4 +1,4 @@ 1 -= **1 Interface Description** =1 += **1 Interface description** = 2 2 3 3 == **Data type definition** == 4 4 ... ... @@ -92,7 +92,7 @@ 92 92 1. From the print result, the first line and the second line are successfully called and returns true; the third line fails the call, the error message is translated as: the bar student has been registered, and there is indeed an error in the code. 93 93 1. The fourth line of code uses two variables to receive the return value. The call failed, the first variable stat is nil, and the second variable err stores the error message. Then print it out using print, which is the output of the third line. This example shows how to capture and view the error message. 94 94 95 -== **Modification of the PrintFunction** ==95 +== **Modification of print function** == 96 96 97 97 For the convenience of remote development, the print data is sent to the front end (web page) by means of network transmission, and the user can see the result of the debug output, because it consumes certain data and occupies the bandwidth of the server (or occupies server resources). So the following restrictions are made. 98 98 ... ... @@ -105,9 +105,7 @@ 105 105 In addition, please refer to the front-end documentation for how to use view debugging. 106 106 107 107 ((( 108 -= **2 Address Operation** = 109 - 110 - 108 += **2 Address operation** = 111 111 ))) 112 112 113 113 |=16-bit data formal|=HLword|=32-bit data formal|=HLword|= 64-bit data formal|=HLword ... ... @@ -140,20 +140,17 @@ 140 140 43218765 141 141 )))|10 142 142 143 - *If HLword entersany other value,it will be treated as invalid.141 + Table 2-1 144 144 145 - Demo: Reads a 32-bit floating-point number at position D0 of PLC 143 +(% class="box errormessage" %) 144 +((( 145 +**✎Note: **If HLword enters any other value, it will be treated as invalid. 146 +))) 146 146 148 +== **addr_getshort(string addr[, number type, number hlword])** == 147 147 150 +**Function:** Read 16-bit signed decimal address 148 148 149 -[[image:企业微信截图_20210506180640.png||height="301" width="600" class="img-thumbnail"]] 150 - 151 -== **2.1 addr_getshort(string addr[, number type, number hlword])** == 152 - 153 -**Function:** 154 - 155 -Read 16-bit signed decimal address 156 - 157 157 **Parameters:** 158 158 159 159 //addr//: address ... ... @@ -171,13 +171,11 @@ 171 171 Failed: multi 172 172 173 173 ((( 174 -== ** 2.2addr_setshort(string addr, number num[, number type, number hlword])** ==169 +== **addr_setshort(string addr, number num[, number type, number hlword])** == 175 175 ))) 176 176 177 -**Function:** 172 +**Function:** Write 16-bit signed decimal address 178 178 179 -Write 16-bit signed decimal address 180 - 181 181 **Parameters:** 182 182 183 183 //addr//: address ... ... @@ -195,13 +195,11 @@ 195 195 Failed: multi 196 196 197 197 ((( 198 -== ** 2.3addr_getword(string addr[, number type, number hlword])** ==191 +== **addr_getword(string addr[, number type, number hlword])** == 199 199 ))) 200 200 201 -**Function:** 194 +**Function:** Read 16-bit unsigned decimal address 202 202 203 -Read 16-bit unsigned decimal address 204 - 205 205 **Parameters:** 206 206 207 207 //addr//: address ... ... @@ -217,13 +217,11 @@ 217 217 Failed: multi 218 218 219 219 ((( 220 -== ** 2.4addr_setword(string addr, number num[, number type, number hlword])** ==211 +== **addr_setword(string addr, number num[, number type, number hlword])** == 221 221 ))) 222 222 223 -**Function:** 214 +**Function:**Write 16-bit unsigned decimal address 224 224 225 -Write 16-bit unsigned decimal address 226 - 227 227 **Parameters:** 228 228 229 229 //addr//: address ... ... @@ -241,13 +241,11 @@ 241 241 Failed: multi 242 242 243 243 ((( 244 -== ** 2.5addr_getint(string addr[, number type, number hlword])** ==233 +== **addr_getint(string addr[, number type, number hlword])** == 245 245 ))) 246 246 247 -**Function:** 236 +**Function:** Read 32-bit signed decimal address 248 248 249 -Read 32-bit signed decimal address 250 - 251 251 **Parameters:** 252 252 253 253 //addr//: address ... ... @@ -263,13 +263,11 @@ 263 263 Failed: multi 264 264 265 265 ((( 266 -== ** 2.6addr_setint(string addr, number num[, number type, number hlword])** ==253 +== **addr_setint(string addr, number num[, number type, number hlword])** == 267 267 ))) 268 268 269 -**Function:** 256 +**Function:** Write 32-bit signed decimal address 270 270 271 -Write 32-bit signed decimal address 272 - 273 273 **Parameters:** 274 274 275 275 //addr//: address ... ... @@ -287,13 +287,11 @@ 287 287 Failed: multi 288 288 289 289 ((( 290 -== ** 2.7addr_getdword(string addr[, number type, number hlword])** ==275 +== **addr_getdword(string addr[, number type, number hlword])** == 291 291 ))) 292 292 293 -**Function:** 278 +**Function:** Read 32-bit unsigned decimal address 294 294 295 -Read 32-bit unsigned decimal address 296 - 297 297 **Parameters:** 298 298 299 299 //addr//: address ... ... @@ -309,13 +309,11 @@ 309 309 Failed: multi 310 310 311 311 ((( 312 -== ** 2.8addr_setdword(string addr, number num[, number type, number hlword])** ==295 +== **addr_setdword(string addr, number num[, number type, number hlword])** == 313 313 ))) 314 314 315 -**Function:** 298 +**Function:** Write 32-bit unsigned decimal address 316 316 317 -Write 32-bit unsigned decimal address 318 - 319 319 **Parameters:** 320 320 321 321 //addr//: address ... ... @@ -333,13 +333,11 @@ 333 333 Failed: multi 334 334 335 335 ((( 336 -== ** 2.9addr_getbit(string addr[, number type])** ==317 +== **addr_getbit(string addr[, number type])** == 337 337 ))) 338 338 339 -**Function:** 320 +**Function:** Read a bit of the register address 340 340 341 -Read a bit of the register address 342 - 343 343 **Parameters:** 344 344 345 345 //addr//: address ... ... @@ -355,13 +355,11 @@ 355 355 Failed: multi 356 356 357 357 ((( 358 -== ** 2.10addr_setbit(string addr, number num[, number type])** ==337 +== **addr_setbit(string addr, number num[, number type])** == 359 359 ))) 360 360 361 -**Function:** 340 +**Function:** Write a bit of the register address 362 362 363 -Write a bit of the register address 364 - 365 365 **Parameters:** 366 366 367 367 //addr//: address ... ... @@ -379,13 +379,11 @@ 379 379 Failed: multi 380 380 381 381 ((( 382 -== ** 2.11addr_getfloat(string addr[, number type, number hlword])** ==359 +== **addr_getfloat(string addr[, number type, number hlword])** == 383 383 ))) 384 384 385 -**Function:** 362 +**Function:** Read 32-bit floating address 386 386 387 -Read 32-bit floating address 388 - 389 389 **Parameters:** 390 390 391 391 //addr//: address ... ... @@ -401,13 +401,11 @@ 401 401 Failed: multi 402 402 403 403 ((( 404 -== ** 2.12addr_setfloat(string addr, number num[, number type, number hlword])** ==379 +== **addr_setfloat(string addr, number num[, number type, number hlword])** == 405 405 ))) 406 406 407 -**Function:** 382 +**Function:** Write 32-bit floating address 408 408 409 -Write 32-bit floating address 410 - 411 411 **Parameters:** 412 412 413 413 //addr//: address ... ... @@ -425,13 +425,11 @@ 425 425 Failed: multi 426 426 427 427 ((( 428 -== ** 2.13addr_getdouble(string addr[, number type, number hlword])** ==401 +== **addr_getdouble(string addr[, number type, number hlword])** == 429 429 ))) 430 430 431 -**Function:** 404 +**Function:** Read 64-bit floating address 432 432 433 -Read 64-bit floating address 434 - 435 435 **Parameters:** 436 436 437 437 //addr//: address ... ... @@ -447,13 +447,11 @@ 447 447 Failed: multi 448 448 449 449 ((( 450 -== ** 2.14addr_setdouble(string addr, number num[, number type, number hlword])** ==421 +== **addr_setdouble(string addr, number num[, number type, number hlword])** == 451 451 ))) 452 452 453 -**Function:** 424 +**Function:** Write 64-bit floating address 454 454 455 -Write 64-bit floating address 456 - 457 457 **Parameters:** 458 458 459 459 addr: address ... ... @@ -471,13 +471,11 @@ 471 471 Failed: multi 472 472 473 473 ((( 474 -== ** 2.15addr_getstring(string addr, number length[, number type, number hlbyte])** ==443 +== **addr_getstring(string addr, number length[, number type, number hlbyte])** == 475 475 ))) 476 476 477 -**Function:** 446 +**Function:** Read the specified length string from address 478 478 479 -Read the specified length string from address 480 - 481 481 **Parameters:** 482 482 483 483 //addr//: address ... ... @@ -495,13 +495,11 @@ 495 495 Failed: multi 496 496 497 497 ((( 498 -== ** 2.16addr_setstring(string addr, string str[, number type, number hlbyte])** ==465 +== **addr_setstring(string addr, string str[, number type, number hlbyte])** == 499 499 ))) 500 500 501 -**Function:** 468 +**Function:** Write the specified length string to address 502 502 503 -Write the specified length string to address 504 - 505 505 **Parameters:** 506 506 507 507 //addr//: address ... ... @@ -519,13 +519,11 @@ 519 519 Failed: multi 520 520 521 521 ((( 522 -== ** 2.17addr_bmov(string dst, string src, number length)** ==487 +== **addr_bmov(string dst, string src, number length)** == 523 523 ))) 524 524 525 -**Function:** 490 +**Function:** Copy data from source address to destination address 526 526 527 -Copy data from source address to destination address 528 - 529 529 **Parameters:** 530 530 531 531 //dst//: destination address ... ... @@ -541,13 +541,11 @@ 541 541 **Failed: multi** 542 542 543 543 ((( 544 -== ** 2.18addr_fill(string addr, number num, number length)** ==507 +== **addr_fill(string addr, number num, number length)** == 545 545 ))) 546 546 547 -**Function:** 510 +**Function:** Write the same value to consecutive addresses 548 548 549 -Write the same value to consecutive addresses 550 - 551 551 **Parameters:** 552 552 553 553 //addr//: address ... ... @@ -563,13 +563,11 @@ 563 563 Failed: multi 564 564 565 565 ((( 566 -== ** 2.19addr_newnoaddr(string addr, number offset)** ==527 +== **addr_newnoaddr(string addr, number offset)** == 567 567 ))) 568 568 569 -**Function:** 530 +**Function:** Offset address value relative to //addr// 570 570 571 -Offset address value relative to //addr// 572 - 573 573 **Parameters:** 574 574 575 575 //addr//: address ... ... @@ -583,13 +583,11 @@ 583 583 Failed: multi 584 584 585 585 ((( 586 -== ** 2.20addr_newstataddr(string addr, number offset)** ==545 +== **addr_newstataddr(string addr, number offset)** == 587 587 ))) 588 588 589 -**Function:** 548 +**Function:** Offset station number relative to //addr //station number 590 590 591 -Offset station number relative to //addr //station number 592 - 593 593 **Parameters:** 594 594 595 595 //addr//: address ... ... @@ -602,12 +602,10 @@ 602 602 603 603 Failed: multi 604 604 605 -== ** 2.21addr_gethex64(string addr[, number type, number hlword])** ==562 +== **addr_gethex64(string addr[, number type, number hlword])** == 606 606 607 -**Function:** 564 +**Function:** Read 64-bit hexadecimal numbers 608 608 609 -Read 64-bit hexadecimal numbers 610 - 611 611 **Parameters:** 612 612 613 613 //addr//: address ... ... @@ -622,12 +622,10 @@ 622 622 623 623 Failed: multi 624 624 625 -== ** 2.22addr_sethex64(string addr, number num[, number type, number hlword])** ==580 +== **addr_sethex64(string addr, number num[, number type, number hlword])** == 626 626 627 -**Function:** 582 +**Function:** Write 64-bit hexadecimal addresses 628 628 629 -Write 64-bit hexadecimal addresses 630 - 631 631 **Parameters:** 632 632 633 633 //addr//: address ... ... @@ -648,11 +648,11 @@ 648 648 649 649 Operations on the serial port such as read, write, etc. must use ':' for full mode calls, ie operations on an open serial object. 650 650 651 -**Serial port name and mode :**604 +**Serial port name and mode** 652 652 653 653 The serial port configured in the communication configuration window cannot be configured again using the script. RS232 and RS458 (or RS422) can be used simultaneously, but RS422 and RS485 are mutually exclusive.For example, when the communication port is configured with COM1-485, the script can only open COM1-232, but not COM1-485/422. Similarly, when the communication port is configured with COM2-485, the script can only open COM2-232, but not COM2-485. 654 654 655 -Attempting to use a script to open a serial port in an unsupported mode will result in an error directly, as below 608 +Attempting to use a script to open a serial port in an unsupported mode will result in an error directly, as below. 656 656 657 657 |((( 658 658 local setup = { ... ... @@ -674,13 +674,11 @@ 674 674 1. When the data bit is 8, the maximum value of data transmission is 255 (0xFF), which supports the transmission of any character. 675 675 676 676 ((( 677 -== ** 3.1serial.open(table setup)** ==630 +== **serial.open(table setup)** == 678 678 ))) 679 679 680 -**Function:** 633 +**Function:** Enable one serial port 681 681 682 -Enable one serial port 683 - 684 684 **Parameters:** 685 685 686 686 //Setup// is a Lua table; it needs to contain the following fields ... ... @@ -714,17 +714,13 @@ 714 714 Failed: multi 715 715 716 716 ((( 717 -== ** 3.2serial.close(serial obj)** ==668 +== **serial.close(serial obj)** == 718 718 ))) 719 719 720 -**Function:** 671 +**Function:** Disable the serial port 721 721 722 - Disable the serialport673 +**Parameters: **//Obj //is the object returned by serial.open 723 723 724 -**Parameters:** 725 - 726 -//Obj //is the object returned by serial.open 727 - 728 728 **Return:** 729 729 730 730 Succeed: true ... ... @@ -732,13 +732,11 @@ 732 732 Failed: multi 733 733 734 734 ((( 735 -== ** 3.3serial:read(number bytes[, number timeout])** ==682 +== **serial:read(number bytes[, number timeout])** == 736 736 ))) 737 737 738 -**Function:** 685 +**Function:** Read the specified byte length serial port data 739 739 740 -Read the specified byte length serial port data 741 - 742 742 **Parameters:** 743 743 744 744 //bytes//: number of bytes ... ... @@ -752,15 +752,13 @@ 752 752 Failed: multi 753 753 754 754 ((( 755 -== ** 3.4serial:write(string data)** ==700 +== **serial:write(string data)** == 756 756 ))) 757 757 758 -**Function:** 703 +**Function:** Write the specified byte length to serial port data 759 759 760 - Writehepecifiedbyte length to serial port data705 +**Parameters: ** 761 761 762 -**Parameters:** 763 - 764 764 //data//: serial port data 765 765 766 766 **Return:** ... ... @@ -770,13 +770,11 @@ 770 770 Failed: multi 771 771 772 772 ((( 773 -== ** 3.5serial:flush([number flag])** ==716 +== **serial:flush([number flag])** == 774 774 ))) 775 775 776 -**Function:** 719 +**Function:** Clear the serial port buffer 777 777 778 -Clear the serial port buffer 779 - 780 780 **Parameters:** 781 781 782 782 //[flag=2]// clear option: 0: read, 1: write, 2: read-write ... ... @@ -788,17 +788,13 @@ 788 788 Failed: multi 789 789 790 790 ((( 791 -== ** 3.6serial:close()** ==732 +== **serial:close()** == 792 792 ))) 793 793 794 -**Function:** 735 +**Function:** Close the serial port object 795 795 796 - Closeheserial port object737 +**Parameters:** None 797 797 798 -**Parameters:** 799 - 800 -None 801 - 802 802 **Return:** 803 803 804 804 Succeed: true ... ... @@ -815,12 +815,10 @@ 815 815 816 816 **QoS value:** 817 817 818 -0: Only push messages once, messages may be lost or duplicated. It can be used for environmental sensor data, it doesn't matter if lose a record, because there will be a second push message soon. This method is mainly used for normal APP push, but if the user smart device is not connected when the message is pushed, the message will be discarded, and the smart device will not be received when it is networked again. 755 +* 0: Only push messages once, messages may be lost or duplicated. It can be used for environmental sensor data, it doesn't matter if lose a record, because there will be a second push message soon. This method is mainly used for normal APP push, but if the user smart device is not connected when the message is pushed, the message will be discarded, and the smart device will not be received when it is networked again. 756 +* 1: The message is delivered at least once, but the message may be delivered repeatedly. 757 +* 2: The message was delivered exactly once. This level can be used in a billing system. In a billing system, repeated or missing messages can lead to incorrect results. This highest quality message push service can also be used for instant messaging APP pushes, ensuring that users only receive messages once. 819 819 820 -1: The message is delivered at least once, but the message may be delivered repeatedly. 821 - 822 -2: The message was delivered exactly once. This level can be used in a billing system. In a billing system, repeated or missing messages can lead to incorrect results. This highest quality message push service can also be used for instant messaging APP pushes, ensuring that users only receive messages once. 823 - 824 824 **Retain flag:** 825 825 826 826 0: not reserved; ... ... @@ -828,13 +828,11 @@ 828 828 1: reserved 829 829 830 830 ((( 831 -== ** 4.1mqtt.create(string serverurl, string clientid)** ==766 +== **mqtt.create(string serverurl, string clientid)** == 832 832 ))) 833 833 834 -**Function:** 769 +**Function:** Create an MQTT object 835 835 836 -Create an MQTT object 837 - 838 838 **Parameters:** 839 839 840 840 //serverurl //Server url ... ... @@ -856,17 +856,13 @@ 856 856 Failed: multi 857 857 858 858 ((( 859 -== ** 4.2mqtt.close(mqtt obj)** ==792 +== **mqtt.close(mqtt obj)** == 860 860 ))) 861 861 862 -**Function:** 795 +**Function:** Close the specified MQTT object (if the connected server will be disconnected automatically) 863 863 864 - ClosehepecifiedMQTT object(iftheconnectedserverwill be disconnectedautomatically)797 +**Parameters: **//Obj //is the objeced returned by mqtt.create 865 865 866 -**Parameters:** 867 - 868 -//Obj //is the objeced returned by mqtt.create 869 - 870 870 **Return:** 871 871 872 872 Succeed: true ... ... @@ -874,32 +874,25 @@ 874 874 Failed: multi 875 875 876 876 ((( 877 -== ** 4.3mqtt:connect(table conn[, table lwt, table cart])** ==806 +== **mqtt:connect(table conn[, table lwt, table cart])** == 878 878 ))) 879 879 880 -**Function:** 809 +**Function:**Establish a connection to the server 881 881 882 -Establish a connection to the server 883 - 884 884 **Parameters:** 885 885 886 886 //conn //is a Lua table and needs to contain the following fields 887 887 888 -//string conn.username//, user name 815 +* //string conn.username//, user name 816 +* //string conn.password//, password 817 +* //number [conn.netway=0]//, networking method, if set error number will use Ethernet method 818 +** 0: Ethernet 819 +** 1: WIFI 820 +** 2: 4G 821 +** 3: 2G 822 +* //number [conn.keepalive=60]//, keep connected heartbeat interval, in seconds 823 +* //number [conn.cleansession=1]//, empty the session as described below: 889 889 890 -//string conn.password//, password 891 - 892 -//number [conn.netway=0]//, networking method, if set error number will use Ethernet method 893 - 894 -* 0: Ethernet 895 -* 1: WIFI 896 -* 2: 4G 897 -* 3: 2G 898 - 899 -//number [conn.keepalive=60]//, keep connected heartbeat interval, in seconds 900 - 901 -//number [conn.cleansession=1]//, empty the session as described below: 902 - 903 903 This function is used to control the behavior when connecting and disconnecting, and the client and server will retain the session information. This information is used to guarantee "at least once" and "accurately once" delivery, as well as the subject of the client subscription, the user can choose to keep or ignore the session message, set as follows: 904 904 905 905 * 1 (Empty): If a session exists and is 1, the previous session messages on the client and server are emptied. ... ... @@ -907,14 +907,11 @@ 907 907 908 908 //lwt// (Last Will and Testament) is a Lua table and needs to contain the following fields 909 909 910 -//string lwt.topic//, topic 832 +* //string lwt.topic//, topic 833 +* //string lwt.message//, message 834 +* //number [lwt.qos=0]//, qos value 835 +* //number [lwt.retain=0]//, retain flag 911 911 912 -//string lwt.message//, message 913 - 914 -//number [lwt.qos=0]//, qos value 915 - 916 -//number [lwt.retain=0]//, retain flag 917 - 918 918 **Return:** 919 919 920 920 Succeed: true ... ... @@ -922,17 +922,13 @@ 922 922 Failed: multi 923 923 924 924 ((( 925 -== ** 4.4mqtt:disconnect([number timeout])** ==844 +== **mqtt:disconnect([number timeout])** == 926 926 ))) 927 927 928 -**Function:** 847 +**Function:** Disconnect from the MQTT server 929 929 930 -Disconnect fromtheMQTTserver849 +**Parameters: **//[timeout=10000] //Disconnect waiting timeout, in milliseconds 931 931 932 -**Parameters:** 933 - 934 -//[timeout=10000] //Disconnect waiting timeout, in milliseconds 935 - 936 936 **Return:** 937 937 938 938 Succeed: true ... ... @@ -940,17 +940,13 @@ 940 940 Failed: multi 941 941 942 942 ((( 943 -== ** 4.5mqtt:isconnected()** ==858 +== **mqtt:isconnected()** == 944 944 ))) 945 945 946 -**Function:** 861 +**Function:** Test whether or not a client is currently connected to the MQTT server 947 947 948 - Test whetheror notaclientis currently connectedto the MQTT server863 +**Parameters:** None 949 949 950 -**Parameters:** 951 - 952 -None 953 - 954 954 **Return:** 955 955 956 956 Succeed: true ~-~-Connected ... ... @@ -958,13 +958,11 @@ 958 958 Failed: false ~-~- Unconnected and other unknowns 959 959 960 960 ((( 961 -== ** 4.6mqtt:subscribe(string topic, number qos)** ==872 +== **mqtt:subscribe(string topic, number qos)** == 962 962 ))) 963 963 964 -**Function:** 875 +**Function: **Subscribe to the topic (before the subscription, the user must first call the connect method to connect to the server) 965 965 966 -Subscribe to the topic (before the subscription, the user must first call the connect method to connect to the server) 967 - 968 968 **Parameters:** 969 969 970 970 //topic//, topic name ... ... @@ -978,13 +978,11 @@ 978 978 Failed: multi 979 979 980 980 ((( 981 -== ** 4.7mqtt:unsubscribe(string topic)** ==890 +== **mqtt:unsubscribe(string topic)** == 982 982 ))) 983 983 984 -**Function:** 893 +**Function:** Unsubscribe topic 985 985 986 -Unsubscribe topic 987 - 988 988 **Parameters:** 989 989 990 990 //topic//, topic name ... ... @@ -996,13 +996,11 @@ 996 996 Failed: multi 997 997 998 998 ((( 999 -== ** 4.8mqtt:publish(string topic, string message, number qos, number retain[, number timeout])** ==906 +== **mqtt:publish(string topic, string message, number qos, number retain[, number timeout])** == 1000 1000 ))) 1001 1001 1002 -**Function:** 909 +**Function:** Publish message 1003 1003 1004 -Publish message 1005 - 1006 1006 **Parameters:** 1007 1007 1008 1008 //topic//, topic name ... ... @@ -1022,17 +1022,13 @@ 1022 1022 Failed: multi 1023 1023 1024 1024 ((( 1025 -== ** 4.9mqtt:close()** ==930 +== **mqtt:close()** == 1026 1026 ))) 1027 1027 1028 -**Function:** 933 +**Function:** Close the mqtt object (the connection to the server will be automatically disconnected) 1029 1029 1030 - Close themqtt object(theconnection to the server will be automatically disconnected)935 +**Parameters:** None 1031 1031 1032 -**Parameters:** 1033 - 1034 -None 1035 - 1036 1036 **Return:** 1037 1037 1038 1038 Succeed: true ... ... @@ -1040,13 +1040,11 @@ 1040 1040 Failed: multi 1041 1041 1042 1042 ((( 1043 -== ** 4.10mqtt:on(string method, function callback)** ==944 +== **mqtt:on(string method, function callback)** == 1044 1044 ))) 1045 1045 1046 -**Function:** 947 +**Function:** Register event callback function 1047 1047 1048 -Register event callback function 1049 - 1050 1050 **Parameters:** 1051 1051 1052 1052 //method//, It can be message/arrived/offline, these 3 types of events