ads-client 2.0.0-beta.3 → 2.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -812,7 +812,7 @@ export declare class Client extends EventEmitter<AdsClientEvents> {
812
812
  * @example
813
813
  * ```js
814
814
  * try {
815
- * const symbol = await client.getSymbol('GVL_Test.ExampleStruct');
815
+ * const symbol = await client.getSymbol('GVL_Read.StandardTypes.INT_');
816
816
  * } catch (err) {
817
817
  * console.log("Error:", err);
818
818
  * }
@@ -964,7 +964,7 @@ export declare class Client extends EventEmitter<AdsClientEvents> {
964
964
  * //Checks if value has changed every 100ms
965
965
  * //Callback is called only when the value has changed
966
966
  * await client.subscribeValue(
967
- * 'GVL_Test.ExampleStruct.',
967
+ * 'GVL_Subscription.NumericValue_10ms',
968
968
  * (data, subscription) => {
969
969
  * console.log(`Value of ${subscription.symbol.name} has changed: ${data.value}`);
970
970
  * },
@@ -1072,7 +1072,7 @@ export declare class Client extends EventEmitter<AdsClientEvents> {
1072
1072
  * //Checks if value has changed every 100ms
1073
1073
  * //Callback is called only when the value has changed
1074
1074
  * await client.subscribe({
1075
- * target: 'GVL_Test.ExampleStruct',
1075
+ * target: 'GVL_Subscription.NumericValue_10ms',
1076
1076
  * callback: (data, subscription) => {
1077
1077
  * console.log(`Value of ${subscription.symbol.name} has changed: ${data.value}`);
1078
1078
  * },
@@ -1491,7 +1491,6 @@ export declare class Client extends EventEmitter<AdsClientEvents> {
1491
1491
  *
1492
1492
  * NOTE: Unlike with {@link readRawByPath}(), this command uses multiple ADS requests for the operation.
1493
1493
  *
1494
- *
1495
1494
  * @example
1496
1495
  * ```js
1497
1496
  * try {
@@ -1614,7 +1613,7 @@ export declare class Client extends EventEmitter<AdsClientEvents> {
1614
1613
  * @example
1615
1614
  * ```js
1616
1615
  * try {
1617
- * const res = await client.readValue('GVL_Test.ExampleStruct');
1616
+ * const res = await client.readValue('GVL_Read.StandardTypes.INT_');
1618
1617
  * console.log(res.value);
1619
1618
  * } catch (err) {
1620
1619
  * console.log("Error:", err);
@@ -1625,10 +1624,11 @@ export declare class Client extends EventEmitter<AdsClientEvents> {
1625
1624
  * @param targetOpts Optional target settings that override values in `settings`
1626
1625
  *
1627
1626
  * @template T In Typescript, the data type of the value, for example `readValue<number>(...)` or `readValue<ST_TypedStruct>(...)` (default: `any`)
1627
+ * @throws Throws an error if sending the command fails or if the target responds with an error.
1628
1628
  */
1629
1629
  readValue<T = any>(path: string, targetOpts?: Partial<AmsAddress>): Promise<ReadValueResult<T>>;
1630
1630
  /**
1631
- * Reads variable's value from the target system by a symbol object
1631
+ * Reads variable's value from the target system by a symbol object (acquired using `getSymbol()`)
1632
1632
  * and returns the value as a Javascript object.
1633
1633
  *
1634
1634
  * Returns variable's
@@ -1642,7 +1642,7 @@ export declare class Client extends EventEmitter<AdsClientEvents> {
1642
1642
  * @example
1643
1643
  * ```js
1644
1644
  * try {
1645
- * const symbol = await client.getSymbol('GVL_Test.ExampleStruct');
1645
+ * const symbol = await client.getSymbol('GVL_Read.StandardTypes.INT_');
1646
1646
  *
1647
1647
  * const res = await client.readValueBySymbol(symbol);
1648
1648
  * console.log(res.value);
@@ -1651,10 +1651,11 @@ export declare class Client extends EventEmitter<AdsClientEvents> {
1651
1651
  * }
1652
1652
  * ```
1653
1653
  *
1654
- * @param symbol Symbol object (acquired using {@link getSymbol}())
1654
+ * @param symbol Symbol object
1655
1655
  * @param targetOpts Optional target settings that override values in `settings`
1656
1656
  *
1657
1657
  * @template T In Typescript, the data type of the value, for example `readValueBySymbol<number>(...)` or `readValueBySymbol<ST_TypedStruct>(...)` (default: `any`)
1658
+ * @throws Throws an error if sending the command fails or if the target responds with an error.
1658
1659
  */
1659
1660
  readValueBySymbol<T = any>(symbol: AdsSymbol, targetOpts?: Partial<AmsAddress>): Promise<ReadValueResult<T>>;
1660
1661
  /**
@@ -1678,7 +1679,7 @@ export declare class Client extends EventEmitter<AdsClientEvents> {
1678
1679
  * example: true
1679
1680
  * };
1680
1681
  *
1681
- * const res = await client.writeValue('GVL_Test.ExampleStruct', value);
1682
+ * const res = await client.writeValue('GVL_Read.StandardTypes.INT_', value);
1682
1683
  * } catch (err) {
1683
1684
  * console.log("Error:", err);
1684
1685
  * }
@@ -1687,169 +1688,379 @@ export declare class Client extends EventEmitter<AdsClientEvents> {
1687
1688
  * @param path Variable path in the PLC (such as `GVL_Test.ExampleStruct`)
1688
1689
  * @param value Value to write
1689
1690
  * @param targetOpts Optional target settings that override values in `settings`
1690
- * @param autoFill If set and the data type is a container (`STRUCT`, `FUNCTION_BLOCK` etc.), missing properties are automatically set to default values (usually `0` or `''`).
1691
+ * @param autoFill If set and the data type is a container (`STRUCT`, `FUNCTION_BLOCK` etc.), missing properties are automatically set to active values read from target (kept as-is).
1691
1692
  *
1692
1693
  * @template T In Typescript, the data type of the value, for example `writeValue<number>(...)` or `writeValue<ST_TypedStruct>(...)`
1694
+ * @throws Throws an error if sending the command fails or if the target responds with an error.
1693
1695
  */
1694
1696
  writeValue<T = any>(path: string, value: T, autoFill?: boolean, targetOpts?: Partial<AmsAddress>): Promise<WriteValueResult<T>>;
1695
1697
  /**
1696
- * **TODO - DOCUMENTATION ONGOING**
1698
+ * Writes variable's value to the target system by a symbol object (acquired using `getSymbol()`).
1699
+ * Converts the value from a Javascript object to a raw value.
1697
1700
  *
1698
- * Writes a value by symbol. Converts the value from a Javascript object to a raw value.
1701
+ * Returns variable's
1702
+ * - converted value
1703
+ * - raw value
1704
+ * - data type
1705
+ * - symbol
1699
1706
  *
1700
- * Returns the converted value, the raw value, the data type and the symbol.
1707
+ * **NOTE:** Do not use `autoFill` for `UNION` types, it doesn't work correctly.
1701
1708
  *
1702
- * **NOTE:** Do not use `autoFill` for `UNION` types, it works without errors but the result isn't probably the desired one
1709
+ * **NOTE:** This requires that the target is a PLC runtime or has equivalent ADS protocol support.
1703
1710
  *
1704
- * @param symbol Symbol (acquired using `getSymbol()`)
1711
+ * @example
1712
+ * ```js
1713
+ * try {
1714
+ * const symbol = await client.getSymbol('GVL_Read.StandardTypes.INT_');
1715
+ *
1716
+ * const res = await client.writeValueBySymbol(symbol, 32767);
1717
+ * } catch (err) {
1718
+ * console.log("Error:", err);
1719
+ * }
1720
+ * ```
1721
+ *
1722
+ * @param symbol Symbol object
1705
1723
  * @param value Value to write
1706
1724
  * @param targetOpts Optional target settings that override values in `settings`
1707
- * @param autoFill If true and data type is a container (`STRUCT`, `FUNCTION_BLOCK` etc.), missing properties are automatically **set to default values** (usually `0` or `''`)
1725
+ * @param autoFill If set and the data type is a container (`STRUCT`, `FUNCTION_BLOCK` etc.), missing properties are automatically set to active values read from target (kept as-is).
1708
1726
  *
1709
1727
  * @template T In Typescript, the data type of the value, for example `writeValue<number>(...)` or `writeValue<ST_TypedStruct>(...)`
1728
+ * @throws Throws an error if sending the command fails or if the target responds with an error.
1710
1729
  */
1711
1730
  writeValueBySymbol<T = any>(symbol: AdsSymbol, value: T, autoFill?: boolean, targetOpts?: Partial<AmsAddress>): Promise<WriteValueResult<T>>;
1712
1731
  /**
1713
- * **TODO - DOCUMENTATION ONGOING**
1714
- *
1715
1732
  * Returns a default (empty) Javascript object representing provided PLC data type.
1716
1733
  *
1717
- * @param dataType Data type name in the PLC as string (such as `ST_Struct`) or `AdsDataType` object
1734
+ * @example
1735
+ * ```js
1736
+ * try {
1737
+ * const res = await client.getDefaultPlcObject('INT');
1738
+ * console.log(res); //0
1739
+
1740
+ * const res2 = await client.getDefaultPlcObject('Tc2_Standard.TON');
1741
+ * console.log(res2); //{ IN: false, PT: 0, Q: false, ET: 0, M: false, StartTime: 0 }
1742
+ *
1743
+ * } catch (err) {
1744
+ * console.log("Error:", err);
1745
+ * }
1746
+ * ```
1747
+ *
1748
+ * @param dataType Data type name in the PLC as string (such as `ST_Struct`) or data type object (acquired using {@link getDataType}())
1718
1749
  * @param targetOpts Optional target settings that override values in `settings`
1719
1750
  *
1720
- * @template T Typescript data type of the PLC data, for example `readValue<number>(...)` or `readValue<ST_TypedStruct>(...)`
1751
+ * @template T Typescript data type of the PLC data, for example `getDefaultPlcObject<number>(...)` or `getDefaultPlcObject<ST_TypedStruct>(...)`
1752
+ * @throws Throws an error if sending the command fails or if the target responds with an error.
1721
1753
  */
1722
1754
  getDefaultPlcObject<T = any>(dataType: string | AdsDataType, targetOpts?: Partial<AmsAddress>): Promise<T>;
1723
1755
  /**
1724
- * **TODO - DOCUMENTATION ONGOING**
1756
+ * Converts raw data to a Javascript object by using the provided data type.
1725
1757
  *
1726
- * Converts a raw byte value to a Javascript object.
1758
+ * @example
1759
+ * ```js
1760
+ * try {
1761
+ * const data = await client.readRaw(16448, 414816, 2);
1762
+ * console.log(data); //<Buffer ff 7f>
1763
+ *
1764
+ * const converted = await client.convertFromRaw(data, 'INT');
1765
+ * console.log(converted); //32767
1766
+ *
1767
+ * } catch (err) {
1768
+ * console.log("Error:", err);
1769
+ * }
1770
+ * ```
1727
1771
  *
1728
- * @param data Raw PLC data as Buffer (read for example with `readRaw()`)
1729
- * @param dataType Data type name in the PLC as string (such as `ST_Struct`) or `AdsDataType` object
1772
+ * @param data Raw data (acquired for example using {@link readRaw}())
1773
+ * @param dataType Data type name in the PLC as string (such as `ST_Struct`) or data type object (acquired using {@link getDataType}())
1730
1774
  * @param targetOpts Optional target settings that override values in `settings`
1731
1775
  *
1732
1776
  * @template T Typescript data type of the PLC data, for example `convertFromRaw<number>(...)` or `convertFromRaw<ST_TypedStruct>(...)`
1777
+ * @throws Throws an error if sending the command fails or if the target responds with an error.
1733
1778
  */
1734
1779
  convertFromRaw<T = any>(data: Buffer, dataType: string | AdsDataType, targetOpts?: Partial<AmsAddress>): Promise<T>;
1735
1780
  /**
1736
- * **TODO - DOCUMENTATION ONGOING**
1781
+ * Converts a Javascript object to raw data by using the provided data type.
1737
1782
  *
1738
- * Converts a Javascript object to raw byte data.
1783
+ * **NOTE:** Do not use `autoFill` for `UNION` types, it doesn't work correctly.
1784
+
1785
+ * @example
1786
+ * ```js
1787
+ * try {
1788
+ * const data = await client.convertToRaw(32767, 'INT');
1789
+ * console.log(data); //<Buffer ff 7f>
1739
1790
  *
1740
- * **NOTE:** Do not use `autoFill` for `UNION` types, it works without errors but the result isn't probably the desired one
1791
+ * } catch (err) {
1792
+ * console.log("Error:", err);
1793
+ * }
1794
+ * ```
1741
1795
  *
1742
- * @param value Javascript object that represents the `dataType` in target system
1743
- * @param dataType Data type name in the PLC as string (such as `ST_Struct`) or `AdsDataType` object
1744
- * @param autoFill If true and data type is a container (`STRUCT`, `FUNCTION_BLOCK` etc.), missing properties are automatically **set to default values** (usually `0` or `''`)
1796
+ * @param value Value to convert
1797
+ * @param dataType Data type name in the PLC as string (such as `ST_Struct`) or data type object (acquired using {@link getDataType}())
1798
+ * @param autoFill autoFill If set and the data type is a container (`STRUCT`, `FUNCTION_BLOCK` etc.), missing properties are automatically set to default values (`0` or empty string).
1745
1799
  * @param targetOpts Optional target settings that override values in `settings`
1746
1800
  *
1747
- * @template T Typescript data type of the PLC data, for example `convertFromRaw<number>(...)` or `convertFromRaw<ST_TypedStruct>(...)`
1801
+ * @throws Throws an error if sending the command fails or if the target responds with an error.
1748
1802
  */
1749
1803
  convertToRaw(value: any, dataType: string | AdsDataType, autoFill?: boolean, targetOpts?: Partial<AmsAddress>): Promise<Buffer>;
1750
1804
  /**
1751
- * **TODO - DOCUMENTATION ONGOING**
1805
+ * Creates a handle to a variable at the target system by variable path (such as `GVL_Test.ExampleStruct`).
1752
1806
  *
1753
- * Creates a variable handle for a PLC symbol by given variable path
1807
+ * The handle can be then used for reading and writing the value.
1754
1808
  *
1755
- * Variable value can be accessed by using the handle with `readRawByHandle()` and `writeRawByHandle()`
1809
+ * Reading and writing dereferenced `POINTER` and `REFERENCE` values is also possible.
1810
+ * See {@link readRawByHandle}() and {@link writeRawByHandle}().
1756
1811
  *
1757
- * @param path Full variable path in the PLC (such as `GVL_Test.ExampleStruct`)
1758
- * @param targetOpts Optional target settings that override values in `settings` (**NOTE:** If used, no caching is available -> possible performance impact)
1812
+ * NOTE: The handle should be deleted after it's no longer needed,
1813
+ * as there is a limited amount of handles available. See {@link deleteVariableHandle}().
1814
+ *
1815
+ * @example
1816
+ * ```js
1817
+ * try {
1818
+ * //POINTER value (Note the dereference operator ^)
1819
+ * const handle1 = await client.createVariableHandle('GVL_Read.ComplexTypes.POINTER_^');
1820
+ * const value = await client.readRawByHandle(handle1);
1821
+ * await client.deleteVariableHandle(handle1);
1822
+ *
1823
+ * const handle2 = await client.createVariableHandle('GVL_Read.StandardTypes.INT_');
1824
+ * const value2 = await client.readRawByHandle(handle2);
1825
+ * await client.deleteVariableHandle(handle2);
1826
+ *
1827
+ * //Now you use convertFromRaw() to get actual values
1828
+ *
1829
+ * } catch (err) {
1830
+ * console.log("Error:", err);
1831
+ * }
1832
+ * ```
1833
+ *
1834
+ * @param path Variable path in the PLC to read (such as `GVL_Test.ExampleStruct`)
1835
+ * @param targetOpts Optional target settings that override values in `settings`
1836
+ *
1837
+ * @throws Throws an error if sending the command fails or if the target responds with an error.
1759
1838
  */
1760
1839
  createVariableHandle(path: string, targetOpts?: Partial<AmsAddress>): Promise<VariableHandle>;
1761
1840
  /**
1762
- * **TODO - DOCUMENTATION ONGOING**
1841
+ * Sends multiple {@link createVariableHandle}() commands in one ADS packet.
1842
+ *
1843
+ * Creates a handle to a variable at the target system by variable path (such as `GVL_Test.ExampleStruct`).
1844
+ *
1845
+ * The handle can be then used for reading and writing the value.
1763
1846
  *
1764
- * Sends multiple createVariableHandle() commands in one ADS packet
1847
+ * Reading and writing dereferenced `POINTER` and `REFERENCE` values is also possible.
1848
+ * See {@link readRawByHandle}() and {@link writeRawByHandle}().
1765
1849
  *
1766
- * Creates a variable handle for a PLC symbol by given variable path
1850
+ * NOTE: The handle should be deleted after it's no longer needed,
1851
+ * as there is a limited amount of handles available. See {@link deleteVariableHandle}().
1767
1852
  *
1768
- * Variable value can be accessed by using the handle with `readRawByHandle()` and `writeRawByHandle()`
1853
+ * Uses ADS sum command under the hood (better and faster performance).
1854
+ * See [Beckhoff Information System](https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_adsdll2/9007199379576075.html&id=9180083787138954512) for more info.
1769
1855
  *
1770
- * Uses ADS sum command under the hood (better perfomance)
1856
+ * @example
1857
+ * ```js
1858
+ * try {
1859
+ * const results = await client.createVariableHandleMulti([
1860
+ * 'GVL_Read.StandardTypes.INT_',
1861
+ * 'GVL_Read.StandardTypes.REAL_'
1862
+ * ]);
1863
+ *
1864
+ * if(results[0].success) {
1865
+ * console.log(`First handle: ${results[0].handle}`);
1866
+ * } else {
1867
+ * console.log(`Creating first handle failed: ${results[0].errorStr}`);
1868
+ * }
1869
+ *
1870
+ * } catch (err) {
1871
+ * console.log("Error:", err);
1872
+ * }
1873
+ * ```
1771
1874
  *
1772
- * @param paths Array of full variable paths in the PLC (such as `GVL_Test.ExampleStruct`)
1875
+ * @param paths Array of variable paths in the PLC to read (such as `GVL_Test.ExampleStruct`)
1773
1876
  * @param targetOpts Optional target settings that override values in `settings`
1877
+ *
1878
+ * @throws Throws an error if sending the command fails or if the target responds with an error.
1774
1879
  */
1775
1880
  createVariableHandleMulti(paths: string[], targetOpts?: Partial<AmsAddress>): Promise<CreateVariableHandleMultiResult[]>;
1776
1881
  /**
1777
- * **TODO - DOCUMENTATION ONGOING**
1882
+ * Deletes a variable handle that was previously created
1883
+ * using {@link createVariableHandle}().
1884
+ *
1885
+ * @example
1886
+ * ```js
1887
+ * try {
1888
+ * const handle = createVariableHandle(...);
1889
+ *
1890
+ * //After use, deleting the handle
1891
+ * await client.deleteVariableHandle(handle);
1778
1892
  *
1779
- * Deletes a variable handle that was previously created using `createVariableHandle()`
1893
+ * } catch (err) {
1894
+ * console.log("Error:", err);
1895
+ * }
1896
+ * ```
1780
1897
  *
1781
1898
  * @param handle Variable handle to delete
1782
- * @param targetOpts Optional target settings that override values in `settings` (**NOTE:** If used, no caching is available -> possible performance impact)
1899
+ * @param targetOpts Optional target settings that override values in `settings`
1900
+ *
1901
+ * @throws Throws an error if sending the command fails or if the target responds with an error.
1783
1902
  */
1784
1903
  deleteVariableHandle(handle: VariableHandle | number, targetOpts?: Partial<AmsAddress>): Promise<void>;
1785
1904
  /**
1786
- * **TODO - DOCUMENTATION ONGOING**
1905
+ * Sends multiple {@link deleteVariableHandle}() commands in one ADS packet.
1906
+ *
1907
+ * Deletes a variable handle that was previously created
1908
+ * using {@link createVariableHandle}().
1909
+ *
1910
+ * Uses ADS sum command under the hood (better and faster performance).
1911
+ * See [Beckhoff Information System](https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_adsdll2/9007199379576075.html&id=9180083787138954512) for more info.
1912
+ *
1913
+ * @example
1914
+ * ```js
1915
+ * try {
1916
+ * const handle1 = createVariableHandle(...);
1917
+ * const handle2 = createVariableHandle(...);
1787
1918
  *
1788
- * Sends multiple deleteVariableHandle() commands in one ADS packet
1919
+ * //After use, deleting the handles
1920
+ * const results = await client.deleteVariableHandleMulti([handle1, handle2]);
1789
1921
  *
1790
- * Deletes a variable handle that was previously created using `createVariableHandle()`
1922
+ * if(results[0].success) {
1923
+ * console.log(`First deleted`);
1924
+ * } else {
1925
+ * console.log(`Deleting first handle failed: ${results[0].errorStr}`);
1926
+ * }
1791
1927
  *
1792
- * Uses ADS sum command under the hood (better performance)
1928
+ * } catch (err) {
1929
+ * console.log("Error:", err);
1930
+ * }
1931
+ * ```
1793
1932
  *
1794
1933
  * @param handles Array of variable handles to delete
1795
1934
  * @param targetOpts Optional target settings that override values in `settings`
1935
+ *
1936
+ * @throws Throws an error if sending the command fails or if the target responds with an error.
1796
1937
  */
1797
1938
  deleteVariableHandleMulti(handles: (VariableHandle | number)[], targetOpts?: Partial<AmsAddress>): Promise<DeleteVariableHandleMultiResult[]>;
1798
1939
  /**
1799
- * **TODO - DOCUMENTATION ONGOING**
1940
+ * Reads raw data from the target system by a previously created variable handle (acquired using {@link createVariableHandle}())
1800
1941
  *
1801
- * Reads raw byte data from the target system by previously created variable handle
1942
+ * @example
1943
+ * ```js
1944
+ * try {
1945
+ * const handle = await client.createVariableHandle('GVL_Read.StandardTypes.INT_'');
1946
+ * const value = await client.readRawByHandle(handle);
1947
+ * await client.deleteVariableHandle(handle);
1802
1948
  *
1949
+ * } catch (err) {
1950
+ * console.log("Error:", err);
1951
+ * }
1952
+ * ```
1803
1953
  * @param handle Variable handle
1804
1954
  * @param size Optional data length to read (bytes) - as default, size in handle is used if available. Uses 0xFFFFFFFF as fallback.
1805
- * @param targetOpts Optional target settings that override values in `settings` (**NOTE:** If used, no caching is available -> possible performance impact)
1955
+ * @param targetOpts Optional target settings that override values in `settings`
1956
+ *
1957
+ * @throws Throws an error if sending the command fails or if the target responds with an error.
1806
1958
  */
1807
1959
  readRawByHandle(handle: VariableHandle | number, size?: number, targetOpts?: Partial<AmsAddress>): Promise<Buffer>;
1808
1960
  /**
1809
- * **TODO - DOCUMENTATION ONGOING**
1961
+ * Writes raw data to the target system by a previously created variable handle (acquired using {@link createVariableHandle}())
1962
+ *
1963
+ * @example
1964
+ * ```js
1965
+ * try {
1966
+ * const value = await client.convertToRaw(32767, 'INT');
1967
+ * console.log(value); //<Buffer ff 7f>
1968
+ *
1969
+ * const handle = await client.createVariableHandle('GVL_Read.StandardTypes.INT_');
1970
+ * await client.writeRawByHandle(handle, value);
1971
+ * await client.deleteVariableHandle(handle);
1810
1972
  *
1811
- * Writes raw byte data to the target system by previously created variable handle
1973
+ * } catch (err) {
1974
+ * console.log("Error:", err);
1975
+ * }
1976
+ * ```
1812
1977
  *
1813
1978
  * @param handle Variable handle
1814
1979
  * @param value Data to write
1815
- * @param targetOpts Optional target settings that override values in `settings` (**NOTE:** If used, no caching is available -> possible performance impact)
1980
+ * @param targetOpts Optional target settings that override values in `settings`
1981
+ *
1982
+ * @throws Throws an error if sending the command fails or if the target responds with an error.
1816
1983
  */
1817
1984
  writeRawByHandle(handle: VariableHandle | number, value: Buffer, targetOpts?: Partial<AmsAddress>): Promise<void>;
1818
1985
  /**
1819
- * **TODO - DOCUMENTATION ONGOING**
1986
+ * Reads raw data from the target system by a symbol object (acquired using `getSymbol()`)
1820
1987
  *
1821
- * Reads raw data by symbol
1988
+ * @example
1989
+ * ```js
1990
+ * try {
1991
+ * const symbol = await client.getSymbol('GVL_Read.StandardTypes.INT_');
1992
+ * const value = await client.readRawBySymbol(symbol);
1822
1993
  *
1823
- * @param symbol Symbol (acquired using `getSymbol()`)
1824
- * @param targetOpts Optional target settings that override values in `settings` (**NOTE:** If used, no caching is available -> possible performance impact)
1994
+ * } catch (err) {
1995
+ * console.log("Error:", err);
1996
+ * }
1997
+ * ```
1998
+ *
1999
+ * @param symbol Symbol
2000
+ * @param targetOpts Optional target settings that override values in `settings`
2001
+ *
2002
+ * @throws Throws an error if sending the command fails or if the target responds with an error.
1825
2003
  */
1826
2004
  readRawBySymbol(symbol: AdsSymbol, targetOpts?: Partial<AmsAddress>): Promise<Buffer>;
1827
2005
  /**
1828
- * **TODO - DOCUMENTATION ONGOING**
2006
+ * Writes raw data to the target system by a symbol object (acquired using `getSymbol()`)
1829
2007
  *
1830
- * Writes raw data by symbol
2008
+ * @example
2009
+ * ```js
2010
+ * try {
2011
+ * const value = await client.convertToRaw(32767, 'INT');
2012
+ * console.log(value); //<Buffer ff 7f>
2013
+ *
2014
+ * const symbol = await client.getSymbol('GVL_Read.StandardTypes.INT_');
2015
+ * await client.writeRawBySymbol(symbol, value);
2016
+ *
2017
+ * } catch (err) {
2018
+ * console.log("Error:", err);
2019
+ * }
2020
+ * ```
1831
2021
  *
1832
- * @param symbol Symbol (acquired using `getSymbol()`)
2022
+ * @param symbol Symbol
1833
2023
  * @param value Data to write
1834
2024
  * @param targetOpts Optional target settings that override values in `settings`
2025
+ *
2026
+ * @throws Throws an error if sending the command fails or if the target responds with an error.
1835
2027
  */
1836
2028
  writeRawBySymbol(symbol: AdsSymbol, value: Buffer, targetOpts?: Partial<AmsAddress>): Promise<void>;
1837
2029
  /**
1838
- * **TODO - DOCUMENTATION ONGOING**
2030
+ * Invokes a function block RPC method on the target system.
1839
2031
  *
1840
- * Invokes/calls a function block RPC method from PLC
2032
+ * Returns the return value of the method and outputs (if any).
1841
2033
  *
1842
- * Returns method return value and/or outputs (if any)
2034
+ * NOTE: In the PLC, `{attribute 'TcRpcEnable'}` is required above the `METHOD` definition.
1843
2035
  *
1844
- * For RPC support, the method needs to have `{attribute 'TcRpcEnable'}` attribute above the `METHOD` definition
2036
+ * @example
2037
+ * ```js
2038
+ * try {
2039
+ * const res = await client.invokeRpcMethod('GVL_RPC.RpcBlock', 'Calculator', {
2040
+ * Value1: 1,
2041
+ * Value2: 123
2042
+ * });
1845
2043
  *
1846
- * @param path Full function block instance path in the PLC (such as `GVL_Test.ExampleBlock`)
1847
- * @param method Function block method name to call
1848
- * @param parameters Function block method parameters (inputs) (if any)
2044
+ * console.log(res);
2045
+ * //{
2046
+ * // returnValue: true,
2047
+ * // outputs: { Sum: 124, Product: 123, Division: 0.008130080997943878 }
2048
+ * //}
2049
+ *
2050
+ * } catch (err) {
2051
+ * console.log("Error:", err);
2052
+ * }
2053
+ * ```
2054
+ *
2055
+ * @param path Variable path in the PLC of the function block instance (such as `GVL_Test.ExampleBlock`)
2056
+ * @param method Function block method name
2057
+ * @param parameters Method parameters (inputs) (if any)
1849
2058
  * @param targetOpts Optional target settings that override values in `settings`
1850
2059
  *
1851
2060
  * @template T Typescript data type of the method return value, for example `invokeRpcMethod<number>(...)` or `invokeRpcMethod<ST_TypedStruct>(...)`
1852
2061
  * @template U Typescript data type of the method outputs object, for example `invokeRpcMethod<number, ST_TypedStruct>(...)`
2062
+ *
2063
+ * @throws Throws an error if sending the command fails or if the target responds with an error.
1853
2064
  */
1854
2065
  invokeRpcMethod<T = any, U = Record<string, any>>(path: string, method: string, parameters?: Record<string, any>, targetOpts?: Partial<AmsAddress>): Promise<RpcMethodCallResult<T, U>>;
1855
2066
  }