public Boolean Connect() { // Create a server object and connect to the TwinCATOpcServer Opc.URL url = new Opc.URL(opcServerEndpoint); OpcCom.Factory fact = new OpcCom.Factory(); server = new Opc.Da.Server(fact, null); server.Connect(url, new Opc.ConnectData(new System.Net.NetworkCredential())); // Create a group Opc.Da.Subscription group; foreach (BrowsableGroup BrowsableGroup in browsableGroups) { Opc.Da.SubscriptionState groupState = new SubscriptionState(); groupState.Name = BrowsableGroup.GroupName; groupState.Active = true; group = (Opc.Da.Subscription)server.CreateSubscription(groupState); Opc.Da.Item[] items = BrowsableGroup.produceItemsFromNodes(); items = group.AddItems(items); EnableDataChangedCallback(group); //todo: //EnableDataReadCallback(group); //todo: //EnableDataWriteCallback(group, BrowsableGroup.produceValueToWrite(items[0],34.0) ); } return(false); }
private BrowsableGroup DiSignals() { BrowsableGroup g = new BrowsableGroup(); g.GroupName = "DI"; g.Nodes = new string[] { "FIX.GREEN.F_CV" }; return(g); }
public void Connect() { BrowsableGroup[] browsableGroups = new BrowsableGroup[] { AiSignals(), DiSignals() }; connector = new OpcDaConnector("opcda://localhost/" + SERVER_NAME, browsableGroups); connector.Connect(); //connector.selectGroup("AI").readNode("FIX.WYSOKOSC.F_CV").execute //connector.selectGroup("AI").writeValue(33).intoNode("FIX.WYSOKOSC.F_CV").execute(); }
private BrowsableGroup AiSignals() { BrowsableGroup g = new BrowsableGroup(); g.GroupName = "AI"; g.Nodes = new string[] { "FIX.BLACKY.F_CV", "FIX.RED.F_CV" }; return(g); }