public Tag() { mDataType = DataType.None; mName = ""; mParent = null; mDepth = 0; UseOverrideValue = false; mManualRead = false; }
public SerialIO() { mResponseReceived = false; mTxData = new byte[7]; mRxData = new byte[7]; mConnected = false; mInitialized = false; mVersionMatched = false; retryCount = 0; mWaitErrorStr = "No Response from CUBLOC - Check Cable and Serial Port"; mVersion = 2; mInputTags = new Tag[11]; mOutputTags = new Tag[10]; for (int i = 0; i < mInputTags.Length; i++) { mInputTags[i] = new Tag("I.D" + i.ToString("00"), DataType.Bool); mInputTags[i].SetFlag(TagFlag.Input, true); } for (int i = 0; i < mOutputTags.Length; i++) { mOutputTags[i] = new Tag("O.D" + i.ToString("00"), DataType.Bool); mOutputTags[i].TagChanged += new EventHandler(OnOutputTagChanged); mOutputTags[i].SetFlag(TagFlag.Output, true); } }
protected int GetTagIndex(Tag tag) { for (int i = 0; i < mOutputTags.Length; i++) { if (mOutputTags[i] == tag) return i; } for (int i = 0; i < mInputTags.Length; i++) { if (mOutputTags[i] == tag) return i; } return -1; }
/////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Adds a tag to the opc server /// </summary> /// <param name="tag"></param> /////////////////////////////////////////////////////////////////////////////////////////// public bool AddTag(Tag tag) { OPCTag opcTag = new OPCTag(tag); if (mTagsByName.ContainsKey(opcTag.Name)) return false; if ((tag.Direction & TagDirection.Output) == TagDirection.Output) { tag.TagChanged += new TagEventHandler(OnTagChanged); } //Add an OPC Group if the update time does not alread exist OPCGroup group = GetGroup(opcTag.UpdateTime); OPCItem item = group.OPCItems.AddItem(opcTag.Name, mTagsByName.Count + 1); opcTag.OPCItem = item; opcTag.OPCGroup = group; if (item != null) { //Save the opctag in a dictionary for quick lookup by name or by ClientHandle mTagsByName.Add(opcTag.Name, opcTag); mTagsByHandle.Add(item.ClientHandle, opcTag); return true; } else { return false; } }
public Tag this[Tag tag] { get { return this[tag.Name]; } }
public void Remove(Tag tag) { mTags.Remove(tag); tag.TagChanged -= new TagEventHandler(OnChildTagChanged); }
public void Insert(int index, Tag tag) { mTags.Insert(index, tag); tag.TagChanged += new TagEventHandler(OnChildTagChanged); }
public override void Copy(Tag tag) { base.Copy(tag); }
public void Add(Tag tag) { mTags.Add(tag); tag.Parent = this; tag.Depth = this.Depth + 1; tag.TagChanged += new TagEventHandler(OnChildTagChanged); }
public TagEventArgs(Tag tag) { Tag = tag; }
public virtual void Copy(Tag tag, bool fireTagChanged) { Name = tag.mName; if (fireTagChanged) { Value = tag.mValue; } else { mValue = tag.mValue; } }
public virtual void Copy(Tag tag) { Copy(tag, true); }
public virtual object Clone() { Tag tag = new Tag(mName, mDataType); tag.mValue = mValue; return tag; }