コード例 #1
0
        public void GetBlocksOfTypeTest()
        {
            var client = new Dacs7Client();

            client.Connect(ConnectionString);
            Assert.True(client.IsConnected);

            var bc = client.GetBlocksOfType(PlcBlockType.Ob);

            client.Disconnect();
            Assert.False(client.IsConnected);
        }
コード例 #2
0
        public void GetBlocksOfTypeTest2()
        {
            var client = new Dacs7Client();

            client.Connect(ConnectionString);
            Assert.True(client.IsConnected);

            var bc = client.GetBlocksOfType(PlcBlockType.Sdb);

            foreach (var c in bc)
            {
                Console.WriteLine(c.Number);
            }

            client.Disconnect();
            Assert.False(client.IsConnected);
        }
コード例 #3
0
 /// <summary>
 /// This method starts a request to the plc to get information of the loaded data blocks
 /// </summary>
 /// <returns></returns>
 public IEnumerable <string> GetDataBlocks()
 {
     return(_client.GetBlocksOfType(PlcBlockType.Db).Select(bi => $"DB{bi.Number}"));
 }