From 5f761b7d915b2291120f9e404c65cda4e5acbcfb Mon Sep 17 00:00:00 2001 From: Joel Bender Date: Thu, 7 Sep 2017 00:23:53 -0400 Subject: [PATCH] sync the versions --- py25/bacpypes/apdu.py | 2 +- py25/bacpypes/appservice.py | 2 +- py25/bacpypes/service/cov.py | 2 +- py27/bacpypes/service/cov.py | 6 ++++++ py34/bacpypes/apdu.py | 10 ++++++---- py34/bacpypes/app.py | 20 ++++++++++++++++---- py34/bacpypes/service/cov.py | 5 +++++ 7 files changed, 36 insertions(+), 11 deletions(-) diff --git a/py25/bacpypes/apdu.py b/py25/bacpypes/apdu.py index aaba304..e5dc057 100755 --- a/py25/bacpypes/apdu.py +++ b/py25/bacpypes/apdu.py @@ -1495,7 +1495,7 @@ class DeviceCommunicationControlRequestEnableDisable(Enumerated): enumerations = \ { 'enable':0 , 'disable':1 - , 'defaultInitiation':2 + , 'disableInitiation':2 } class DeviceCommunicationControlRequest(ConfirmedRequestSequence): diff --git a/py25/bacpypes/appservice.py b/py25/bacpypes/appservice.py index 74af2dc..44736b5 100755 --- a/py25/bacpypes/appservice.py +++ b/py25/bacpypes/appservice.py @@ -1474,7 +1474,7 @@ class ApplicationServiceAccessPoint(ApplicationServiceElement, ServiceAccessPoin try: xpdu = atype() xpdu.decode(apdu) - except Exception,err: + except Exception, err: ApplicationServiceAccessPoint._exception("error PDU decoding error: %r", err) xpdu = Error(errorClass=0, errorCode=0) diff --git a/py25/bacpypes/service/cov.py b/py25/bacpypes/service/cov.py index 0ed7bdf..c879244 100644 --- a/py25/bacpypes/service/cov.py +++ b/py25/bacpypes/service/cov.py @@ -304,7 +304,7 @@ class COVIncrementCriteria(COVDetection): # continue COVDetection.send_cov_notifications(self) -bacpypes_debugging(COVIncrementCriteria) +bacpypes_debugging(COVDetection) class AccessDoorCriteria(COVDetection): diff --git a/py27/bacpypes/service/cov.py b/py27/bacpypes/service/cov.py index d1b88b2..438e0b2 100644 --- a/py27/bacpypes/service/cov.py +++ b/py27/bacpypes/service/cov.py @@ -243,6 +243,7 @@ class COVDetection(DetectionAlgorithm): "(" + ','.join(self.properties_tracked) + ')' + \ ">" + class GenericCriteria(COVDetection): properties_tracked = ( @@ -316,6 +317,7 @@ class AccessDoorCriteria(COVDetection): 'doorAlarmState', ) + class AccessPointCriteria(COVDetection): properties_tracked = ( @@ -332,6 +334,7 @@ class AccessPointCriteria(COVDetection): ) monitored_property_reference = 'accessEvent' + class CredentialDataInputCriteria(COVDetection): properties_tracked = ( @@ -344,6 +347,7 @@ class CredentialDataInputCriteria(COVDetection): 'updateTime', ) + class LoadControlCriteria(COVDetection): properties_tracked = ( @@ -363,6 +367,7 @@ class LoadControlCriteria(COVDetection): 'dutyWindow', ) + class PulseConverterCriteria(COVDetection): properties_tracked = ( @@ -374,6 +379,7 @@ class PulseConverterCriteria(COVDetection): 'statusFlags', ) + # mapping from object type to appropriate criteria class criteria_type_map = { 'accessPoint': AccessPointCriteria, diff --git a/py34/bacpypes/apdu.py b/py34/bacpypes/apdu.py index d81729e..c01e7b9 100755 --- a/py34/bacpypes/apdu.py +++ b/py34/bacpypes/apdu.py @@ -4,7 +4,7 @@ Application Layer Protocol Data Units """ -from .errors import DecodingError +from .errors import DecodingError, TooManyArguments from .debugging import ModuleLogger, DebugContents, bacpypes_debugging from .pdu import PCI, PDUData @@ -683,6 +683,7 @@ class APCISequence(APCI, Sequence): # create a tag list and decode the rest of the data self._tag_list = TagList() self._tag_list.decode(apdu) + if _debug: APCISequence._debug(" - tag list: %r", self._tag_list) # pass the taglist to the Sequence for additional decoding Sequence.decode(self, self._tag_list) @@ -690,6 +691,7 @@ class APCISequence(APCI, Sequence): # trailing unmatched tags if self._tag_list: if _debug: APCISequence._debug(" - trailing unmatched tags") + raise TooManyArguments() def apdu_contents(self, use_dict=None, as_class=dict): """Return the contents of an object as a dict.""" @@ -1484,9 +1486,9 @@ register_confirmed_request_type(RemoveListElementRequest) class DeviceCommunicationControlRequestEnableDisable(Enumerated): enumerations = \ - { 'enable':0 - , 'disable':1 - , 'defaultInitiation':2 + { 'enable': 0 + , 'disable': 1 + , 'disableInitiation': 2 } class DeviceCommunicationControlRequest(ConfirmedRequestSequence): diff --git a/py34/bacpypes/app.py b/py34/bacpypes/app.py index 5ddfe56..bd35a64 100755 --- a/py34/bacpypes/app.py +++ b/py34/bacpypes/app.py @@ -200,9 +200,7 @@ class Application(ApplicationServiceElement, Collector): # keep track of the local device if localDevice: - self.smap = StateMachineAccessPoint(localDevice) self.localDevice = localDevice - self.smap._localDevice = self.localDevice # bind the device object to this application localDevice._app = self @@ -226,8 +224,6 @@ class Application(ApplicationServiceElement, Collector): # use the provided cache or make a default one self.deviceInfoCache = deviceInfoCache or DeviceInfoCache() - if not self.smap.deviceInfoCache: - self.smap.deviceInfoCache = self.deviceInfoCache # controllers for managing confirmed requests as a client self.controllers = {} @@ -474,6 +470,14 @@ class BIPSimpleApplication(ApplicationIOController, WhoIsIAmServices, ReadWriteP # include a application decoder self.asap = ApplicationServiceAccessPoint() + # pass the device object to the state machine access point so it + # can know if it should support segmentation + self.smap = StateMachineAccessPoint(localDevice) + + # the segmentation state machines need access to the same device + # information cache as the application + self.smap.deviceInfoCache = self.deviceInfoCache + # a network service access point will be needed self.nsap = NetworkServiceAccessPoint() @@ -522,6 +526,14 @@ class BIPForeignApplication(ApplicationIOController, WhoIsIAmServices, ReadWrite # include a application decoder self.asap = ApplicationServiceAccessPoint() + # pass the device object to the state machine access point so it + # can know if it should support segmentation + self.smap = StateMachineAccessPoint(localDevice) + + # the segmentation state machines need access to the same device + # information cache as the application + self.smap.deviceInfoCache = self.deviceInfoCache + # a network service access point will be needed self.nsap = NetworkServiceAccessPoint() diff --git a/py34/bacpypes/service/cov.py b/py34/bacpypes/service/cov.py index 03115ec..438e0b2 100644 --- a/py34/bacpypes/service/cov.py +++ b/py34/bacpypes/service/cov.py @@ -317,6 +317,7 @@ class AccessDoorCriteria(COVDetection): 'doorAlarmState', ) + class AccessPointCriteria(COVDetection): properties_tracked = ( @@ -333,6 +334,7 @@ class AccessPointCriteria(COVDetection): ) monitored_property_reference = 'accessEvent' + class CredentialDataInputCriteria(COVDetection): properties_tracked = ( @@ -345,6 +347,7 @@ class CredentialDataInputCriteria(COVDetection): 'updateTime', ) + class LoadControlCriteria(COVDetection): properties_tracked = ( @@ -364,6 +367,7 @@ class LoadControlCriteria(COVDetection): 'dutyWindow', ) + class PulseConverterCriteria(COVDetection): properties_tracked = ( @@ -375,6 +379,7 @@ class PulseConverterCriteria(COVDetection): 'statusFlags', ) + # mapping from object type to appropriate criteria class criteria_type_map = { 'accessPoint': AccessPointCriteria,