type

ConnDispatch

abstract class ConnDispatch : Obj

ConnDispatch provides an implementation for all callbacks. A subclass is created by each connector to implement the various callbacks and store mutable state. All dispatch callbacks are executed within the parent Conn actor. See Custom Connectors.

constructors

make

Constructor with framework specific argument

methods

close

Force this connector closed.

conn

Parent connector

db

Runtime database

dis

Display name

hasPointsWatched

Return if there is one or more points currently in watch.

id

Record id

lib

Parent library

log

Log for this connector

onClose

Callback to handle close of the connection.

onConnRemoved

Callback when conn record is removed

onConnUpdated

Callback when conn record is updated

onHouseKeeping

Callback made periodically every few seconds to handle background tasks.

onLearn

Callback to handle learn tree navigation.

onOpen

Callback to handle opening the connection.

onPing

Callback to handle ping of the connector.

onPointAdded

Callback when point is added to this connector

onPointRemoved

Callback when point is removed from this connector

onPointUpdated

Callback when point record is updated

onPollBucket

Callback to poll a bucket of points with the same tuning config.

onPollManual

Callback made periodically for manual polling.

onReceive

Callback to handle custom actor messages

onSyncCur

Callback to synchronize the given list of points.

onSyncHis

Callback to synchronize the a point's history data from the connector.

onUnwatch

Callback when one or more points are taken out of watch mode.

onWatch

Callback when one or more points are put into watch mode.

onWrite

Callback to write a point.

open

Open the connector.

point

Get the point managed by this connector via its point rec id.

points

Get list of all points managed by this connector.

pointsWatched

Get list of points which are currently in watch.

rec

Current version of the record.

rt

Runtime system

setConnData

Set the Conn.data value.

setPointData

Set the ConnPoint.data value.

trace

Debug tracing for this connector

Slot Details

close

This close(Err? cause)

Force this connector closed.

conn

Conn conn()

Parent connector

db

Folio db()

Runtime database

dis

Str dis()

Display name

hasPointsWatched

Bool hasPointsWatched()

Return if there is one or more points currently in watch.

id

Ref id()

Record id

lib

virtual ConnLib lib()

Parent library

log

Log log()

Log for this connector

make

new make(Obj arg)

Constructor with framework specific argument

onClose

abstract Void onClose()

Callback to handle close of the connection.

onConnRemoved

virtual Void onConnRemoved()

Callback when conn record is removed

onConnUpdated

virtual Void onConnUpdated()

Callback when conn record is updated

onHouseKeeping

virtual Void onHouseKeeping()

Callback made periodically every few seconds to handle background tasks.

onLearn

virtual Grid onLearn(Obj? arg)

Callback to handle learn tree navigation. This method should return a grid where the rows are either navigation elements to traverse or points to map. The learn tag is used to indicate a row which may be "dived into" to navigate the remote system's tree. The learn value is passed back to this function to get the next level of the tree. A null arg should return the root of the learn tree.

Also see ConnLib.onLearn which provides the top-level callback for learn. If your learn implementation does not require an open connection, then use the ConnLib level callback. By default that callback will dispatch a message to Conn actor, perform open, and then invoke this callback.

The following tags should be used to indicate points to map:

  • dis: display name for navigation (required for all rows)
  • point: marker indicating point (1 or more fooCur/His/Write)
  • fooPoint: marker
  • fooCur: address if object can be mapped for cur real-time sync
  • fooWrite: address if object can be mapped for writing
  • fooHis: address if object can be mapped for history sync
  • kind: point kind type if known
  • unit: point unit if known
  • hisInterpolate: if point is known to be collected as COV
  • enum: if range of bool or multi-state is known
  • any other known tags to map to the learned points

onOpen

abstract Void onOpen()

Callback to handle opening the connection. Raise DownErr or FaultErr if the connection failed. This callback is always called before operations such as onPing.

onPing

abstract Dict onPing()

Callback to handle ping of the connector. Return custom status tags such as device version, etc to store on the connector record persistently. If there are version tags which should be removed then map those tags to Remove.val. If ping fails then raise exception and the connector will be automatically closed.

onPointAdded

virtual Void onPointAdded(ConnPoint pt)

Callback when point is added to this connector

onPointRemoved

virtual Void onPointRemoved(ConnPoint pt)

Callback when point is removed from this connector

onPointUpdated

virtual Void onPointUpdated(ConnPoint pt)

Callback when point record is updated

onPollBucket

virtual Void onPollBucket(ConnPoint[] points)

Callback to poll a bucket of points with the same tuning config. Default implementation calls onSyncCur. This callback is only used if the Conn.pollMode is configured as "buckets".

onPollManual

virtual Void onPollManual()

Callback made periodically for manual polling. This callback is only invoked if Conn.pollMode is configured as "manual". The frequency of the callback is determined by Conn.pollFreq. Use pointsWatched to list of points currently being watched.

onReceive

virtual Obj? onReceive(HxMsg msg)

Callback to handle custom actor messages

onSyncCur

virtual Void onSyncCur(ConnPoint[] points)

Callback to synchronize the given list of points. The result of this call should be to invoke ConnPoint.updateCurOk or ConnPoint.updateCurErr on each point. All the points are guaranteed to return true for isCurEnabled

onSyncHis

virtual Obj? onSyncHis(ConnPoint point, Span span)

Callback to synchronize the a point's history data from the connector. The result of this callback must be to invoke ConnPoint.updateHisOk or ConnPoint.updateHisErr (or just raise exception). The return of this method should be whatever updateHisXXX returns.

onUnwatch

virtual Void onUnwatch(ConnPoint[] points)

Callback when one or more points are taken out of watch mode.

onWatch

virtual Void onWatch(ConnPoint[] points)

Callback when one or more points are put into watch mode. All the points are guaranteed to return true for isCurEnabled

onWrite

virtual Void onWrite(ConnPoint point, ConnWriteInfo event)

Callback to write a point. The connector should write info.val to the remote system. If successful then call ConnPoint.updateWriteOk. If there is an error then invoke ConnPoint.updateWriteErr or raise an exception. Note the value may have been convered from writeVal if writeConvert is configured.

open

This open()

Open the connector. The connection will linger open based on the configured linger timeout, then automatically close. If the connector fails to open, then raise an exception.

point

ConnPoint? point(Ref id, Bool checked := true)

Get the point managed by this connector via its point rec id.

points

ConnPoint[] points()

Get list of all points managed by this connector.

pointsWatched

ConnPoint[] pointsWatched()

Get list of points which are currently in watch.

rec

Dict rec()

Current version of the record. This dict only represents the current persistent tags. It does not track transient changes such as connStatus.

rt

HxRuntime rt()

Runtime system

setConnData

Void setConnData(Obj? val)

Set the Conn.data value. The value must be immutable.

setPointData

Void setPointData(ConnPoint pt, Obj? val)

Set the ConnPoint.data value. The value must be immutable.

trace

ConnTrace trace()

Debug tracing for this connector