Skip to content

Latest commit

 

History

History
389 lines (261 loc) · 11.3 KB

CloudOfThingsEventWriter.rst

File metadata and controls

389 lines (261 loc) · 11.3 KB

CloudOfThingsEventWriter

Description

The CloudOfThingsEventWriter object sends Event <object_Event> objects to the Cloud of Things or stores them, if the connection is temporary lost.

› Inherits

EventOutput <object_EventOutput>

Overview

Properties

  • alarmCategories <property_CloudOfThingsEventWriter_alarmCategories>
  • buffering <property_CloudOfThingsEventWriter_buffering>
  • client <property_CloudOfThingsEventWriter_client>
  • error <property_CloudOfThingsEventWriter_error>
  • errorString <property_CloudOfThingsEventWriter_errorString>
  • eventDatabase <property_CloudOfThingsEventWriter_eventDatabase>
  • sendStoredDataCount <property_CloudOfThingsEventWriter_sendStoredDataCount>
  • sendStoredDataInterval <property_CloudOfThingsEventWriter_sendStoredDataInterval>
  • EventOutput.filterCategories <property_EventOutput_filterCategories>
  • EventOutput.filterExactSeverity <property_EventOutput_filterExactSeverity>
  • EventOutput.filterMinimumSeverity <property_EventOutput_filterMinimumSeverity>
  • Object.objectId <property_Object_objectId>
  • Object.parent <property_Object_parent>

Methods

  • Object.deserializeProperties() <method_Object_deserializeProperties>
  • Object.fromJson() <method_Object_fromJson>
  • Object.serializeProperties() <method_Object_serializeProperties>
  • Object.toJson() <method_Object_toJson>

Signals

  • alarmCategoriesDataChanged() <signal_CloudOfThingsEventWriter_alarmCategoriesDataChanged>
  • errorOccurred() <signal_CloudOfThingsEventWriter_errorOccurred>
  • EventOutput.filterCategoriesDataChanged() <signal_EventOutput_filterCategoriesDataChanged>
  • Object.completed() <signal_Object_completed>

Enumerations

  • AlarmSeverity <enum_CloudOfThingsEventWriter_AlarmSeverity>
  • Error <enum_CloudOfThingsEventWriter_Error>

Properties

single: alarmCategories

alarmCategories

This property holds a list of EventCategory <object_EventCategory> objects, which assigned Event <object_Event> objects are treated as alarms. Other events pushed to this output are treated as Cloud of Things events and the severity is ignored.

› Type

List <object_List><EventCategory <object_EventCategory>>

› Signal

alarmCategoriesChanged()

› Attributes

Readonly

single: buffering

buffering

This property holds whether Event <object_Event> objects should be stored when CloudOfThingsClient <object_CloudOfThingsClient> is not connected. If the connection is restored buffered measurements will be sent with an interval of sendStoredDataInterval <property_CloudOfThingsEventWriter_sendStoredDataInterval> ms.

› Type

Boolean

› Default

true

› Signal

bufferingChanged()

› Attributes

Writable

single: client

client

This property holds the Cloud of Things client. This property can be left blank if CloudOfThingsClient <object_CloudOfThingsClient> is a parent.

› Type

CloudOfThingsClient <object_CloudOfThingsClient>

› Signal

clientChanged()

› Attributes

Writable

single: error

error

This property holds the most recently occurred error or CloudOfThingsEventWriter.NoError <enumitem_CloudOfThingsEventWriter_NoError> if no error occurred. If the same error occurs multiple times this property does not change. Use the errorOccurred() <signal_CloudOfThingsEventWriter_errorOccurred> signal to detect multiple occurrences of the same error.

› Type

Error <enum_CloudOfThingsEventWriter_Error>

› Signal

errorChanged()

› Attributes

Readonly

single: errorString

errorString

This property holds the current human readable error string corresponding to the current value in the error <property_CloudOfThingsEventWriter_error> property. It may include additional information such as failure reasons or locations.

› Type

String

› Signal

errorStringChanged()

› Attributes

Readonly

single: eventDatabase

eventDatabase

This property holds the event database which buffers the events if no connection is available.

› Type

CloudOfThingsEventDatabase <object_CloudOfThingsEventDatabase>

› Signal

eventDatabaseChanged()

› Attributes

Readonly

single: sendStoredDataCount

sendStoredDataCount

This property holds how many stored events from eventDatabase <property_CloudOfThingsEventWriter_eventDatabase> are sent at once after the connection is restored. The lowest possible value is 1.

› Type

SignedInteger

› Default

1

› Signal

sendStoredDataCountChanged()

› Attributes

Writable

single: sendStoredDataInterval

sendStoredDataInterval

This property holds holds the send interval in milliseconds in which stored elements from eventDatabase <property_CloudOfThingsEventWriter_eventDatabase> are sent after the connection is restored. The minimum value is 100.

› Type

SignedInteger

› Default

2000

› Signal

sendStoredDataIntervalChanged()

› Attributes

Writable

Signals

single: alarmCategoriesDataChanged

alarmCategoriesDataChanged(SignedInteger index)

This signal is emitted whenever the List.dataChanged() <signal_List_dataChanged> signal is emitted, i.e. the item at index in the alarmCategories <property_CloudOfThingsEventWriter_alarmCategories> list itself emitted the dataChanged() signal.

single: errorOccurred

errorOccurred()

This signal is emitted whenever an error has occurred, regardless of whether the error <property_CloudOfThingsEventWriter_error> property has changed or not. In contrast to the change notification signal of the error <property_CloudOfThingsEventWriter_error> property this signal is also emitted several times if a certain error occurs several times in succession.

Enumerations

single: AlarmSeverity

AlarmSeverity

This enumeration describes the serverity of an alarm in Cloud of Things. A fixed mapping from Event <object_Event> serverity is performed, if the events category is in alarmCategories <property_CloudOfThingsEventWriter_alarmCategories>.

single: CloudOfThingsEventWriter.Warning

single: CloudOfThingsEventWriter.Minor

single: CloudOfThingsEventWriter.Major

single: CloudOfThingsEventWriter.Critical

Name Value Description
CloudOfThingsEventWriter.Warning 0 Lowest severity - default if not set otherwise.
CloudOfThingsEventWriter.Minor 1 Minor severity is used when the events severity is Warning.
CloudOfThingsEventWriter.Major 2 Major severity is used when the events severity is Error.
CloudOfThingsEventWriter.Critical 3 Critical severity is used when the events severity is Fatal.

single: Error

Error

This enumeration describes all errors which can occur in CloudOfThingsEventWriter objects. The most recently occurred error is stored in the error <property_CloudOfThingsEventWriter_error> property.

single: CloudOfThingsEventWriter.NoError

single: CloudOfThingsEventWriter.InvalidClient

single: CloudOfThingsEventWriter.InvalidIdError

Name Value Description
CloudOfThingsEventWriter.NoError 0 No error occurred or was detected.
CloudOfThingsEventWriter.InvalidClient 1 No CloudOfThingsClient set or found.
CloudOfThingsEventWriter.InvalidIdError 2 Empty or invalid object id.

Example

import InCore.Foundation 2.5
import InCore.CloudOfThings 2.5

Application {

    EventLog {
        outputs: [ eventWriter ]
        EventCategory { id: measurementValueCategory }
        EventGroup {
            Event {
                id: temperatureEvent
                description: "temperature above 70°C"
            }
            Event {
                id: deviceStartedEvent
                description: "device started"
            }
            Event {
                id: measurementValueEvent
                description: "measurement above threshold"
                category: measurementValueCategory
                severity: Event.Error
            }
        }
    }

    //trigger events here

    CloudOfThingsClient {
        id: client
        tenant: "mustercloud"
        transport.tenantForMQTT: "nb-iot"

        registrator {
            isRegistered: true
            password: "y0urAwes@meP4ssword"
        }

        CloudOfThingsEventWriter {
            id: eventWriter
            //events with a category in alarmCategories are sent as alarm, all other as event
            alarmCategories: [ measurementValueCategory ]

            eventDatabase {
                bufferSize: 500
            }
        }
    }
}