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.
Constructor with framework specific argument
Force this connector closed
Parent connector
Project database
Display name
Parent library
Return if there is one or more points currently in watch
Record id
Log for this connector
Callback to handle close of the connection
Callback when conn record is removed
Callback when conn record is updated
Callback made periodically every few seconds to handle background tasks
Callback to handle learn tree navigation
Callback to handle opening the connection
Callback to handle ping of the connector
Callback when point is added to this connector
Callback when point is removed from this connector
Callback when point record is updated
Callback to poll a bucket of points with the same tuning config
Callback made periodically for manual polling
Callback to handle custom actor messages
Callback to synchronize the given list of points
Callback to synchronize the a point's history data from the connector
Callback when one or more points are taken out of watch mode
Callback when one or more points are put into watch mode
Callback to write a point
Open the connector
Get the point managed by this connector via its point rec id
Get list of all points managed by this connector
Get list of points which are currently in watch
Project
Current version of the record
Set the Conn.data value
Set the ConnPoint.data value
Debug tracing for this connector
This close(Err? cause)
Force this connector closed.
Conn conn()
Parent connector
Folio db()
Project database
Str dis()
Display name
virtual ConnExt ext()
Parent library
Bool hasPointsWatched()
Return if there is one or more points currently in watch.
Ref id()
Record id
Log log()
Log for this connector
new make(Obj arg)
Constructor with framework specific argument
abstract Void onClose()
Callback to handle close of the connection.
virtual Void onConnRemoved()
Callback when conn record is removed
virtual Void onConnUpdated()
Callback when conn record is updated
virtual Void onHouseKeeping()
Callback made periodically every few seconds to handle background tasks.
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 ConnExt.onLearn which provides the top-level callback
for learn. If your learn implementation does not require an open
connection, then use the ConnExt 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
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.
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 None.val. If ping fails then raise exception and the connector will be automatically closed.
virtual Void onPointAdded(ConnPoint pt)
Callback when point is added to this connector
virtual Void onPointRemoved(ConnPoint pt)
Callback when point is removed from this connector
virtual Void onPointUpdated(ConnPoint pt)
Callback when point record is updated
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".
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.
virtual Obj? onReceive(HxMsg msg)
Callback to handle custom actor messages
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
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.
virtual Void onUnwatch(ConnPoint[] points)
Callback when one or more points are taken out of watch mode.
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
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.
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.
ConnPoint? point(Ref id, Bool checked := true)
Get the point managed by this connector via its point rec id.
ConnPoint[] points()
Get list of all points managed by this connector.
ConnPoint[] pointsWatched()
Get list of points which are currently in watch.
Proj proj()
Project
Dict rec()
Current version of the record.
This dict only represents the current persistent tags.
It does not track transient changes such as connStatus.
Void setConnData(Obj? val)
Set the Conn.data value. The value must be immutable.
Void setPointData(ConnPoint pt, Obj? val)
Set the ConnPoint.data value. The value must be immutable.
ConnTrace trace()
Debug tracing for this connector