本文整理汇总了Python中bacpypes.debugging.ModuleLogger类的典型用法代码示例。如果您正苦于以下问题:Python ModuleLogger类的具体用法?Python ModuleLogger怎么用?Python ModuleLogger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModuleLogger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ModuleLogger
import random
import string
from bacpypes.debugging import bacpypes_debugging, ModuleLogger
from bacpypes.consolelogging import ConfigArgumentParser
from bacpypes.core import run
from bacpypes.app import LocalDeviceObject, BIPSimpleApplication
from bacpypes.object import FileObject, register_object_type
from bacpypes.basetypes import ServicesSupported
# some debugging
_debug = 0
_log = ModuleLogger(globals())
#
# Local Record Access File Object Type
#
@bacpypes_debugging
class LocalRecordAccessFileObject(FileObject):
def __init__(self, **kwargs):
""" Initialize a record accessed file object. """
if _debug:
LocalRecordAccessFileObject._debug("__init__ %r",
kwargs,
)
FileObject.__init__(self,
示例2: ModuleLogger
import random
from bacpypes.debugging import bacpypes_debugging, ModuleLogger
from bacpypes.consolelogging import ConfigArgumentParser
from bacpypes.core import run
from bacpypes.primitivedata import Real
from bacpypes.app import LocalDeviceObject, BIPSimpleApplication
from bacpypes.object import AnalogValueObject, Property, register_object_type
from bacpypes.errors import ExecutionError
# some debugging
_debug = 0
_log = ModuleLogger(globals())
# globals
this_device = None
this_application = None
#
# RandomValueProperty
#
@bacpypes_debugging
class RandomValueProperty(Property):
def __init__(self, identifier):
if _debug: RandomValueProperty._debug("__init__ %r", identifier)
Property.__init__(self, identifier, Real, default=None, optional=True, mutable=False)
示例3: ModuleLogger
from bacpypes.basetypes import ServicesSupported, ErrorType
from bacpypes.apdu import ReadPropertyMultipleACK, ReadAccessResult, ReadAccessResultElement, ReadAccessResultElementChoice
from bacpypes.app import LocalDeviceObject, BIPSimpleApplication
from bacpypes.object import AnalogValueObject, PropertyError, get_object_class
from bacpypes.apdu import Error
from bacpypes.errors import ExecutionError
from csv import DictReader
import logging
#---------------------------------------------------------------------------#
# configure the service logging
#---------------------------------------------------------------------------#
# some debugging
_debug = 0
_log = ModuleLogger(globals())
import struct
parser = ArgumentParser(description='Run a test pymodbus driver')
parser.add_argument('config', help='device registry configuration')
parser.add_argument('interface', help='interface address and optionally the port for the device to listen on')
args = parser.parse_args()
MODBUS_REGISTER_SIZE = 2
class Register(object):
def __init__(self, point_name, instance_number, object_type, property_name, read_only):
self.read_only = read_only
self.register_type = "byte"
self.property_name = property_name
示例4: ModuleLogger
as the other filters, and accepts the debugging options of other BACpypes
applications.
"""
from collections import defaultdict
from bacpypes.debugging import bacpypes_debugging, ModuleLogger
from bacpypes.consolelogging import ArgumentParser
from bacpypes.pdu import Address
from bacpypes.analysis import trace, Tracer
from bacpypes.apdu import WhoIsRequest, IAmRequest
# some debugging
_debug = 0
_log = ModuleLogger(globals())
# globals
filterSource = None
filterDestination = None
filterHost = None
# dictionaries of requests
whoIsTraffic = defaultdict(int)
iAmTraffic = defaultdict(int)
#
# Match
#
示例5: ModuleLogger
from bacpypes.consolelogging import ArgumentParser
from bacpypes.pdu import Address
from bacpypes.comm import bind
from bacpypes.apdu import APDU, ReadPropertyRequest, \
ComplexAckPDU, RejectPDU, AbortPDU
from bacpypes.app import LocalDeviceObject, Application
from bacpypes.appservice import ApplicationServiceAccessPoint, StateMachineAccessPoint
from tests.state_machine import Server, StateMachine
# some debugging
_debug = 0
_log = ModuleLogger(globals())
# defaults for testing
BACPYPES_TEST = ""
BACPYPES_TEST_OPTION = ""
# parsed test options
test_options = None
#
# TestApplication
#
@bacpypes_debugging
class TestApplication(Application):
示例6: ModuleLogger
"""
Who-Is and I-Am Device Filter
"""
import sys
from bacpypes.debugging import Logging, function_debugging, ModuleLogger
from bacpypes.consolelogging import ConsoleLogHandler
from bacpypes.pdu import Address
from bacpypes.analysis import trace, strftimestamp, Tracer
from bacpypes.apdu import WhoIsRequest, IAmRequest
# some debugging
_debug = 0
_log = ModuleLogger(globals())
# globals
filterSource = None
filterDestination = None
filterHost = None
filterDevice = None
#
# Match
#
@function_debugging
def Match(addr1, addr2):
"""Return true iff addr1 matches addr2."""
if _debug: Match._debug("Match %r %r", addr1, addr2)
示例7: ModuleLogger
from bacpypes.pdu import Address
from bacpypes.netservice import NetworkServiceAccessPoint, NetworkServiceElement
from bacpypes.bvllservice import BIPBBMD, AnnexJCodec, UDPMultiplexer
from bacpypes.app import LocalDeviceObject, Application
from bacpypes.appservice import StateMachineAccessPoint, ApplicationServiceAccessPoint
from bacpypes.primitivedata import Real
from bacpypes.object import AnalogValueObject, Property
from bacpypes.vlan import Network, Node
from bacpypes.errors import ExecutionError
# some debugging
_debug = 0
_log = ModuleLogger(globals())
#
# RandomValueProperty
#
@bacpypes_debugging
class RandomValueProperty(Property):
def __init__(self, identifier):
if _debug: RandomValueProperty._debug("__init__ %r", identifier)
Property.__init__(self, identifier, Real, default=None, optional=True, mutable=False)
def ReadProperty(self, obj, arrayIndex=None):
if _debug: RandomValueProperty._debug("ReadProperty %r arrayIndex=%r", obj, arrayIndex)
示例8: ModuleLogger
"""
Summarize COV Notifications
"""
import sys
from bacpypes.debugging import Logging, function_debugging, ModuleLogger
from bacpypes.consolelogging import ConsoleLogHandler
from bacpypes.pdu import Address
from bacpypes.analysis import trace, strftimestamp, Tracer
from bacpypes.apdu import UnconfirmedCOVNotificationRequest
# some debugging
_debug = 0
_log = ModuleLogger(globals())
# globals
filterSource = None
filterDestination = None
filterHost = None
# dictionary of requests
requests = {}
#
# Match
#
@function_debugging
示例9: ModuleLogger
import sys
import logging
from ConfigParser import ConfigParser
from bacpypes.debugging import Logging, ModuleLogger
from bacpypes.consolelogging import ConsoleLogHandler
from bacpypes.core import run
from bacpypes.app import BIPSimpleApplication
from bacpypes.object import LocalDeviceObject
#debugging
_debug = 0
_log = ModuleLogger(globals())
#_main_
try:
_log.debug("initialization")
_log.debug("running")
except Exception, e:
_log.exception("an error has occured: %s", e)
finally:
_log.debug("finally")
示例10: ModuleLogger
import sys
from collections import defaultdict
from bacpypes.debugging import Logging, function_debugging, ModuleLogger
from bacpypes.consolelogging import ConsoleLogHandler
from bacpypes.analysis import trace, strftimestamp, Tracer
try:
from CSStat import Statistics
except ImportError:
Statistics = lambda: None
# some debugging
_debug = 0
_log = ModuleLogger(globals())
# globals
counter = defaultdict(int)
#
# PDUsPerMinuteTracer
#
class PDUsPerMinuteTracer(Tracer, Logging):
def __init__(self):
if _debug: PDUsPerMinuteTracer._debug("__init__")
Tracer.__init__(self, self.Filter)
def Filter(self, pkt):
示例11: ModuleLogger
As a router, this does not have an application layer.
"""
from bacpypes.debugging import bacpypes_debugging, ModuleLogger
from bacpypes.consolelogging import ArgumentParser
from bacpypes.core import run
from bacpypes.comm import bind
from bacpypes.pdu import Address
from bacpypes.netservice import NetworkServiceAccessPoint, NetworkServiceElement
from bacpypes.bvllservice import BIPSimple, AnnexJCodec, UDPMultiplexer
# some debugging
_debug = 0
_log = ModuleLogger(globals())
#
# IP2IPRouter
#
@bacpypes_debugging
class IP2IPRouter:
def __init__(self, addr1, net1, addr2, net2):
if _debug:
IP2IPRouter._debug("__init__ %r %r %r %r", addr1, net1, addr2, net2)
# a network service access point will be needed
self.nsap = NetworkServiceAccessPoint()
示例12: ModuleLogger
"""
"""
from functools import partial
from bacpypes.debugging import bacpypes_debugging, ModuleLogger
from bacpypes.consolelogging import ArgumentParser
from bacpypes.core import run_once
from bacpypes.service.detect import DetectionAlgorithm, monitor_filter
from bacpypes.object import AnalogValueObject
# some debugging
_debug = 0
_log = ModuleLogger(globals())
#
# something_changed
#
def something_changed(thing, old_value, new_value):
print("%r changed from %r to %r" % (thing, old_value, new_value))
#
# SampleEventDetection
#
class SampleEventDetection(DetectionAlgorithm):
def __init__(self, **kwargs):
示例13: ModuleLogger
import sys
from bacpypes.debugging import bacpypes_debugging, ModuleLogger
from bacpypes.udp import UDPDirector
from bacpypes.comm import Client, Server, bind
from bacpypes.pdu import Address, PDU
from bacpypes.core import run, stop
from bacpypes.consolelogging import ArgumentParser
from bacpypes.console import ConsoleClient
# some debugging
_debug = 0
_log = ModuleLogger(globals())
# globals
local_unicast_tuple = None
local_broadcast_tuple = None
#
# MiddleMan
#
@bacpypes_debugging
class MiddleMan(Client, Server):
def indication(self, pdu):
if _debug: MiddleMan._debug('indication %r', pdu)
示例14: ModuleLogger
from bacpypes.debugging import bacpypes_debugging, ModuleLogger
from bacpypes.consolelogging import ConfigArgumentParser
from bacpypes.consolecmd import ConsoleCmd
from bacpypes.core import run
from bacpypes.pdu import Address, GlobalBroadcast
from bacpypes.app import LocalDeviceObject, BIPSimpleApplication
from bacpypes.apdu import WhoIsRequest, IAmRequest
from bacpypes.basetypes import ServicesSupported
from bacpypes.errors import DecodingError
# some debugging
_debug = 0
_log = ModuleLogger(globals())
# globals
this_device = None
this_application = None
this_console = None
#
# WhoIsIAmApplication
#
class WhoIsIAmApplication(BIPSimpleApplication):
def __init__(self, *args):
if _debug: WhoIsIAmApplication._debug("__init__ %r", args)
BIPSimpleApplication.__init__(self, *args)
示例15: ModuleLogger
"""
This sample application provides a single MultiState Value Object to test
reading and writing its various properties.
"""
from bacpypes.debugging import ModuleLogger
from bacpypes.consolelogging import ConfigArgumentParser
from bacpypes.core import run
from bacpypes.app import LocalDeviceObject, BIPSimpleApplication
from bacpypes.object import MultiStateValueObject
# some debugging
_debug = 0
_log = ModuleLogger(globals())
# globals
this_device = None
this_application = None
#
# __main__
#
try:
# parse the command line arguments
args = ConfigArgumentParser(description=__doc__).parse_args()
if _debug: _log.debug("initialization")
if _debug: _log.debug(" - args: %r", args)