public void WriteEmptyTextItem(DataItemsQueryDTO tag, int currentDB, int replicate)
        {
            if (this.ConnectionState != ConnectionStates.Online)
            {
                throw new Exception("Can't write, the client is disconnected.");
            }

            int offset = Int32.Parse(tag.Offset.Substring(0, tag.Offset.IndexOf('.')));

            var result = client.WriteBytes(DataType.DataBlock, currentDB, offset + 2, S7.Net.Types.String.ToByteArray(new String('\0', replicate)));

            if ((ErrorCode)result != ErrorCode.NoError)
            {
                throw new Exception(((ErrorCode)result).ToString() + "\n" + "Tag: " + tag.Name);
            }
        }
Example #2
0
 public void WriteEmptyTextTag(DataItemsQueryDTO tag, int replicate)
 {
     plcDriver.WriteEmptyTextItem(tag, CurrentDb, replicate);
 }