Options
All
  • Public
  • Public/Protected
  • All
Menu

Observes Sensors and Sensor-related objects. This controller is designed to be used by a client as a counterpart to a SensorSourceController which should answer its requests.

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

runtime

Methods

discoverSensors

  • discoverSensors(): Observable<Sensor>
  • Returns an observable of the Sensors in the system.

    This is performed by sending a Discovery event with the object type of Sensor.

    This method does not perform any kind of caching and it should be performed on the application-side.

    Returns Observable<Sensor>

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
  • Advertise a Log object for an error.

    Parameters

    • error: any

      an error (object)

    • message: string

      additional error message

    • Rest ...tags: string[]

      any number of log tags

    Returns void

logErrorWithStacktrace

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

logFatal

  • logFatal(error: any, message: string, ...tags: string[]): void
  • Advertise a Log object for a fatal error.

    Parameters

    • error: any

      an error (object)

    • message: string

      additional error message

    • Rest ...tags: string[]

      any number of log tags

    Returns void

logInfo

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

logWarning

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

observeAdvertisedObservations

  • observeAdvertisedObservations(sensorId: string): Observable<Observation>

observeAdvertisedSensors

  • observeAdvertisedSensors(): Observable<Sensor>

observeChanneledObservations

  • observeChanneledObservations(sensorId: string, channelId?: string): Observable<Observation>
  • Observe the channeled observations for the given Sensor. By default, the channelId is the same as the sensorId.

    Parameters

    • sensorId: string

      ObjectId of the sensor to listen observations of.

    • Optional channelId: string

      ChannelId to listen to. This is by default the objectId of the Sensor and therefore should be left undefined. (optional)

    Returns Observable<Observation>

onCommunicationManagerStarting

  • onCommunicationManagerStarting(): void

onCommunicationManagerStopping

  • onCommunicationManagerStopping(): void

onDispose

  • onDispose(): void
  • Called by the container when this instance should be disposed.

    Implement cleanup side effects here. Ensure that super.onDispose is called in your override. The base implementation does nothing.

    Returns 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

querySensorsOfThing

  • querySensorsOfThing(thingId: string): Observable<Sensor[]>
  • Returns an observable of the Sensors that are associated with this Thing.

    This is performed by sending a Query event for Sensor objects with the parentObjectId matching the objectId of the Thing.

    This method does not perform any kind of caching and it should be performed on the application-side.

    Parameters

    • thingId: string

    Returns Observable<Sensor[]>

Generated using TypeDoc