Skip to content

Commit

Permalink
merge #160
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelBender committed Feb 17, 2018
1 parent 83857fe commit d8703a4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
10 changes: 6 additions & 4 deletions py25/bacpypes/service/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,15 @@ def __init__(self, **kwargs):
if 'objectIdentifier' not in kwargs:
raise RuntimeError("objectIdentifier is required")

# coerce the object identifier
object_identifier = kwargs['objectIdentifier']
if isinstance(object_identifier, (int, long)):
object_identifier = ('device', object_identifier)

# the object list is provided
if 'objectList' in kwargs:
raise RuntimeError("objectList is provided by LocalDeviceObject and cannot be overridden")
else:
kwargs['objectList'] = ArrayOf(ObjectIdentifier)([
kwargs['objectIdentifier'],
])
kwargs['objectList'] = ArrayOf(ObjectIdentifier)([object_identifier])

# check for a minimum value
if kwargs['maxApduLengthAccepted'] < 50:
Expand Down
10 changes: 6 additions & 4 deletions py27/bacpypes/service/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,15 @@ def __init__(self, **kwargs):
if 'objectIdentifier' not in kwargs:
raise RuntimeError("objectIdentifier is required")

# coerce the object identifier
object_identifier = kwargs['objectIdentifier']
if isinstance(object_identifier, (int, long)):
object_identifier = ('device', object_identifier)

# the object list is provided
if 'objectList' in kwargs:
raise RuntimeError("objectList is provided by LocalDeviceObject and cannot be overridden")
else:
kwargs['objectList'] = ArrayOf(ObjectIdentifier)([
kwargs['objectIdentifier'],
])
kwargs['objectList'] = ArrayOf(ObjectIdentifier)([object_identifier])

# check for a minimum value
if kwargs['maxApduLengthAccepted'] < 50:
Expand Down
10 changes: 6 additions & 4 deletions py34/bacpypes/service/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,15 @@ def __init__(self, **kwargs):
if 'objectIdentifier' not in kwargs:
raise RuntimeError("objectIdentifier is required")

# coerce the object identifier
object_identifier = kwargs['objectIdentifier']
if isinstance(object_identifier, int):
object_identifier = ('device', object_identifier)

# the object list is provided
if 'objectList' in kwargs:
raise RuntimeError("objectList is provided by LocalDeviceObject and cannot be overridden")
else:
kwargs['objectList'] = ArrayOf(ObjectIdentifier)([
kwargs['objectIdentifier'],
])
kwargs['objectList'] = ArrayOf(ObjectIdentifier)([object_identifier])

# check for a minimum value
if kwargs['maxApduLengthAccepted'] < 50:
Expand Down

0 comments on commit d8703a4

Please sign in to comment.