.. _object_Event: :index:`Event` -------------- Description *********** The Event object represents a system or runtime event which is sent to certain :ref:`EventOutput ` objects whenever it is triggered. :**› Inherits**: :ref:`DataObject ` Overview ******** Properties ++++++++++ .. hlist:: :columns: 2 * :ref:`category ` * :ref:`errorCode ` * :ref:`severity ` * :ref:`DataObject.data ` * :ref:`DataObject.dataType ` * :ref:`DataObject.description ` * :ref:`DataObject.name ` * :ref:`DataObject.timestamp ` * :ref:`DataObject.uuid ` * :ref:`DataObject.view ` * :ref:`Object.objectId ` * :ref:`Object.parent ` Methods +++++++ .. hlist:: :columns: 1 * :ref:`trigger() ` * :ref:`DataObject.touch() ` * :ref:`Object.deserializeProperties() ` * :ref:`Object.fromJson() ` * :ref:`Object.serializeProperties() ` * :ref:`Object.toJson() ` Signals +++++++ .. hlist:: :columns: 1 * :ref:`Object.completed() ` Enumerations ++++++++++++ .. hlist:: :columns: 1 * :ref:`Severity ` * :ref:`DataObject.DataType ` Properties ********** .. _property_Event_category: .. _signal_Event_categoryChanged: .. index:: single: category category ++++++++ This property is optional and can be set to group events. This property can be used for filtering within :ref:`EventOutput `. If no category is set and the event is child of an :ref:`EventGroup ` the category of the group is used. :**› Type**: :ref:`EventCategory ` :**› Signal**: categoryChanged() :**› Attributes**: Writable, Optional .. _property_Event_errorCode: .. _signal_Event_errorCodeChanged: .. index:: single: errorCode errorCode +++++++++ This property holds a user-defined, system- or application-specific error code and can be used for data modelling purposes. Its value is not evaluated by any InCore object. :**› Type**: SignedInteger :**› Default**: ``0`` :**› Signal**: errorCodeChanged() :**› Attributes**: Writable, Optional .. _property_Event_severity: .. _signal_Event_severityChanged: .. index:: single: severity severity ++++++++ This property holds the severity of this event. If the event is child of an :ref:`EventGroup ` and the :ref:`severity ` property of the event equals :ref:`Event.NoSeverity ` the severity of the event group is used instead. :**› Type**: :ref:`Severity ` :**› Default**: :ref:`Event.NoSeverity ` :**› Signal**: severityChanged() :**› Attributes**: Writable, Optional Methods ******* .. _method_Event_trigger: .. index:: single: trigger trigger() +++++++++ This method triggers the event. If the event belongs to an :ref:`EventLog ` with one or multiple attached :ref:`EventOutput ` objects it will be forwarded to these outputs. Depending on the configured filters it either will be discarded or handled by the respective output. Enumerations ************ .. _enum_Event_Severity: .. index:: single: Severity Severity ++++++++ This enumeration describes all possible types of data which can be represented by the :ref:`DataObject.data ` property. .. index:: single: Event.NoSeverity .. index:: single: Event.Debug .. index:: single: Event.Information .. index:: single: Event.Warning .. index:: single: Event.Error .. index:: single: Event.Fatal .. list-table:: :widths: auto :header-rows: 1 * - Name - Value - Description .. _enumitem_Event_NoSeverity: * - ``Event.NoSeverity`` - ``0`` - The event has no dedicated severity and will match any severity filters. .. _enumitem_Event_Debug: * - ``Event.Debug`` - ``1`` - The event is only relevant for debugging the application. .. _enumitem_Event_Information: * - ``Event.Information`` - ``2`` - Events of this severity are used for informational purposes, e.g. information on the current operating status. .. _enumitem_Event_Warning: * - ``Event.Warning`` - ``3`` - Events of this severity signal deviations from the normal operating state. .. _enumitem_Event_Error: * - ``Event.Error`` - ``4`` - An error occurred and usually requires actions to be taken. .. _enumitem_Event_Fatal: * - ``Event.Fatal`` - ``5`` - A fatal error occurred which usually leads to a system failure. .. _example_Event: Example ******* .. code-block:: qml import InCore.Foundation 2.5 Application { Timer { interval: 5000 onTriggered: timerEvent.trigger() } EventLog { //define categories to group events - its id can be handled in the outputs EventCategory { id: deviceCategory } //each Event in the group will get the groups category and severity, besides it overrides them EventGroup { category: deviceCategory severity: Event.Error Event { id: omniscientEvent errorCode: 42 name: "omniscient event" description: "the answer to life, the universe and everything" severity: Event.Information } Event { id: timerEvent name: "Timer event" description: "the timer timed out" } } //each event will be delivered to all outputs, but only handled if the filtering based on category or severity matches outputs: [ journal ] } //this outputs date, time, name and description of the event to the journal if the category matches EventJournal { id: journal } }