public void opcWriteConnectSockets() { if (dataSocket.IsConnected) { dataSocket.Disconnect(); } dataSocket.Connect(opcurl, AccessMode.Write);//Connect to OPC }
public void opcWriteConnectSockets() //Method for setting OPC communication to write { 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 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 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 static DataSocket f_建立OPC连接(string URL, AccessMode _Mode) { DataSocket dataSocket = new DataSocket(); dataSocket.Connect(URL, _Mode); return(dataSocket); }
public void SetOpcValue(double value) { _dataSocket.Connect(_opcUrl, AccessMode.Write); _dataSocket.Data.Value = value; _dataSocket.Update(); _dataSocket.Disconnect(); }
public void 加载触屏数据() { U = new DataSocket(); U.Connect("opc://localhost/National Instruments.NIOPCServers/kaiquan.kaiquan.Anyway.U", AccessMode.WriteAutoUpdate); I = new DataSocket(); I.Connect("opc://localhost/National Instruments.NIOPCServers/kaiquan.kaiquan.Anyway.I", AccessMode.WriteAutoUpdate); P = new DataSocket(); P.Connect("opc://localhost/National Instruments.NIOPCServers/kaiquan.kaiquan.Anyway.P", AccessMode.WriteAutoUpdate); }
public void writeToOPC(bool opcValue) { using (DataSocket ds = new DataSocket()) { ds.Connect(itURL, AccessMode.Write); ds.Data.Value = opcValue; ds.Update(); } }
public RDPSessionPage() { NavigationPage.SetHasNavigationBar(this, false); //InitializeComponent(); if (GlobalConfiguration.isStdOutOff) { Utils.setStdoutOff(); } if (GlobalConfiguration.isEnableImageStreaming || GlobalConfiguration.isEnableInputDeviceController) { canvas = new SKCanvasView { //VerticalOptions = LayoutOptions.FillAndExpand VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill }; canvas.PaintSurface += OnCanvasViewPaintSurface; // Skiaを利用する場合、ビットマップデータのバッファはここで用意してしまう skiaBufStreams = new MemoryStream[2]; skiaBufStreams.SetValue(new MemoryStream(), 0); skiaBufStreams.SetValue(new MemoryStream(), 1); } Title = "RDPSession"; layout = new AbsoluteLayout(); Content = layout; socket = new DataSocket(NetworkTypes.Client); if (GlobalConfiguration.isEnableSoundStreaming && !GlobalConfiguration.isClientRunWithoutConn) { connectToSoundServer(); // start recieve sound data which playing on remote PC } if (GlobalConfiguration.isEnableInputDeviceController) { setupInputManager(); } if ((GlobalConfiguration.isEnableImageStreaming || GlobalConfiguration.isEnableInputDeviceController) && !GlobalConfiguration.isClientRunWithoutConn) { socket.ConnectedCallback += Socket_ConnectedCallback; socket.DisconnectedCallback += Socket_DisconnectedCallback; socket.ConnectionFailedCallback += Socket_ConnectionFailedCallback; socket.DataRecievedCallback += Socket_DataRecievedCallback; socket.StartDataRecievedCallback += Socket_StartDataRecievedCallback; socket.EndDataRecievedCallback += Socket_EndDataRecievedCallback; socket.Connect(IPAddress.Parse(GlobalConfiguration.ServerAddress), GlobalConfiguration.ImageAndInputServerPort); } }
public bool Connect(string opcUrl) { if (_dataSocket.IsConnected) { this.Disconnect(); return(_dataSocket.IsConnected); } _dataSocket.Connect(opcUrl, AccessMode.Read); _dataSocket.Update(); return(_dataSocket.IsConnected); }
public bool readFromOPC() { bool OPCvalue = false; using (DataSocket ds = new DataSocket()) { ds.Connect(itURL, AccessMode.Read); ds.Update(); OPCvalue = Convert.ToBoolean(ds.Data.Value); } return(OPCvalue); }
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 bool Setup() { if (Config.Address == 0) { throw new InvalidOperationException("Configuration address not configured"); } if (Config.Port == 0) { throw new InvalidOperationException("Configuration port not configured"); } try { //check if the camera is active DataSocket.Connect(new IPEndPoint(Config.Address, Config.Port)); DataSocket.Send(Encoding.ASCII.GetBytes((int)CameraRequest.Alive + Constants.EndOfMessage)); //grab data byte[] recieveData = new byte[1000]; int bytesRec = DataSocket.Receive(recieveData); //if there was no data the camera must have been off if (bytesRec <= 0) { Console.WriteLine("Camera not active, No data recieved"); DataSocket.Shutdown(SocketShutdown.Both); DataSocket.Close(); return(false); } else { Console.WriteLine("Camera response = {0}", Encoding.ASCII.GetString(recieveData, 0, bytesRec - Constants.EndOfMessage.Length)); } } catch (SocketException e) { Console.WriteLine("Socket Exception : {0}", e); if (!DataSocket.Connected) { return(false); } DataSocket.Shutdown(SocketShutdown.Both); DataSocket.Close(); return(false); } return(true); }
public double readFromOPC() { double OPCvalue = 0; try { using (DataSocket ds = new DataSocket()) { ds.Connect(itURL, AccessMode.Read); ds.Update(); OPCvalue = Convert.ToDouble(ds.Data.Value); opcQuality = ds.Data.Attributes["Quality"].Value.ToString(); } } catch (Exception ex) { OPCvalue = 998; } return(OPCvalue); }
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; } }
private void connectButton_Click(object sender, RoutedEventArgs e) { // handle pause if (uiState == UIStates.Streaming || uiState == UIStates.Paused) { var state = uiState; SetConnectionUIStates(state == UIStates.Streaming ? UIStates.Paused : UIStates.Streaming); var metaData = new MetaData() { type = state == UIStates.Streaming ? MetaDataTypes.PauseCapture : MetaDataTypes.ResumeCapture, dataSize = -1 }; socket.SendMetaData(metaData); return; } // handle connect SetConnectionUIStates(UIStates.Streaming); NetworkHost host = null; if (settingsOverlay.settings.customSocketAddress.enabled) { if (string.IsNullOrEmpty(serverTextBox.Text)) { #if DEBUG connectedToLocalPC = true; host = new NetworkHost("localhost") { endpoints = new List <IPEndPoint>() { new IPEndPoint(IPAddress.Loopback, 8888) } }; #else return; #endif } else { host = new NetworkHost(serverTextBox.Text) { endpoints = new List <IPEndPoint>() { new IPEndPoint(IPAddress.Loopback, 8888) } }; connectedToLocalPC = host.name == Dns.GetHostName() || host.name.ToLower() == "localhost" || host.name == "127.0.0.1"; } } else { if (serverComboBox.SelectedIndex == -1) { #if DEBUG connectedToLocalPC = true; host = new NetworkHost("localhost") { endpoints = new List <IPEndPoint>() { new IPEndPoint(IPAddress.Loopback, 8888) } }; #else return; #endif } else { host = (NetworkHost)serverComboBox.SelectedValue; connectedToLocalPC = host.name == Dns.GetHostName(); } } socket = new DataSocket(NetworkTypes.Client); socket.ConnectedCallback += Socket_ConnectedCallback; socket.DisconnectedCallback += Socket_DisconnectedCallback; socket.ConnectionFailedCallback += Socket_ConnectionFailedCallback; socket.DataRecievedCallback += Socket_DataRecievedCallback; socket.StartDataRecievedCallback += Socket_StartDataRecievedCallback; socket.EndDataRecievedCallback += Socket_EndDataRecievedCallback; socket.Connect(host.endpoints[0]); }
public static DataSocket f_建立OPC连接(string URL, AccessMode _Mode) { DataSocket dataSocket = new DataSocket(); dataSocket.Connect(URL, _Mode); return dataSocket; }