@@ -20,10 +20,35 @@ Add Node BACstack to your project by using:
2020$ npm install --save bacstack
2121```
2222
23- ** Who Is**
23+ #### Client
24+
25+ To be able to communicate to BACNET devices, you have to initialize a new
26+ bacstack instance. Hereby, following options are avilable:
27+
28+ - ` option ` * [ object] * - The options object used for parameterising the bacstack.
29+ - ` port ` * [ number] * - BACNET communication port for listening and sending. Default is ` 47808 ` . * Optional* .
30+ - ` interface ` * [ string] * - Specific BACNET communication interface if different from primary one. * Optional* .
31+ - ` broadcastAddress ` * [ string] * - The address used for broadcast messages. Default is ` 255.255.255.255 ` . * Optional* .
32+ - ` adpuTimeout ` * [ number] * - The timeout in milliseconds until a transaction should be interpreted as error. Default is ` 3000 ` . * Optional* .
33+
34+ ``` js
35+ var bacnet = require (' bacstack' );
36+ var client = bacnet ({
37+ port: 47809 , // Use BAC1 as communication port
38+ interface: ' 192.168.251.10' , // Listen on a specific interface
39+ broadcastAddress: ' 192.168.251.255' , // Use the subnet broadcast address
40+ adpuTimeout: 6000 // Wait twice as long for response
41+ });
42+ ```
43+
44+ #### Who Is
2445
2546The ` whoIs ` command discovers all BACNET devices in the network.
2647
48+ - ` lowLimit ` * [ number] * - Minimal device instance number to search for. * Optional* .
49+ - ` highLimit ` * [ number] * - Maximal device instance number to search for. * Optional* .
50+ - ` address ` * [ string] * - Unicast address if command should device directly. * Optional* .
51+
2752``` js
2853var bacnet = require (' bacstack' );
2954var client = bacnet ();
@@ -35,10 +60,17 @@ client.on('iAm', function(address, deviceId, maxAdpu, segmentation, vendorId) {
3560client .whoIs ();
3661```
3762
38- ** Read Property**
63+ #### Read Property
3964
4065The ` readProperty ` command reads a single property of an object from a device.
4166
67+ - ` address ` * [ string] * - IP address of the target device.
68+ - ` objectType ` * [ number] * - The BACNET object type to read.
69+ - ` objectInstance ` * [ number] * - The BACNET object instance to read.
70+ - ` propertyId ` * [ number] * - The BACNET property id in the specified object to read.
71+ - ` arrayIndex ` * [ number] * - The array index of the property to be read.
72+ - ` next ` * [ function] * - The callback containing an error, in case of a failure and value object in case of success.
73+
4274``` js
4375var bacnet = require (' bacstack' );
4476var client = bacnet ();
@@ -48,15 +80,51 @@ client.readProperty('192.168.1.43', 8, 44301, 28, null, function(err, value) {
4880});
4981```
5082
51- ** Write Property**
83+ #### Write Property
5284
5385The ` writeProperty ` command writes a single property of an object to a device.
5486
87+ - ` address ` * [ string] * - IP address of the target device.
88+ - ` objectType ` * [ number] * - The BACNET object type to write.
89+ - ` objectInstance ` * [ number] * - IP address of the target device.
90+ - ` propertyId ` * [ number] * - The BACNET property id in the specified object to write.
91+ - ` priority ` * [ number] * - The priority to be used for writing to the property.
92+ - ` valueList ` * [ array] * - A list of values to be written to the speicifed property.
93+ - ` next ` * [ function] * - The callback containing an error, in case of a failure and value object in case of success.
94+
95+ propertyId, ,
96+
97+ ``` js
98+ var bacnet = require (' bacstack' );
99+ var client = bacnet ();
100+
101+ client .writeProperty (' 192.168.1.43' , 8 , 44301 , 28 , 12 , [100 ], function (err , value ) {
102+ console .log (' value: ' , value);
103+ });
104+ ```
105+
106+ #### Read Property Multiple
107+
108+ The ` readPropertyMultiple ` command reads multiple properties in multiple objects
109+ from a device.
110+
111+ - ` address ` * [ string] * - IP address of the target device.
112+ - ` propertyIdAndArrayIndex ` * [ array] * - List of object and property specifications to be read.
113+ - ` objectIdentifier ` * [ object] * - Specifies which object to read.
114+ - ` type ` * [ number] * - The BACNET object type to read.
115+ - ` instance ` * [ number] * - The BACNET object instance to read.
116+ - ` propertyReferences ` * [ array] * - List of properties to be read.
117+ - ` propertyIdentifier ` * [ number] * - The BACNET property id in the specified object to read. Also supports ` 8 ` for * all* properties.
118+ - ` next ` * [ function] * - The callback containing an error, in case of a failure and value object in case of success.
119+
55120``` js
56121var bacnet = require (' bacstack' );
57122var client = bacnet ();
58123
59- client .writeProperty (' 192.168.1.43' , 8 , 44301 , 28 , null , 1 , function (err , value ) {
124+ var requestArray = [
125+ {objectIdentifier: {type: 8 , instance: 4194303 }, propertyReferences: [{propertyIdentifier: 8 }]}
126+ ];
127+ client .readPropertyMultiple (' 192.168.1.43' , requestArray, function (err , value ) {
60128 console .log (' value: ' , value);
61129});
62130```
0 commit comments