public double?ReadFloatingTag(string tag) { try { if (_socket.IsConnected) { _socket.Disconnect(); } _socket.Connect(_url + tag, AccessMode.Read); if (_socket.IsConnected) { _socket.Update(); var value = Convert.ToDouble(_socket.Data.Value); _socket.Disconnect(); ClearConnectionError(tag); return(value); } else { LogConnectionError(tag); return(null); } } catch (Exception e) { throw new Exception(e.ToString()); } }
public void opcWriteConnectSockets() //Method for setting OPC communication to write { if (dataSocket.IsConnected) { dataSocket.Disconnect(); } dataSocket.Connect(opcurl, AccessMode.Write);//Connect to OPC }
public void opcWriteConnectSockets() { if (dataSocket.IsConnected) { dataSocket.Disconnect(); } dataSocket.Connect(opcurl, AccessMode.Write);//Connect to OPC }
public double GetOpcValue() { _datasocket.Connect(_opcUrl, AccessMode.Read); _datasocket.Update(); var value = Convert.ToDouble(_datasocket.Data.Value); _datasocket.Disconnect(); return(value); }
public void writeToOPC(double temperature, double u) { try { using (DataSocket ds = new DataSocket()) { if (ds.IsConnected) { ds.Disconnect(); } if (tName == "Temperature") { ds.Data.Value = temperature; } else if (tName == "Control") { ds.Data.Value = u; } ds.Connect(itURL, AccessMode.Write); ds.Update(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void SetOpcValue(double value) { _dataSocket.Connect(_opcUrl, AccessMode.Write); _dataSocket.Data.Value = value; _dataSocket.Update(); _dataSocket.Disconnect(); }
public void WriteToServer(string tag, double value) { try { if (_socket.IsConnected) { _socket.Disconnect(); } _socket.Connect(_url + tag, AccessMode.Write); _socket.Data.Value = value; _socket.Update(); _socket.Disconnect(); //_socket.SyncWrite(value, 2000); } catch (Exception e) { Console.WriteLine(e); throw; } }
public void writeToOPC(bool opcValue) { using (DataSocket ds = new DataSocket()) { if (ds.IsConnected) { ds.Disconnect(); } var temp = opcValue; ds.Connect(itURL, AccessMode.Write); ds.Data.Value = temp; ds.Update(); } }
public void Disconnect() { _dataSocket.Disconnect(); }