Code Monkey home page Code Monkey logo

bacnet4j-wrapper's Introduction

Code-House Bacnet4J wrapper

CircleCI build GitHub license GitHub release Github all releases

Bacnet4j is implementation of bacnet protocol in Java. Bacnet is an standard which is quite old and bacnet4j implementation is quite awful when it comes to interacting with devices. To avoid headaches with bacnet4j calls we provided this simple facade which hides most of weirdness's of bacnet4j. Thanks to this you can interact with devices, read and set property values, in simpler way.

Many of initial surprises which most of developers experienced is cleaned up with 5.0 release (which is now in use), yet API of Bacnet4j remains a mystery if you do not follow spec. For this reason our wrapper is still maintained. Even if its documentation is not any better than original library, it still provides basic operations in less confusing way.

IP: variant

BacNetClient client = new BacNetIpClient("<bind ip>", "<broadcast ip>", <client device id>);
client.start();
Set<Device> devices = client.discoverDevices(5000); // given number is timeout in millis
for (Device device : devices) {
    System.out.println(device);

    for (Property property : client.getDeviceProperties(device)) {
        System.out.println(property.getName() + " " + client.getPropertyValue(property));
    }
}

client.stop();

MSTP variant:

BacNetClient client = new BacNetMstpClient("<serial port>", <serial node id>, <client device id>);
client.start();
Set<Device> devices = client.discoverDevices(5000); // given number is timeout in millis
for (Device device : devices) {
    System.out.println(device);

    for (Property property : client.getDeviceProperties(device)) {
        System.out.println(property.getName() + " " + client.getPropertyValue(property));
    }
}

client.stop();

Supported features

This project is aimed to offer simple facade thus it is limited to device and following bacnet object types:

  • analogInput
  • analogOutput
  • analogValue
  • binaryInput
  • binaryOutput
  • binaryValue
  • multiStateInput
  • multiStateOutput
  • multiStateValue

As of 1.2.x there is support for additional object types, however they are considered experimental:

  • calendar
  • pulseConverter
  • schedule
  • characterstringValue
  • dateTimeValue
  • largeAnalogValue
  • octetstringValue
  • timeValue
  • integerValue
  • positiveIntegerValue
  • datetimePatternValue
  • timePatternValue
  • datePatternValue
  • accumulator

Most of them is still commendable and supports access through present value property, but some of them bring additional properties which are not visible through wrapper APIs.

If you are interested in adding other types of objects to API feel free to submit PR.

Each property of type enlisted above can be read and attempted to set via client.getPropertyValue and client.setPropertyValue method calls. There are two variants of set/get property methods - with and without converter argument. If you know type of property then you can convert it upfront to bacnet4j structure. By default library will try to guess, however in most of cases it will fail.

How to build

To build project you need:

  • Java 8
  • Apache Maven 2+

Links

bacnet4j-wrapper's People

Contributors

splatch avatar odwrotnie avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.