-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from ChristianTremblay/release_19.4.28
Release 19.4.28
- Loading branch information
Showing
48 changed files
with
2,428 additions
and
1,700 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
# Copyright (C) 2015 by Christian Tremblay, P.Eng <[email protected]> | ||
# Licensed under LGPLv3, see file LICENSE in this source tree. | ||
# | ||
''' | ||
""" | ||
SimpleApplication | ||
================= | ||
|
@@ -15,19 +15,19 @@ | |
Additional functionality is enabled by inheriting this application, and then | ||
extending it with more functions. [See BAC0.scripts for more examples of this.] | ||
''' | ||
#--- standard Python modules --- | ||
""" | ||
# --- standard Python modules --- | ||
from collections import defaultdict | ||
|
||
#--- 3rd party modules --- | ||
# --- 3rd party modules --- | ||
from bacpypes.app import BIPSimpleApplication, BIPForeignApplication | ||
from bacpypes.pdu import Address | ||
from bacpypes.service.object import ReadWritePropertyMultipleServices | ||
|
||
#--- this application's modules --- | ||
# --- this application's modules --- | ||
from ..utils.notes import note_and_log | ||
|
||
#------------------------------------------------------------------------------ | ||
# ------------------------------------------------------------------------------ | ||
|
||
|
||
@note_and_log | ||
|
@@ -43,7 +43,10 @@ class SimpleApplication(BIPSimpleApplication, ReadWritePropertyMultipleServices) | |
def __init__(self, *args, bbmdAddress=None, bbmdTTL=0): | ||
self.localAddress = None | ||
|
||
super().__init__(*args) | ||
try: | ||
super().__init__(*args) | ||
except OSError: | ||
raise | ||
|
||
self._request = None | ||
|
||
|
@@ -54,17 +57,19 @@ def __init__(self, *args, bbmdAddress=None, bbmdTTL=0): | |
self.local_unicast_tuple = self.localAddress.addrTuple | ||
self.local_broadcast_tuple = self.localAddress.addrBroadcastTuple | ||
else: | ||
self.local_unicast_tuple = ('', 47808) | ||
self.local_broadcast_tuple = ('255.255.255.255', 47808) | ||
self.local_unicast_tuple = ("", 47808) | ||
self.local_broadcast_tuple = ("255.255.255.255", 47808) | ||
|
||
def do_WhoIsRequest(self, apdu): | ||
"""Respond to a Who-Is request.""" | ||
self.log(("do_WhoIsRequest {!r}".format(apdu))) | ||
|
||
# build a key from the source and parameters | ||
key = (str(apdu.pduSource), | ||
apdu.deviceInstanceRangeLowLimit, | ||
apdu.deviceInstanceRangeHighLimit) | ||
key = ( | ||
str(apdu.pduSource), | ||
apdu.deviceInstanceRangeLowLimit, | ||
apdu.deviceInstanceRangeHighLimit, | ||
) | ||
|
||
# count the times this has been received | ||
self.who_is_counter[key] += 1 | ||
|
@@ -85,7 +90,9 @@ def do_IAmRequest(self, apdu): | |
|
||
|
||
@note_and_log | ||
class ForeignDeviceApplication(BIPForeignApplication, ReadWritePropertyMultipleServices): | ||
class ForeignDeviceApplication( | ||
BIPForeignApplication, ReadWritePropertyMultipleServices | ||
): | ||
""" | ||
Defines a basic BACnet/IP application to process BACnet requests. | ||
|
@@ -97,7 +104,10 @@ class ForeignDeviceApplication(BIPForeignApplication, ReadWritePropertyMultipleS | |
def __init__(self, *args, bbmdAddress=None, bbmdTTL=0): | ||
self.localAddress = None | ||
|
||
super().__init__(*args, bbmdAddress=bbmdAddress, bbmdTTL=bbmdTTL) | ||
try: | ||
super().__init__(*args, bbmdAddress=bbmdAddress, bbmdTTL=bbmdTTL) | ||
except OSError: | ||
raise | ||
|
||
self._request = None | ||
|
||
|
@@ -108,17 +118,19 @@ def __init__(self, *args, bbmdAddress=None, bbmdTTL=0): | |
self.local_unicast_tuple = self.localAddress.addrTuple | ||
self.local_broadcast_tuple = self.localAddress.addrBroadcastTuple | ||
else: | ||
self.local_unicast_tuple = ('', 47808) | ||
self.local_broadcast_tuple = ('255.255.255.255', 47808) | ||
self.local_unicast_tuple = ("", 47808) | ||
self.local_broadcast_tuple = ("255.255.255.255", 47808) | ||
|
||
def do_WhoIsRequest(self, apdu): | ||
"""Respond to a Who-Is request.""" | ||
self.log(("do_WhoIsRequest {!r}".format(apdu))) | ||
|
||
# build a key from the source and parameters | ||
key = (str(apdu.pduSource), | ||
apdu.deviceInstanceRangeLowLimit, | ||
apdu.deviceInstanceRangeHighLimit) | ||
key = ( | ||
str(apdu.pduSource), | ||
apdu.deviceInstanceRangeLowLimit, | ||
apdu.deviceInstanceRangeHighLimit, | ||
) | ||
|
||
# count the times this has been received | ||
self.who_is_counter[key] += 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
from . import ScriptApplication | ||
from . import ScriptApplication |
Oops, something went wrong.