Beispiel #1
0
        private string AddMyRefreshGroup1(OpcServer OpcSrv)
        {
            float deadBand = 90.0F;

            try
            {      // create group with 2 sec update rate
                oGrp = OpcSrv.AddGroup("Line1", true, UpdateRate, ref deadBand, 0, 0);
            }
            catch
            {
                DBLogging.InsertLogs("Exception: AddMyRefreshGroup1", false, "Group could not be added", _connStr);
                return("Group could not be added");
            }

            oGrp.DataChanged += new DataChangeEventHandler(DataChangedHandler);
            oGrp.AdviseIOPCDataCallback();


            //client handle as item index
            items1[0] = new OPCItemDef(TagLPG_Bay01_RFID_Puched, true, 0, VarEnum.VT_BOOL);
            items1[1] = new OPCItemDef(TagLPG_WB_RFIDPunched, true, 1, VarEnum.VT_BOOL);
            items1[2] = new OPCItemDef(TagLPG_Bay01_LPGBatchComplete, true, 2, VarEnum.VT_BOOL);

            int rtc;

            rtc = oGrp.AddItems(items1, out addRslt1);

            if (HRESULTS.Failed(rtc))
            {
                return("Error at AddItem");
            }
            for (int i = 0; i < addRslt1.Length; ++i)
            {
                ItemValues1[i] = new OPCItemState();
            }

            return("");
        }