//- #endregion #region // Public Class Methods //------------------------------ /// <summary> /// BuildCategory /// </summary> public static void BuildCategory() { Application.Instance.AddAeCategory(CATEGORY_DATA); CATEGORY_DATA.AddAttribute(5550, "CV", typeof(uint)); CATEGORY_DATA.AddAttribute(5551, "DATA", typeof(int)); CATEGORY_DATA.AddAttribute(5552, "ADDRESS", typeof(string)); CATEGORY_DATA.AddAttribute(5553, "TEXT", typeof(string)); } // end BuildEventCategory
} // end BuildAddressSpace public int BuildEventCategories() { int result = 0; try { _timeTick = new AeCategory(EnumEventType.SIMPLE, CAT_ID_TIME_TICK, "time tick"); result = Application.Instance.AddAeCategory(_timeTick); if (ResultCode.SUCCEEDED(result)) { _timeTick.AddAttribute(1, "hour", typeof(ushort)); _timeTick.AddAttribute(2, "minute", typeof(ushort)); _timeTick.AddAttribute(3, "second", typeof(ushort)); } else { Application.Instance.Trace(EnumTraceLevel.WRN, EnumTraceGroup.OPCSERVER, "Console.BuildEventCategories", "AddAeCategory has failed for <timeTick>"); } // end if .. else _timeSlot = new AeCategory(EnumEventType.CONDITION, CAT_ID_TIME_SLOT, "time slot 1"); result = Application.Instance.AddAeCategory(_timeSlot); if (ResultCode.SUCCEEDED(result)) { _timeSlot.AddAttribute(1, "second", typeof(ushort)); _timeSlot.AddConditionDefinition(COND_NAME_BETWEEN_SINGLE); _timeSlot.AddConditionDefinition(COND_NAME_BETWEEN_MULTIPLE); _timeSlot.AddSubConditionDefinition(COND_NAME_BETWEEN_MULTIPLE, "[10,30["); _timeSlot.AddSubConditionDefinition(COND_NAME_BETWEEN_MULTIPLE, "[30,50]"); } else { Application.Instance.Trace(EnumTraceLevel.WRN, EnumTraceGroup.OPCSERVER, "Console.BuildEventCategories", "AddAeCategory has failed for <time slot 1>"); } // end if ... else } catch (Exception exc) { Trace( EnumTraceLevel.ERR, EnumTraceGroup.USER1, "OpcServer::BuildEventCategories", exc.ToString()); return((int)EnumResultCode.E_FAIL); } // end try...catch return((int)EnumResultCode.S_OK); } // end BuildEventCategories
} // end BuildAddressSpace public int BuildEventCategories() { try { AeCategory simulationCategory = new AeCategory( EnumEventType.SIMPLE, CATEGORY_ID_SIMULATION, "SimulationCategory"); Application.Instance.AddAeCategory(simulationCategory); simulationCategory.AddAttribute( ATTRIBUTE_ID_SIMULATION, "SimulationAttribute", typeof(System.UInt16)); } catch(Exception exc) { Trace( EnumTraceLevel.ERR, EnumTraceGroup.USER1, "OpcServer::BuildEventCategories", exc.ToString()); return (int)EnumResultCode.E_FAIL; } // end try...catch return (int)EnumResultCode.S_OK; } // end BuildEventCategories
public int BuildAEEventCategories() { try { int result = (int)EnumResultCode.E_FAIL; // time tick AeCategory timeTickCategory = new AeCategory( EnumEventType.SIMPLE, Console.CATEGORY_ID_TIME_TICK, "time tick"); result = Application.Instance.AddAeCategory(timeTickCategory); if (result == (uint)EnumResultCode.S_OK) { timeTickCategory.AddAttribute(1, "hour", typeof(System.UInt16)); timeTickCategory.AddAttribute(2, "minute", typeof(System.UInt16)); timeTickCategory.AddAttribute(3, "second", typeof(System.UInt16)); } // key hit AeCategory keyHitCategory = new AeCategory( EnumEventType.TRACKING, Console.CATEGORY_ID_KEY_HIT, "key hit"); result = Application.Instance.AddAeCategory(keyHitCategory); if (result == (uint)EnumResultCode.S_OK) { keyHitCategory.AddAttribute(1, "key", typeof(System.UInt16)); } // time slot m_timeSlotCategory = new AeCategory( EnumEventType.CONDITION, Console.CATEGORY_ID_TIME_SLOT, "time slot"); result = Application.Instance.AddAeCategory(m_timeSlotCategory); if (result == (uint)EnumResultCode.S_OK) { m_timeSlotCategory.AddAttribute(1, "second", typeof(System.UInt16)); m_timeSlotCategory.AddConditionDefinition(Console.COND_NAME_BETWEEN_SINGLE); m_timeSlotCategory.AddConditionDefinition(Console.COND_NAME_BETWEEN_MULTIPLE); m_timeSlotCategory.AddSubConditionDefinition(Console.COND_NAME_BETWEEN_MULTIPLE, "[10,30]"); AeSubConditionDefinition subConditionDefinition = m_timeSlotCategory.GetSubConditionDefinition( Console.COND_NAME_BETWEEN_MULTIPLE, "[10,30]"); if (subConditionDefinition != null) { subConditionDefinition.Description = "[10,30]"; subConditionDefinition.Severity = 100; } m_timeSlotCategory.AddSubConditionDefinition(Console.COND_NAME_BETWEEN_MULTIPLE, "[30,50]"); subConditionDefinition = m_timeSlotCategory.GetSubConditionDefinition( Console.COND_NAME_BETWEEN_MULTIPLE, "[30,50]"); if (subConditionDefinition != null) { subConditionDefinition.Description = "[30,50]"; subConditionDefinition.Severity = 200; } } //alarm simulation simple AeCategory alarmSimpleCategory = new AeCategory( EnumEventType.SIMPLE, Console.CATEGORY_ID_DA_WRITE_SIMPLE, "alarm simulation simple"); result = Application.Instance.AddAeCategory(alarmSimpleCategory); //alarm simulation tracking AeCategory alarmTrackingCategory = new AeCategory( EnumEventType.TRACKING, Console.CATEGORY_ID_DA_WRITE_TRACKING, "alarm simulation simple"); result = Application.Instance.AddAeCategory(alarmTrackingCategory); } catch (Exception exc) { Trace( EnumTraceLevel.ERR, EnumTraceGroup.USER1, "OpcServer::BuildEventCategories", exc.ToString()); return((int)EnumResultCode.E_FAIL); } // end try...catch return((int)EnumResultCode.S_OK); } // end BuildAEEventCategories
//- #endregion #region // Public Methods //------------------------ /// <summary> /// BuildCategory /// </summary> public static void BuildCategory() { Application.Instance.AddAeCategory(CATEGORY_DEVICE); CATEGORY_DEVICE.AddAttribute(5550, "CV", typeof(uint)); } // end BuildEventCategory