new Aggregator()
Generates the id and initializes the Aggregator.
Extends
Members
-
protected_dbStorage
-
Database of the Aggregator.
-
protected_interpretationsArray.<Interpretation>
-
-
protected_widgetsArray.<String>
-
List of subscribed widgets referenced by ID.
-
protectedcallbacksCallbackList
-
List of Callbacks.
-
protectedconstantAttributesAttributeList
-
All available constant Attributes and their values.
-
idstring
-
ID of the Widget. Will be generated.
-
namestring
-
Name of the Aggregator.
-
protectedoldAttributesAttributeList
-
This temporary variable is used for storing the old attribute values. So these can be used to check conditions.
-
protectedsubscribersSubscriberList
-
List of Subscriber.
Methods
-
inherited protected_addConstantOutAttribute(constantAttribute)
-
Adds a new constantAttributeValue. If the given value is not included in the list, the associated type will be also added. Otherwise, only the value will be updated.
Name Type Description constantAttribute
Attribute AttributeValue
-
protected_aggregatorSetup()
-
InitMethod for Aggregators. Called by constructor. Initializes the associated Storage.
-
inherited protected_init()
-
Function for initializing. Calls all initFunctions and will be called by the constructor.
-
inherited protected_initCallbacks()
-
Initializes the provided Callbacks.
-
inherited protected_initConstantOutAttributes()
-
Initializes the provided ConstantAttributes.
-
protected_initOutAttributes()
-
Retrieves all Attributes of the specified widgets.
-
protected_initWidgetSubscription(widgetId){CallbackList}
-
Subscribes to the widgets that are defined in the Widget ID List used in the initCallback method.
Name Type Description widgetId
String Widget that should be subscribed.
Returns:
Type Description CallbackList -
inherited abstract,protected_intervalRunning(interval)
-
Runs the context acquisition constantly in an interval. Can be called by init.
Name Type Description interval
Number Interval in ms
-
inherited protected_register()
-
Registers the component to the associated Discoverer.
-
protected_removeWidget(_widgetId)
-
Removes Widget ID from list.
Name Type Description _widgetId
String Id of the Widget
-
inherited protected_sendResponse(response, callback)
-
Name Type Description response
callback
-
inherited protected_sendToSubscriber(callback)
-
Sends all Attributes, specified in the given callback, to components which are subscribed to this Callback.
Name Type Description callback
string Name of the searched Callback.
-
abstract,protected_setAggregatorAttributeValues()
-
Initializes the provided attributeValues that are only specific to the Aggregator. Called by aggregatorSetup().
-
abstract,protected_setAggregatorCallbacks()
-
Initializes the provided Callbacks that are only specific to the Aggregator. Called by aggregatorSetup().
-
abstract,protected_setAggregatorConstantAttributeValues()
-
Initializes the provided ConstantAttributeValues that are only specific to the Aggregator. Called by aggregatorSetup().
-
inherited protected_setOutAttributes(attributesOrArray)
-
Sets the AttributeValueList and also the associated AttributeTypes.
Name Type Description attributesOrArray
AttributeList | Array List or Array of AttributeValues
-
protected_setWidgets(widgetIds)
-
Sets Widget IDs.
Name Type Description widgetIds
Array.<String> List of Widget IDs
-
protected_store(attribute)
-
Stores the data.
Name Type Description attribute
Attribute data that should be stored
-
protected_subscribeTo(widget, callbacks, subSet, conditions)
-
Subscribes to the given widget for the specified Callbacks.
Name Type Description widget
Widget Widget that should be subscribed to.
callbacks
CallbackList required Callbacks
subSet
conditions
-
inherited protectedaddCallback(callback)
-
Adds a new Callback.
Name Type Description callback
Callback List or Array of AttributeValues.
-
inherited addOutAttribute(attribute, multipleInstances)
-
Adds a new AttributeValue. If the given value is not included in the list, the associated type will be also added. Otherwise, only the value will be updated.
Name Type Description attribute
Attribute multipleInstances
Boolean -
inherited addSubscriber(subscriber)
-
Adds a new Subscriber.
Name Type Description subscriber
Subscriber nullable Subscriber
-
addWidget(widgetIdOrWidget)
-
Adds Widget ID.
Name Type Description widgetIdOrWidget
String | Widget Widget ID
-
addWidgetSubscription(widgetIdOrWidget, callbackList)
-
Adds the specified callbacks of a widget to the aggregator.
Name Type Description widgetIdOrWidget
String | Widget Widget that should be subscribed.
callbackList
CallbackList required Callbacks
-
inherited didFinishInitialization(attributes)
-
Method will be invoked after the initialization of the widget finished. Can be overridden by inheriting classes to take action after initialization.
Name Type Description attributes
-
abstractdidFinishSetup()
-
After the aggregator finished its setup start searching for component that satisfy the attributes that where requrested.
-
inherited doesSatisfyTypeOf(attribute){boolean}
-
Returns true if the widget can satisfy the requested attribute type.
Name Type Description attribute
AttributeType Returns:
Type Description boolean -
inherited getCallbacks(){CallbackList}
-
Returns a list of callbacks that can be subscribed to.
Returns:
Type Description CallbackList -
inherited getConstantOutAttributes(attributes){AttributeList}
-
Returns the available ConstantAttributeTypes (attributes that do not change).
Name Type Description attributes
AttributeList nullable Returns:
Type Description AttributeList -
getCurrentData(){AttributeList}
-
Returns the current Attributes that are saved in the cache.
Returns:
Type Description AttributeList -
inherited getId(){string}
-
Returns the id of the widget.
Returns:
Type Description string -
inherited getName(){string}
-
Returns the name of the widget.
Returns:
Type Description string -
inherited getOutAttributes(attributes){AttributeList}
-
Returns the available AttributeTypes.
Name Type Description attributes
AttributeList optional nullable Returns:
Type Description AttributeList -
getStorageOverview(){Array}
-
Returns an overview about the stored attributes. It may be that the overview about the stored attributes is not up to date, because an asynchronous function is used for the retrieval. For retrieving the current data, this function can be used as callback function in queryTables().
Returns:
Type Description Array -
inherited getSubscriber(){SubscriberList}
-
Returns the Subscriber.
Returns:
Type Description SubscriberList -
inherited getType(){string}
-
Returns the type of this class, in this case "Widget".
Returns:
Type Description string -
inherited getValueForAttributeWithTypeOf(attributeType){*}
-
Returns the last acquired attribute value with the given attribute type.
Name Type Description attributeType
AttributeType The attribute type to return the last value for.
Returns:
Type Description * -
getWidgets(){Array}
-
Returns the available Widget IDs.
Returns:
Type Description Array -
interpretData(interpreterId, inAttributes, outAttributes, callback)
-
Calls the given Interpreter for interpretation the data.
Name Type Description interpreterId
String ID of the searched Interpreter
inAttributes
AttributeList outAttributes
AttributeList callback
function nullable for additional actions, if an asynchronous function is used
-
inherited protectedisOutAttribute(attribute){boolean}
-
Verifies whether the specified attributes is a provided Attribute.
Name Type Description attribute
Attribute Returns:
Type Description boolean -
inherited abstractnotify()
-
Notifies other components and sends the attributes.
-
inherited putData(attributes)
-
Updates the Attributes by external components.
Name Type Description attributes
AttributeList | Array Data that should be entered.
-
queryAttribute(name, callback)
-
Queries the database and returns the last retrieval result. It may be that the retrieval result is not up to date, because an asynchronous function is used for the retrieval. For retrieving the current data, this function can be used as callback function in retrieveStorage().
Name Type Description name
String Name of the searched AtTributes.
callback
function nullable for alternative actions, because an asynchronous function is used
-
inherited abstractqueryGenerator(callback)
-
Name Type Description callback
-
queryReferencedComponents(callback)
-
Query all referenced widgets and afterwards all connected interpreters.
Name Type Description callback
function the callback to query after all components did finish their work.
-
queryReferencedInterpreters(callback)
-
Let's all connected interpreters interpret data.
Name Type Description callback
function The callback to query after all the interpreters did interpret data.
-
abstractqueryReferencedWidget(widgetId, callback)
-
Updates the information for the widget with the provided ID and calls the callback afterwards.
Name Type Description widgetId
String The ID of the widget to query.
callback
Callback The callback to query after the widget was updated.
-
abstractqueryReferencedWidgets(callback)
-
Updates all the widgets referenced by the aggregator and calls the provided callback afterwards.
Name Type Description callback
function The callback to query after all the widget where updated.
-
queryTables(callback)
-
Only updates the attribute cache in the database. For an alternative action a callback can be used.
Name Type Description callback
function nullable for alternative actions, because an asynchronous function is used
-
inherited queryWidget(){AttributeList}
-
Returns all available AttributeValues, Attributes and ConstantAttributes.
Returns:
Type Description AttributeList -
inherited removeSubscriber(subscriberId)
-
Removes the specified Subscriber.
Name Type Description subscriberId
Subscriber Subscriber
-
retrieveStorage(){RetrievalResult}
-
Queries a specific table and only actualizes the storage cache. For an alternativ action can be used a callback.
Returns:
Type Description RetrievalResult -
inherited abstractsendToSubscriber(callback)
-
Queries the associated sensor and updates the attributes with new values. Must be overridden by the subclasses. Overriding subclasses can call this.__super(_function) to invoke the provided callback function.
Name Type Description callback
function nullable For alternative actions, because an asynchronous function can be used.
-
inherited protectedsetCallbacks(callbacks)
-
Sets Callbacks.
Name Type Description callbacks
CallbackList | Array List or Array of Callbacks.
-
inherited protectedsetConstantOutAttributes(constantAttributes)
-
Sets the ConstantAttributeValueList and also the associated AttributeTypes.
Name Type Description constantAttributes
AttributeList | Array List or Array of AttributeValues
-
inherited setDiscoverer(_discoverer)
-
Sets the associated Discoverer and registers to that.
Name Type Description _discoverer
Discoverer Discoverer
-
inherited protectedsetId(id)
-
Sets the id of the Widget.
Name Type Description id
string Id of the Widget.
-
inherited protectedsetName(name)
-
Sets the name of the Widget.
Name Type Description name
string Name of the Widget.
-
inherited protectedsetSubscriber(subscribers)
-
Sets SubscriberList.
Name Type Description subscribers
SubscriberList | Array List or Array of Subscriber.
-
unsubscribeFrom(widgetId)
-
Removes subscribed Widgets and deletes the entry for subscribers in the associated Widget.
Name Type Description widgetId
String Widget that should be removed.
-
inherited updateAndQueryWidget(callback){AttributeList}
-
Updates and returns all available AttributeValues, Attributes and ConstantAtrributes.
Name Type Description callback
function nullable For alternative actions, because an asynchronous function can be used.
Returns:
Type Description AttributeList -
inherited updateWidgetInformation(callback)
-
Updates the attributes by calling queryGenerator.
Name Type Description callback
function nullable For alternative actions, because an asynchronous function can be used.