Skip to content

Client-api#3

Open
SammyOina wants to merge 25 commits intoabsmach:mainfrom
SammyOina:client-api
Open

Client-api#3
SammyOina wants to merge 25 commits intoabsmach:mainfrom
SammyOina:client-api

Conversation

@SammyOina
Copy link
Copy Markdown

This commit adds the implementation of the BACnet client interface. The client provides methods for reading and writing BACnet properties. The client uses the provided transport to send and receive BACnet messages.

The client interface defines two methods: ReadProperty and WriteProperty. The ReadProperty method takes a context, an address, and a ReadPropertyRequest as arguments and returns a slice of BACnet values and an error. The WriteProperty method takes a context, an address, and a WritePropertyRequest as arguments and returns an error.

The client struct has a transport field of type transport.Transport, which is used for sending and receiving BACnet messages.

The ReadProperty method implementation sends a ReadPropertyRequest to the specified address using the transport. It returns the response as a slice of BACnet values or an error if no response is received.

The WriteProperty method implementation sends a WritePropertyRequest to the specified address using the transport. It returns an error if no response is received.

This commit also includes the necessary imports and error definition.

Signed-off-by: SammyOina sammyoina@gmail.com

Signed-off-by: SammyOina <sammyoina@gmail.com>
Signed-off-by: SammyOina <sammyoina@gmail.com>
Signed-off-by: SammyOina <sammyoina@gmail.com>
Signed-off-by: SammyOina <sammyoina@gmail.com>
Signed-off-by: SammyOina <sammyoina@gmail.com>
Signed-off-by: SammyOina <sammyoina@gmail.com>
Signed-off-by: SammyOina <sammyoina@gmail.com>
Signed-off-by: SammyOina <sammyoina@gmail.com>
Signed-off-by: SammyOina <sammyoina@gmail.com>
add bvlc
update npdu
add transport

Signed-off-by: SammyOina <sammyoina@gmail.com>
Signed-off-by: SammyOina <sammyoina@gmail.com>
Signed-off-by: SammyOina <sammyoina@gmail.com>
Signed-off-by: SammyOina <sammyoina@gmail.com>
Signed-off-by: SammyOina <sammyoina@gmail.com>
Signed-off-by: SammyOina <sammyoina@gmail.com>
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 <sammyoina@gmail.com>
…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 <sammyoina@gmail.com>
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 <sammyoina@gmail.com>
Signed-off-by: SammyOina <sammyoina@gmail.com>
…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 <sammyoina@gmail.com>
The commit fixes an incorrect comparison in the IAM.go file. The tagNumber variable is now correctly compared to the BACnetObjectIdentifier constant. Also adds write property.

Signed-off-by: SammyOina <sammyoina@gmail.com>
This commit adds a new file writeProperty.go which contains an example main function for writing a BACnet property value. The function sets up the necessary variables and creates the NPDU (Network Protocol Data Unit) for sending the request to the BACnet device. It then encodes the NPDU and creates the APDU (Application Protocol Data Unit) with the necessary information for a WriteProperty service request.

The purpose of this commit is to provide the functionality for writing a BACnet property value to a BACnet device.

Signed-off-by: SammyOina <sammyoina@gmail.com>
This commit adds the implementation of the BACnet client interface. The client provides methods for reading and writing BACnet properties. The client uses the provided transport to send and receive BACnet messages.

The client interface defines two methods: ReadProperty and WriteProperty. The ReadProperty method takes a context, an address, and a ReadPropertyRequest as arguments and returns a slice of BACnet values and an error. The WriteProperty method takes a context, an address, and a WritePropertyRequest as arguments and returns an error.

The client struct has a transport field of type transport.Transport, which is used for sending and receiving BACnet messages.

The ReadProperty method implementation sends a ReadPropertyRequest to the specified address using the transport. It returns the response as a slice of BACnet values or an error if no response is received.

The WriteProperty method implementation sends a WritePropertyRequest to the specified address using the transport. It returns an error if no response is received.

This commit also includes the necessary imports and error definition.

Signed-off-by: SammyOina <sammyoina@gmail.com>
Signed-off-by: SammyOina <sammyoina@gmail.com>
Add missing import statement for "fmt"

Add comments to ReadProperty and WriteProperty methods

Add NewClient function to create a new client

Updates examples to new client interface.

Signed-off-by: SammyOina <sammyoina@gmail.com>
@SammyOina SammyOina marked this pull request as ready for review September 20, 2023 06:36
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.

1 participant