ExternalAPI

interface ExternalAPI

Defines the hooks for defining external APIs such as HTTP, Telnet.

Inheritors

Functions

Link copied to clipboard
open fun activeMeasurement(session: Int? = null): ActiveMeasurement?

Returns the active measurement in the session. If session == null, it is the latest session.

Link copied to clipboard
open fun activeRun(session: Int? = null): ActiveRun?

Returns the active run id in the session. If session == null, it is the latest session.

Link copied to clipboard
abstract fun busy(): List<String>

Does this instance still have active asynchronous tasks or active sessions planning to write on disk?

Link copied to clipboard
abstract fun busyLogCount(): Int

Tells how many sessions are still writing / planning to serialize their state on disk.

Link copied to clipboard
open fun finishedMeasurements(session: Int? = null, measurement: Int? = null): List<MeasurementSummary>

Return a summary of a past measurement.

Link copied to clipboard
open fun finishedRuns(session: Int? = null, run: Int? = null): List<RunSummary>

Returns a past run id in the session. If session == null, it is the latest session.

Link copied to clipboard
abstract fun freePool(): MeterHandlerPool

The pool of all the free meters associated with the instance.

Link copied to clipboard

Return a list of received MQTT messages.

Link copied to clipboard

Global configuration for this instance.

Link copied to clipboard
abstract fun handleCommand(cmd: Command): JsonResponse<*>

Handles commands. Commands are different from events in that they are not being logged. Session info is included if needed. The handling is synchronous, but long-running tasks might start asynchronous processes.

Link copied to clipboard
abstract fun handleSessionEvent(event: SessionEvent, sessionId: Int? = null): JsonResponse<*>

Handle an event. If sessionId == null, it is the latest session.

Link copied to clipboard
abstract fun handleSessionResourceEvents(events: List<ResourceConsumptionEvent>, sessionId: Int? = null)

Handle multiple resource consumption events. If sessionId == null, it is the latest session.

Link copied to clipboard
open fun handleTriggerEvent(triggerType: TriggerType, sessionId: Int? = null): JsonResponse<*>

Handle a trigger event. If session == null, it is the latest session.

Link copied to clipboard
abstract fun instance(): String

Instance id.

Link copied to clipboard

Shorter summary of the instance status. Faster to compute, for the web UI.

Link copied to clipboard

Summary data structure for the whole app setup.

Link copied to clipboard

Up-to-date snapshot of the log entries of the past sessions.

Link copied to clipboard
abstract fun logFileCount(): Long

Tells how many ordinary files in located in the log directory. This can be an estimate and only needs to grow when a log has been serialized on disk.

Link copied to clipboard
abstract fun nodeImage(resource: String): <Error class: unknown class><String, ByteArray>?

Data for displaying the images of the nodes

Link copied to clipboard
abstract fun nodes(): List<NodeSummary>

Summary of external nodes associated with this instance.

Link copied to clipboard
open fun <T> ok(result: T?): JsonResponse<T>

Return a result packages in JsonResponse

Link copied to clipboard
abstract fun pool(): MeterHandlerPool

The pool of all meters associated with the instance. Does not include dummy copies of the meters.

Link copied to clipboard
abstract fun qrImage(resource: String): ByteArray?

Data for displaying the QR codes of the server's addresses.

Link copied to clipboard
open fun sendMqttMessage(topic: String, content: String): JsonResponse<*>

Send a MQTT message with the given topic and content.

Link copied to clipboard
abstract fun session(id: Int? = null): Session

Returns the session with the given id OR latest session OR throws an exception

Link copied to clipboard
abstract fun sessions(): Collection<Session>

A snapshot of currently active & inactive sessions.

Link copied to clipboard
open fun unsupportedCommand(name: String?, type: String, uri: String? = null): JsonResponse<*>