/// <summary>
/// Initializes a new instance of the <see cref="BlockState"/> class.
/// </summary>
/// <param name="nodeManager">The context.</param>
/// <param name="nodeId">The node id.</param>
/// <param name="block">The block.</param>
public BlockState(
DataAccessServerNodeManager nodeManager,
NodeId nodeId,
UnderlyingSystemBlock block) : base(null)
{
m_blockId = block.Id;
m_nodeManager = nodeManager;
this.SymbolicName = block.Name;
this.NodeId = nodeId;
this.BrowseName = new QualifiedName(block.Name, nodeId.NamespaceIndex);
this.DisplayName = new LocalizedText(block.Name);
this.Description = null;
this.WriteMask = 0;
this.UserWriteMask = 0;
this.EventNotifier = EventNotifiers.None;
UnderlyingSystem system = nodeManager.SystemContext.SystemHandle as UnderlyingSystem;
if (system != null)
{
IList <UnderlyingSystemTag> tags = block.GetTags();
for (int ii = 0; ii < tags.Count; ii++)
{
BaseVariableState variable = CreateVariable(nodeManager.SystemContext, tags[ii]);
AddChild(variable);
variable.OnSimpleWriteValue = OnWriteTagValue;
}
}
}