From 94471c6e4e226da133eac37045760fcbfa5362e6 Mon Sep 17 00:00:00 2001 From: "David M. Raker" Date: Mon, 2 Mar 2026 12:14:51 -0800 Subject: [PATCH 1/3] Comments and TODO --- src/protocol_proxy/protocol/bacnet/bacnet.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/protocol_proxy/protocol/bacnet/bacnet.py b/src/protocol_proxy/protocol/bacnet/bacnet.py index d34110f..647189e 100644 --- a/src/protocol_proxy/protocol/bacnet/bacnet.py +++ b/src/protocol_proxy/protocol/bacnet/bacnet.py @@ -36,13 +36,17 @@ def __init__(self, local_interface, bacnet_port=0, vendor_id=999, object_name='V objectIdentifier=("network-port", bacnet_port), objectName="NetworkPort-1", networkNumber=bacnet_port, networkNumberQuality="configured") + # TODO: In order to implement better error handling, it may be necessary to sublcass Application. + # BACPypes3 raises an AssertionError, for instance in the Application.confirmation which does not + # seem to be possible to catch without overriding the method. + # It should be possilble to make this class a subclass of Application, + # instead of having Application as an attribute. self.app = Application.from_object_list( [device_object, network_port_object], device_info_cache=device_info_cache, # TODO: If these should be passed in, add to args & launch. router_info_cache=router_info_cache, aseID=ase_id ) - #_log.debug(f'WE HAVE AN APP: {self.app.device_info_cache}') async def query_device(self, address: str, property_name: str = 'object-identifier'): """Returns properties about the device at the given address. From 86446b360be109cc473abc7e2da0e9a30afe220f Mon Sep 17 00:00:00 2001 From: "David M. Raker" Date: Mon, 2 Mar 2026 12:16:22 -0800 Subject: [PATCH 2/3] Improved error handling in confirmed_private_transfer. --- src/protocol_proxy/protocol/bacnet/bacnet.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/protocol_proxy/protocol/bacnet/bacnet.py b/src/protocol_proxy/protocol/bacnet/bacnet.py index 647189e..dbf7db6 100644 --- a/src/protocol_proxy/protocol/bacnet/bacnet.py +++ b/src/protocol_proxy/protocol/bacnet/bacnet.py @@ -190,15 +190,19 @@ async def confirmed_private_transfer(self, address: Address, vendor_id: int, ser serviceNumber=service_number) if service_parameters: cpt_request.serviceParameters = service_parameters - response = await self.app.request(cpt_request) - if isinstance(response, ConfirmedPrivateTransferError): - _log.warning(f'Error calling Confirmed Private Transfer Service: {response}') - return None - elif isinstance(response, ConfirmedPrivateTransferACK): - return response + try: + response = await self.app.request(cpt_request) + except Exception as e: + _log.warning(f'Exception sending Confirmed Private Transfer Request: {e}') else: - _log.warning(f'Some other Error: {response}') # TODO: Improve error handling. - return None + if isinstance(response, ConfirmedPrivateTransferError): + _log.warning(f'Error calling Confirmed Private Transfer Service: {response}') + return None + elif isinstance(response, ConfirmedPrivateTransferACK): + return response + else: + _log.warning(f'Some other Error: {response}') # TODO: Improve error handling. + return None async def scan_subnet(self, network_str: str, From 5f92f4d00679b890642cb3e37c85d41b50f1a366 Mon Sep 17 00:00:00 2001 From: "David M. Raker" Date: Tue, 3 Mar 2026 14:52:12 -0800 Subject: [PATCH 3/3] Update versions for packages and dependencies. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 86f5fdc..28b3e49 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,7 +53,7 @@ classifiers = [ [tool.poetry.dependencies] python = ">=3.10,<4.0" bacpypes3 = ">=0.0.102" -protocol-proxy = ">=2.0.0rc0" +protocol-proxy = ">=2.0.0rc2" [tool.poetry.group.dev.dependencies] # No additional dependencies.