} // end HandleReadRequests public override int HandleWriteRequests() { lock (m_requestJanitor) { int count = Requests.Count; for (int i = 0; i < count; i++) { DaRequest currentRequest = Requests[i] as DaRequest; if ((currentRequest != null) && (currentRequest.ProgressRequestState(EnumRequestState.CREATED, EnumRequestState.INPROGRESS) == true)) { MyDaAddressSpaceElement requestElement = currentRequest.AddressSpaceElement as MyDaAddressSpaceElement; if (requestElement != null) { currentRequest.Result = (EnumResultCode)requestElement.ValueChanged(currentRequest.Value); } // end if } // end if } // end for return(CompleteRequests()); } // end lock } // end HandleWriteRequests
public static void BuildNamespace() { MyDaAddressSpaceElement tag = null, node = null; ValueQT val = null; node = new MyDaAddressSpaceElement(); node.Name = "CTT"; node.Type = MyDaAddressSpaceElement.TYP_NODE; node.IoMode = EnumIoMode.NONE; node.HasChildren = true; Application.Instance.DaAddressSpaceRoot.AddChild(node); tag = new MyDaAddressSpaceElement(); tag.Name = "I1"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(SByte); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { val = new ValueQT((sbyte)1, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } // end if tag = new MyDaAddressSpaceElement(); tag.Name = "UI1"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(Byte); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { val = new ValueQT((byte)1, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "I2"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(Int16); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { val = new ValueQT((Int16)1, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "UI2"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(UInt16); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { val = new ValueQT((UInt16)1, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "I4"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(Int32); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { val = new ValueQT((Int32)1, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "UI4"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(UInt32); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { val = new ValueQT((UInt32)1, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "I8"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(Int64); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { val = new ValueQT((Int64)1, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "UI8"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(UInt64); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { val = new ValueQT((UInt64)1, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "R4"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(Single); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { val = new ValueQT((Single)1.0, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "R8"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(Double); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { val = new ValueQT((Double)1.0, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "BOOL"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(Boolean); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { val = new ValueQT(true, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "BSTR"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(String); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { val = new ValueQT("CTT", EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "DATE"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(DateTime); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { val = new ValueQT(DateTime.Now, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "I1 array"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(SByte[]); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { SByte[] v = new SByte[5] { 0, 1, 2, 3, 4 }; val = new ValueQT(v, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "UI1 array"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(Byte[]); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { Byte[] v1 = new Byte[5] { 0, 1, 2, 3, 4 }; val = new ValueQT(v1, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "I2 array"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(Int16[]); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { Int16[] v2 = new Int16[5] { 0, 1, 2, 3, 4 }; val = new ValueQT(v2, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "UI2 array"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(UInt16[]); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { UInt16[] v3 = new UInt16[5] { 0, 1, 2, 3, 4 }; val = new ValueQT(v3, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "I4 array"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(Int32[]); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { Int32[] v4 = new Int32[5] { 0, 1, 2, 3, 4 }; val = new ValueQT(v4, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "UI4 array"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(UInt32[]); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { UInt32[] v5 = new UInt32[5] { 0, 1, 2, 3, 4 }; val = new ValueQT(v5, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "I8 array"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(Int64[]); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { Int64[] v6 = new Int64[5] { 0, 1, 2, 3, 4 }; val = new ValueQT(v6, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "UI8 array"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(UInt64[]); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { UInt64[] v7 = new UInt64[5] { 0, 1, 2, 3, 4 }; val = new ValueQT(v7, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "R4 array"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(Single[]); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { Single[] v8 = new Single[5] { 0, 1, 2, 3, 4 }; val = new ValueQT(v8, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "R8 array"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(Double[]); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { Double[] v9 = new Double[5] { 0.0, 1.0, 2.0, 3.0, 4.0 }; val = new ValueQT(v9, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "BOOL array"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(Boolean[]); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { bool[] va = new bool[5] { true, false, true, false, true }; val = new ValueQT(va, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "BSTR array"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(String[]); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { string[] vb = new string[5] { "A", "B", "C", "D", "E" }; val = new ValueQT(vb, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } tag = new MyDaAddressSpaceElement(); tag.Name = "DATE array"; tag.Type = MyDaAddressSpaceElement.TYP_TAG; tag.AccessRights = EnumAccessRights.READWRITEABLE; tag.Datatype = typeof(DateTime[]); tag.IoMode = EnumIoMode.POLL; if (node.AddChild(tag)) { DateTime[] vc = new DateTime[5]; vc[0] = DateTime.Now; vc[1] = DateTime.Now; vc[2] = DateTime.Now; vc[3] = DateTime.Now; vc[4] = DateTime.Now; val = new ValueQT(vc, EnumQuality.GOOD, DateTime.Now); tag.ValueChanged(val); } } // end BuildNamespace