public void Initialize(ISystemContext context, string itemId, DaProperty property, ushort namespaceIndex)
{
m_itemId = itemId;
m_property = property;
if (property == null)
{
return;
}
this.NodeId = DaModelUtils.ConstructIdForDaElement(m_itemId, property.PropertyId, namespaceIndex);
this.BrowseName = new QualifiedName(property.Name, namespaceIndex);
this.DisplayName = new LocalizedText(property.Name);
this.TypeDefinitionId = Opc.Ua.VariableTypeIds.PropertyType;
this.Value = null;
this.StatusCode = StatusCodes.BadWaitingForInitialData;
this.Timestamp = DateTime.UtcNow;
bool isArray = false;
this.DataType = ComUtils.GetDataTypeId(property.DataType, out isArray);
this.ValueRank = (isArray)?ValueRanks.OneOrMoreDimensions:ValueRanks.Scalar;
this.ArrayDimensions = null;
// assume that properties with item ids are writeable. the server may still reject the write.
if (String.IsNullOrEmpty(property.ItemId))
{
this.AccessLevel = AccessLevels.CurrentRead;
}
else
{
this.AccessLevel = AccessLevels.CurrentReadOrWrite;
}
this.UserAccessLevel = this.AccessLevel;
this.MinimumSamplingInterval = MinimumSamplingIntervals.Indeterminate;
this.Historizing = false;
// add a reference to the parent node.
NodeId parentNodeId = DaModelUtils.ConstructIdForDaElement(itemId, -1, namespaceIndex);
this.AddReference(ReferenceTypeIds.HasProperty, true, parentNodeId);
}
#endregion