Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOISSUE - Add Read Property and WHOIS support #1

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

SammyOina
Copy link

@SammyOina SammyOina commented Aug 28, 2023

What does this do?

  • New Feature: Added support for BACnet protocol communication over UDP in the bacnet package. This includes encoding and decoding of various BACnet messages such as WhoIs, IAm, YouAre, and ReadProperty.
  • New Feature: Introduced a BitArray type in the internal package to handle bit-level operations.
  • New Feature: Created an encoding package for handling encoding and decoding of various data types in the BACnet protocol.
  • New Feature: Added a transport package with support for UDP transport, including functionality to determine the broadcast address.
  • New Feature: Implemented a BACnet client in the bacnet package that supports ReadProperty and WHoIs operations.

Which issue(s) does this PR fix/relate to?

List any changes that modify/break current functionality

Have you included tests for your changes?

Did you document any new/modified functionality?

Notes

WhoIS is still buggy.
To test the package you can simulate a bacnet server using an external library such as this https://github.com/Kretiss/BACnet-simulator/blob/main/rooms_simulator.py and run one of the examples in the example directory.

Signed-off-by: SammyOina <[email protected]>
Signed-off-by: SammyOina <[email protected]>
Signed-off-by: SammyOina <[email protected]>
Signed-off-by: SammyOina <[email protected]>
client.go Outdated Show resolved Hide resolved
encoding/encoding.go Outdated Show resolved Hide resolved
encoding/tags.go Outdated Show resolved Hide resolved
encoding/encoding.go Outdated Show resolved Hide resolved
encoding/encoding.go Outdated Show resolved Hide resolved
base.go Outdated Show resolved Hide resolved
Signed-off-by: SammyOina <[email protected]>
Signed-off-by: SammyOina <[email protected]>
add bvlc
update npdu
add transport

Signed-off-by: SammyOina <[email protected]>
Signed-off-by: SammyOina <[email protected]>
Signed-off-by: SammyOina <[email protected]>
Signed-off-by: SammyOina <[email protected]>
Signed-off-by: SammyOina <[email protected]>
Signed-off-by: SammyOina <[email protected]>
The BACnetValue.Decode() method now returns an error
to handle decoding errors properly.

- The method signature has been updated to return (int, error)
- If there is an error during decoding, the method now returns (-1, err)

This change ensures that decoding errors are properly handled
and allows for better error reporting and debugging.

Signed-off-by: SammyOina <[email protected]>
…eadPropertyACK.Decode() method

The decoding error for object_identifier and property_identifier in the ReadPropertyACK.Decode() method has been fixed. This change ensures that the error message accurately reflects the cause of the decoding failure.

This commit addresses the following changes:
- Updated error message for object_identifier decoding error
- Updated error message for property_identifier decoding error

Signed-off-by: SammyOina <[email protected]>
The BACnetValue.Decode() method was updated to handle decoding errors
in the ReadAccessSpecification and BACnetDeviceObjectPropertyReference
types. This ensures that the decoding process is accurate and reliable.

Signed-off-by: SammyOina <[email protected]>
@SammyOina SammyOina changed the title add bacnet package NOISSUE - Add Read Property and WHOIS support Sep 15, 2023
@SammyOina SammyOina marked this pull request as ready for review September 15, 2023 15:01
…oding

The commit fixes the issue where unnecessary print statements were present in the code. Additionally, it adds the decoding of the BACnet message in the response of the read property example.

Signed-off-by: SammyOina <[email protected]>
pkg/transport/udp/broadcast.go Outdated Show resolved Hide resolved
pkg/encoding/property.go Outdated Show resolved Hide resolved
Remove commented out code and fix formatting in readProperty.go file.

extract constants

add coomments

Signed-off-by: SammyOina <[email protected]>
The import and function name in readProperty.go have been fixed to use the correct package and function names.

- Changed import from "bacnet" to "example/bacnet"
- Changed function name from "NewBACnetAddress" to "NewAddress"
- Changed "bacnet.BacnetMaxSegments" to "bacnet.MaxSegments"

Signed-off-by: SammyOina <[email protected]>
- Fix address creation in readProperty.go and whois.go to pass the correct parameters to the bacnet.NewAddress function.
- In readProperty.go, change `bacnet.NewAddress(0, nil, "127.0.0.6:47809", &netType)` to `bacnet.NewAddress(0, nil, "127.0.0.6:47809", &netType)`.
- In whois.go, change `*bacnet.NewAddress(0xFFFF, nil, "127.0.0.255:47809", &netType)` to `bacnet.NewAddress(0xFFFF, nil, "127.0.0.255:47809", &netType)`.

This commit fixes the address creation in the readProperty and whois.go files by passing the correct parameters to the bacnet.NewAddress function.

Signed-off-by: SammyOina <[email protected]>
example/readProperty/readProperty.go Outdated Show resolved Hide resolved
example/readProperty/readProperty.go Outdated Show resolved Hide resolved
example/readProperty/readProperty.go Outdated Show resolved Hide resolved
example/whoIs/whois.go Show resolved Hide resolved
example/whoIs/whois.go Outdated Show resolved Hide resolved
example/whoIs/whois.go Outdated Show resolved Hide resolved
internal/bitarray.go Outdated Show resolved Hide resolved
pkg/bacnet/apdu.go Outdated Show resolved Hide resolved
pkg/bacnet/bvlc.go Show resolved Hide resolved
pkg/bacnet/bvlc.go Show resolved Hide resolved
Signed-off-by: SammyOina <[email protected]>
"net"
"time"

"github.com/absmach/bacnet/pkg/bacnet"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package name seems odd. bacnet/pkg/bacnet. Why not move bacnet to the root of the project as this repository is bacnet package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants