外观
bacnetServerExt 扩展参考
原文: https://finproducts.atlassian.net/wiki/spaces/JIDD3/pages/34793553924/FIN+5.3.1+bacnetServerExt 中文整理基于 FIN 5.3.1
导读: BACnet 服务器扩展
以下为 API 参考,保留英文以便对照源码;目录已列出(英文标题便于检索);概述已尽量中译。
目录(导读)
- classes
- errs
- docs
- Overview
- Config
- How it works
- Point types
- Point property types
- Slot Details
- devAddr
- devAddress
- make
- req
- onStart
- onStop
- receive
- callbackHandler
- ext
- setHook
- getLoggingTypeFromRec
- covWatcher
- cur
- getBindAddress
- pollingWatcher
- serverWatcher
- setHooks
- syncDevices
- devices
- initStack
- syncManager
- user
- bacnetServerDeviceList
- bacnetServerGetObject
- bacnetServerProjects
- bacnetServerRestart
- bacnetServerSyncDevices
- getBacnetServerMaxDeviceInstance
- getBacnetServerMaxMacAddress
- getLocalBindAddressStackConfig
- getLocalDnetNumberStackConfig
- getPhyiscalDnetStackConfig
- writeLocalBindAddressStackConfig
- writeLocalDnetNumberStackConfig
- writePhyiscalDnetStackConfig
- checkMsg
- checkMsgFuture
- initMsg
- refreshSyncDeviceInterval
- stopped
- syncTickFreq
- fanToBacnetStatus
- getDeafultValue
- getPointForObject
- initAndAddDeviceToWatchIfNeeded
- isTrendLogObjectId
- syncCur
- vendorId
- vendorName
- equals
- hash
- macAddress
- netConfig
- networkNumber
- toStr
- addDeviceObjectsToWatch
- defaultStopWatchInterval
- forceStop
- getProj
- isWatchActive
- isWatchAlive
- latestRenewTimestamp
- msgFuture
- onRenew
- pointWatchId
- pollInterval
- pollMsg
- pollMsgFuture
- refList
- renewWatchMsg
- resetLatestRenewRequestTime
- retryCount
- stopMsg
- stopWatchInterval
- stopWatchIntervalChangeMsg
- watchName
- terminate
API 正文(英文)
docs
Overview
The bacnetServer extension implements a BACnet router-gateway over BACnet/IP.
See ANNEX H - COMBINING BACnet NETWORKS WITH NON-BACnet NETWORKS (NORMATIVE) of the BACnet standard
Functionality supported by the bacnetServer extension:
- READ_PROPERTY
- READ_PROPERTY_MULTIPLE
- READ_RANGE
- WRITE_PROPERTY
- WRITE_PROPERTY_MULTIPLE
- WHO_IS
- I_AM
- WHO_HAS
- I_HAVE
- SUBSCRIBE_COV (both confirmed and unconfirmed)
- CONFIRMED_COV_NOTIFICATION
- UNCONFIRMED_COV_NOTIFICATION
Config
The server bind address can be configured by adding the <bacnetLocalAddress> Str tag to the bacnetServer extension record. If no tag is set, the default value will be:
bacnetLocalAddress: 0.0.0.0:47808To enable BACnet Server, the bacnetServerNetwork Number tag must be added to the bacnetServer extension record.
How it works
The bacnetServer extension acts a BACnet router-gateway to virtual networks of virtual devices.
Each Folio project could be enabled as a BACnet network by adding the bacnetServerNetwork Number tag to the bacnetServer extension. A project that wishes to be visible to the BAcnet network must add the bacnetNetwork tag, and the tag value must be unique if there are multiple projects that are enabled as BACnet networks.
The extension will create a BACnet virtual devices from any equipment that has a bacnetDeviceRef Ref tag applied. This references must point to a BACnet device record. The record should contain:
tag: bacnetDevice
kind: Marker
tag: bacnetInstance
kind: Number
tag: bacnetMacAddress
kind: NumberThere is an automatic scan process that looks for equipments with the bacnetDeviceRef tag across the current project, and it automatically allocates instance numbers for each point under the matching equipment.
The automatic numbering process will create virtual trend points for points that have histories, this will make the increment between points to be 2 in that case.
Point instances must be unique within a device. Device instances must be unique within a project (network). The user is free to manually allocate the bacnetInstance tag as she/he wishes as long there is no conflict generated. Assigning -1 to a point's bacnetInstance removes the point from the device object list.
Point types
The extension will convert any of the points under an equipment annotated with bacnetInstance as follows:
- Point kind
Bool-> BACnet Binary Input/Value(if writable) point - Point kind
Number-> BACnet Analog Input/Value(if writable) point - Point kind
Str-> BACnet Multi State Input/Value(if writable) point
Point property types
The only BACnet property that is writable is PRESENT_VALUE for Value points. Any other property should be considered read-only.
BACnet Device (represented here by an equip):
- VENDOR_NAME
- VENDOR_IDENTIFIER
- MODEL_NAME
- FIRMWARE_REVISION
- APPLICATION_SOFTWARE_VERSION
- PROTOCOL_VERSION
- PROTOCOL_REVISION
- PROTOCOL_SERVICES_SUPPORTED
- SEGMENTATION_SUPPORTED
- MAX_APDU_LENGTH_ACCEPTED
- MAX_SEGMENTS_ACCEPTED
- OBJECT_NAME
- OBJECT_IDENTIFIER
- OBJECT_TYPE
- SYSTEM_STATUS
- LOCATION
- DESCRIPTION
- OBJECT_LIST
- APDU_TIMEOUT
- NUMBER_OF_APDU_RETRIES
- DATABASE_REVISION
BACnet Analog Input/Value point:
- OBJECT_NAME
- OBJECT_IDENTIFIER
- OBJECT_TYPE
- UNITS
- PRESENT_VALUE
- COV_INCREMENT
- OUT_OF_SERVICE
- STATUS_FLAGS
- EVENT_STATE
- RELIABILITY
BACnet Binary Input/Value point:
- OBJECT_NAME
- OBJECT_IDENTIFIER
- OBJECT_TYPE
- INACTIVE_TEXT
- ACTIVE_TEXT
- PRESENT_VALUE
- OUT_OF_SERVICE
- STATUS_FLAGS
- EVENT_STATE
- RELIABILITY
BACnet Multi State Input/Value:
- OBJECT_NAME
- OBJECT_IDENTIFIER
- OBJECT_TYPE
- STATE_TEXT
- NUMBER_OF_STATES
- PRESENT_VALUE
- OUT_OF_SERVICE
- STATUS_FLAGS
- EVENT_STATE
- RELIABILITY
BACnet Trend Log:
- OBJECT_NAME
- OBJECT_IDENTIFIER
- OBJECT_TYPE
- ENABLE
- BUFFER_SIZE
- RECORD_COUNT
- TOTAL_RECORD_COUNT
- LOG_BUFFER
- LOG_DEVICE_OBJECT_PROPERTY
- LOGGING_TYPE
- STATUS_FLAGS
- EVENT_STATE
BacnetCOVMsg
const class BacnetCOVMsg : Obj
Constructors
| make |
Fields
| devAddr |
Methods
| devAddress | |
| req |
Slot Details
devAddr
const Unsafe devAddr
devAddress
DeviceAddress devAddress()
make
new make(SubscribeCov r, DeviceAddress d)
req
SubscribeCov req()
BacnetCOVWatcher
const class BacnetCOVWatcher : Actor
Constructors
| make |
Methods
| onStart | |
| onStop | |
| receive |
Slot Details
make
new make(Ext ext)
onStart
Void onStart()
onStop
Void onStop()
receive
virtual override Obj? receive(Obj? msg)
BacnetReadPropertyHandler
class BacnetReadPropertyHandler : Obj, BacStacCallback
Constructors
| make |
Fields
| ext |
Methods
| callbackHandler | |
| setHook |
Slot Details
callbackHandler
virtual override Obj? callbackHandler(Obj? dataInput)
ext
BacnetServerExt? ext
make
new make(BacnetServerExt ext)
setHook
Void setHook()
BacnetReadPropertyMultipleHandler
class BacnetReadPropertyMultipleHandler : Obj, BacStacCallback
Constructors
| make |
Fields
| ext |
Methods
| callbackHandler | |
| setHook |
Slot Details
callbackHandler
virtual override Obj? callbackHandler(Obj? data)
ext
BacnetServerExt? ext
make
new make(BacnetServerExt ext)
setHook
Void setHook()
BacnetReadRangeHandler
class BacnetReadRangeHandler : Obj, BacStacCallback
Constructors
| make |
Fields
| ext |
Methods
| callbackHandler | |
| getLoggingTypeFromRec | |
| setHook |
Slot Details
callbackHandler
virtual override Obj? callbackHandler(Obj? data)
ext
BacnetServerExt? ext
getLoggingTypeFromRec
static Int getLoggingTypeFromRec(Dict rec)
make
new make(BacnetServerExt ext)
setHook
Void setHook()
BacnetServerExt
@ExtMeta { name="bacnetServer"; depends=["finstack"] } @FinExtMeta { licFeature="finstack"; pngIcon=... } const class BacnetServerExt : FinExt
Methods
| covWatcher | |
| cur | |
| getBindAddress | |
| onStart | |
| onStop | |
| pollingWatcher | |
| serverWatcher | |
| setHooks | |
| syncDevices |
Slot Details
covWatcher
BacnetCOVWatcher covWatcher()
cur
static BacnetServerExt? cur(Bool checked := true)
getBindAddress
Str getBindAddress()
onStart
virtual override Void onStart()
onStop
virtual override Void onStop()
pollingWatcher
PollingWatcher pollingWatcher()
serverWatcher
BacnetServerWatcher serverWatcher()
setHooks
Void setHooks()
syncDevices
Void syncDevices(Bool isManualSync := false, Bool isEnableStackDBSync := true)
BacnetServerHandler
const class BacnetServerHandler : Obj
Constructors
| make |
Fields
| ext | |
| user |
Methods
| devices | |
| initStack | |
| syncDevices | |
| syncManager |
Slot Details
devices
ConcurrentHashMap devices()
ext
const BacnetServerExt ext
initStack
Void initStack(Int networkNumber)
make
new make(BacnetServerExt ext)
syncDevices
Void syncDevices(Bool isEnableStackDBSync)
syncManager
GatewayDeviceUpdateManager syncManager()
user
const static User user := ...
BacnetServerLib
const class BacnetServerLib : Obj
Methods
| bacnetServerDeviceList | List all devices registered across all projects. |
| bacnetServerGetObject | Return BACnet object type and instance number for a point record. |
| bacnetServerProjects | List all BACnet projects for those BACnetServer is enabled. |
| bacnetServerRestart | Restarts the BACnet server. |
| bacnetServerSyncDevices | Re-create BACnet devices for the current project. |
| getBacnetServerMaxDeviceInstance | |
| getBacnetServerMaxMacAddress | |
| getLocalBindAddressStackConfig | |
| getLocalDnetNumberStackConfig | |
| getPhyiscalDnetStackConfig | |
| writeLocalBindAddressStackConfig | |
| writeLocalDnetNumberStackConfig | |
| writePhyiscalDnetStackConfig |
Slot Details
bacnetServerDeviceList
@Axon { admin=true } static Grid bacnetServerDeviceList(Bool includeObjects := false)
List all devices registered across all projects. If includeObjects set to true it will also list the children objects of each device. Default value is false.
Parameters:
- includeObjects.
bacnetServerGetObject
@Axon { admin=true } static Grid bacnetServerGetObject(Obj? rec)
Return BACnet object type and instance number for a point record.
bacnetServerProjects
@Axon { admin=true } static Grid bacnetServerProjects()
List all BACnet projects for those BACnetServer is enabled.
bacnetServerRestart
@Axon { admin=true } static Grid bacnetServerRestart()
Restarts the BACnet server.
bacnetServerSyncDevices
@Axon { admin=true } static Grid bacnetServerSyncDevices()
Re-create BACnet devices for the current project.
getBacnetServerMaxDeviceInstance
@Axon static Number getBacnetServerMaxDeviceInstance()
getBacnetServerMaxMacAddress
@Axon static Number getBacnetServerMaxMacAddress()
getLocalBindAddressStackConfig
@Axon static Str getLocalBindAddressStackConfig()
getLocalDnetNumberStackConfig
@Axon static Number getLocalDnetNumberStackConfig()
getPhyiscalDnetStackConfig
@Axon static Number getPhyiscalDnetStackConfig()
writeLocalBindAddressStackConfig
@Axon static Grid writeLocalBindAddressStackConfig(Str address := "0.0.0.0\\:47808")
writeLocalDnetNumberStackConfig
@Axon static Grid writeLocalDnetNumberStackConfig(Str num := "65530")
writePhyiscalDnetStackConfig
@Axon static Grid writePhyiscalDnetStackConfig(Str num := "65531")
BacnetServerWatcher
const class BacnetServerWatcher : Actor
Constructors
| make |
Fields
| checkMsg | |
| checkMsgFuture | |
| ext | |
| initMsg | |
| stopped | |
| syncTickFreq |
Methods
| onStart | |
| onStop | |
| receive | |
| refreshSyncDeviceInterval |
Slot Details
checkMsg
const static Obj checkMsg := "_check_"
checkMsgFuture
const AtomicRef checkMsgFuture := AtomicRef.<ctor>()
ext
const Ext ext
initMsg
const static Obj initMsg := "_init_"
make
new make(Ext ext)
onStart
Void onStart()
onStop
Void onStop()
receive
virtual override Obj? receive(Obj? msg)
refreshSyncDeviceInterval
Void refreshSyncDeviceInterval()
stopped
const AtomicBool stopped := AtomicBool.<ctor>(false)
syncTickFreq
const static Obj syncTickFreq := "_syncTickFreq_"
BacnetSubscribeCovHandler
class BacnetSubscribeCovHandler : Obj, BacStacCallback
Constructors
| make |
Fields
| ext |
Methods
| callbackHandler | |
| setHook |
Slot Details
callbackHandler
virtual override Obj? callbackHandler(Obj? data)
ext
BacnetServerExt? ext
make
new make(BacnetServerExt ext)
setHook
Void setHook()
BacnetUtils
const class BacnetUtils : Obj
Methods
| fanToBacnetStatus | |
| getDeafultValue | |
| getPointForObject | |
| initAndAddDeviceToWatchIfNeeded | |
| isTrendLogObjectId | |
| syncCur | |
| vendorId | |
| vendorName |
Slot Details
fanToBacnetStatus
static BacStacReliability fanToBacnetStatus(Obj fanStat)
getDeafultValue
static Obj? getDeafultValue(Str kind)
getPointForObject
static Dict? getPointForObject(NetObject obj, Proj proj)
initAndAddDeviceToWatchIfNeeded
static Void initAndAddDeviceToWatchIfNeeded(BacnetServerExt ext, NetObject? obj, Device dev)
isTrendLogObjectId
static Bool isTrendLogObjectId(Str objectId)
syncCur
static Obj? syncCur(NetObject obj, Proj proj, Dict? pointRec)
vendorId
static Int vendorId(BacnetServerExt ext)
vendorName
static Str vendorName(BacnetServerExt ext)
BacnetWhoHasHandler
class BacnetWhoHasHandler : Obj, BacStacCallback
Constructors
| make |
Fields
| ext |
Methods
| callbackHandler | |
| setHook |
Slot Details
callbackHandler
virtual override Obj? callbackHandler(Obj? data)
ext
BacnetServerExt? ext
make
new make(BacnetServerExt ext)
setHook
Void setHook()
BacnetWhoIsHandler
class BacnetWhoIsHandler : Obj, BacStacCallback
Constructors
| make |
Fields
| ext |
Methods
| callbackHandler | |
| setHook |
Slot Details
callbackHandler
virtual override Obj? callbackHandler(Obj? data)
ext
BacnetServerExt? ext
make
new make(BacnetServerExt ext)
setHook
Void setHook()
BacnetWritePropertyHandler
class BacnetWritePropertyHandler : Obj, BacStacCallback
Constructors
| make |
Fields
| ext |
Methods
| callbackHandler | |
| setHook |
Slot Details
callbackHandler
virtual override Obj? callbackHandler(Obj? data)
ext
BacnetServerExt? ext
make
new make(BacnetServerExt ext)
setHook
Void setHook()
BacnetWritePropertyMultipleHandler
class BacnetWritePropertyMultipleHandler : Obj, BacStacCallback
Constructors
| make |
Fields
| ext |
Methods
| callbackHandler | |
| setHook |
Slot Details
callbackHandler
virtual override Obj? callbackHandler(Obj? responseData)
ext
BacnetServerExt? ext
make
new make(BacnetServerExt ext)
setHook
Void setHook()
DeviceAddress
const class DeviceAddress : Obj
Constructors
| make |
Fields
| macAddress | |
| networkNumber |
Methods
| equals | |
| hash | |
| netConfig | |
| toStr |
Slot Details
equals
virtual override Bool equals(Obj? other)
hash
virtual override Int hash()
macAddress
const Int macAddress
make
new make(Int networkNumber, Int macAddress)
netConfig
NetworkConfig? netConfig()
networkNumber
const Int networkNumber
toStr
virtual override Str toStr()
PollingWatcher
const class PollingWatcher : Actor
Constructors
| make |
Fields
Methods
| addDeviceObjectsToWatch | |
| getProj | |
| isWatchAlive | |
| onRenew | |
| onStart | |
| onStop | |
| receive |
Slot Details
addDeviceObjectsToWatch
Void addDeviceObjectsToWatch(Device dev)
defaultStopWatchInterval
const static Duration defaultStopWatchInterval := 10min
ext
const Ext ext
forceStop
const AtomicBool forceStop := AtomicBool.<ctor>(false)
getProj
Proj? getProj()
initMsg
const static Obj initMsg := "_init_"
isWatchActive
const AtomicBool isWatchActive := AtomicBool.<ctor>(false)
isWatchAlive
Bool isWatchAlive()
latestRenewTimestamp
const AtomicRef latestRenewTimestamp := AtomicRef.<ctor>(Duration.now())
make
new make(BacnetServerExt ext)
msgFuture
const AtomicRef msgFuture := AtomicRef.<ctor>()
onRenew
Future onRenew()
onStart
Void onStart()
onStop
Future onStop(Bool forceStop := false)
pointWatchId
const AtomicRef pointWatchId := AtomicRef.<ctor>()
pollInterval
const static Duration pollInterval := 45sec
pollMsg
const static Obj pollMsg := "_poll_"
pollMsgFuture
const AtomicRef pollMsgFuture := AtomicRef.<ctor>()
receive
virtual override Obj? receive(Obj? msg)
refList
const AtomicRef refList := AtomicRef.<ctor>()
renewWatchMsg
const static Obj renewWatchMsg := "_renew_"
resetLatestRenewRequestTime
const static Obj resetLatestRenewRequestTime := "_reset_latest_request_time_"
retryCount
const AtomicInt retryCount := AtomicInt.<ctor>(0)
stopMsg
const static Obj stopMsg := "_stop_"
stopWatchInterval
const AtomicRef stopWatchInterval := AtomicRef.<ctor>()
stopWatchIntervalChangeMsg
const static Obj stopWatchIntervalChangeMsg := "_change_"
watchName
const static Obj watchName := "bacnet-server-poll-watch"
StopSocketRecvCallbackLoop
const class StopSocketRecvCallbackLoop : Err
Constructors
| make |
Fields
| terminate |
Slot Details
make
new make(Str err)
terminate
const Bool terminate := true