Changes for page 01 Lua Functions

Last modified by Theodore Xu on 2023/10/26 10:51

From version 5.28
edited by Stone Wu
on 2022/07/12 10:35
Change comment: (Autosaved)
To version 5.29
edited by Stone Wu
on 2022/07/12 10:40
Change comment: (Autosaved)

Summary

Details

Page properties
Content
... ... @@ -1727,20 +1727,73 @@
1727 1727  (% class="wikigeneratedid" %)
1728 1728  Table 9-1
1729 1729  
1730 -(% class="wikigeneratedid" %)
1731 1731  == **crc:calc(string crcValue)** ==
1732 1732  
1733 1733  **Function:** Calculate CRC result
1734 1734  
1735 -**parameter:**
1734 +**Parameter:**
1736 1736  
1737 1737  crcValue: the value to be calculated
1738 1738  
1739 1739  **Return:**
1740 1740  
1741 -Succeed: calcul
1740 +Succeed: calculated result
1742 1742  
1743 -Failed: multi
1742 +Failed: multi, error code
1744 1744  )))
1745 1745  
1746 -
1745 +Example:
1746 +
1747 +{{code language="LUA"}}
1748 +function crcTest.main()
1749 +
1750 +local param = {
1751 +
1752 +name = '',
1753 +
1754 +width = 64,
1755 +
1756 +poly = 0x42F0E1EBA9EA3693,
1757 +
1758 +init = 0xFFFFFFFFFFFFFFFF,
1759 +
1760 +xorout = 0xFFFFFFFFFFFFFFFF,
1761 +
1762 +refin = 1,
1763 +
1764 +refout = 1
1765 +
1766 +}
1767 +
1768 +crc64,err = crc.init(param)
1769 +
1770 +if not crc64 then
1771 +
1772 +print("Crc init failed:", err)
1773 +else
1774 +
1775 +crcvalue = crc64:calc("123456789")
1776 +
1777 +print(string.format("crc64 calc :0X%16X", crcvalue))
1778 +
1779 +end
1780 +
1781 +end
1782 +{{/code}}
1783 +
1784 += **11 Special function for V-NET** =
1785 +
1786 +**normal_get_alldata()**
1787 +
1788 +**Function: **Obtain the data of all the monitoring points
1789 +
1790 +**Parameter: None**
1791 +
1792 +**Return:**
1793 +
1794 +Succeed: table two-dimensional arrays, as follows:
1795 +
1796 +* Each item is a monitoring point and contains 4 attributes: ID, status, tag name, value)
1797 +* Status contains 3 enumerated values (0: offline, 1: online, 2: timeout) Customization returns an empty table if there is no configuration, and vice versa, with "field name/field content"
1798 +
1799 +Failed: multi, error code