예제 #1
0
        private static WriteValue MakeWriteValue(NodeId item, DataValue value, DataType type, int dimension)
        {
            object?v  = value.GetValue(type, dimension);
            var    dv = new Workstation.ServiceModel.Ua.DataValue(v);

            return(new WriteValue()
            {
                NodeId = item,
                AttributeId = AttributeIds.Value,
                Value = dv
            });
        }
예제 #2
0
        private VTQ MakeVTQ(Workstation.ServiceModel.Ua.DataValue readRes, VTQ lastValue, string dataItemID)
        {
            var t = Timestamp.FromDateTime(readRes.SourceTimestamp);

            try {
                var q = MapQuality(readRes.StatusCode);
                var v = MakeDataValue(readRes.Variant, lastValue.V);
                return(new VTQ(t, q, v));
            }
            catch (Exception exp) {
                string name = mapId2Info.ContainsKey(dataItemID) ? mapId2Info[dataItemID].Name : dataItemID;
                LogWarn("ReadConvertFailed", $"Converting read result of '{name}' failed.", dataItemID, exp.Message);
                return(new VTQ(t, Quality.Bad, lastValue.V));
            }
        }
        internal virtual void Publish(object target, DataValue dataValue)
        {
            if (this.publishData == null)
            {
                if (this.Property.PropertyType == typeof(DataValue))
                {
                    this.publishData = new Action<object, DataValue>((t, d) => this.Property.SetValue(t, d));
                    return;
                }

                this.publishData = new Action<object, DataValue>((t, d) => this.Property.SetValue(t, d.Value));
            }

            this.publishData(target, dataValue);
        }
        public virtual void Decode(IDecoder decoder) {
            decoder.PushNamespace("http://opcfoundation.org/UA/2008/02/Types.xsd");
			ClientHandle = decoder.ReadUInt32("ClientHandle");
			Value = decoder.ReadDataValue("Value");
            decoder.PopNamespace();
        }
        public virtual void Decode(IDecoder decoder) {
            decoder.PushNamespace("http://opcfoundation.org/UA/2008/02/Types.xsd");
			NodeId = decoder.ReadNodeId("NodeId");
			AttributeId = decoder.ReadUInt32("AttributeId");
			IndexRange = decoder.ReadString("IndexRange");
			Value = decoder.ReadDataValue("Value");
            decoder.PopNamespace();
        }
 public override void Publish(DataValue dataValue)
 {
 }
        public override void Publish(DataValue dataValue)
        {
            var queue = (ObservableQueue <DataValue>)Property.GetValue(Target) !;

            queue.Enqueue(dataValue);
        }
 public override void Publish(DataValue dataValue)
 {
     Property.SetValue(Target, dataValue.GetValue());
     SetDataErrorInfo(dataValue.StatusCode);
 }
 public abstract void Publish(DataValue dataValue);