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
-
... ... @@ -1727,183 +1727,20 @@ 1727 1727 (% class="wikigeneratedid" %) 1728 1728 Table 9-1 1729 1729 1730 +(% class="wikigeneratedid" %) 1730 1730 == **crc:calc(string crcValue)** == 1731 1731 1732 1732 **Function:** Calculate CRC result 1733 1733 1734 -** Parameter:**1735 +**parameter:** 1735 1735 1736 1736 crcValue: the value to be calculated 1737 1737 1738 1738 **Return:** 1739 1739 1740 -Succeed: calcul ated result1741 +Succeed: calcul 1741 1741 1742 -Failed: multi , error code1743 +Failed: multi 1743 1743 ))) 1744 1744 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 -= **10 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: 1797 -** 1: ID 1798 -** 2: status 1799 -** 3: tag name 1800 -** 4: value 1801 -* Status contains 3 enumerated values 1802 -** 0: offline 1803 -** 1: online 1804 -** 2: timeout 1805 -* Customization returns an empty table if there is no configuration, otherwise returns "field name/field content" 1806 - 1807 -For example: 1808 - 1809 -{ 1810 - 1811 -[1]= {[1]=1234, [2]=1, [3]='temp', [4]='23.5'}, 1812 - 1813 -[2]= {[1]=1235, [2]=1, [3]='humi', [4]='67'}, 1814 - 1815 -... 1816 - 1817 -[n]= {[1]=xxxx, [2]=x, [3]='xxxx', [4]='xx.x'}, 1818 - 1819 -} 1820 - 1821 -Failed: table, empty table 1822 - 1823 -== **normal_setdata_byname(string name, string data)** == 1824 - 1825 -**Function:** Write data to the monitoring point name 1826 - 1827 -**Parameter:** 1828 - 1829 -name: the name of monitoring point 1830 - 1831 -data: the data to be written 1832 - 1833 -**Return:** 1834 - 1835 -Succeed: string: The value of the monitor point before it is written 1836 - 1837 -Failed: mil 1838 - 1839 -== **normal_getdata_byname(string name)** == 1840 - 1841 - 1842 - 1843 - 1844 -**Function:** Read the data of the monitoring point name 1845 - 1846 -**Parameter:** 1847 - 1848 -name: the name of monitoring point 1849 - 1850 -**Return:** 1851 - 1852 -Succeed: string 1853 - 1854 -Failed: mil 1855 - 1856 -= **11 MySQL database operation** = 1857 - 1858 -== **luaMySql.init(string sourcename, string username, string password, string host, number port, string character)** == 1859 - 1860 -**Function:** Configure database connection parameters 1861 - 1862 -**Parameter:** 1863 - 1864 -sourcename: the name of database 1865 - 1866 -username: the username of the connection 1867 - 1868 -password: the password of the connection 1869 - 1870 -host: the host name of the connection 1871 - 1872 -port: the host port of the connection 1873 - 1874 -character: the character set of the connection 1875 - 1876 -**Return:** 1877 - 1878 -Succeed: string 1879 - 1880 -Failed: multi 1881 - 1882 -== **luaMySql.exec(string statement)** == 1883 - 1884 -**Function:** Execute the given SQL statement without returning the result set (add, delete, change) 1885 - 1886 -**Parameter:** 1887 - 1888 -statement: the given SQL statement 1889 - 1890 -**Return:** 1891 - 1892 -Succeed: status: returns the number of rows affected by SQL statement execution. 1893 - 1894 -Failed: mil, errorString 1895 - 1896 -== **luaMySql.execWithResult(string statement)** == 1897 - 1898 - 1899 -**Function:** Execute the given SQL statement returning the result set (che) 1900 - 1901 -**Parameter:** 1902 - 1903 -statement: the given SQL statement 1904 - 1905 -**Return:** 1906 - 1907 -Succeed: status: returns the number of rows affected by SQL statement execution. 1908 - 1909 -Failed: mil, errorString 1746 +