Skip to content

Instantly share code, notes, and snippets.

@JoelBender
Created July 15, 2020 17:15
Show Gist options
  • Save JoelBender/5ddb15970d5ea1d0dd7926e5dfb9ca61 to your computer and use it in GitHub Desktop.
Save JoelBender/5ddb15970d5ea1d0dd7926e5dfb9ca61 to your computer and use it in GitHub Desktop.
from bacpypes.primitivedata import TagList
from bacpypes.basetypes import (
DeviceObjectPropertyReference,
EventParameterAccessEventAccessEvent,
)
x = EventParameterAccessEventAccessEvent(
listOfAccessEvents=["deniedMaxAttempts"],
accessEventTimeReference=DeviceObjectPropertyReference(
objectIdentifier=("analogValue", 1), propertyIdentifier="presentValue"
),
)
print("x:")
x.debug_contents()
# listOfAccessEvents
# [0] = 'deniedMaxAttempts'
# accessEventTimeReference
# objectIdentifier = ('analogValue', 1)
# propertyIdentifier = 'presentValue'
tl = TagList()
x.encode(tl)
print("tag list:")
tl.debug_contents()
# <bacpypes.primitivedata.OpeningTag(open(0)) instance at 0x7fcdad7e7160>
# tagClass = 2 opening
# tagNumber = 0
# tagLVT = 0
# <bacpypes.primitivedata.Tag(enumerated) instance at 0x7fcdb1873da0>
# tagClass = 0 application
# tagNumber = 9 enumerated
# tagLVT = 1
# tagData = '8c'
# <bacpypes.primitivedata.ClosingTag(close(0)) instance at 0x7fcdb1873e10>
# tagClass = 3 closing
# tagNumber = 0
# tagLVT = 0
# tagData = ''
# <bacpypes.primitivedata.OpeningTag(open(1)) instance at 0x7fcdace86f98>
# tagClass = 2 opening
# tagNumber = 1
# tagLVT = 0
# tagData = ''
# <bacpypes.primitivedata.ContextTag(context(0)) instance at 0x7fcdace93128>
# tagClass = 1 context
# tagNumber = 0
# tagLVT = 4
# tagData = '00.80.00.01'
# <bacpypes.primitivedata.ContextTag(context(1)) instance at 0x7fcdace93160>
# tagClass = 1 context
# tagNumber = 1
# tagLVT = 1
# tagData = '55'
# <bacpypes.primitivedata.ClosingTag(close(1)) instance at 0x7fcdace930f0>
# tagClass = 3 closing
# tagNumber = 1
# tagLVT = 0
# tagData = ''
y = EventParameterAccessEventAccessEvent()
y.decode(tl)
print("y:")
y.debug_contents()
# listOfAccessEvents
# [0] = 'deniedMaxAttempts'
# accessEventTimeReference
# objectIdentifier = ('analogValue', 1)
# propertyIdentifier = 'presentValue'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment