예제 #1
0
        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);
        }
예제 #2
0
        private BrowsableGroup DiSignals()
        {
            BrowsableGroup g = new BrowsableGroup();

            g.GroupName = "DI";
            g.Nodes     = new string[] { "FIX.GREEN.F_CV" };
            return(g);
        }
예제 #3
0
 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();
 }
예제 #4
0
        private BrowsableGroup AiSignals()
        {
            BrowsableGroup g = new BrowsableGroup();

            g.GroupName = "AI";
            g.Nodes     = new string[] { "FIX.BLACKY.F_CV", "FIX.RED.F_CV" };
            return(g);
        }