Exemplo n.º 1
0
        public void ModbusLinkSuccess(string id, string message)
        {
            var device = Z;

            if (id == "从站")
            {
                device = C;
            }
            //GetDeviceParameter(device);
            // 心跳包保证链接
            Task.Run(() =>
            {
                while (device.Client != null && device.Client.Connected && device.IsSuccess)
                {
                    device.F05(PLCSite.M(0), true, null);
                    device.F03(PLCSite.D(0), 8, (data) =>
                    {
                        _clients.All.SendAsync("LiveData", new { name = device.Name, data = ReceiveData.F03(data, 8) });
                    });
                    Thread.Sleep(10);
                }
            });
            //if (_clients != null)
            //{
            //  _clients.All.SendAsync("Send", new { Id = id, Message = message });
            //}
        }
Exemplo n.º 2
0
 public Boolean DF05(InPLC data)
 {
     Z.F05(PLCSite.M(data.Address), data.F05, null);
     C.F05(PLCSite.M(data.Address), data.F05, null);
     return(true);
 }