Skip to content

hxConn ​

原文: https://finproducts.atlassian.net/wiki/spaces/JIDD3/pages/34793848899/FIN+5.3.1+hxConn 中文整理基于 FIN 5.3.1

导读: Haxall 连接器框架

以下为 API 参考,保留英文以便对照源码;目录已列出(英文标题便于检索);概述已尽量中译。


目录(导读) ​

  • classes
  • enums
  • errs
  • Slot Details
    • close
    • data
    • db
    • dis
    • id
    • isDisabled
    • lib
    • linger
    • log
    • openRetryFreq
    • ping
    • pingFreq
    • point
    • pointIds
    • points
    • pollFreq
    • pollMode
    • rec
    • receive
    • rt
    • sendSync
    • status
    • sync
    • syncCur
    • timeout
    • toStr
    • trace
    • tuning
    • conn
    • hasPointsWatched
    • make
    • onClose
    • onConnRemoved
    • onConnUpdated
    • onHouseKeeping
    • onLearn
    • onOpen
    • onPing
    • onPointAdded
    • onPointRemoved
    • onPointUpdated
    • onPollBucket
    • onPollManual
    • onReceive
    • onSyncCur
    • onSyncHis
    • onUnwatch
    • onWatch
    • onWrite
    • open
    • pointsWatched
    • setConnData
    • setPointData
    • conns
    • onConnDetails
    • onPointDetails
    • onRecUpdate
    • onStart
    • onStop
    • tuningDefault
    • curAddr
    • hisAddr
    • isCurEnabled
    • isEnabled
    • isHisEnabled
    • isWatched
    • isWriteEnabled
    • kind
    • tz
    • unit
    • updateCurErr
    • updateCurOk
    • updateHisErr
    • updateHisOk
    • updateWriteErr
    • updateWriteOk
    • writeAddr
    • buckets
    • disabled
    • fromStr
    • manual
    • vals
    • connTuningRef
    • maxThreads
    • down
    • fault
    • isLocal
    • isOk
    • isRemote
    • isUnknown
    • ok
    • remoteDisabled
    • remoteDown
    • remoteFault
    • remoteUnknown
    • stale
    • unknown
    • asLog
    • clear
    • disable
    • dispatch
    • enable
    • event
    • max
    • phase
    • poll
    • read
    • readSince
    • req
    • res
    • write
    • arg
    • argToStr
    • msg
    • toGrid
    • ts
  • …(其余标题见英文正文)

API 正文(英文) ​

errs ​

RemoteStatusErrModels a failure condition when the remote point is not "ok"

Conn ​

const class Conn : Actor

Conn models a connection to a single endpoint.

Methods

closeForce close of connection if open
dataLibrary specific connector data.
dbRuntime database
disDisplay name
idRecord id
isDisabledDoes the record have the disabled marker configured
libParent connector library
lingerConfigured linger timeout - see connLinger
logLog for this connector
openRetryFreqFrequency to retry opens.
pingInvoke ping request
pingFreqConfigured ping frequency to test connection or null if feature is disabled - see connPingFreq
pointGet the point managed by this connector via its point rec id.
pointIdsGet list of all point ids managed by this connector.
pointsGet list of all points managed by this connector.
pollFreqConfigured poll frequency if connector uses manual polling
pollModePoll strategy for connector
recCurrent version of the record.
receiveActor messages are routed to ConnDispatch
rtRuntime system
sendSyncSync a synchronous message to the actor, and block based on the configurable timeout.
statusCurrent status of the connector
syncBlock until this conn processes its current actor queue
syncCurSynchronize the current values for the given points
timeoutTimeout to use for I/O and actor messaging - see actorTimeout.
toStrDebug string
traceDebug tracing for this connector
tuningConn tuning configuration to use for this connector.

Slot Details ​


close ​

virtual override Future close()

Force close of connection if open


data ​

Obj? data()

Library specific connector data. This value is managed by the connector actor via ConnDispatch.setConnData.


db ​

Folio db()

Runtime database


dis ​

Str dis()

Display name


id ​

virtual override Ref id()

Record id


isDisabled ​

Bool isDisabled()

Does the record have the disabled marker configured


lib ​

virtual override ConnLib lib()

Parent connector library


linger ​

Duration linger()

Configured linger timeout - see connLinger


log ​

Log log()

Log for this connector


openRetryFreq ​

Duration openRetryFreq()

Frequency to retry opens. See connOpenRetryFreq.


ping ​

virtual override Future ping()

Invoke ping request


pingFreq ​

Duration? pingFreq()

Configured ping frequency to test connection or null if feature is disabled - see connPingFreq


point ​

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

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


pointIds ​

Ref[] pointIds()

Get list of all point ids managed by this connector.


points ​

ConnPoint[] points()

Get list of all points managed by this connector.


pollFreq ​

Duration? pollFreq()

Configured poll frequency if connector uses manual polling


pollMode ​

ConnPollMode pollMode()

Poll strategy for connector


rec ​

virtual override Dict rec()

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


receive ​

virtual override Obj? receive(Obj? m)

Actor messages are routed to ConnDispatch


rt ​

HxRuntime rt()

Runtime system


sendSync ​

Obj? sendSync(HxMsg msg)

Sync a synchronous message to the actor, and block based on the configurable timeout.


status ​

ConnStatus status()

Current status of the connector


sync ​

This sync(Duration? timeout := null)

Block until this conn processes its current actor queue


syncCur ​

Future syncCur(ConnPoint[] points)

Synchronize the current values for the given points


timeout ​

Duration timeout()

Timeout to use for I/O and actor messaging - see actorTimeout.


toStr ​

virtual override Str toStr()

Debug string


trace ​

ConnTrace trace()

Debug tracing for this connector


tuning ​

ConnTuning tuning()

Conn tuning configuration to use for this connector.


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

makeConstructor with framework specific argument

Methods

closeForce this connector closed.
connParent connector
dbRuntime database
disDisplay name
hasPointsWatchedReturn if there is one or more points currently in watch.
idRecord id
libParent library
logLog for this connector
onCloseCallback to handle close of the connection.
onConnRemovedCallback when conn record is removed
onConnUpdatedCallback when conn record is updated
onHouseKeepingCallback made periodically every few seconds to handle background tasks.
onLearnCallback to handle learn tree navigation.
onOpenCallback to handle opening the connection.
onPingCallback to handle ping of the connector.
onPointAddedCallback when point is added to this connector
onPointRemovedCallback when point is removed from this connector
onPointUpdatedCallback when point record is updated
onPollBucketCallback to poll a bucket of points with the same tuning config.
onPollManualCallback made periodically for manual polling.
onReceiveCallback to handle custom actor messages
onSyncCurCallback to synchronize the given list of points.
onSyncHisCallback to synchronize the a point's history data from the connector.
onUnwatchCallback when one or more points are taken out of watch mode.
onWatchCallback when one or more points are put into watch mode.
onWriteCallback to write a point.
openOpen the connector.
pointGet the point managed by this connector via its point rec id.
pointsGet list of all points managed by this connector.
pointsWatchedGet list of points which are currently in watch.
recCurrent version of the record.
rtRuntime system
setConnDataSet the Conn.data value.
setPointDataSet the ConnPoint.data value.
traceDebug 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


ConnLib ​

abstract const class ConnLib : HxLib

Connector library base class. See Custom Connectors.

Constructors

makeConstructor

Methods

connLookup a connector by its record id
connsList all the connectors
onConnDetailsReturn connector specific details to insert into debug report.
onLearnLibrary level callback to process a connector learn.
onPointDetailsReturn connector specific details to insert into debug report.
onRecUpdateRecord update - if overridden you must call super
onStartStart callback - if overridden you must call super
onStopStop callback - if overridden you must call super
pointLookup a point by its record id
pointsList all the points across all connectors
recSettings record
tuningDefaultCreate default point tuning configuration for this library

Slot Details ​


conn ​

Conn? conn(Ref id, Bool checked := true)

Lookup a connector by its record id


conns ​

Conn[] conns()

List all the connectors


make ​

new make()

Constructor


onConnDetails ​

virtual Str onConnDetails(Conn conn)

Return connector specific details to insert into debug report. Connectors should avoid requiring a message to the Conn actor so that debug can proceed even if the actor is blocked on I/O. Utilize Conn.data to cache debug information.


onLearn ​

virtual Future onLearn(Conn conn, Obj? arg)

Library level callback to process a connector learn. The default operation dispatches to the connector actor, performs an open, and then callback to to ConnDispatch.onLearn. However, some connectors can perform a learn operation without using an open connector (for example using configuration files). In that case, use this hook to process the learn request without dispatching to the Conn actor.


onPointDetails ​

virtual Str onPointDetails(ConnPoint point)

Return connector specific details to insert into debug report. Connectors should avoid requiring a message to the Conn actor so that debug can proceed even if the actor is blocked on I/O. Utilize ConnPoint.data to cache debug information.


onRecUpdate ​

virtual override Void onRecUpdate()

Record update - if overridden you must call super


onStart ​

virtual override Void onStart()

Start callback - if overridden you must call super


onStop ​

virtual override Void onStop()

Stop callback - if overridden you must call super


point ​

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

Lookup a point by its record id


points ​

ConnPoint[] points()

List all the points across all connectors


rec ​

virtual override ConnSettings rec()

Settings record


tuningDefault ​

virtual ConnTuning tuningDefault()

Create default point tuning configuration for this library


ConnPoint ​

const class ConnPoint : Obj

ConnPoint models a point within a connector.

Methods

connParent connector
curAddrCurrent address tag value if configured on the point
dataLibrary specific point data.
disDisplay name
hisAddrHistory address tag value if configured on the point
idRecord id
isCurEnabledIs current address enabled on this point.
isDisabledDoes the record have the disabled marker configured
isEnabledIs the record missing disabled marker configured
isHisEnabledIs history address supported on this point.
isWatchedIs this point currently in one or more watches
isWriteEnabledIs write address enabled on this point.
kindPoint kind defined by rec kind tag
libParent connector library
recCurrent version of the record.
toStrDebug string
tuningConn tuning configuration to use for this point
tzTimezone defined by rec tz tag
unitUnit defined by rec unit tag or null
updateCurErrPut point into down/fault/remoteErr with given error.
updateCurOkUpdate current value and status
updateHisErrUpdate his sync with given error
updateHisOkWrite new history items and update status.
updateWriteErrUpdate write status down/fault with given error
updateWriteOkUpdate write value and status
writeAddrWrite address tag value if configured on the point

Slot Details ​


conn ​

virtual override Conn conn()

Parent connector


curAddr ​

Obj? curAddr()

Current address tag value if configured on the point


data ​

Obj? data()

Library specific point data. This value is managed by the connector actor via ConnDispatch.setPointData.


dis ​

Str dis()

Display name


hisAddr ​

Obj? hisAddr()

History address tag value if configured on the point


id ​

virtual override Ref id()

Record id


isCurEnabled ​

Bool isCurEnabled()

Is current address enabled on this point. This returns true only when all the of following conditions are met:

  • the connector supports current values
  • this point has a cur address tag configured
  • the address tag value is of the proper type
  • the point is not disabled

isDisabled ​

Bool isDisabled()

Does the record have the disabled marker configured


isEnabled ​

Bool isEnabled()

Is the record missing disabled marker configured


isHisEnabled ​

Bool isHisEnabled()

Is history address supported on this point. This returns true only when all the of following conditions are met:

  • the connector supports history synchronization
  • this point has a his address tag configured
  • the address tag value is of the proper type
  • the point is not disabled

isWatched ​

Bool isWatched()

Is this point currently in one or more watches


isWriteEnabled ​

Bool isWriteEnabled()

Is write address enabled on this point. This returns true only when all the of following conditions are met:

  • the connector supports writable points
  • this point has a write address tag configured
  • the address tag value is of the proper type
  • the point is not disabled

kind ​

Kind kind()

Point kind defined by rec kind tag


lib ​

virtual override ConnLib lib()

Parent connector library


rec ​

virtual override Dict rec()

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


toStr ​

virtual override Str toStr()

Debug string


tuning ​

ConnTuning tuning()

Conn tuning configuration to use for this point


tz ​

TimeZone tz()

Timezone defined by rec tz tag


unit ​

Unit? unit()

Unit defined by rec unit tag or null


updateCurErr ​

Void updateCurErr(Err err)

Put point into down/fault/remoteErr with given error.


updateCurOk ​

Void updateCurOk(Obj? val)

Update current value and status


updateHisErr ​

Obj? updateHisErr(Err err)

Update his sync with given error


updateHisOk ​

Obj? updateHisOk(HisItem[] items, Span span)

Write new history items and update status. Span should be same value passed to onSyncHis. The items will be normalized, clipped by span, converted by hisConvert if configured, and then and written to historian.


updateWriteErr ​

Void updateWriteErr(ConnWriteInfo info, Err err)

Update write status down/fault with given error


updateWriteOk ​

Void updateWriteOk(ConnWriteInfo info)

Update write value and status


writeAddr ​

Obj? writeAddr()

Write address tag value if configured on the point


ConnPollMode ​

@Serializable { simple=true } enum class ConnPollMode : Enum

The polling modes supported by the connector framework

Enum

disabledPolling not supported
manualConnector implementation handles all polling logic
bucketsConnector framework handles the polling logic using buckets strategy

Constructors

fromStrReturn the ConnPollMode instance for the specified name.

Fields

valsList of ConnPollMode values indexed by ordinal

Methods

isEnabledReturn true if the mode is not disabled.

Slot Details ​


buckets ​

const static ConnPollMode buckets := ...

Connector framework handles the polling logic using buckets strategy


disabled ​

const static ConnPollMode disabled := ...

Polling not supported


fromStr ​

static new fromStr(Str name, Bool checked := true)

Return the ConnPollMode instance for the specified name. If not a valid name and checked is false return null, otherwise throw ParseErr.


isEnabled ​

Bool isEnabled()

Return true if the mode is not disabled.


manual ​

const static ConnPollMode manual := ...

Connector implementation handles all polling logic


vals ​

const static ConnPollMode[] vals := ...

List of ConnPollMode values indexed by ordinal


ConnSettings ​

const class ConnSettings : TypedDict

ConnSettings is the base class for connector library settings.

Constructors

makeConstructor

Fields

connTuningRefDefault tuning to use when connTuningRef is not explicitly configured on the connector or point record.
maxThreadsMax threads for the connector's actor pool.

Slot Details ​


connTuningRef ​

@TypedTag const Ref? connTuningRef

Default tuning to use when connTuningRef is not explicitly configured on the connector or point record.


make ​

new make(Dict d, |This| f)

Constructor


maxThreads ​

@TypedTag { restart=true; meta="minVal: 1\nmaxVal: 5000" } const Int maxThreads := 100

Max threads for the connector's actor pool. Adding more threads allows more connectors to work concurrently processing their messages. However more threads will incur additional memory usage. In general this value should be somewhere between 50% and 75% of the total number of connectors in the extension. A restart is required for a change to take effect.


ConnStatus ​

@Serializable { simple=true } enum class ConnStatus : Enum

ConnStatus enumeration. This is a unified status value that incorporates connStatus, curStatus, writeStatus and hisStatus. We do not model hisStatus pending/syncing.

Enum

unknown
ok
stale
down
fault
disabled
remoteUnknown
remoteDown
remoteFault
remoteDisabled

Constructors

fromStrReturn the ConnStatus instance for the specified name.

Fields

valsList of ConnStatus values indexed by ordinal

Methods

isDisabledIs the disabled instance
isLocalReturn if this is not isRemote
isOkIs the ok instance
isRemoteIs this is a remote status
isUnknownIs the unknown instance

Slot Details ​


disabled ​

const static ConnStatus disabled := ...


down ​

const static ConnStatus down := ...


fault ​

const static ConnStatus fault := ...


fromStr ​

static new fromStr(Str name, Bool checked := true)

Return the ConnStatus instance for the specified name. If not a valid name and checked is false return null, otherwise throw ParseErr.


isDisabled ​

Bool isDisabled()

Is the disabled instance


isLocal ​

Bool isLocal()

Return if this is not isRemote


isOk ​

Bool isOk()

Is the ok instance


isRemote ​

Bool isRemote()

Is this is a remote status


isUnknown ​

Bool isUnknown()

Is the unknown instance


ok ​

const static ConnStatus ok := ...


remoteDisabled ​

const static ConnStatus remoteDisabled := ...


remoteDown ​

const static ConnStatus remoteDown := ...


remoteFault ​

const static ConnStatus remoteFault := ...


remoteUnknown ​

const static ConnStatus remoteUnknown := ...


stale ​

const static ConnStatus stale := ...


unknown ​

const static ConnStatus unknown := ...


vals ​

const static ConnStatus[] vals := ...

List of ConnStatus values indexed by ordinal


ConnTrace ​

const class ConnTrace : Actor

ConnTrace provides a debug trace for each connector. Trace messages are stored in RAM using a circular buffer.

Methods

asLogExpose the trace as a standard system log.
clearClear the trace log
disableDisable tracing for the connector
dispatchTrace a dispatch message
enableEnable tracing the connector
eventTrace a protocol specific unsolicited event message.
isEnabledIs tracing currently enabled for the connector
maxMax number of trace messages to store in RAM
phaseTrace a phase message
pollTrace a poll message
readGet the current trace messages or empty list if not enabled.
readSinceRead all trace messages since the given timestamp.
reqTrace a protocol specific request message.
resTrace a protocol specific response message.
writeWrite a trace message

Slot Details ​


asLog ​

Log asLog()

Expose the trace as a standard system log. Messages sent to the log instance are traced as follows:

  • if message starts with ">" it is logged as "req" type
  • if message starts with "<" it is logged as "res" type
  • if message starts with "^" it is logged as "event" type
  • otherwise it is logged as "log" type

When logging as a request/response the 2nd line is used as summary with the expectation that log format is patterned as follows:

< message-id
Summary line
... more details ...

clear ​

Void clear()

Clear the trace log


disable ​

Void disable()

Disable tracing for the connector


dispatch ​

Void dispatch(HxMsg msg)

Trace a dispatch message


enable ​

Void enable()

Enable tracing the connector


event ​

Void event(Str msg, Obj arg)

Trace a protocol specific unsolicited event message. The arg must be a Str or Buf. If arg is a Buf then you must call toImmutable on it first to ensure backing array is not cleared.


isEnabled ​

Bool isEnabled()

Is tracing currently enabled for the connector


max ​

Int max()

Max number of trace messages to store in RAM


phase ​

Void phase(Str msg, Obj? arg := null)

Trace a phase message


poll ​

Void poll(Str msg, Obj? arg := null)

Trace a poll message


read ​

ConnTraceMsg[] read()

Get the current trace messages or empty list if not enabled. Messages are ordered from oldest to newest.


readSince ​

ConnTraceMsg[] readSince(DateTime? since)

Read all trace messages since the given timestamp. If the timestamp is null, then read all messages in the buffer. Messages are ordered from oldest to newest.


req ​

Void req(Str msg, Obj arg)

Trace a protocol specific request message. The arg must be a Str or Buf. If arg is a Buf then you must call toImmutable on it first to ensure backing array is not cleared.


res ​

Void res(Str msg, Obj arg)

Trace a protocol specific response message. The arg must be a Str or Buf. If arg is a Buf then you must call toImmutable on it first to ensure backing array is not cleared.


write ​

Void write(Str type, Str msg, Obj? arg := null)

Write a trace message


ConnTraceMsg ​

const class ConnTraceMsg : Obj

ConnTraceMsg models one timestamped trace message

Fields

argExtra data about this trace mesage
msgDescription of the trace message
tsTimestamp of trace message
typeMessage type

Methods

argToStrArgument to debug string
toGridConvert list of trace messages to a grid
toStrString representation (subject to change)

Slot Details ​


arg ​

const Obj? arg

Extra data about this trace mesage:

  • "dispatch": the HxMsg instance
  • "req": message as Str or Buf
  • "res": message as Str or Buf
  • "event": message as Str or Buf
  • "log": LogRec instance

argToStr ​

Str? argToStr()

Argument to debug string


msg ​

const Str msg

Description of the trace message


toGrid ​

static Grid toGrid(ConnTraceMsg[] list, Obj? meta := null)

Convert list of trace messages to a grid


toStr ​

virtual override Str toStr()

String representation (subject to change)


ts ​

const DateTime ts

Timestamp of trace message


type ​

const Str type

Message type:

  • "dispatch": message send to the ConnDispatch
  • "req": protocol specific request message
  • "res": protocol specific response message
  • "event": protocol specific unsolicited event message
  • "poll": polling callback
  • "hk": house keeping callback
  • "log": when using the trace as a system log

ConnTuning ​

const class ConnTuning : Obj

ConnTuning models a connTuning rec. See Connector Tuning

Constructors

makeConstruct with current record

Methods

disDisplay name
idRecord id
pollTimeFrequency between polls of curVal.
recRec for tuning config
staleTimeTime before a point's curStatus marked from "ok" to "stale".
toStrDebug string
writeMaxTimeMaximum time between writes used to send periodic writes.
writeMinTimeMinimum time between writes used to throttle the speed of writes.
writeOnOpenRewrite the point everytime time the connector transitions to open.
writeOnStartIssue a write when system starts up, otherwise suppress it.

Slot Details ​


dis ​

Str dis()

Display name


id ​

Ref id()

Record id


make ​

new make(Dict rec)

Construct with current record


pollTime ​

Duration pollTime()

Frequency between polls of curVal. See See Connector Tuning.


rec ​

Dict rec()

Rec for tuning config


staleTime ​

Duration staleTime()

Time before a point's curStatus marked from "ok" to "stale". See See Connector Tuning.


toStr ​

virtual override Str toStr()

Debug string


writeMaxTime ​

Duration? writeMaxTime()

Maximum time between writes used to send periodic writes. See See Connector Tuning.


writeMinTime ​

Duration? writeMinTime()

Minimum time between writes used to throttle the speed of writes. See See Connector Tuning.


writeOnOpen ​

Bool writeOnOpen()

Rewrite the point everytime time the connector transitions to open. See See Connector Tuning.


writeOnStart ​

Bool writeOnStart()

Issue a write when system starts up, otherwise suppress it. See Connector Tuning.


ConnWriteInfo ​

const class ConnWriteInfo : Obj

ConnWriteInfo wraps the value to write to the remote system. It carries information used to update local transient tags.

Fields

valValue to write to the remote system; might be converted from writeVal

Methods

asMaxTime
asMinTime
asOnOpen
toStrDebug string representation

Slot Details ​


asMaxTime ​

This asMaxTime()


asMinTime ​

This asMinTime()


asOnOpen ​

This asOnOpen()


toStr ​

virtual override Str toStr()

Debug string representation


val ​

const Obj? val

Value to write to the remote system; might be converted from writeVal


RemoteStatusErr ​

const class RemoteStatusErr : Err

Models a failure condition when the remote point is not "ok"

Constructors

makeConstruct with status of remote point

Fields

statusStatus of the remote point

Slot Details ​


make ​

new make(ConnStatus status)

Construct with status of remote point


status ​

const ConnStatus status

Status of the remote point