Skip to content

lib-bacnetServer 库参考 ​

原文: https://finproducts.atlassian.net/wiki/spaces/JIDD3/pages/34793357819/FIN+5.3.1+lib-bacnetServer 中文整理基于 FIN 5.3.1

导读: BACnet 服务器扩展

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


目录(导读) ​

  • lib
  • meta
  • docs
  • tags
  • funcs
  • def
  • supertypes
  • Overview
  • Config
  • How it works
  • Point types
  • Point property types
  • bacnetServerDeviceList(includeObjects: false)
  • bacnetServerGetObject(rec)
  • bacnetServerProjects()
  • bacnetServerRestart()
  • bacnetServerSyncDevices()
  • finBacnetAutoCreate(stage, equips, instance, macaddr, iteration, enable: false, netnum: null, locaddr: null)
    • src
  • finBacnetAutoCreateForm(id: null, selectedDicts: null)
  • finBacnetAutoCreateManual(equips, instance, macaddr, iteration, enable, netnum, locaddr)
  • finBacnetCheckServerDeviceData(instance, macaddr)
  • finConfigureBacnetServerCommit(serverNetworkNumber, bindAddress, port, localNetworkNumber)
  • finConfigureBacnetServerForm(refill: null)
  • findBacnetServerInstanceChildPoint(deviceEquip, equipRec, instanceNumber, checked)
  • getBacnetServerMaxDeviceInstance()
  • getBacnetServerMaxMacAddress()
  • getLocalBindAddressStackConfig()
  • getLocalDnetNumberStackConfig()
  • getPhyiscalDnetStackConfig()
  • writeLocalBindAddressStackConfig(address: "0.0.0.0\:47808")
  • writeLocalDnetNumberStackConfig(num: "65530")
  • writePhyiscalDnetStackConfig(num: "65531")

概述(中译) ​

BACnet 服务器扩展


API 正文(英文) ​

docs ​

Overview • Config • How it works • Point types • Point property types


tags ​

bacnetServerCovIncrementNumeric tag that sets the delta threshold for when a COV notification should be send
bacnetServerDeviceApplied to a record to create a BACnet device object
bacnetServerDeviceRefApplied to an equip to bind the equip to a bacnetServerDevice
bacnetServerDisApply the bacnetServerDis tag of String type to any point or equip to set custom description for the BACnet server
bacnetServerIgnoreApply the bacnetServerIgnore marker tag to any point you do not want to process or expose via the BACnet server
bacnetServerInstanceApplied to a bacnetDevice to export it as an BACnet device
bacnetServerLocalAddressApplied to a bacnetServer ext record configures the interface the server listens to request
bacnetServerMacAddressApplied to a bacnetServerDevice assigns an unique mac address to this device
bacnetServerNetworkApplied to a bacnetServer ext record assigns an unique BACnet network number to the current project the extension is enabled in
bacnetServerReadOnlyApply the bacnetServerReadOnly marker tag to any points you wish to expose as read-only via the BACnet server, while still allowing them to be writable within FIN.Execute the folio query bacnetServerSyncDevices() to ensure all devices are synchronized with this new configuration
bacnetServerRefreshIntervalNumeric tag that says how often the BACnet server will rescan equipments on the current project
disjoinCurValWriteArrayThis marker tag is applied on <bacnetServer> ext

funcs ​

bacnetServerDeviceListList all devices registered across all projects
bacnetServerGetObjectReturn BACnet object type and instance number for a point record
bacnetServerProjectsList all BACnet projects for those BACnetServer is enabled
bacnetServerRestartRestarts the BACnet server
bacnetServerSyncDevicesRe-create BACnet devices for the current project
finBacnetAutoCreateThe commit action used by "Create Bacnet Devices" (finBacnetAutoCreateForm) to create bacnet devices from the desired equips
finBacnetAutoCreateFormThe UI form for "Create Bacnet Devices"
finBacnetAutoCreateManualBackend function used for "Create Bacnet Devices" (finBacnetAutoCreateForm) to manually configure bacnet devices
finBacnetCheckServerDeviceDataChecks if the server device can be created
finConfigureBacnetServerCommitSets the values required by a bacnet server even when bacnetExt is disabled
finConfigureBacnetServerFormThe UI form for "Configure Bacnet Server"
findBacnetServerInstanceChildPointAxon function
getBacnetServerMaxDeviceInstance
getBacnetServerMaxMacAddress
getLocalBindAddressStackConfig
getLocalDnetNumberStackConfig
getPhyiscalDnetStackConfig
writeLocalBindAddressStackConfig
writeLocalDnetNumberStackConfig
writePhyiscalDnetStackConfig


def ​

bacnetServerCovIncrement ​

Numeric tag that sets the delta threshold for when a COV notification should be send. This tag should be applied to points that are kind Number. The default value is 0.1


meta ​

defbacnetServerCovIncrement
isnumber
liblib:bacnetServer

supertypes ​

valData value type
scalarScalar is an atomic value kind
numberInteger or floating point numbers annotated with an optional unit


def ​

bacnetServerDevice ​

Applied to a record to create a BACnet device object.


meta ​

defbacnetServerDevice
ismarker
liblib:bacnetServer

supertypes ​

markerMarker labels a dict with typing information


def ​

bacnetServerDeviceRef ​

Applied to an equip to bind the equip to a bacnetServerDevice.


meta ​

defbacnetServerDeviceRef
isref
liblib:bacnetServer

supertypes ​

valData value type
scalarScalar is an atomic value kind
refReference to an entity


def ​

bacnetServerDis ​

Apply the bacnetServerDis tag of String type to any point or equip to set custom description for the BACnet server. Execute the folio query bacnetServerSyncDevices() and bacnetServerRestart() to ensure all devices are synchronized with this new configuration.


meta ​

defbacnetServerDis
isstr
liblib:bacnetServer

supertypes ​

valData value type
scalarScalar is an atomic value kind
strUnicode string of characters


def ​

bacnetServerIgnore ​

Apply the bacnetServerIgnore marker tag to any point you do not want to process or expose via the BACnet server. Execute the folio query bacnetServerSyncDevices() to ensure all devices are synchronized with this new configuration.


meta ​

defbacnetServerIgnore
ismarker
liblib:bacnetServer

supertypes ​

markerMarker labels a dict with typing information


def ​

bacnetServerInstance ​

Applied to a bacnetDevice to export it as an BACnet device. The exported device will have the instance number specified by this tag. It also applies to points. All points that are under a equip that will be exposed as a BACnet device will be exported also with their instance numbers unique in the device. Please note that the bacnetServerInstance increment for points is 2, this ensures that if the point has history, then the trend log object can be exposed also. In this case if a point AV100 has the his tag, the trend log will have the bacnetServerInstance 101.

Setting bacnetServerInstance to -1 on a point, will exclude that point from the device.


meta ​

defbacnetServerInstance
isnumber
liblib:bacnetServer

supertypes ​

valData value type
scalarScalar is an atomic value kind
numberInteger or floating point numbers annotated with an optional unit


def ​

bacnetServerLocalAddress ​

Applied to a bacnetServer ext record configures the interface the server listens to request. Default is 0.0.0.0:47808 which means all interfaces on the current machine.


meta ​

defbacnetServerLocalAddress
isstr
liblib:bacnetServer

supertypes ​

valData value type
scalarScalar is an atomic value kind
strUnicode string of characters


def ​

bacnetServerMacAddress ​

Applied to a bacnetServerDevice assigns an unique mac address to this device.


meta ​

defbacnetServerMacAddress
isnumber
liblib:bacnetServer

supertypes ​

valData value type
scalarScalar is an atomic value kind
numberInteger or floating point numbers annotated with an optional unit


def ​

bacnetServerNetwork ​

Applied to a bacnetServer ext record assigns an unique BACnet network number to the current project the extension is enabled in.


meta ​

defbacnetServerNetwork
isnumber
liblib:bacnetServer

supertypes ​

valData value type
scalarScalar is an atomic value kind
numberInteger or floating point numbers annotated with an optional unit


def ​

bacnetServerReadOnly ​

Apply the bacnetServerReadOnly marker tag to any points you wish to expose as read-only via the BACnet server, while still allowing them to be writable within FIN.Execute the folio query bacnetServerSyncDevices() to ensure all devices are synchronized with this new configuration.


meta ​

defbacnetServerReadOnly
ismarker
liblib:bacnetServer

supertypes ​

markerMarker labels a dict with typing information


def ​

bacnetServerRefreshInterval ​

Numeric tag that says how often the BACnet server will rescan equipments on the current project. At each scan the server will recreate the equipment devices with new data from the project. The default value is 59sec


meta ​

defbacnetServerRefreshInterval
isnumber
liblib:bacnetServer

supertypes ​

valData value type
scalarScalar is an atomic value kind
numberInteger or floating point numbers annotated with an optional unit


def ​

disjoinCurValWriteArray ​

This marker tag is applied on <bacnetServer> ext. It make sure that curVal does not comes from write array while sending COV.


meta ​

defdisjoinCurValWriteArray
ismarker
liblib:bacnetServer

supertypes ​

markerMarker labels a dict with typing information

lib bacnetServer ​

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:47808

To 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: Number

There 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


def ​

func:bacnetServerDeviceList ​

bacnetServerDeviceList(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.

meta ​

admin✓
deffunc:bacnetServerDeviceList
isfunc
liblib:bacnetServer
namebacnetServerDeviceList

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:bacnetServerGetObject ​

bacnetServerGetObject(rec) ​

Return BACnet object type and instance number for a point record.


meta ​

admin✓
deffunc:bacnetServerGetObject
isfunc
liblib:bacnetServer
namebacnetServerGetObject

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:bacnetServerProjects ​

bacnetServerProjects() ​

List all BACnet projects for those BACnetServer is enabled.


meta ​

admin✓
deffunc:bacnetServerProjects
isfunc
liblib:bacnetServer
namebacnetServerProjects

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:bacnetServerRestart ​

bacnetServerRestart() ​

Restarts the BACnet server.


meta ​

admin✓
deffunc:bacnetServerRestart
isfunc
liblib:bacnetServer
namebacnetServerRestart

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:bacnetServerSyncDevices ​

bacnetServerSyncDevices() ​

Re-create BACnet devices for the current project.


meta ​

admin✓
deffunc:bacnetServerSyncDevices
isfunc
liblib:bacnetServer
namebacnetServerSyncDevices

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:finBacnetAutoCreate ​

finBacnetAutoCreate(stage, equips, instance, macaddr, iteration, enable: false, netnum: null, locaddr: null) ​

The commit action used by "Create Bacnet Devices" (finBacnetAutoCreateForm) to create bacnet devices from the desired equips. It takes 8 args: num stage (1 for autocreate), a list with equip rec ids, num instance, num macAddress, num iteration, bool enable, num netNumber and num localAddress.

  1. finBacnetAutoCreate(1, [read(vav)->id], 2, 3, 4, false, 5, 6) Our equip (vav in this case) has now a "bacnetServerDeviceRef" on it. We can run "readById(read(vav)->bacnetServerDeviceRef)" in folio to display the info regarding our bacnet device based on the arguments we used when we created it.

meta ​

deffunc:finBacnetAutoCreate
isfunc
liblib:bacnetServer
namefinBacnetAutoCreate

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(stage, equips, instance, macaddr, iteration, enable: false, netnum: null, locaddr: null) => do
  if(stage == 1 or stage == 2) try read(ext=="bacnetServer").diff({bacnetServerNetwork: netnum}).commit catch throw "The Bacnet Server Ext Must Be Enabled In Settings"

  if(stage != 2) equips = equips.sort((x,y)=> readById(x).dis <=> readById(y).dis)
  else equips = equips.sort((x,y)=> readById(x->equip).dis <=> readById(y->equip).dis)

  if(stage == 1) do //run auto
 finBacnetCheckServerDeviceData(instance, macaddr)
    devRef: null
    equip: null

    equips.each x=> do
      equip = readById(x)
      if(equip.has("bacnetServerDeviceRef")) do //if has device ref
  rec : readById(equip->bacnetServerDeviceRef, false)
  if(rec == null) do
  throw "There is a bacnetServerDeviceRef tag applied on this equip which does not point to any of the bacnetServerDevice available. Remove the tag to be able to create a new device."
  end
        rec.diff({bacnetServerInstance: instance, bacnetServerMacAddress: macaddr}).commit //update record
      end
      else do //if new bacnet device
        devRef = diff(null, {bacnetServerDevice: marker(), disMacro: "Device(\$bacnetServerInstance:\$bacnetServerMacAddress)", bacnetServerInstance: instance, bacnetServerMacAddress: macaddr}, {add}).commit->id //make record
        equip.diff({bacnetServerDeviceRef: devRef}).commit //add record ref to equip
      end

      instance = instance + iteration
      macaddr = macaddr + 1
    end
 bacnetServerSyncDevices()
  end
  else if(stage == 2) do //run manual set
    devRef: null
    equip: null

    equips.each x=> do //check dup macaddr and instance
finBacnetCheckServerDeviceData(x->instance, x->macaddr)
    end

    equips.each x=> do
      equip = readById(x->equip)
      if(equip.has("bacnetServerDeviceRef")) do //if has device ref
  rec : readById(equip->bacnetServerDeviceRef)
  if(rec == null) do
  throw "There is a bacnetServerDeviceRef tag applied on this equip which does not point to any of the bacnetServerDevice available. Remove the tag to be able to create a new device."
  end
        readById(equip->bacnetServerDeviceRef).diff({bacnetServerInstance: x->instance, bacnetServerMacAddress: x->macaddr}).commit //update record
      end
      else do //if new bacnet device
        devRef = diff(null, {bacnetServerDevice: marker(), disMacro: "Device(\$bacnetServerInstance:\$bacnetServerMacAddress)", bacnetServerInstance: x->instance, bacnetServerMacAddress: x->macaddr}, {add}).commit->id //make record
        equip.diff({bacnetServerDeviceRef: devRef}).commit
      end
    end
 bacnetServerSyncDevices()
  end
  else if(stage == 3) do //make item renderer data
    stuff: []
    eq: null
    equips.each x=> do
      eq = readById(x)
      stuff = stuff.add({name: eq.dis, id: x, ins: try readById(eq->bacnetServerDeviceRef)->bacnetServerInstance catch instance, mac: try readById(eq->bacnetServerDeviceRef)->bacnetServerMacAddress catch macaddr})
      instance = instance + iteration
      macaddr = macaddr + 1
    end
    stuff
  end
end


def ​

func:finBacnetAutoCreateForm ​

finBacnetAutoCreateForm(id: null, selectedDicts: null) ​

The UI form for "Create Bacnet Devices". Make sure the "bacnetServer" extension is enabled for the changes to take place. Allows the user to create bacnet devices from equips. It takes two params: equip ids and a list of selected dicts and it will return a pop-up window with specific fields to fill out. example for City Center Vav-01: finBacnetAutoCreateForm(@1a169da0-ef590b20,[{dis: "City Center Vav-01", id: @1a169da0-ef590b20, hvac, hotWaterReheat, icon16: fan://equipExt/res/img/equipHvac.png, boilerRef: @1ec6403f-7598b699, indent: 0, mod: dateTime(2016-05-16, 18:12:17.168, "UTC"), ahuRef: @1a169f42-a1d26b60, floorRef: @1a16992d-9cbd4882, children, vav, navName: "Vav-01", siteRef: @1a169921-22d9c3b8, description: "Cafe Lounge", treePath: equip:/City Center/Floor 1/Vav-01, equip, level: 0, disMacro: "$siteRef $navName"}])


meta ​

dbToolCategorytoLocale("finStackExt::advanced")
deffunc:finBacnetAutoCreateForm
distoLocale("bacnetServerExt::createBacnetDevices")
formOnequip
isfunc
liblib:bacnetServer
namefinBacnetAutoCreateForm

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id: null, selectedDicts: null) => do
try readAll(bacnetServerDevice).findAll(x=> bacnetServerDeviceList().colToList("bacnetServerDeviceRef").index(x->id) == null).finHardDelete catch 0
if(selectedDicts == null) selectedDicts = []
  body: [
  {name: "filt", editorType: "filter", prompt: toLocale("bacnetServerExt::selectedEquips"), defVal: "(id==@"+selectedDicts.toRecIdList.concat(" or id==@")+") and equip"},
  {name: "instance", editorType: "numericstepper", prompt: toLocale("bacnetServerExt::selectInstanceStart"), defVal: 100, minVal: 0},
  {name: "macaddr", editorType: "numericstepper", prompt: toLocale("bacnetServerExt::selectMacAddress"), defVal: 1, minVal: 1},
  {name: "iteration", editorType: "numericstepper", prompt: toLocale("bacnetServerExt::selectIteration"), defVal: 100, minVal: 1, toolTip: "Each point with history will create a virtual trend log object, so double instances count"},
  {name: "netnum", editorType: "label", prompt: toLocale("bacnetServerExt::bacnetNetworkNumber"), text: try getLocalDnetNumberStackConfig() catch "Error getting server network."},
  {name: "lists", editorType: "table", prompt: toLocale("bacnetServerExt::registeredBacnetServers"), dataProvider: "if(bacnetServerProjects().size > 0) bacnetServerProjects() else [{msg: \"None Found\"}]", toolTip: "Used to prevent local address collision"},
  {name: "locaddr", editorType: "label", prompt: toLocale("bacnetServerExt::bacnetLocalAddress"), text: try getLocalBindAddressStackConfig() catch "0.0.0.0:47808"},
  {name: "manual", editorType: "checkbox", label: toLocale("bacnetServerExt::runManualConfig")},
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
  {name: "applyButton",  editorType: "button", label: toLocale("finStackExt::coreApply"),  controlBar: true}
  ]

  { "dis": toLocale("bacnetServerExt::createBacnetDevices"),
  "name": "finBacnetAutoCreateForm",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "commitButton": "\$applyButton",
  "commitAction": "if(\$manual) finBacnetAutoCreateManual(readAll(parseFilter(\$filt)).toRecIdList, \$instance, \$macaddr, \$iteration, false, \$netnum, \$locaddr) else finBacnetAutoCreate(1,readAll(parseFilter(\$filt)).toRecIdList, \$instance, \$macaddr, \$iteration, false, \$netnum, \$locaddr)",
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:finBacnetAutoCreateManual ​

finBacnetAutoCreateManual(equips, instance, macaddr, iteration, enable, netnum, locaddr) ​

Backend function used for "Create Bacnet Devices" (finBacnetAutoCreateForm) to manually configure bacnet devices. It takes 7 args: a list with equip rec ids, num instance, num macAddress, num iteration, bool enable (for write local address checkbox), num netNumber and num localAddress and returns the pop-up window for manually configure bacnet devices populated based on the arguments passed.

  1. finBacnetAutoCreateManual([read(vav)->id], 1, 2, 3, false, 4, 5)

meta ​

deffunc:finBacnetAutoCreateManual
isfunc
liblib:bacnetServer
namefinBacnetAutoCreateManual

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(equips, instance, macaddr, iteration, enable, netnum, locaddr) => do
  data: finBacnetAutoCreate(3,equips,instance,macaddr,iteration)
  dataStr: ""
  dataForBody: [{
      name: "headerGroup",
      editorType: "group",
      horizontal,
      children: [
        {name: "name", editorType: "label", text: toLocale("j2FinToolsExt::equip"), width: 173},
        {name: "instance", editorType: "label", text:toLocale("finStackMobileExt::deviceInstance"), width:135},
        {name: "macaddr", editorType: "label", text: toLocale("finStackMobileExt::macAddress"), width:135}
      ]
    }]

  data.each((x, i) => do
    dataStr = dataStr + "{name: \$name"+i+",equip:"+x->id.toAxonCode+", instance: \$instance"+i+", macaddr: \$macaddr"+i+"}" + (if(i != (data.size() - 1)) ", " else "")

    dataForBody = dataForBody.add({
      name: "group"+i,
      editorType: "group",
      horizontal,
      children: [
        {name: "name"+i, editorType: "label", text: x->name, width:173},
        {name: "instance"+i, editorType: "numericstepper", defVal: x->ins, minVal: 0, width:135},
        {name: "macaddr"+i, editorType: "numericstepper", defVal: x->mac, minVal: 1, width: 135}
      ]
    })
  end)

  body: dataForBody.addAll([
    {name: "netnum", editorType: "label", prompt: toLocale("bacnetServerExt::bacnetNetworkNumber"), text: netnum},

    {
      name: "lists",
      editorType: "table",
      prompt: toLocale("bacnetServerExt::registeredBacnetServers"),
      dataProvider: "if(bacnetServerProjects().size > 0) bacnetServerProjects() else [{msg: toLocale(\"bacnetServerExt::noneFound\")}]",
      toolTip: "Used to prevent local address collision",
      height: 150
    },

    {name: "locaddr", editorType: "label", prompt: toLocale("bacnetServerExt::bacnetLocalAddress"), text: locaddr},

    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
    {name: "applyButton",  editorType: "button", label: toLocale("finStackExt::coreApply"),  controlBar: true}
  ])

  {
    "dis": toLocale("bacnetServerExt::manuallyConfigueBacnetDevices"),
    "name": "finBacnetAutoCreateManual",
    "body": body.toJSON,
    "cancelButton": "\$cancelButton",
    "commitButton": "\$applyButton",
    "commitAction": "finBacnetAutoCreate(2, ["+dataStr+"], null, null, null, false, \$netnum, \$locaddr)",
    "width": 800,
    "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:finBacnetCheckServerDeviceData ​

finBacnetCheckServerDeviceData(instance, macaddr) ​

Checks if the server device can be created. Throws an error if instance number is out of range, MAC address is out of range, or if a device or device meta data already exists.


meta ​

deffunc:finBacnetCheckServerDeviceData
isfunc
liblib:bacnetServer
namefinBacnetCheckServerDeviceData
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(instance, macaddr) => do
  if(instance < 0 or instance > getBacnetServerMaxDeviceInstance()) throw "Invalid instance number: " + instance + "\nDevice instance number must be between 0 and " + getBacnetServerMaxDeviceInstance()
  if(macaddr < 1 or macaddr > getBacnetServerMaxMacAddress()) throw "Invalid MAC address: " + macaddr + "\nMAC address must be between 1 and " + getBacnetServerMaxMacAddress()

  deviceInstanceNumRec : readAll(parseFilter("bacnetServerDevice and bacnetServerInstance == " + instance))
  if(deviceInstanceNumRec.size > 0) do
    deviceInstanceNumRec.each dev => do
      equipRec  : read(parseFilter("equip and bacnetServerDeviceRef == @" + dev.get("id")), false)
      if(equipRec != null) do
        throw "A BACNet Device with Instance of " + instance + " already Exists\n BACNet Instances must be unique"
      end
    end
    errStr : "Device Instance Number : " + instance + " already exists in meta data (run bacnetServerDevice). To remove the meta data, run readAll(bacnetServerDevice and bacnetServerInstance == " + instance +").finHardDelete query. Use this query with caution as it will delete all the meta related to device instance " + instance + " or create a device with different instance number."
    throw errStr
  end
  deviceMacAddressRec : readAll(parseFilter("bacnetServerDevice and bacnetServerMacAddress == " + macaddr))
  if(deviceMacAddressRec.size > 0) do
    deviceMacAddressRec.each dev => do
      equipRec  : read(parseFilter("equip and bacnetServerDeviceRef == @" + dev.get("id")), false)
      if(equipRec != null) do
        throw "A BACNet Device with MAC Address of " + macaddr + " already Exists\n BACNet MAC Addresses must be unique"
      end
    end
    errStr : "Device Mac Address : " + macaddr + " already exists in meta data (run bacnetServerDevice). To remove the meta data, run readAll(bacnetServerDevice and bacnetServerMacAddress == " + macaddr +").finHardDelete query. Use this query with caution as it will delete all the meta related to mac address " + macaddr + " or create a device with different MAC address."
    throw errStr
  end
 end


def ​

func:finConfigureBacnetServerCommit ​

finConfigureBacnetServerCommit(serverNetworkNumber, bindAddress, port, localNetworkNumber) ​

Sets the values required by a bacnet server even when bacnetExt is disabled


meta ​

deffunc:finConfigureBacnetServerCommit
isfunc
liblib:bacnetServer
namefinConfigureBacnetServerCommit

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(serverNetworkNumber, bindAddress, port, localNetworkNumber) => do
  if(serverNetworkNumber > 65535 or port > 65535 or localNetworkNumber > 65535)
    return finConfigureBacnetServerForm({localNetworkNumber: localNetworkNumber, serverNetworkNumber:serverNetworkNumber, bindAddress:bindAddress, port:port.toStr, errMsg: " No field value may exceed 65535."})
  else if(serverNetworkNumber < 1 or port < 1 or localNetworkNumber < 1)
    return finConfigureBacnetServerForm({localNetworkNumber: localNetworkNumber, serverNetworkNumber:serverNetworkNumber, bindAddress:bindAddress, port:port.toStr, errMsg: " Invalid input, values below 1 are not allowed."})
  else if(not reMatches(r"^(\d{1,4}\.){3}\d{1,4}$", bindAddress))
    return finConfigureBacnetServerForm({localNetworkNumber: localNetworkNumber, serverNetworkNumber:serverNetworkNumber, bindAddress:bindAddress, port:port.toStr, errMsg: " Local bin address must be a valid IP address."})
  try do
    writePhyiscalDnetStackConfig(serverNetworkNumber.toStr)
    writeLocalBindAddressStackConfig(bindAddress + ":" + port.toStr)
    writeLocalDnetNumberStackConfig(localNetworkNumber.toStr)
  catch(err) do
    return finConfigureBacnetServerForm({localNetworkNumber: localNetworkNumber, serverNetworkNumber:serverNetworkNumber, bindAddress:bindAddress, port:port.toStr, errMsg: err.dis})
  end
  return finFormAlertOk("Success", "Configuration set!")
end


def ​

func:finConfigureBacnetServerForm ​

finConfigureBacnetServerForm(refill: null) ​

The UI form for "Configure Bacnet Server". Use when bacnetExt is disabled or in fault to set local bind address, server network number and local network number.


meta ​

appFormOnconnectors,folio
deffunc:finConfigureBacnetServerForm
disConfigure BACnet Server
folderPathtoLocale("finStackExt::rightMenuConnectors")
formOnbacnetConn
isfunc
liblib:bacnetServer
namefinConfigureBacnetServerForm

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(refill: null) => do
  currentServerNum: getPhyiscalDnetStackConfig()
  currentBinAddr: getLocalBindAddressStackConfig().split(":")
  currentLocalNum: getLocalDnetNumberStackConfig()

  errMsg: ""
  formName: "configureBacnetServerForm"

  if (refill != null) do
    formName = formName + random(1..10000)
    if (refill.has("localNetworkNumber"))
      currentLocalNum = refill["localNetworkNumber"]
    if (refill.has("serverNetworkNumber"))
      currentServerNum = refill["serverNetworkNumber"]
    if (refill.has("bindAddress"))
      currentBinAddr = currentBinAddr.set(0, refill["bindAddress"])
    if (refill.has("port"))
      currentBinAddr = currentBinAddr.set(1, refill["port"])
    if (refill.has("errMsg"))
      errMsg = "Error:" + refill["errMsg"]
  end

  body: [
        { name: "cancelButton",
          editorType: "button",
          label: toLocale("finStackExt::cancel"),
          controlBar: true },

        { name: "applyButton",
          editorType: "button",
          label: toLocale("finStackExt::coreApply"),
          controlBar: true},

        { name: "localNetworkNumber",
          editorType: "numericstepper",
          prompt: "Local Network Number",
          defVal: currentLocalNum,
          toolTip: "" },

        { name: "bindAddress",
          editorType: "textinput",
          prompt: "Local Bind Address",
          defVal: currentBinAddr[0],
          toolTip: "" },

        { name: "port",
          editorType: "numericstepper",
          prompt: "Port Number",
          defVal: currentBinAddr[1],
          toolTip: "" },

        { name: "serverNetworkNumber",
          editorType: "numericstepper",
          prompt: "Server Network Number",
          defVal: currentServerNum,
          toolTip: "" }]

  if (errMsg != "") do
   body = body.insert(0, {name: "errLabel", editorType: "label", text: errMsg})
  end
  { "dis": toLocale("bacnetServerExt::configureBacnetServer"),
        "name": formName,
        "body": body.toJSON,
        "cancelButton": "\$cancelButton",
        "commitButton": "\$applyButton",
        "commitAction": "finConfigureBacnetServerCommit(\$serverNetworkNumber,\$bindAddress,\$port,\$localNetworkNumber)",
    "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:findBacnetServerInstanceChildPoint ​

findBacnetServerInstanceChildPoint(deviceEquip, equipRec, instanceNumber, checked) ​

Axon function


meta ​

admin✓
deffunc:findBacnetServerInstanceChildPoint
isfunc
liblib:bacnetServer
namefindBacnetServerInstanceChildPoint

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:getBacnetServerMaxDeviceInstance ​

getBacnetServerMaxDeviceInstance() ​


meta ​

deffunc:getBacnetServerMaxDeviceInstance
isfunc
liblib:bacnetServer
namegetBacnetServerMaxDeviceInstance

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:getBacnetServerMaxMacAddress ​

getBacnetServerMaxMacAddress() ​


meta ​

deffunc:getBacnetServerMaxMacAddress
isfunc
liblib:bacnetServer
namegetBacnetServerMaxMacAddress

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:getLocalBindAddressStackConfig ​

getLocalBindAddressStackConfig() ​


meta ​

deffunc:getLocalBindAddressStackConfig
isfunc
liblib:bacnetServer
namegetLocalBindAddressStackConfig

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:getLocalDnetNumberStackConfig ​

getLocalDnetNumberStackConfig() ​


meta ​

deffunc:getLocalDnetNumberStackConfig
isfunc
liblib:bacnetServer
namegetLocalDnetNumberStackConfig

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:getPhyiscalDnetStackConfig ​

getPhyiscalDnetStackConfig() ​


meta ​

deffunc:getPhyiscalDnetStackConfig
isfunc
liblib:bacnetServer
namegetPhyiscalDnetStackConfig

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:writeLocalBindAddressStackConfig ​

writeLocalBindAddressStackConfig(address: "0.0.0.0\:47808") ​


meta ​

deffunc:writeLocalBindAddressStackConfig
isfunc
liblib:bacnetServer
namewriteLocalBindAddressStackConfig

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:writeLocalDnetNumberStackConfig ​

writeLocalDnetNumberStackConfig(num: "65530") ​


meta ​

deffunc:writeLocalDnetNumberStackConfig
isfunc
liblib:bacnetServer
namewriteLocalDnetNumberStackConfig

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:writePhyiscalDnetStackConfig ​

writePhyiscalDnetStackConfig(num: "65531") ​


meta ​

deffunc:writePhyiscalDnetStackConfig
isfunc
liblib:bacnetServer
namewritePhyiscalDnetStackConfig

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function