How to use the bacpypes.debugging.bacpypes_debugging function in bacpypes

To help you get started, we’ve selected a few bacpypes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JoelBender / bacpypes / tests / extended_tag_list.py View on Github external
@bacpypes_debugging
def time_statement(value):
    if _debug: time_statement._debug("time_statement %r", value)

    return Time(value)
github JoelBender / bacpypes / tests / test_primitive_data / test_boolean.py View on Github external
@bacpypes_debugging
def boolean_decode(tag):
    """Decode an boolean application tag into an boolean."""
    if _debug: boolean_decode._debug("boolean_decode %r", tag)

    obj = Boolean(tag)
    if _debug: boolean_decode._debug("    - obj: %r", obj)

    return obj
github JoelBender / bacpypes / tests / extended_tag_list.py View on Github external
@bacpypes_debugging
def integer_statement(value):
    if _debug: integer_statement._debug("integer_statement %r", value)

    return Integer(int(value))
github JoelBender / bacpypes / tests / test_primitive_data / test_unsigned.py View on Github external
@bacpypes_debugging
def unsigned_decode(tag):
    """Decode an unsigned application tag into an unsigned."""
    if _debug: unsigned_decode._debug("unsigned_decode %r", tag)

    obj = Unsigned(tag)
    if _debug: unsigned_decode._debug("    - obj: %r", obj)

    return obj
github JoelBender / bacpypes / tests / test_primitive_data / test_double.py View on Github external
@bacpypes_debugging
def double_endec(v, x):
    """Pass the value to Double, construct a tag from the hex string,
    and compare results of encode and decoding each other."""
    if _debug: double_endec._debug("double_endec %r %r", v, x)

    tag = double_tag(x)
    if _debug: double_endec._debug("    - tag: %r, %r", tag, tag.tagData)

    obj = Double(v)
    if _debug: double_endec._debug("    - obj: %r, %r", obj, obj.value)

    assert double_encode(obj) == tag
    if _debug: real_endec._debug("    - tags match")

    if math.isnan(v):
        assert math.isnan(double_decode(tag).value)
github JoelBender / bacpypes / tests / test__template.py View on Github external
@bacpypes_debugging
def teardown_module():
    """This function is called once at the end of the tests in this module."""
    if _debug: teardown_module._debug("teardown_module")
github JoelBender / bacpypes / tests / test_primitive_data / test_octet_string.py View on Github external
@bacpypes_debugging
def octet_string_tag(x):
    """Convert a hex string to an octet_string application tag."""
    if _debug: octet_string_tag._debug("octet_string_tag %r", x)

    b = xtob(x)
    tag = Tag(Tag.applicationTagClass, Tag.octetStringAppTag, len(b), b)
    if _debug: octet_string_endec._debug("    - tag: %r", tag)

    return tag
github JoelBender / bacpypes / tests / test_primitive_data / test_object_type.py View on Github external
@bacpypes_debugging
def object_type_tag(x):
    """Convert a hex string to an enumerated application tag."""
    if _debug: object_type_tag._debug("object_type_tag %r", x)

    b = xtob(x)
    tag = Tag(Tag.applicationTagClass, Tag.enumeratedAppTag, len(b), b)
    if _debug: object_type_endec._debug("    - tag: %r", tag)

    return tag
github JoelBender / bacpypes / tests / test_primitive_data / test_boolean.py View on Github external
@bacpypes_debugging
def boolean_endec(v, x):
    """Pass the value to Boolean, construct a tag from the hex string,
    and compare results of encode and decoding each other."""
    if _debug: boolean_endec._debug("boolean_endec %r %r", v, x)

    tag = boolean_tag(x)
    if _debug: boolean_endec._debug("    - tag: %r, %r", tag, tag.tagData)

    obj = Boolean(v)
    if _debug: boolean_endec._debug("    - obj: %r, %r", obj, obj.value)

    assert boolean_encode(obj) == tag
    assert boolean_decode(tag) == obj
github JoelBender / bacpypes / samples / ReadPropertyMultipleServer25.py View on Github external
#
#   Random Value Object Type
#

class RandomAnalogValueObject(AnalogValueObject):

    properties = [
        RandomValueProperty('presentValue'),
        ]

    def __init__(self, **kwargs):
        if _debug: RandomAnalogValueObject._debug("__init__ %r", kwargs)
        AnalogValueObject.__init__(self, **kwargs)

bacpypes_debugging(RandomAnalogValueObject)
register_object_type(RandomAnalogValueObject)

#
#   __main__
#

def main():
    # check the version
    if (sys.version_info[:2] != (2, 5)):
        sys.stderr.write("Python 2.5 only\n")
        sys.exit(1)

    # parse the command line arguments
    args = ConfigArgumentParser(description=__doc__).parse_args()

    if _debug: _log.debug("initialization")