Coder Social home page Coder Social logo

gobacnet's Introduction

goBACnet

Build Status GoDoc

gobacnet is a client for bacnet written exclusively with go. The goal is to only offer a client and a test server application.

NOTE: This code is very experimental and therefore should not be used in anything you want working. There are many changes being made and I cannot guarantee compatibility between versions. Many features of the protocol are missing and will be added overtime.

Installation

Part of this library is a command line client. To install from source run:

go get -u github.com/alexbeltran/gobacnet/baccli

For usage run:

baccli --help

Features

Below are features that are intended to be completed for the library and for the command line interface ordered in no particular manner. If you would like a feature not in the list below add a discussion on github for it.

Library

  • Who Is
  • Read Property
  • Read Multiple Property
  • Read Range
  • Write Property
  • Write Property Multiple
  • Who Has
  • Change of Value Notification
  • Event Notification
  • Subscribe Change of Value
  • Atomic Read File
  • Atomic Write File

Command Line Interface

  • Who Is
  • Read Property
  • Read Multiple Property
  • Read Range
  • Write Property
  • Write Property Multiple
  • Who Has
  • Atomic Read File
  • Atomic Write File

Contributing

Contributions are more then welcome for this project. Use golint for formatting and be sure to include test coverage on any new additions.

License

This library is heavily based on the BACnet-Stack library originally written by Steve Karg and therefore is released under the same license as his project. This includes the exception which allows for this library to be linked by proprietary code without that code becoming GPL. This exception was taken from the original BACnet stack and is included in every file.

The exception is as follows:

    "As a special exception, if other files instantiate
     templates or use macros or inline functions from
     this file, or you compile this file and link it
     with other works to produce a work based on this file,
     this file does not by itself cause the resulting work
     to be covered by the GNU General Public License.
     However the source code for this file must still be
     made available in accordance with section (3) of the
     GNU General Public License."

gobacnet's People

Contributors

alexbeltran avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gobacnet's Issues

Change error passing to add context

Currently all errors are simply passed. Adding a little bit of context as we pass it up the chain will help with debugging.

i.e.

_, err := os.Create()
if err != nil{
    return fmt.Errof("unable to create file: %v")
}

instead of

_, err := os.Create()
if err != nil{
    return err
}

This would be useful when passing up the chain since there are multiple stages and packages used for each command called. An example would be an error in the encoding portion could give additional context in the net layer so we know at what point it fails.

readprop command is not working

@alexbeltran hi, i tried whoIs command in my windows pc , its is working
but when i try to run readprop command im not getting the output
C:\Users\DELL\go\src\github.com\alexbeltran\gobacnet>baccli whoIs -i "Npcap Loopback Adapter" -p 47808
{
"ID": {
"Type": 8,
"Instance": 1294418
},
"MaxApdu": 1464,
"Segmentation": 0,
"Vendor": 260,
"Addr": {
"Net": 0,
"Len": 0,
"MacLen": 6,
"Mac": "qf7CI9KO",
"Adr": null
},
"Objects": {}
}
]
Failed to write to log, write gobacnet.log: file already closed
for the above command im getting the output like this

can you tell me how to run readprop commmand below i mentioned how did i tried

C:\Users\DELL\go\src\github.com\alexbeltran\gobacnet>baccli readprop -d 1294418 -o 0 -j 0 -i Npcap Loopback Adapterr

im getting the errors like
time="2019-08-08T17:18:19+05:45" level=fatal msg="route ip+net: no such network interface"
plz help me with this issue
thank you

Add graceful error handling

Right now when a read property is not handle correctly it will time out instead of interpreting type 80 messages.

Flatten structure

The types subpackage is nice to handle internally but once other projects start to use it, a flatter structure would be nice so all the end user of the library will have to do is import gobacnet instead of import gobacnet and import gobacnet/types.

This flattening is less important for parts that are not exposed such as the tsm and utsm.

read mutil error!

read mutil error!
read property is ok. help

time="2022-08-29T12:01:32+08:00" level=debug msg="Broadcast Address: 192.168.32.255"
time="2022-08-29T12:01:32+08:00" level=debug msg="Local Address: 192.168.32.199/24"
time="2022-08-29T12:01:32+08:00" level=debug msg="Port: bac0"
time="2022-08-29T12:01:32+08:00" level=debug msg="Received IAm Message"
time="2022-08-29T12:01:34+08:00" level=debug msg="Received Complex Ack"
time="2022-08-29T12:01:34+08:00" level=debug msg="WEIRD PACKET: Class 2 Code 32: [48 1 14 12 0 0 0 7 30 41 70 94 145 2 145 32 95 41 85 78 68 193 199 32 164 79 31]"
time="2022-08-29T12:01:34+08:00" level=debug msg="Received Complex Ack"
time="2022-08-29T12:01:34+08:00" level=debug msg="WEIRD PACKET: Class 2 Code 32: [48 1 14 12 0 0 0 7 30 41 70 94 145 2 145 32 95 41 85 78 68 193 199 32 164 79 31]"
time="2022-08-29T12:01:34+08:00" level=error msg="read udp [::]:47808: use of closed network connection"

Add rate limiting based on bacnet device address

At the moment, we query devices as fast as possible. This may not be the best for devices since they are typically fairly slow. I think an option to have a rate limiter based on ever bacnet device address may help with congestion.

when using api loggrus does not print to stdout

Right now the package is using global loggrus instead of keeping a local instance. This has caused issues when trying to use the loggrus package from outside the package. This was observed in baccli.

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.