mirror of
https://github.com/JoelBender/bacpypes
synced 2025-10-27 00:57:47 +08:00
hooks in the application to set/clear the _app value in the object
This commit is contained in:
@@ -186,6 +186,9 @@ class Application(ApplicationServiceElement, Logging):
|
||||
# append the new object's identifier to the device's object list
|
||||
self.localDevice.objectList.append(object_identifier)
|
||||
|
||||
# let the object know which application stack it belongs to
|
||||
obj._app = self
|
||||
|
||||
def delete_object(self, obj):
|
||||
"""Add an object to the local collection."""
|
||||
if _debug: Application._debug("delete_object %r", obj)
|
||||
@@ -202,6 +205,9 @@ class Application(ApplicationServiceElement, Logging):
|
||||
indx = self.localDevice.objectList.index(object_identifier)
|
||||
del self.localDevice.objectList[indx]
|
||||
|
||||
# make sure the object knows it's detached from an application
|
||||
obj._app = None
|
||||
|
||||
def get_object_id(self, objid):
|
||||
"""Return a local object or None."""
|
||||
return self.objectIdentifier.get(objid, None)
|
||||
|
||||
Reference in New Issue
Block a user