public void ReadDB100Int12Test() { int result = 0; if (!Client.Connected) { result = Client.ConnectTo(IpAddress, Rack, Slot); } if (result == 0) { byte[] buffer = new byte[2]; result = Client.ReadArea(S7.S7AreaDB, 100, 12, 2, buffer); var int12 = S7.GetShortAt(buffer, 0); Assert.Equal(int12, 99); } }
public void Initial(IList <Tag> tags, Machine machine) { S7Client = new S7ClientAsync(); //connect S7Client.SetConnectionType(S7.OP); var result = S7Client.ConnectTo(machine.IPAddress, machine.Rack, machine.Slot); if (result > 0) { //S7ClientAsync.ErrorText(result); //log here //try to connect return; } var enabledJobs = _azureIot.Jobs.Where(x => x.Enable == true && x.Commands != null).ToList(); foreach (Job jobItem in enabledJobs) { var activedCommand = jobItem.Commands.Where(x => x.Tags != null && x.Tags.Count > 0); foreach (var pair in activedCommand) { var tList = new List <Tag>(); foreach (var tagItem in tags) { if (pair.Tags.Contains(tagItem.Name)) { tList.Add(tagItem); } } DictJob.Add(pair, tList); } } }