Options
All
  • Public
  • Public/Protected
  • All
Menu

A convenience controller that observes things and associated sensor and observation objects, combining the functionality of ThingObserverController and SensorObserverController.

This controller is designed to be used by a client that wants to easily handle sensor-related events as well as sensor observations.

Hierarchy

Index

Constructors

constructor

Accessors

communicationManager

container

options

registeredName

  • get registeredName(): string
  • Gets the registered name of this controller.

    The registered name is either defined by the corresponding key in the Components.controllers object in the container configuration, or by invoking Container.registerController method with this name.

    Returns string

registeredSensorsChangeInfo$

  • Gets an Observable emitting information about changes in the currently registered sensors.

    Registered sensor objects are augmented by a property thing which references the associated Thing object.

    Emitted sensor objects are read-only. If you need to modify one, e.g. to delete the thing property, clone the object first (using clone() function in @coaty/core).

    Returns BehaviorSubject<RegisteredSensorsChangeInfo>

runtime

sensorFilter

  • set sensorFilter(sensorFilter: (sensor: Sensor, thing: Thing) => boolean): void
  • Sets a filter predicate that determines whether an observed sensor is relevant and should be registered with the controller.

    The filter predicate should return true if the passed-in sensor is relevant; false otherwise.

    By default, all observed sensors of all relevant things are considered relevant.

    Parameters

    • sensorFilter: (sensor: Sensor, thing: Thing) => boolean

      a filter predicate for sensors

    Returns void

sensorObservation$

thingFilter

  • set thingFilter(thingFilter: (thing: Thing) => boolean): void
  • Sets a filter predicate that determines whether an observed thing is relevant and should be registered with the controller.

    The filter predicate should return true if the passed-in thing is relevant; false otherwise.

    By default, all observed things are considered relevant.

    Parameters

    • thingFilter: (thing: Thing) => boolean

      a filter predicate for things

        • Parameters

          Returns boolean

    Returns void

Methods

discoverThings

  • discoverThings(): Observable<Thing>

Protected extendLogObject

  • extendLogObject(log: Log): void
  • Whenever one of the controller's log methods (e.g. logDebug, logInfo, logWarning, logError, logFatal) is called by application code, the controller creates a Log object with appropriate property values and passes it to this method before advertising it.

    You can override this method to additionally set certain properties (such as LogHost.hostname or Log.logLabels). Ensure that super.extendLogObject is called in your override. The base method does nothing.

    Parameters

    • log: Log

      log object to be extended before being advertised

    Returns void

logDebug

  • logDebug(message: string, ...tags: string[]): void

logError

  • logError(error: any, message: string, ...tags: string[]): void

logErrorWithStacktrace

  • logErrorWithStacktrace(error: any, message: string, ...tags: string[]): void

logFatal

  • logFatal(error: any, message: string, ...tags: string[]): void

logInfo

  • logInfo(message: string, ...tags: string[]): void

logWarning

  • logWarning(message: string, ...tags: string[]): void

observeAdvertisedThings

  • observeAdvertisedThings(): Observable<Thing>

onCommunicationManagerStarting

  • onCommunicationManagerStarting(): void

onCommunicationManagerStopping

  • onCommunicationManagerStopping(): void

onDispose

  • onDispose(): void

onInit

  • onInit(): void
  • Called when the container has completely set up and injected all dependency components, including all its controllers.

    Override this method to perform initializations in your custom controller class instead of defining a constructor. Although the base implementation does nothing it is good practice to call super.onInit() in your override method; especially if your custom controller class does not extend from the base Controller class directly.

    Returns void

queryThingsAtLocation

  • queryThingsAtLocation(locationId: string): Observable<Thing[]>

Generated using TypeDoc