public void SetFilter(
int eventTypes,
ushort lowSeverity,
ushort highSeverity,
uint[] categoryIds,
string[] areas,
string[] sources)
{
ThrowIfDisposed();
lock (m_lock)
{
// validate event types.
if (eventTypes <= 0 || eventTypes > 0x7)
{
throw ComUtils.CreateComException(ResultIds.E_INVALIDARG);
}
// validate severity.
if (lowSeverity == 0 || highSeverity > 1000 || lowSeverity > highSeverity)
{
throw ComUtils.CreateComException(ResultIds.E_INVALIDARG);
}
// validate categories.
if (categoryIds != null)
{
for (int ii = 0; ii < categoryIds.Length; ii++)
{
if (m_mapper.GetCategory(categoryIds[ii]) == null)
{
throw ComUtils.CreateComException(ResultIds.E_INVALIDARG);
}
}
}
// validate areas.
List<NodeId> areasToUse = new List<NodeId>();
if (areas != null)
{
for (int ii = 0; ii < areas.Length; ii++)
{
List<NodeId> areaIds = m_browser.SearchByQualifiedName(areas[ii], true);
if (areaIds.Count == 0)
{
throw ComUtils.CreateComException(ResultIds.E_INVALIDARG);
}
areasToUse.AddRange(areaIds);
}
}
// validate sources.
List<NodeId> sourcesToUse = new List<NodeId>();
if (sources != null)
{
for (int ii = 0; ii < sources.Length; ii++)
{
List<NodeId> sourceIds = m_browser.SearchByQualifiedName(sources[ii], false);
if (sourceIds.Count == 0)
{
throw ComUtils.CreateComException(ResultIds.E_INVALIDARG);
}
sourcesToUse.AddRange(sourceIds);
}
}
m_areas = areas;
m_sources = sources;
UpdateAreaFilter(areasToUse);
UpdateSourceFilter(sourcesToUse);
m_filter.SetFilter(eventTypes, lowSeverity, highSeverity, categoryIds, m_sourceNodes);
}
}