mirror of
https://github.com/JoelBender/bacpypes
synced 2025-09-28 22:15:23 +08:00
remove flakes
This commit is contained in:
parent
4a7870ae12
commit
f0af96c55b
|
@ -7,7 +7,7 @@ Application Layer Protocol Data Units
|
|||
from .errors import DecodingError
|
||||
from .debugging import ModuleLogger, DebugContents, bacpypes_debugging
|
||||
|
||||
from .pdu import PCI, PDUData, NPDU
|
||||
from .pdu import PCI, PDUData
|
||||
from .primitivedata import Boolean, CharacterString, Enumerated, Integer, \
|
||||
ObjectIdentifier, ObjectType, OctetString, Real, TagList, Unsigned, \
|
||||
expand_enumerations
|
||||
|
@ -352,7 +352,7 @@ class APDU(APCI, PDUData):
|
|||
|
||||
def dict_contents(self, use_dict=None, as_class=dict):
|
||||
"""Return the contents of an object as a dict."""
|
||||
if _debug: NPDU._debug("dict_contents use_dict=%r as_class=%r", use_dict, as_class)
|
||||
if _debug: APDU._debug("dict_contents use_dict=%r as_class=%r", use_dict, as_class)
|
||||
|
||||
# make/extend the dictionary of content
|
||||
if use_dict is None:
|
||||
|
|
|
@ -9,8 +9,8 @@ from .comm import ApplicationServiceElement, bind
|
|||
|
||||
from .pdu import Address
|
||||
|
||||
from .primitivedata import Address, ApplicationTag, Atomic, BitString, Boolean, CharacterString, ClosingTag, ContextTag, Date, DecodingError, Double, Enumerated, GlobalBroadcast, Integer, LocalBroadcast, LocalStation, ModuleLogger, Null, ObjectIdentifier, ObjectType, OctetString, OpeningTag, PCI, PDU, PDUData, Real, RemoteBroadcast, RemoteStation, Tag, TagList, Time, Unsigned
|
||||
from .constructeddata import Address, Any, AnyAtomic, ApplicationTag, Array, ArrayOf, Atomic, BitString, Boolean, CharacterString, Choice, ClosingTag, ContextTag, Date, DecodingError, Double, Element, Enumerated, GlobalBroadcast, Integer, LocalBroadcast, LocalStation, ModuleLogger, Null, ObjectIdentifier, ObjectType, OctetString, OpeningTag, PCI, PDU, PDUData, Real, RemoteBroadcast, RemoteStation, Sequence, SequenceOf, Tag, TagList, Time, Unsigned
|
||||
from .primitivedata import Atomic, Date, Null, ObjectIdentifier, Time, Unsigned
|
||||
from .constructeddata import Any, Array, ArrayOf
|
||||
|
||||
from .appservice import StateMachineAccessPoint, ApplicationServiceAccessPoint
|
||||
from .netservice import NetworkServiceAccessPoint, NetworkServiceElement
|
||||
|
|
|
@ -9,7 +9,7 @@ import hashlib
|
|||
from .errors import EncodingError, DecodingError
|
||||
from .debugging import ModuleLogger, DebugContents, bacpypes_debugging
|
||||
|
||||
from .pdu import Address, GlobalBroadcast, LocalBroadcast, LocalStation, ModuleLogger, PCI, PDU, PDUData, RemoteBroadcast, RemoteStation
|
||||
from .pdu import LocalStation, PCI, PDUData
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
|
|
@ -7,15 +7,24 @@ BACnet Streaming Link Layer Service
|
|||
import random
|
||||
|
||||
from .debugging import ModuleLogger, DebugContents, bacpypes_debugging
|
||||
from .errors import ConfigurationError, DecodingError, EncodingError, ExecutionError
|
||||
|
||||
from .comm import Client, bind, ApplicationServiceElement
|
||||
from .tcp import TCPClientDirector, TCPServerDirector, StreamToPacket
|
||||
|
||||
from .pdu import PDU, unpack_ip_addr
|
||||
from .npdu import NPDU
|
||||
from .netservice import NetworkAdapter
|
||||
|
||||
from .bsll import AUTHENTICATION_FAILURE, AUTHENTICATION_HASH, AUTHENTICATION_NO_SERVICE, AUTHENTICATION_REQUIRED, AccessChallenge, AccessRequest, AccessResponse, Address, BSLCI, BSLPDU, CLIENT_SERVER_SERVICE_ID, ClientToLESBroadcastNPDU, ClientToLESUnicastNPDU, ClientToServerBroadcastAPDU, ClientToServerUnicastAPDU, DEVICE_TO_DEVICE_SERVICE_ID, DebugContents, DecodingError, DeviceToDeviceAPDU, EncodingError, GlobalBroadcast, LANE_SERVICE_ID, LESToClientBroadcastNPDU, LESToClientUnicastNPDU, LocalBroadcast, LocalStation, ModuleLogger, NO_DEVICE_TO_DEVICE_SERVICE, NO_LANE_SERVICE, NO_PROXY_SERVICE, NO_ROUTER_TO_ROUTER_SERVICE, PCI, PDU, PDUData, PROXY_SERVICE_ID, ProxyToServerBroadcastNPDU, ProxyToServerUnicastNPDU, ROUTER_TO_ROUTER_SERVICE_ID, RemoteBroadcast, RemoteStation, Result, RouterToRouterNPDU, SUCCESS, ServerToClientBroadcastAPDU, ServerToClientUnicastAPDU, ServerToProxyBroadcastNPDU, ServerToProxyUnicastNPDU, ServiceRequest, UNRECOGNIZED_SERVICE
|
||||
from .bsll import AUTHENTICATION_FAILURE, AUTHENTICATION_HASH, \
|
||||
AUTHENTICATION_NO_SERVICE, AUTHENTICATION_REQUIRED, AccessChallenge, \
|
||||
AccessRequest, AccessResponse, Address, BSLCI, BSLPDU, \
|
||||
CLIENT_SERVER_SERVICE_ID, DEVICE_TO_DEVICE_SERVICE_ID, DeviceToDeviceAPDU, \
|
||||
LANE_SERVICE_ID, LocalBroadcast, NO_DEVICE_TO_DEVICE_SERVICE, \
|
||||
NO_LANE_SERVICE, NO_PROXY_SERVICE, NO_ROUTER_TO_ROUTER_SERVICE, \
|
||||
PROXY_SERVICE_ID, ProxyToServerBroadcastNPDU, ProxyToServerUnicastNPDU, \
|
||||
ROUTER_TO_ROUTER_SERVICE_ID, Result, RouterToRouterNPDU, SUCCESS, \
|
||||
ServerToProxyBroadcastNPDU, ServerToProxyUnicastNPDU, ServiceRequest, \
|
||||
UNRECOGNIZED_SERVICE, bsl_pdu_types, hash_functions
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
|
|
@ -7,7 +7,7 @@ BACnet Virtual Link Layer Module
|
|||
from .errors import EncodingError, DecodingError
|
||||
from .debugging import ModuleLogger, DebugContents, bacpypes_debugging
|
||||
|
||||
from .pdu import Address, GlobalBroadcast, LocalBroadcast, LocalStation, ModuleLogger, PCI, PDU, PDUData, RemoteBroadcast, RemoteStation, unpack_ip_addr
|
||||
from .pdu import Address, PCI, PDUData, unpack_ip_addr
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
@ -127,7 +127,7 @@ class BVLPDU(BVLCI, PDUData):
|
|||
|
||||
def dict_contents(self, use_dict=None, as_class=dict, key_values=()):
|
||||
"""Return the contents of an object as a dict."""
|
||||
if _debug: NPDU._debug("dict_contents use_dict=%r as_class=%r key_values=%r", use_dict, as_class, key_values)
|
||||
if _debug: BVLPDU._debug("dict_contents use_dict=%r as_class=%r key_values=%r", use_dict, as_class, key_values)
|
||||
|
||||
# make/extend the dictionary of content
|
||||
if use_dict is None:
|
||||
|
|
|
@ -8,16 +8,19 @@ import struct
|
|||
from time import time as _time
|
||||
|
||||
from .debugging import ModuleLogger, DebugContents, bacpypes_debugging
|
||||
from .errors import ConfigurationError, DecodingError, EncodingError, ExecutionError
|
||||
|
||||
from . import udp
|
||||
|
||||
from .udp import UDPDirector
|
||||
from .task import OneShotTask, RecurringTask
|
||||
|
||||
from .comm import Client, Server, bind, \
|
||||
ServiceAccessPoint, ApplicationServiceElement
|
||||
|
||||
from .bvll import Address, BVLCI, BVLPDU, DebugContents, DecodingError, DeleteForeignDeviceTableEntry, DistributeBroadcastToNetwork, EncodingError, FDTEntry, ForwardedNPDU, GlobalBroadcast, LocalBroadcast, LocalStation, ModuleLogger, OriginalBroadcastNPDU, OriginalUnicastNPDU, PCI, PDU, PDUData, ReadBroadcastDistributionTable, ReadBroadcastDistributionTableAck, ReadForeignDeviceTable, ReadForeignDeviceTableAck, RegisterForeignDevice, RemoteBroadcast, RemoteStation, Result, WriteBroadcastDistributionTable
|
||||
from .pdu import Address, LocalBroadcast, LocalStation, PDU
|
||||
from .bvll import BVLPDU, DeleteForeignDeviceTableEntry, \
|
||||
DistributeBroadcastToNetwork, FDTEntry, ForwardedNPDU, \
|
||||
OriginalBroadcastNPDU, OriginalUnicastNPDU, \
|
||||
ReadBroadcastDistributionTable, ReadBroadcastDistributionTableAck, \
|
||||
ReadForeignDeviceTable, ReadForeignDeviceTableAck, RegisterForeignDevice, \
|
||||
Result, WriteBroadcastDistributionTable, bvl_pdu_types
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
@ -82,13 +85,13 @@ class UDPMultiplexer:
|
|||
|
||||
# create and bind the direct address
|
||||
self.direct = _MultiplexClient(self)
|
||||
self.directPort = udp.UDPDirector(self.addrTuple)
|
||||
self.directPort = UDPDirector(self.addrTuple)
|
||||
bind(self.direct, self.directPort)
|
||||
|
||||
# create and bind the broadcast address
|
||||
if specialBroadcast and (not noBroadcast):
|
||||
self.broadcast = _MultiplexClient(self)
|
||||
self.broadcastPort = udp.UDPDirector(self.addrBroadcastTuple, reuse=True)
|
||||
self.broadcastPort = UDPDirector(self.addrBroadcastTuple, reuse=True)
|
||||
bind(self.direct, self.broadcastPort)
|
||||
else:
|
||||
self.broadcast = None
|
||||
|
|
|
@ -9,7 +9,8 @@ import sys
|
|||
from .errors import DecodingError
|
||||
from .debugging import ModuleLogger, bacpypes_debugging
|
||||
|
||||
from .primitivedata import Address, ApplicationTag, Atomic, BitString, Boolean, CharacterString, ClosingTag, ContextTag, Date, DecodingError, Double, Enumerated, GlobalBroadcast, Integer, LocalBroadcast, LocalStation, ModuleLogger, Null, ObjectIdentifier, ObjectType, OctetString, OpeningTag, PCI, PDU, PDUData, Real, RemoteBroadcast, RemoteStation, Tag, TagList, Time, Unsigned
|
||||
from .primitivedata import Atomic, ClosingTag, OpeningTag, Tag, TagList, \
|
||||
Unsigned
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
|
|
@ -12,13 +12,8 @@ from .errors import ConfigurationError
|
|||
from .comm import Client, Server, bind, \
|
||||
ServiceAccessPoint, ApplicationServiceElement
|
||||
|
||||
from .npdu import Address, DecodingError, DisconnectConnectionToNetwork, \
|
||||
EstablishConnectionToNetwork, GlobalBroadcast, IAmRouterToNetwork, \
|
||||
ICouldBeRouterToNetwork, InitializeRoutingTable, InitializeRoutingTableAck, \
|
||||
LocalBroadcast, LocalStation, NPCI, NPDU, NetworkNumberIs, \
|
||||
PCI, PDU, PDUData, RejectMessageToNetwork, RemoteBroadcast, RemoteStation, \
|
||||
RouterAvailableToNetwork, RouterBusyToNetwork, RoutingTableEntry, \
|
||||
WhatIsNetworkNumber, WhoIsRouterToNetwork
|
||||
from .pdu import Address, LocalBroadcast, LocalStation, PDU, RemoteStation
|
||||
from .npdu import IAmRouterToNetwork, NPDU, WhoIsRouterToNetwork, npdu_types
|
||||
from .apdu import APDU as _APDU
|
||||
|
||||
# some debugging
|
||||
|
|
|
@ -7,8 +7,8 @@ NPDU
|
|||
from .errors import DecodingError
|
||||
from .debugging import ModuleLogger, DebugContents, bacpypes_debugging, btox
|
||||
|
||||
from .pdu import Address, LocalStation, LocalBroadcast, RemoteStation, RemoteBroadcast, \
|
||||
GlobalBroadcast, PCI, PDU, PDUData
|
||||
from .pdu import Address, RemoteStation, RemoteBroadcast, GlobalBroadcast, \
|
||||
PCI, PDUData
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
@ -204,7 +204,7 @@ class NPCI(PCI, DebugContents):
|
|||
|
||||
def npci_contents(self, use_dict=None, as_class=dict):
|
||||
"""Return the contents of an object as a dict."""
|
||||
if _debug: npci._debug("npci_contents use_dict=%r as_class=%r", use_dict, as_class)
|
||||
if _debug: NPCI._debug("npci_contents use_dict=%r as_class=%r", use_dict, as_class)
|
||||
|
||||
# make/extend the dictionary of content
|
||||
if use_dict is None:
|
||||
|
@ -273,7 +273,7 @@ class NPDU(NPCI, PDUData):
|
|||
|
||||
def dict_contents(self, use_dict=None, as_class=dict):
|
||||
"""Return the contents of an object as a dict."""
|
||||
if _debug: NPDU._debug("dict_contents use_dict=%r as_class=%r key_values=%r", use_dict, as_class, key_values)
|
||||
if _debug: NPDU._debug("dict_contents use_dict=%r as_class=%r", use_dict, as_class)
|
||||
|
||||
# make/extend the dictionary of content
|
||||
if use_dict is None:
|
||||
|
|
|
@ -9,10 +9,36 @@ import sys
|
|||
from .errors import ConfigurationError, ExecutionError
|
||||
from .debugging import function_debugging, ModuleLogger, Logging
|
||||
|
||||
from .primitivedata import Address, ApplicationTag, Atomic, BitString, Boolean, CharacterString, ClosingTag, ContextTag, Date, DecodingError, Double, Enumerated, GlobalBroadcast, Integer, LocalBroadcast, LocalStation, ModuleLogger, Null, ObjectIdentifier, ObjectType, OctetString, OpeningTag, PCI, PDU, PDUData, Real, RemoteBroadcast, RemoteStation, Tag, TagList, Time, Unsigned
|
||||
from .constructeddata import Address, Any, AnyAtomic, ApplicationTag, Array, ArrayOf, Atomic, BitString, Boolean, CharacterString, Choice, ClosingTag, ContextTag, Date, DecodingError, Double, Element, Enumerated, GlobalBroadcast, Integer, LocalBroadcast, LocalStation, ModuleLogger, Null, ObjectIdentifier, ObjectType, OctetString, OpeningTag, PCI, PDU, PDUData, Real, RemoteBroadcast, RemoteStation, Sequence, SequenceOf, Tag, TagList, Time, Unsigned
|
||||
from .basetypes import AccessAuthenticationFactorDisable, AccessCredentialDisable, AccessCredentialDisableReason, AccessEvent, AccessPassbackMode, AccessRule, AccessRuleLocationSpecifier, AccessRuleTimeRangeSpecifier, AccessThreatLevel, AccessUserType, AccessZoneOccupancyState, AccumulatorRecord, AccumulatorRecordAccumulatorStatus, Action, ActionCommand, ActionList, Address, AddressBinding, Any, AnyAtomic, ApplicationTag, Array, ArrayOf, AssignedAccessRights, Atomic, AuthenticationFactor, AuthenticationFactorFormat, AuthenticationFactorType, AuthenticationPolicy, AuthenticationPolicyPolicy, AuthenticationStatus, AuthorizationException, AuthorizationMode, BackupState, BinaryPV, BitString, Boolean, COVSubscription, CalendarEntry, ChannelValue, CharacterString, Choice, ClientCOV, ClosingTag, ContextTag, CredentialAuthenticationFactor, DailySchedule, Date, DateRange, DateTime, DaysOfWeek, DecodingError, Destination, DeviceAddress, DeviceObjectPropertyReference, DeviceObjectPropertyValue, DeviceObjectReference, DeviceStatus, DoorAlarmState, DoorSecuredStatus, DoorStatus, DoorValue, Double, Element, EngineeringUnits, Enumerated, ErrorClass, ErrorCode, ErrorType, EventNotificationSubscription, EventParameter, EventParameterAccessEvent, EventParameterAccessEventAccessEvent, EventParameterBufferReady, EventParameterChangeOfBitstring, EventParameterChangeOfCharacterString, EventParameterChangeOfLifeSafety, EventParameterChangeOfState, EventParameterChangeOfStatusFlags, EventParameterChangeOfValue, EventParameterChangeOfValueCOVCriteria, EventParameterCommandFailure, EventParameterDoubleOutOfRange, EventParameterExtended, EventParameterExtendedParameters, EventParameterFloatingLimit, EventParameterOutOfRange, EventParameterSignedOutOfRange, EventParameterUnsignedOutOfRange, EventParameterUnsignedRange, EventState, EventTransitionBits, EventType, FaultParameter, FaultParameterCharacterString, FaultParameterExtended, FaultParameterExtendedParameters, FaultParameterLifeSafety, FaultParameterState, FaultParameterStatusFlags, FaultType, FileAccessMethod, GlobalBroadcast, Integer, KeyIdentifier, LifeSafetyMode, LifeSafetyOperation, LifeSafetyState, LightingCommand, LightingInProgress, LightingOperation, LightingTransition, LimitEnable, LocalBroadcast, LocalStation, LockStatus, LogData, LogDataLogData, LogMultipleRecord, LogRecord, LogRecordLogDatum, LogStatus, LoggingType, Maintenance, ModuleLogger, NetworkSecurityPolicy, NodeType, NotificationParameters, NotificationParametersAccessEventType, NotificationParametersBufferReady, NotificationParametersChangeOfBitstring, NotificationParametersChangeOfCharacterStringType, NotificationParametersChangeOfLifeSafety, NotificationParametersChangeOfState, NotificationParametersChangeOfStatusFlagsType, NotificationParametersChangeOfValue, NotificationParametersChangeOfValueNewValue, NotificationParametersCommandFailure, NotificationParametersComplexEventType, NotificationParametersDoubleOutOfRangeType, NotificationParametersExtended, NotificationParametersExtendedParametersType, NotificationParametersFloatingLimit, NotificationParametersOutOfRange, NotificationParametersSignedOutOfRangeType, NotificationParametersUnsignedOutOfRangeType, NotificationParametersUnsignedRange, NotifyType, Null, ObjectIdentifier, ObjectPropertyReference, ObjectPropertyValue, ObjectType, ObjectTypesSupported, OctetString, OpeningTag, OptionalCharacterString, PCI, PDU, PDUData, Polarity, PortPermission, Prescale, PriorityArray, PriorityValue, ProcessIdSelection, ProgramError, ProgramRequest, ProgramState, PropertyAccessResult, PropertyAccessResultAccessResult, PropertyIdentifier, PropertyReference, PropertyStates, PropertyValue, Real, Recipient, RecipientProcess, Reliability, RemoteBroadcast, RemoteStation, RestartReason, ResultFlags, Scale, SecurityKeySet, SecurityLevel, SecurityPolicy, Segmentation, Sequence, SequenceOf, ServicesSupported, SetpointReference, ShedLevel, ShedState, SilencedState, SpecialEvent, SpecialEventPeriod, StatusFlags, Tag, TagList, Time, TimeStamp, TimeValue, Unsigned, VTClass, VTSession, WeekNDay, WriteStatus
|
||||
from .apdu import EventNotificationParameters, ReadAccessSpecification, ReadAccessResult
|
||||
from .primitivedata import Atomic, BitString, Boolean, CharacterString, Date, \
|
||||
Double, Integer, ObjectIdentifier, ObjectType, OctetString, Real, Time, \
|
||||
Unsigned
|
||||
from .constructeddata import AnyAtomic, Array, ArrayOf, Choice, Element, \
|
||||
Sequence, SequenceOf
|
||||
from .basetypes import AccessCredentialDisable, AccessCredentialDisableReason, \
|
||||
AccessEvent, AccessPassbackMode, AccessRule, AccessThreatLevel, \
|
||||
AccessUserType, AccessZoneOccupancyState, AccumulatorRecord, Action, \
|
||||
ActionList, AddressBinding, AssignedAccessRights, AuthenticationFactor, \
|
||||
AuthenticationFactorFormat, AuthenticationPolicy, AuthenticationStatus, \
|
||||
AuthorizationException, AuthorizationMode, BackupState, BinaryPV, \
|
||||
COVSubscription, CalendarEntry, ChannelValue, ClientCOV, \
|
||||
CredentialAuthenticationFactor, DailySchedule, DateRange, DateTime, \
|
||||
Destination, DeviceObjectPropertyReference, DeviceObjectReference, \
|
||||
DeviceStatus, DoorAlarmState, DoorSecuredStatus, DoorStatus, DoorValue, \
|
||||
EngineeringUnits, EventNotificationSubscription, EventParameter, \
|
||||
EventState, EventTransitionBits, EventType, FaultParameter, FaultType, \
|
||||
FileAccessMethod, LifeSafetyMode, LifeSafetyOperation, LifeSafetyState, \
|
||||
LightingCommand, LightingInProgress, LightingTransition, LimitEnable, \
|
||||
LockStatus, LogMultipleRecord, LogRecord, LogStatus, LoggingType, \
|
||||
Maintenance, NetworkSecurityPolicy, NodeType, NotifyType, \
|
||||
ObjectPropertyReference, ObjectTypesSupported, OptionalCharacterString, \
|
||||
Polarity, PortPermission, Prescale, PriorityArray, ProcessIdSelection, \
|
||||
ProgramError, ProgramRequest, ProgramState, PropertyAccessResult, \
|
||||
PropertyIdentifier, Recipient, Reliability, RestartReason, Scale, \
|
||||
SecurityKeySet, SecurityLevel, Segmentation, ServicesSupported, \
|
||||
SetpointReference, ShedLevel, ShedState, SilencedState, SpecialEvent, \
|
||||
StatusFlags, TimeStamp, VTClass, VTSession, WriteStatus
|
||||
from .apdu import EventNotificationParameters, ReadAccessSpecification, \
|
||||
ReadAccessResult
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
|
|
@ -5,13 +5,14 @@ Primitive Data
|
|||
"""
|
||||
|
||||
import sys
|
||||
import struct
|
||||
import time
|
||||
import re
|
||||
|
||||
from .debugging import ModuleLogger, btox
|
||||
|
||||
from .errors import DecodingError
|
||||
from .pdu import Address, GlobalBroadcast, LocalBroadcast, LocalStation, ModuleLogger, PCI, PDU, PDUData, RemoteBroadcast, RemoteStation
|
||||
from .pdu import PDUData
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
@ -1126,7 +1127,7 @@ class Date(Atomic):
|
|||
self.value = arg
|
||||
elif isinstance(arg, str):
|
||||
date_match = Date._date_regex.match(arg)
|
||||
if not tup_match:
|
||||
if not date_match:
|
||||
raise ValueError("invalid date pattern")
|
||||
date_groups = date_match.groups()
|
||||
|
||||
|
@ -1146,7 +1147,7 @@ class Date(Atomic):
|
|||
tup_list[2] -= 1900
|
||||
|
||||
# day-of-week madness
|
||||
dow = tup_groups[3]
|
||||
dow = date_groups[3]
|
||||
if dow is None:
|
||||
tup_list.append(0)
|
||||
elif (dow == '*'):
|
||||
|
@ -1239,9 +1240,9 @@ class Time(Atomic):
|
|||
pass
|
||||
elif isinstance(arg,Tag):
|
||||
self.decode(arg)
|
||||
elif isinstance(arg, types.TupleType):
|
||||
elif isinstance(arg, tuple):
|
||||
self.value = arg
|
||||
elif isinstance(arg, types.StringTypes):
|
||||
elif isinstance(arg, str):
|
||||
tup_match = Time._time_regex.match(arg)
|
||||
if not tup_match:
|
||||
raise ValueError("invalid time pattern")
|
||||
|
|
|
@ -10,7 +10,6 @@ import cPickle as pickle
|
|||
from time import time as _time, sleep as _sleep
|
||||
from StringIO import StringIO
|
||||
|
||||
from .errors import ConfigurationError, DecodingError, EncodingError, ExecutionError
|
||||
from .debugging import ModuleLogger, DebugContents, bacpypes_debugging
|
||||
|
||||
from .core import deferred
|
||||
|
|
|
@ -7,7 +7,7 @@ Application Layer Protocol Data Units
|
|||
from .errors import DecodingError
|
||||
from .debugging import ModuleLogger, DebugContents, bacpypes_debugging
|
||||
|
||||
from .pdu import PCI, PDUData, NPDU
|
||||
from .pdu import PCI, PDUData
|
||||
from .primitivedata import Boolean, CharacterString, Enumerated, Integer, \
|
||||
ObjectIdentifier, ObjectType, OctetString, Real, TagList, Unsigned, \
|
||||
expand_enumerations
|
||||
|
@ -351,7 +351,7 @@ class APDU(APCI, PDUData):
|
|||
|
||||
def dict_contents(self, use_dict=None, as_class=dict):
|
||||
"""Return the contents of an object as a dict."""
|
||||
if _debug: NPDU._debug("dict_contents use_dict=%r as_class=%r key_values=%r", use_dict, as_class, key_values)
|
||||
if _debug: APDU._debug("dict_contents use_dict=%r as_class=%r", use_dict, as_class)
|
||||
|
||||
# make/extend the dictionary of content
|
||||
if use_dict is None:
|
||||
|
|
|
@ -9,8 +9,8 @@ from .comm import ApplicationServiceElement, bind
|
|||
|
||||
from .pdu import Address
|
||||
|
||||
from .primitivedata import *
|
||||
from .constructeddata import *
|
||||
from .primitivedata import Atomic, Date, Null, ObjectIdentifier, Time, Unsigned
|
||||
from .constructeddata import Any, Array, ArrayOf
|
||||
|
||||
from .appservice import StateMachineAccessPoint, ApplicationServiceAccessPoint
|
||||
from .netservice import NetworkServiceAccessPoint, NetworkServiceElement
|
||||
|
|
|
@ -9,7 +9,7 @@ import hashlib
|
|||
from .errors import EncodingError, DecodingError
|
||||
from .debugging import ModuleLogger, DebugContents, bacpypes_debugging
|
||||
|
||||
from .pdu import *
|
||||
from .pdu import LocalStation, PCI, PDUData
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
|
|
@ -7,15 +7,24 @@ BACnet Streaming Link Layer Service
|
|||
import random
|
||||
|
||||
from .debugging import ModuleLogger, DebugContents, bacpypes_debugging
|
||||
from .errors import *
|
||||
|
||||
from .comm import Client, bind, ApplicationServiceElement
|
||||
from .tcp import TCPClientDirector, TCPServerDirector, StreamToPacket
|
||||
|
||||
from .pdu import PDU, unpack_ip_addr
|
||||
from .npdu import NPDU
|
||||
from .netservice import NetworkAdapter
|
||||
|
||||
from .bsll import *
|
||||
from .bsll import AUTHENTICATION_FAILURE, AUTHENTICATION_HASH, \
|
||||
AUTHENTICATION_NO_SERVICE, AUTHENTICATION_REQUIRED, AccessChallenge, \
|
||||
AccessRequest, AccessResponse, Address, BSLCI, BSLPDU, \
|
||||
CLIENT_SERVER_SERVICE_ID, DEVICE_TO_DEVICE_SERVICE_ID, DeviceToDeviceAPDU, \
|
||||
LANE_SERVICE_ID, LocalBroadcast, NO_DEVICE_TO_DEVICE_SERVICE, \
|
||||
NO_LANE_SERVICE, NO_PROXY_SERVICE, NO_ROUTER_TO_ROUTER_SERVICE, \
|
||||
PROXY_SERVICE_ID, ProxyToServerBroadcastNPDU, ProxyToServerUnicastNPDU, \
|
||||
ROUTER_TO_ROUTER_SERVICE_ID, Result, RouterToRouterNPDU, SUCCESS, \
|
||||
ServerToProxyBroadcastNPDU, ServerToProxyUnicastNPDU, ServiceRequest, \
|
||||
UNRECOGNIZED_SERVICE, bsl_pdu_types, hash_functions
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
|
|
@ -7,7 +7,7 @@ BACnet Virtual Link Layer Module
|
|||
from .errors import EncodingError, DecodingError
|
||||
from .debugging import ModuleLogger, DebugContents, bacpypes_debugging
|
||||
|
||||
from .pdu import *
|
||||
from .pdu import Address, PCI, PDUData, unpack_ip_addr
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
@ -127,7 +127,7 @@ class BVLPDU(BVLCI, PDUData):
|
|||
|
||||
def dict_contents(self, use_dict=None, as_class=dict, key_values=()):
|
||||
"""Return the contents of an object as a dict."""
|
||||
if _debug: NPDU._debug("dict_contents use_dict=%r as_class=%r key_values=%r", use_dict, as_class, key_values)
|
||||
if _debug: BVLPDU._debug("dict_contents use_dict=%r as_class=%r key_values=%r", use_dict, as_class, key_values)
|
||||
|
||||
# make/extend the dictionary of content
|
||||
if use_dict is None:
|
||||
|
|
|
@ -8,16 +8,19 @@ import struct
|
|||
from time import time as _time
|
||||
|
||||
from .debugging import ModuleLogger, DebugContents, bacpypes_debugging
|
||||
from .errors import *
|
||||
|
||||
from . import udp
|
||||
|
||||
from .udp import UDPDirector
|
||||
from .task import OneShotTask, RecurringTask
|
||||
|
||||
from .comm import Client, Server, bind, \
|
||||
ServiceAccessPoint, ApplicationServiceElement
|
||||
|
||||
from .bvll import *
|
||||
from .pdu import Address, LocalBroadcast, LocalStation, PDU
|
||||
from .bvll import BVLPDU, DeleteForeignDeviceTableEntry, \
|
||||
DistributeBroadcastToNetwork, FDTEntry, ForwardedNPDU, \
|
||||
OriginalBroadcastNPDU, OriginalUnicastNPDU, \
|
||||
ReadBroadcastDistributionTable, ReadBroadcastDistributionTableAck, \
|
||||
ReadForeignDeviceTable, ReadForeignDeviceTableAck, RegisterForeignDevice, \
|
||||
Result, WriteBroadcastDistributionTable, bvl_pdu_types
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
@ -83,13 +86,13 @@ class UDPMultiplexer:
|
|||
|
||||
# create and bind the direct address
|
||||
self.direct = _MultiplexClient(self)
|
||||
self.directPort = udp.UDPDirector(self.addrTuple)
|
||||
self.directPort = UDPDirector(self.addrTuple)
|
||||
bind(self.direct, self.directPort)
|
||||
|
||||
# create and bind the broadcast address
|
||||
if specialBroadcast and (not noBroadcast):
|
||||
self.broadcast = _MultiplexClient(self)
|
||||
self.broadcastPort = udp.UDPDirector(self.addrBroadcastTuple, reuse=True)
|
||||
self.broadcastPort = UDPDirector(self.addrBroadcastTuple, reuse=True)
|
||||
bind(self.direct, self.broadcastPort)
|
||||
else:
|
||||
self.broadcast = None
|
||||
|
|
|
@ -9,7 +9,8 @@ import sys
|
|||
from .errors import DecodingError
|
||||
from .debugging import ModuleLogger, bacpypes_debugging
|
||||
|
||||
from .primitivedata import *
|
||||
from .primitivedata import Atomic, ClosingTag, OpeningTag, Tag, TagList, \
|
||||
Unsigned
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
|
|
@ -12,13 +12,8 @@ from .errors import ConfigurationError
|
|||
from .comm import Client, Server, bind, \
|
||||
ServiceAccessPoint, ApplicationServiceElement
|
||||
|
||||
from .npdu import Address, DecodingError, DisconnectConnectionToNetwork, \
|
||||
EstablishConnectionToNetwork, GlobalBroadcast, IAmRouterToNetwork, \
|
||||
ICouldBeRouterToNetwork, InitializeRoutingTable, InitializeRoutingTableAck, \
|
||||
LocalBroadcast, LocalStation, NPCI, NPDU, NetworkNumberIs, \
|
||||
PCI, PDU, PDUData, RejectMessageToNetwork, RemoteBroadcast, RemoteStation, \
|
||||
RouterAvailableToNetwork, RouterBusyToNetwork, RoutingTableEntry, \
|
||||
WhatIsNetworkNumber, WhoIsRouterToNetwork
|
||||
from .pdu import Address, LocalBroadcast, LocalStation, PDU, RemoteStation
|
||||
from .npdu import IAmRouterToNetwork, NPDU, WhoIsRouterToNetwork, npdu_types
|
||||
from .apdu import APDU as _APDU
|
||||
|
||||
# some debugging
|
||||
|
|
|
@ -7,8 +7,8 @@ NPDU
|
|||
from .errors import DecodingError
|
||||
from .debugging import ModuleLogger, DebugContents, bacpypes_debugging, btox
|
||||
|
||||
from .pdu import Address, LocalStation, LocalBroadcast, RemoteStation, RemoteBroadcast, \
|
||||
GlobalBroadcast, PCI, PDU, PDUData
|
||||
from .pdu import Address, RemoteStation, RemoteBroadcast, GlobalBroadcast, \
|
||||
PCI, PDUData
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
@ -205,7 +205,7 @@ class NPCI(PCI, DebugContents):
|
|||
|
||||
def npci_contents(self, use_dict=None, as_class=dict):
|
||||
"""Return the contents of an object as a dict."""
|
||||
if _debug: npci._debug("npci_contents use_dict=%r as_class=%r", use_dict, as_class)
|
||||
if _debug: NPCI._debug("npci_contents use_dict=%r as_class=%r", use_dict, as_class)
|
||||
|
||||
# make/extend the dictionary of content
|
||||
if use_dict is None:
|
||||
|
@ -273,7 +273,7 @@ class NPDU(NPCI, PDUData):
|
|||
|
||||
def dict_contents(self, use_dict=None, as_class=dict):
|
||||
"""Return the contents of an object as a dict."""
|
||||
if _debug: NPDU._debug("dict_contents use_dict=%r as_class=%r key_values=%r", use_dict, as_class, key_values)
|
||||
if _debug: NPDU._debug("dict_contents use_dict=%r as_class=%r", use_dict, as_class)
|
||||
|
||||
# make/extend the dictionary of content
|
||||
if use_dict is None:
|
||||
|
|
|
@ -9,10 +9,36 @@ import sys
|
|||
from .errors import ConfigurationError, ExecutionError
|
||||
from .debugging import function_debugging, ModuleLogger, Logging
|
||||
|
||||
from .primitivedata import *
|
||||
from .constructeddata import *
|
||||
from .basetypes import *
|
||||
from .apdu import EventNotificationParameters, ReadAccessSpecification, ReadAccessResult
|
||||
from .primitivedata import Atomic, BitString, Boolean, CharacterString, Date, \
|
||||
Double, Integer, ObjectIdentifier, ObjectType, OctetString, Real, Time, \
|
||||
Unsigned
|
||||
from .constructeddata import AnyAtomic, Array, ArrayOf, Choice, Element, \
|
||||
Sequence, SequenceOf
|
||||
from .basetypes import AccessCredentialDisable, AccessCredentialDisableReason, \
|
||||
AccessEvent, AccessPassbackMode, AccessRule, AccessThreatLevel, \
|
||||
AccessUserType, AccessZoneOccupancyState, AccumulatorRecord, Action, \
|
||||
ActionList, AddressBinding, AssignedAccessRights, AuthenticationFactor, \
|
||||
AuthenticationFactorFormat, AuthenticationPolicy, AuthenticationStatus, \
|
||||
AuthorizationException, AuthorizationMode, BackupState, BinaryPV, \
|
||||
COVSubscription, CalendarEntry, ChannelValue, ClientCOV, \
|
||||
CredentialAuthenticationFactor, DailySchedule, DateRange, DateTime, \
|
||||
Destination, DeviceObjectPropertyReference, DeviceObjectReference, \
|
||||
DeviceStatus, DoorAlarmState, DoorSecuredStatus, DoorStatus, DoorValue, \
|
||||
EngineeringUnits, EventNotificationSubscription, EventParameter, \
|
||||
EventState, EventTransitionBits, EventType, FaultParameter, FaultType, \
|
||||
FileAccessMethod, LifeSafetyMode, LifeSafetyOperation, LifeSafetyState, \
|
||||
LightingCommand, LightingInProgress, LightingTransition, LimitEnable, \
|
||||
LockStatus, LogMultipleRecord, LogRecord, LogStatus, LoggingType, \
|
||||
Maintenance, NetworkSecurityPolicy, NodeType, NotifyType, \
|
||||
ObjectPropertyReference, ObjectTypesSupported, OptionalCharacterString, \
|
||||
Polarity, PortPermission, Prescale, PriorityArray, ProcessIdSelection, \
|
||||
ProgramError, ProgramRequest, ProgramState, PropertyAccessResult, \
|
||||
PropertyIdentifier, Recipient, Reliability, RestartReason, Scale, \
|
||||
SecurityKeySet, SecurityLevel, Segmentation, ServicesSupported, \
|
||||
SetpointReference, ShedLevel, ShedState, SilencedState, SpecialEvent, \
|
||||
StatusFlags, TimeStamp, VTClass, VTSession, WriteStatus
|
||||
from .apdu import EventNotificationParameters, ReadAccessSpecification, \
|
||||
ReadAccessResult
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
|
|
@ -5,13 +5,14 @@ Primitive Data
|
|||
"""
|
||||
|
||||
import sys
|
||||
import struct
|
||||
import time
|
||||
import re
|
||||
|
||||
from .debugging import ModuleLogger, btox
|
||||
|
||||
from .errors import DecodingError
|
||||
from .pdu import *
|
||||
from .pdu import PDUData
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
@ -1126,7 +1127,7 @@ class Date(Atomic):
|
|||
self.value = arg
|
||||
elif isinstance(arg, str):
|
||||
date_match = Date._date_regex.match(arg)
|
||||
if not tup_match:
|
||||
if not date_match:
|
||||
raise ValueError("invalid date pattern")
|
||||
date_groups = date_match.groups()
|
||||
|
||||
|
@ -1146,7 +1147,7 @@ class Date(Atomic):
|
|||
tup_list[2] -= 1900
|
||||
|
||||
# day-of-week madness
|
||||
dow = tup_groups[3]
|
||||
dow = date_groups[3]
|
||||
if dow is None:
|
||||
tup_list.append(0)
|
||||
elif (dow == '*'):
|
||||
|
@ -1239,9 +1240,9 @@ class Time(Atomic):
|
|||
pass
|
||||
elif isinstance(arg,Tag):
|
||||
self.decode(arg)
|
||||
elif isinstance(arg, types.TupleType):
|
||||
elif isinstance(arg, tuple):
|
||||
self.value = arg
|
||||
elif isinstance(arg, types.StringTypes):
|
||||
elif isinstance(arg, str):
|
||||
tup_match = Time._time_regex.match(arg)
|
||||
if not tup_match:
|
||||
raise ValueError("invalid time pattern")
|
||||
|
|
|
@ -10,7 +10,6 @@ import cPickle as pickle
|
|||
from time import time as _time, sleep as _sleep
|
||||
from StringIO import StringIO
|
||||
|
||||
from .errors import *
|
||||
from .debugging import ModuleLogger, DebugContents, bacpypes_debugging
|
||||
|
||||
from .core import deferred
|
||||
|
|
|
@ -7,7 +7,7 @@ Application Layer Protocol Data Units
|
|||
from .errors import DecodingError
|
||||
from .debugging import ModuleLogger, DebugContents, bacpypes_debugging
|
||||
|
||||
from .pdu import PCI, PDUData, NPDU
|
||||
from .pdu import PCI, PDUData
|
||||
from .primitivedata import Boolean, CharacterString, Enumerated, Integer, \
|
||||
ObjectIdentifier, ObjectType, OctetString, Real, TagList, Unsigned, \
|
||||
expand_enumerations
|
||||
|
@ -351,7 +351,7 @@ class APDU(APCI, PDUData):
|
|||
|
||||
def dict_contents(self, use_dict=None, as_class=dict):
|
||||
"""Return the contents of an object as a dict."""
|
||||
if _debug: NPDU._debug("dict_contents use_dict=%r as_class=%r key_values=%r", use_dict, as_class, key_values)
|
||||
if _debug: APDU._debug("dict_contents use_dict=%r as_class=%r", use_dict, as_class)
|
||||
|
||||
# make/extend the dictionary of content
|
||||
if use_dict is None:
|
||||
|
|
|
@ -9,8 +9,8 @@ from .comm import ApplicationServiceElement, bind
|
|||
|
||||
from .pdu import Address
|
||||
|
||||
from .primitivedata import *
|
||||
from .constructeddata import *
|
||||
from .primitivedata import Atomic, Date, Null, ObjectIdentifier, Time, Unsigned
|
||||
from .constructeddata import Any, Array, ArrayOf
|
||||
|
||||
from .appservice import StateMachineAccessPoint, ApplicationServiceAccessPoint
|
||||
from .netservice import NetworkServiceAccessPoint, NetworkServiceElement
|
||||
|
|
|
@ -9,7 +9,7 @@ import hashlib
|
|||
from .errors import EncodingError, DecodingError
|
||||
from .debugging import ModuleLogger, DebugContents, bacpypes_debugging
|
||||
|
||||
from .pdu import *
|
||||
from .pdu import LocalStation, PCI, PDUData
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
|
|
@ -7,15 +7,24 @@ BACnet Streaming Link Layer Service
|
|||
import random
|
||||
|
||||
from .debugging import ModuleLogger, DebugContents, bacpypes_debugging
|
||||
from .errors import *
|
||||
|
||||
from .comm import Client, bind, ApplicationServiceElement
|
||||
from .tcp import TCPClientDirector, TCPServerDirector, StreamToPacket
|
||||
|
||||
from .pdu import PDU, unpack_ip_addr
|
||||
from .npdu import NPDU
|
||||
from .netservice import NetworkAdapter
|
||||
|
||||
from .bsll import *
|
||||
from .bsll import AUTHENTICATION_FAILURE, AUTHENTICATION_HASH, \
|
||||
AUTHENTICATION_NO_SERVICE, AUTHENTICATION_REQUIRED, AccessChallenge, \
|
||||
AccessRequest, AccessResponse, Address, BSLCI, BSLPDU, \
|
||||
CLIENT_SERVER_SERVICE_ID, DEVICE_TO_DEVICE_SERVICE_ID, DeviceToDeviceAPDU, \
|
||||
LANE_SERVICE_ID, LocalBroadcast, NO_DEVICE_TO_DEVICE_SERVICE, \
|
||||
NO_LANE_SERVICE, NO_PROXY_SERVICE, NO_ROUTER_TO_ROUTER_SERVICE, \
|
||||
PROXY_SERVICE_ID, ProxyToServerBroadcastNPDU, ProxyToServerUnicastNPDU, \
|
||||
ROUTER_TO_ROUTER_SERVICE_ID, Result, RouterToRouterNPDU, SUCCESS, \
|
||||
ServerToProxyBroadcastNPDU, ServerToProxyUnicastNPDU, ServiceRequest, \
|
||||
UNRECOGNIZED_SERVICE, bsl_pdu_types, hash_functions
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
|
|
@ -7,7 +7,7 @@ BACnet Virtual Link Layer Module
|
|||
from .errors import EncodingError, DecodingError
|
||||
from .debugging import ModuleLogger, DebugContents, bacpypes_debugging
|
||||
|
||||
from .pdu import *
|
||||
from .pdu import Address, PCI, PDUData, unpack_ip_addr
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
@ -127,7 +127,7 @@ class BVLPDU(BVLCI, PDUData):
|
|||
|
||||
def dict_contents(self, use_dict=None, as_class=dict, key_values=()):
|
||||
"""Return the contents of an object as a dict."""
|
||||
if _debug: NPDU._debug("dict_contents use_dict=%r as_class=%r key_values=%r", use_dict, as_class, key_values)
|
||||
if _debug: BVLPDU._debug("dict_contents use_dict=%r as_class=%r key_values=%r", use_dict, as_class, key_values)
|
||||
|
||||
# make/extend the dictionary of content
|
||||
if use_dict is None:
|
||||
|
|
|
@ -8,16 +8,19 @@ import struct
|
|||
from time import time as _time
|
||||
|
||||
from .debugging import ModuleLogger, DebugContents, bacpypes_debugging
|
||||
from .errors import *
|
||||
|
||||
from . import udp
|
||||
|
||||
from .udp import UDPDirector
|
||||
from .task import OneShotTask, RecurringTask
|
||||
|
||||
from .comm import Client, Server, bind, \
|
||||
ServiceAccessPoint, ApplicationServiceElement
|
||||
|
||||
from .bvll import *
|
||||
from .pdu import Address, LocalBroadcast, LocalStation, PDU
|
||||
from .bvll import BVLPDU, DeleteForeignDeviceTableEntry, \
|
||||
DistributeBroadcastToNetwork, FDTEntry, ForwardedNPDU, \
|
||||
OriginalBroadcastNPDU, OriginalUnicastNPDU, \
|
||||
ReadBroadcastDistributionTable, ReadBroadcastDistributionTableAck, \
|
||||
ReadForeignDeviceTable, ReadForeignDeviceTableAck, RegisterForeignDevice, \
|
||||
Result, WriteBroadcastDistributionTable, bvl_pdu_types
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
@ -83,13 +86,13 @@ class UDPMultiplexer:
|
|||
|
||||
# create and bind the direct address
|
||||
self.direct = _MultiplexClient(self)
|
||||
self.directPort = udp.UDPDirector(self.addrTuple)
|
||||
self.directPort = UDPDirector(self.addrTuple)
|
||||
bind(self.direct, self.directPort)
|
||||
|
||||
# create and bind the broadcast address
|
||||
if specialBroadcast and (not noBroadcast):
|
||||
self.broadcast = _MultiplexClient(self)
|
||||
self.broadcastPort = udp.UDPDirector(self.addrBroadcastTuple, reuse=True)
|
||||
self.broadcastPort = UDPDirector(self.addrBroadcastTuple, reuse=True)
|
||||
bind(self.direct, self.broadcastPort)
|
||||
else:
|
||||
self.broadcast = None
|
||||
|
|
|
@ -9,7 +9,8 @@ import sys
|
|||
from .errors import DecodingError
|
||||
from .debugging import ModuleLogger, bacpypes_debugging
|
||||
|
||||
from .primitivedata import *
|
||||
from .primitivedata import Atomic, ClosingTag, OpeningTag, Tag, TagList, \
|
||||
Unsigned
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
|
|
@ -12,13 +12,8 @@ from .errors import ConfigurationError
|
|||
from .comm import Client, Server, bind, \
|
||||
ServiceAccessPoint, ApplicationServiceElement
|
||||
|
||||
from .npdu import Address, DecodingError, DisconnectConnectionToNetwork, \
|
||||
EstablishConnectionToNetwork, GlobalBroadcast, IAmRouterToNetwork, \
|
||||
ICouldBeRouterToNetwork, InitializeRoutingTable, InitializeRoutingTableAck, \
|
||||
LocalBroadcast, LocalStation, NPCI, NPDU, NetworkNumberIs, \
|
||||
PCI, PDU, PDUData, RejectMessageToNetwork, RemoteBroadcast, RemoteStation, \
|
||||
RouterAvailableToNetwork, RouterBusyToNetwork, RoutingTableEntry, \
|
||||
WhatIsNetworkNumber, WhoIsRouterToNetwork
|
||||
from .pdu import Address, LocalBroadcast, LocalStation, PDU, RemoteStation
|
||||
from .npdu import IAmRouterToNetwork, NPDU, WhoIsRouterToNetwork, npdu_types
|
||||
from .apdu import APDU as _APDU
|
||||
|
||||
# some debugging
|
||||
|
|
|
@ -7,8 +7,8 @@ NPDU
|
|||
from .errors import DecodingError
|
||||
from .debugging import ModuleLogger, DebugContents, bacpypes_debugging, btox
|
||||
|
||||
from .pdu import Address, LocalStation, LocalBroadcast, RemoteStation, RemoteBroadcast, \
|
||||
GlobalBroadcast, PCI, PDU, PDUData
|
||||
from .pdu import Address, RemoteStation, RemoteBroadcast, GlobalBroadcast, \
|
||||
PCI, PDUData
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
@ -205,7 +205,7 @@ class NPCI(PCI, DebugContents):
|
|||
|
||||
def npci_contents(self, use_dict=None, as_class=dict):
|
||||
"""Return the contents of an object as a dict."""
|
||||
if _debug: npci._debug("npci_contents use_dict=%r as_class=%r", use_dict, as_class)
|
||||
if _debug: NPCI._debug("npci_contents use_dict=%r as_class=%r", use_dict, as_class)
|
||||
|
||||
# make/extend the dictionary of content
|
||||
if use_dict is None:
|
||||
|
@ -273,7 +273,7 @@ class NPDU(NPCI, PDUData):
|
|||
|
||||
def dict_contents(self, use_dict=None, as_class=dict):
|
||||
"""Return the contents of an object as a dict."""
|
||||
if _debug: NPDU._debug("dict_contents use_dict=%r as_class=%r key_values=%r", use_dict, as_class, key_values)
|
||||
if _debug: NPDU._debug("dict_contents use_dict=%r as_class=%r", use_dict, as_class)
|
||||
|
||||
# make/extend the dictionary of content
|
||||
if use_dict is None:
|
||||
|
|
|
@ -9,10 +9,36 @@ import sys
|
|||
from .errors import ConfigurationError, ExecutionError
|
||||
from .debugging import function_debugging, ModuleLogger, Logging
|
||||
|
||||
from .primitivedata import *
|
||||
from .constructeddata import *
|
||||
from .basetypes import *
|
||||
from .apdu import EventNotificationParameters, ReadAccessSpecification, ReadAccessResult
|
||||
from .primitivedata import Atomic, BitString, Boolean, CharacterString, Date, \
|
||||
Double, Integer, ObjectIdentifier, ObjectType, OctetString, Real, Time, \
|
||||
Unsigned
|
||||
from .constructeddata import AnyAtomic, Array, ArrayOf, Choice, Element, \
|
||||
Sequence, SequenceOf
|
||||
from .basetypes import AccessCredentialDisable, AccessCredentialDisableReason, \
|
||||
AccessEvent, AccessPassbackMode, AccessRule, AccessThreatLevel, \
|
||||
AccessUserType, AccessZoneOccupancyState, AccumulatorRecord, Action, \
|
||||
ActionList, AddressBinding, AssignedAccessRights, AuthenticationFactor, \
|
||||
AuthenticationFactorFormat, AuthenticationPolicy, AuthenticationStatus, \
|
||||
AuthorizationException, AuthorizationMode, BackupState, BinaryPV, \
|
||||
COVSubscription, CalendarEntry, ChannelValue, ClientCOV, \
|
||||
CredentialAuthenticationFactor, DailySchedule, DateRange, DateTime, \
|
||||
Destination, DeviceObjectPropertyReference, DeviceObjectReference, \
|
||||
DeviceStatus, DoorAlarmState, DoorSecuredStatus, DoorStatus, DoorValue, \
|
||||
EngineeringUnits, EventNotificationSubscription, EventParameter, \
|
||||
EventState, EventTransitionBits, EventType, FaultParameter, FaultType, \
|
||||
FileAccessMethod, LifeSafetyMode, LifeSafetyOperation, LifeSafetyState, \
|
||||
LightingCommand, LightingInProgress, LightingTransition, LimitEnable, \
|
||||
LockStatus, LogMultipleRecord, LogRecord, LogStatus, LoggingType, \
|
||||
Maintenance, NetworkSecurityPolicy, NodeType, NotifyType, \
|
||||
ObjectPropertyReference, ObjectTypesSupported, OptionalCharacterString, \
|
||||
Polarity, PortPermission, Prescale, PriorityArray, ProcessIdSelection, \
|
||||
ProgramError, ProgramRequest, ProgramState, PropertyAccessResult, \
|
||||
PropertyIdentifier, Recipient, Reliability, RestartReason, Scale, \
|
||||
SecurityKeySet, SecurityLevel, Segmentation, ServicesSupported, \
|
||||
SetpointReference, ShedLevel, ShedState, SilencedState, SpecialEvent, \
|
||||
StatusFlags, TimeStamp, VTClass, VTSession, WriteStatus
|
||||
from .apdu import EventNotificationParameters, ReadAccessSpecification, \
|
||||
ReadAccessResult
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
|
|
@ -506,7 +506,7 @@ class PDU(PCI, PDUData):
|
|||
super(PDU, self).__init__(*args, **kwargs)
|
||||
|
||||
def __str__(self):
|
||||
return '<%s %s -> %s : %s>' % (self.__class__.__name__, self.pduSource, self.pduDestination, _str_to_hex(self.pduData,'.'))
|
||||
return '<%s %s -> %s : %s>' % (self.__class__.__name__, self.pduSource, self.pduDestination, btox(self.pduData,'.'))
|
||||
|
||||
def dict_contents(self, use_dict=None, as_class=dict):
|
||||
"""Return the contents of an object as a dict."""
|
||||
|
|
|
@ -5,13 +5,14 @@ Primitive Data
|
|||
"""
|
||||
|
||||
import sys
|
||||
import struct
|
||||
import time
|
||||
import re
|
||||
|
||||
from .debugging import ModuleLogger, btox
|
||||
|
||||
from .errors import DecodingError
|
||||
from .pdu import *
|
||||
from .pdu import PDUData
|
||||
|
||||
# some debugging
|
||||
_debug = 0
|
||||
|
@ -1122,7 +1123,7 @@ class Date(Atomic):
|
|||
self.value = arg
|
||||
elif isinstance(arg, str):
|
||||
date_match = Date._date_regex.match(arg)
|
||||
if not tup_match:
|
||||
if not date_match:
|
||||
raise ValueError("invalid date pattern")
|
||||
date_groups = date_match.groups()
|
||||
|
||||
|
@ -1142,7 +1143,7 @@ class Date(Atomic):
|
|||
tup_list[2] -= 1900
|
||||
|
||||
# day-of-week madness
|
||||
dow = tup_groups[3]
|
||||
dow = date_groups[3]
|
||||
if dow is None:
|
||||
tup_list.append(0)
|
||||
elif (dow == '*'):
|
||||
|
@ -1237,6 +1238,25 @@ class Time(Atomic):
|
|||
self.decode(arg)
|
||||
elif isinstance(arg, tuple):
|
||||
self.value = arg
|
||||
elif isinstance(arg, str):
|
||||
tup_match = Time._time_regex.match(arg)
|
||||
if not tup_match:
|
||||
raise ValueError("invalid time pattern")
|
||||
|
||||
tup_list = []
|
||||
for s in tup_match:
|
||||
if s == '*':
|
||||
tup_list.append(255)
|
||||
elif s in None:
|
||||
tup_list.append(0)
|
||||
else:
|
||||
tup_list.append(int(s))
|
||||
|
||||
# fix the hundredths if necessary
|
||||
if (tup_list[3] > 0) and (tup_list[3] < 10):
|
||||
tup_list[3] = tup_list[3] * 10
|
||||
|
||||
self.value = tuple(tup_list)
|
||||
elif isinstance(arg, Time):
|
||||
self.value = arg.value
|
||||
else:
|
||||
|
|
|
@ -10,7 +10,6 @@ import pickle
|
|||
from time import time as _time, sleep as _sleep
|
||||
from io import StringIO
|
||||
|
||||
from .errors import *
|
||||
from .debugging import ModuleLogger, DebugContents, bacpypes_debugging
|
||||
|
||||
from .core import deferred
|
||||
|
|
1
tests/test_comm/test_client.py
Normal file
1
tests/test_comm/test_client.py
Normal file
|
@ -0,0 +1 @@
|
|||
# placeholder
|
1
tests/test_comm/test_pdudata.py
Normal file
1
tests/test_comm/test_pdudata.py
Normal file
|
@ -0,0 +1 @@
|
|||
# placeholder
|
1
tests/test_comm/test_server.py
Normal file
1
tests/test_comm/test_server.py
Normal file
|
@ -0,0 +1 @@
|
|||
# placeholder
|
Loading…
Reference in New Issue
Block a user