npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-bacnet-master

v1.0.0

Published

[![Build Status](https://travis-ci.org/relayr/node-bacnet.svg?branch=master)](https://travis-ci.org/relayr/node-bacnet)

Downloads

6

Readme

experimental nodejs BACnet wrapper

Build Status

This is an experiment to see if it is viable to build a thin wrapper around the bacnet-stack c library using the Node.js addons api.

Contents

  • bacnet-stack/ - contains the full contents of the c library checked out from svn://svn.code.sf.net/p/bacnet/code/trunk/bacnet-stack
    • .svn/ - the svn db is checked in to make it easier to update to newer versions and in case we have something to push back to the c library - I don't know if this is a bad idea
  • src/ - contains the wrapper code
    • h_*.c - request and response message handlers - modified from code in bacnet-stack/demo/handlers
    • functions.cc - contains the addon code that runs when functions are called from js
    • init.cc - runs on module initialisation
    • module.cc - defines the module
    • *conversion.cc - provides conversions between js and the BACnet structs
    • emitter.cc - emits js events into an EventEmitter in js-land asynchronously with events from the c code
  • test/test.js - contains just a single example script which uses the module to send a whois message

License

The bacnet-stack code is provided under an eCos license, which is a GPL license with the exception that code linked to it is not covered. For simplicity we would release the wrapper also under the eCos license.

Some code is additionally licensed under an MIT license.

Technical considerations

  • Currently this builds for OSX and Linux (x86), it needs to be cross-platform. The c library supports most everything so it shouldn't be a problem.
  • We will want some high load tests to detect memory leaks and incorrect threading.
  • Some of the bacnet-stack code is static and so we are restricted to one instance per VM - the tests spawn various devices in forked VMs
  • Many of the files I've included in the build are probably not needed and can be removed to reduce install time
  • We may want to switch to a tag of the bacnet-stack instead of the random head on the day I started the project
  • Segmentation is not supported in bacnet-stack (see below)
  • I've seen failures occasionally when making requests concurrently

Installation

npm install should get everything you need. Though you may also need to install compiler tools - such as build-essential on Ubuntu.

Operations needed

BACnet is a huge and impressive protocol suite - the scope of this project currently is only to cover the most basic operations which are needed for our use case and compliance.

For our use case we will need at least these commands:

  • whois
  • write property
  • read property
  • subscribe to cov

And to receive these messages:

  • i am
  • read ack
  • write ack
  • cov ack
  • cov notification

In order to simulate devices we will also want these the opposite way around.

Priorities remaining

  1. synchronise sending requests
  2. separate the code into modules
  3. use c++11
  4. Subscribe to COV
  5. Try again to get 2 devices running on 1 process
  6. Add stress tests to seek memory leaks / socket problems / queue exhaustion (events added faster than consumed in either direction)
  7. Enable writing of the deviceid using WriteProperty - so it can be configured by the installer
  8. Get cross-architecture tests running
  9. Get cross-architecture to work
  10. Make initialisation non-blocking

Things we're not currently trying to support

  • non-ip datalinks
  • bbmp / remote device registration
  • services other than those above
  • bacnet routers

Useful BACnet documentation

Usage considerations

Segmentation not supported

bacnet-stack doesnt support segmentation - so this client doesn't support segmentation.

This can be worked around for large arrays (particularly object lists) by reading the length of the array (index 0) and then reading each element of the array. This should be OK if these arrays don't need to be subscribed using COV or read regularly.

Another option is that we find a way to get segmentation support, such as by merging this branch - https://svn.code.sf.net/p/bacnet/code/branches/jbennet/bacnet-stack-0-5-7/

Known issues

Ran out of invoke ids!

Ocassionally runs out of invocation IDs - the request will throw an error immediately and with PRINT_ENABLED will print to console "Ran out of invoke ids!" - this may not be recoverable - we have to look into how the underlying c library issues and reuses the invocation ids.

Issues with concurrent BACnet requests

It doesn't always happen, but at the moment its best to avoid concurrent requests.