Promotic

AutoOffset - property of the PmBuffer object

Description:
The internal automated positioning in the data block works automatically (but can also be set in the script).
Syntax:
Long AutoOffset
Note:
Property access for read and write.
 
At the beginning (with the creation of of the PmBuffer object) the value of this property is set to 0.
 
After each successfull read/write operation of a value in the data block, this property is automatically set to the end (behind) yhe read/written value (to the next read/written value).
This can be used for continuous value reading/writing or for detecting the number of read/written bytes by the difference of the value of this property before the operation and after the operation.
 
The read/write position is available in the form of the nOffset parameter in each method working with the data block (e.g. GetUint8, SetInt16), where the -4 value means that the value of this internal positioning AutoOffset is used.
Example:
JavaScriptSelect and copy to clipboard

var oBuf = Pm.CreatePmBuffer();
var s1 = "40302010605070";
oBuf.SetHexaString(-2, s1);
oBuf.AutoOffset = 0;   // Writing into the property
var val1 = oBuf.GetInt32(-4);
var val2 = oBuf.GetInt16(-4);
var val3 = oBuf.GetUint8(-4);
var nAutoOffset = oBuf.AutoOffset;   // Reading from the property, nAutoOffset = 7

History:
Pm9.00.04: Created
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.