Skip to content

Commit

Permalink
clean merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelBender committed Jul 27, 2021
2 parents 172070f + dfecdc2 commit 967782c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
22 changes: 13 additions & 9 deletions py34/bacpypes/service/cov.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ class Subscription(OneShotTask, DebugContents):
'lifetime',
)

def __init__(self, obj_ref, client_addr, proc_id, obj_id, confirmed, lifetime=0):
if _debug: Subscription._debug("__init__ %r %r %r %r %r %r", obj_ref, client_addr, proc_id, obj_id, confirmed, lifetime)
def __init__(self, obj_ref, client_addr, proc_id, obj_id, confirmed, lifetime, cov_inc):
if _debug: Subscription._debug("__init__ %r %r %r %r %r %r %r", obj_ref, client_addr, proc_id, obj_id, confirmed, lifetime, cov_inc)
OneShotTask.__init__(self)

# save the reference to the related object
Expand All @@ -102,10 +102,12 @@ def __init__(self, obj_ref, client_addr, proc_id, obj_id, confirmed, lifetime=0)
self.proc_id = proc_id
self.obj_id = obj_id
self.confirmed = confirmed
self.lifetime = lifetime
self.covIncrement = cov_inc

# if lifetime is none, consider permanent subscription (0)
self.lifetime = 0 if lifetime is None else lifetime
self.install_task(delta=self.lifetime)
# if lifetime is zero this is a permanent subscription
if lifetime > 0:
self.install_task(delta=self.lifetime)

def cancel_subscription(self):
if _debug: Subscription._debug("cancel_subscription")
Expand Down Expand Up @@ -678,15 +680,17 @@ def cov_abort(self, cov, request, response):

### delete the rest of the pending requests for this client

def do_SubscribeCOVRequest(self, apdu):
if _debug: ChangeOfValueServices._debug("do_SubscribeCOVRequest %r", apdu)
def do_SubscribeCOVPropertyRequest(self, apdu):
if _debug: ChangeOfValueServices._debug("do_SubscribeCOVPropertyRequest %r", apdu)

# extract the pieces
client_addr = apdu.pduSource
proc_id = apdu.subscriberProcessIdentifier
obj_id = apdu.monitoredObjectIdentifier
confirmed = apdu.issueConfirmedNotifications
lifetime = apdu.lifetime
prop_id = apdu.monitoredPropertyIdentifier
cov_inc = apdu.covIncrement

# request is to cancel the subscription
cancel_subscription = (confirmed is None) and (lifetime is None)
Expand Down Expand Up @@ -737,7 +741,8 @@ def do_SubscribeCOVRequest(self, apdu):
if _debug: ChangeOfValueServices._debug(" - create a subscription")

# make a subscription
cov = Subscription(obj, client_addr, proc_id, obj_id, confirmed, lifetime)
cov = Subscription(obj, client_addr, proc_id, obj_id,
confirmed, lifetime, cov_inc)
if _debug: ChangeOfValueServices._debug(" - cov: %r", cov)

# add it to our subscriptions lists
Expand All @@ -754,4 +759,3 @@ def do_SubscribeCOVRequest(self, apdu):
if not cancel_subscription:
if _debug: ChangeOfValueServices._debug(" - send a notification")
deferred(cov_detection.send_cov_notifications, cov)

13 changes: 10 additions & 3 deletions samples/COVClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
from bacpypes.iocb import IOCB

from bacpypes.pdu import Address
from bacpypes.apdu import SubscribeCOVRequest, SimpleAckPDU, RejectPDU, AbortPDU
from bacpypes.apdu import SubscribeCOVRequest, SimpleAckPDU, RejectPDU, AbortPDU, SubscribeCOVPropertyRequest
from bacpypes.primitivedata import ObjectIdentifier

from bacpypes.app import BIPSimpleApplication
from bacpypes.local.device import LocalDeviceObject
from bacpypes.basetypes import PropertyReference

# some debugging
_debug = 0
Expand Down Expand Up @@ -145,8 +146,14 @@ def do_subscribe(self, args):
lifetime = None

# build a request
request = SubscribeCOVRequest(
subscriberProcessIdentifier=proc_id, monitoredObjectIdentifier=obj_id
# request = SubscribeCOVRequest(
# subscriberProcessIdentifier=proc_id, monitoredObjectIdentifier=obj_id
# )
request = SubscribeCOVPropertyRequest(
subscriberProcessIdentifier=proc_id,
monitoredObjectIdentifier=obj_id,
monitoredPropertyIdentifier=PropertyReference(propertyIdentifier=85),
covIncrement=2
)
request.pduDestination = Address(addr)

Expand Down
4 changes: 2 additions & 2 deletions samples/WhoIsRouterForeign.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ def main():
# make a simple application
this_application = WhoIsRouterApplication(
args.ini.address,
bbmdAddress=Address(args.ini.foreignbbmd),
bbmdTTL=int(args.ini.foreignttl),
bbmdAddress=Address(args.ini.foreignbbmd),
bbmdTTL=int(args.ini.foreignttl)
)
if _debug: _log.debug(" - this_application: %r", this_application)

Expand Down

0 comments on commit 967782c

Please sign in to comment.