mirror of
https://github.com/JoelBender/bacpypes
synced 2025-09-28 22:15:23 +08:00
bring branch up-to-date with stage
This commit is contained in:
commit
b9f23bff26
|
@ -197,6 +197,9 @@ def read_property_to_result_element(obj, propertyIdentifier, propertyArrayIndex=
|
||||||
read_result = ReadAccessResultElementChoice()
|
read_result = ReadAccessResultElementChoice()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if not obj:
|
||||||
|
raise ExecutionError(errorClass='object', errorCode='unknownObject')
|
||||||
|
|
||||||
read_result.propertyValue = read_property_to_any(obj, propertyIdentifier, propertyArrayIndex)
|
read_result.propertyValue = read_property_to_any(obj, propertyIdentifier, propertyArrayIndex)
|
||||||
if _debug: read_property_to_result_element._debug(" - success")
|
if _debug: read_property_to_result_element._debug(" - success")
|
||||||
except PropertyError, error:
|
except PropertyError, error:
|
||||||
|
@ -252,12 +255,6 @@ class ReadWritePropertyMultipleServices(Capability):
|
||||||
obj = self.get_object_id(objectIdentifier)
|
obj = self.get_object_id(objectIdentifier)
|
||||||
if _debug: ReadWritePropertyMultipleServices._debug(" - object: %r", obj)
|
if _debug: ReadWritePropertyMultipleServices._debug(" - object: %r", obj)
|
||||||
|
|
||||||
# make sure it exists
|
|
||||||
if not obj:
|
|
||||||
resp = Error(errorClass='object', errorCode='unknownObject', context=apdu)
|
|
||||||
if _debug: ReadWritePropertyMultipleServices._debug(" - unknown object error: %r", resp)
|
|
||||||
break
|
|
||||||
|
|
||||||
# build a list of result elements
|
# build a list of result elements
|
||||||
read_access_result_element_list = []
|
read_access_result_element_list = []
|
||||||
|
|
||||||
|
@ -273,6 +270,21 @@ class ReadWritePropertyMultipleServices(Capability):
|
||||||
|
|
||||||
# check for special property identifiers
|
# check for special property identifiers
|
||||||
if propertyIdentifier in ('all', 'required', 'optional'):
|
if propertyIdentifier in ('all', 'required', 'optional'):
|
||||||
|
if not obj:
|
||||||
|
# build a property access error
|
||||||
|
read_result = ReadAccessResultElementChoice()
|
||||||
|
read_result.propertyAccessError = ErrorType(errorClass='object', errorCode='unknownObject')
|
||||||
|
|
||||||
|
# make an element for this error
|
||||||
|
read_access_result_element = ReadAccessResultElement(
|
||||||
|
propertyIdentifier=propertyIdentifier,
|
||||||
|
propertyArrayIndex=propertyArrayIndex,
|
||||||
|
readResult=read_result,
|
||||||
|
)
|
||||||
|
|
||||||
|
# add it to the list
|
||||||
|
read_access_result_element_list.append(read_access_result_element)
|
||||||
|
else:
|
||||||
for propId, prop in obj._properties.items():
|
for propId, prop in obj._properties.items():
|
||||||
if _debug: ReadWritePropertyMultipleServices._debug(" - checking: %r %r", propId, prop.optional)
|
if _debug: ReadWritePropertyMultipleServices._debug(" - checking: %r %r", propId, prop.optional)
|
||||||
|
|
||||||
|
|
|
@ -196,6 +196,9 @@ def read_property_to_result_element(obj, propertyIdentifier, propertyArrayIndex=
|
||||||
read_result = ReadAccessResultElementChoice()
|
read_result = ReadAccessResultElementChoice()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if not obj:
|
||||||
|
raise ExecutionError(errorClass='object', errorCode='unknownObject')
|
||||||
|
|
||||||
read_result.propertyValue = read_property_to_any(obj, propertyIdentifier, propertyArrayIndex)
|
read_result.propertyValue = read_property_to_any(obj, propertyIdentifier, propertyArrayIndex)
|
||||||
if _debug: read_property_to_result_element._debug(" - success")
|
if _debug: read_property_to_result_element._debug(" - success")
|
||||||
except PropertyError as error:
|
except PropertyError as error:
|
||||||
|
@ -250,12 +253,6 @@ class ReadWritePropertyMultipleServices(Capability):
|
||||||
obj = self.get_object_id(objectIdentifier)
|
obj = self.get_object_id(objectIdentifier)
|
||||||
if _debug: ReadWritePropertyMultipleServices._debug(" - object: %r", obj)
|
if _debug: ReadWritePropertyMultipleServices._debug(" - object: %r", obj)
|
||||||
|
|
||||||
# make sure it exists
|
|
||||||
if not obj:
|
|
||||||
resp = Error(errorClass='object', errorCode='unknownObject', context=apdu)
|
|
||||||
if _debug: ReadWritePropertyMultipleServices._debug(" - unknown object error: %r", resp)
|
|
||||||
break
|
|
||||||
|
|
||||||
# build a list of result elements
|
# build a list of result elements
|
||||||
read_access_result_element_list = []
|
read_access_result_element_list = []
|
||||||
|
|
||||||
|
@ -271,6 +268,21 @@ class ReadWritePropertyMultipleServices(Capability):
|
||||||
|
|
||||||
# check for special property identifiers
|
# check for special property identifiers
|
||||||
if propertyIdentifier in ('all', 'required', 'optional'):
|
if propertyIdentifier in ('all', 'required', 'optional'):
|
||||||
|
if not obj:
|
||||||
|
# build a property access error
|
||||||
|
read_result = ReadAccessResultElementChoice()
|
||||||
|
read_result.propertyAccessError = ErrorType(errorClass='object', errorCode='unknownObject')
|
||||||
|
|
||||||
|
# make an element for this error
|
||||||
|
read_access_result_element = ReadAccessResultElement(
|
||||||
|
propertyIdentifier=propertyIdentifier,
|
||||||
|
propertyArrayIndex=propertyArrayIndex,
|
||||||
|
readResult=read_result,
|
||||||
|
)
|
||||||
|
|
||||||
|
# add it to the list
|
||||||
|
read_access_result_element_list.append(read_access_result_element)
|
||||||
|
else:
|
||||||
for propId, prop in obj._properties.items():
|
for propId, prop in obj._properties.items():
|
||||||
if _debug: ReadWritePropertyMultipleServices._debug(" - checking: %r %r", propId, prop.optional)
|
if _debug: ReadWritePropertyMultipleServices._debug(" - checking: %r %r", propId, prop.optional)
|
||||||
|
|
||||||
|
|
|
@ -196,6 +196,9 @@ def read_property_to_result_element(obj, propertyIdentifier, propertyArrayIndex=
|
||||||
read_result = ReadAccessResultElementChoice()
|
read_result = ReadAccessResultElementChoice()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if not obj:
|
||||||
|
raise ExecutionError(errorClass='object', errorCode='unknownObject')
|
||||||
|
|
||||||
read_result.propertyValue = read_property_to_any(obj, propertyIdentifier, propertyArrayIndex)
|
read_result.propertyValue = read_property_to_any(obj, propertyIdentifier, propertyArrayIndex)
|
||||||
if _debug: read_property_to_result_element._debug(" - success")
|
if _debug: read_property_to_result_element._debug(" - success")
|
||||||
except PropertyError as error:
|
except PropertyError as error:
|
||||||
|
@ -250,12 +253,6 @@ class ReadWritePropertyMultipleServices(Capability):
|
||||||
obj = self.get_object_id(objectIdentifier)
|
obj = self.get_object_id(objectIdentifier)
|
||||||
if _debug: ReadWritePropertyMultipleServices._debug(" - object: %r", obj)
|
if _debug: ReadWritePropertyMultipleServices._debug(" - object: %r", obj)
|
||||||
|
|
||||||
# make sure it exists
|
|
||||||
if not obj:
|
|
||||||
resp = Error(errorClass='object', errorCode='unknownObject', context=apdu)
|
|
||||||
if _debug: ReadWritePropertyMultipleServices._debug(" - unknown object error: %r", resp)
|
|
||||||
break
|
|
||||||
|
|
||||||
# build a list of result elements
|
# build a list of result elements
|
||||||
read_access_result_element_list = []
|
read_access_result_element_list = []
|
||||||
|
|
||||||
|
@ -271,6 +268,21 @@ class ReadWritePropertyMultipleServices(Capability):
|
||||||
|
|
||||||
# check for special property identifiers
|
# check for special property identifiers
|
||||||
if propertyIdentifier in ('all', 'required', 'optional'):
|
if propertyIdentifier in ('all', 'required', 'optional'):
|
||||||
|
if not obj:
|
||||||
|
# build a property access error
|
||||||
|
read_result = ReadAccessResultElementChoice()
|
||||||
|
read_result.propertyAccessError = ErrorType(errorClass='object', errorCode='unknownObject')
|
||||||
|
|
||||||
|
# make an element for this error
|
||||||
|
read_access_result_element = ReadAccessResultElement(
|
||||||
|
propertyIdentifier=propertyIdentifier,
|
||||||
|
propertyArrayIndex=propertyArrayIndex,
|
||||||
|
readResult=read_result,
|
||||||
|
)
|
||||||
|
|
||||||
|
# add it to the list
|
||||||
|
read_access_result_element_list.append(read_access_result_element)
|
||||||
|
else:
|
||||||
for propId, prop in obj._properties.items():
|
for propId, prop in obj._properties.items():
|
||||||
if _debug: ReadWritePropertyMultipleServices._debug(" - checking: %r %r", propId, prop.optional)
|
if _debug: ReadWritePropertyMultipleServices._debug(" - checking: %r %r", propId, prop.optional)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user