How to use the bacpypes.primitivedata.CharacterString 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 / test_primitive_data / test_character_string.py View on Github external
def character_string_decode(tag):
    """Decode an character_string application tag into an character_string."""
    if _debug: character_string_decode._debug("character_string_decode %r", tag)

    obj = CharacterString(tag)
    if _debug: character_string_decode._debug("    - obj: %r", obj)

    return obj
github JoelBender / bacpypes / tests / test_objects / test_ScheduleObject.py View on Github external
, (OptionalProperty,'weeklySchedule', ArrayOf(DailySchedule))
        , (OptionalProperty,'exceptionSchedule', ArrayOf(SpecialEvent))
        , (ReadableProperty,'scheduleDefault', AnyAtomic)
        , (ReadableProperty,'listOfObjectPropertyReferences', SequenceOf(DeviceObjectPropertyReference))
        , (ReadableProperty,'priorityForWriting', Unsigned)
        , (ReadableProperty,'statusFlags', StatusFlags)
        , (ReadableProperty,'reliability', Reliability)
        , (ReadableProperty,'outOfService', Boolean)
        , (OptionalProperty,'eventDetectionEnable', Boolean)
        , (OptionalProperty,'notificationClass', Unsigned)
        , (OptionalProperty,'eventEnable', EventTransitionBits)
        , (ReadableProperty,'eventState', EventState)
        , (OptionalProperty,'ackedTransitions', EventTransitionBits)
        , (OptionalProperty,'notifyType', NotifyType)
        , (OptionalProperty,'eventTimeStamps', ArrayOf(TimeStamp))
        , (OptionalProperty,'eventMessageTexts', ArrayOf(CharacterString))
        , (OptionalProperty,'eventMessageTextsConfig', ArrayOf(CharacterString))
        , (OptionalProperty,'reliabilityEvaluationInhibit', Boolean)
        ]
github JoelBender / bacpypes / tests / test_objects / test_LoopObject.py View on Github external
, (OptionalProperty,'derivativeConstant', Real)
        , (OptionalProperty,'derivativeConstantUnits', EngineeringUnits)
        , (OptionalProperty,'bias', Real)
        , (OptionalProperty,'maximumOutput', Real)
        , (OptionalProperty,'minimumOutput', Real)
        , (ReadableProperty,'priorityForWriting', Unsigned)
        , (OptionalProperty,'covIncrement', Real)
        , (OptionalProperty,'timeDelay', Unsigned)
        , (OptionalProperty,'notificationClass', Unsigned)
        , (OptionalProperty,'errorLimit', Real)
        , (OptionalProperty,'deadband', Real)
        , (OptionalProperty,'eventEnable', EventTransitionBits)
        , (OptionalProperty,'ackedTransitions', EventTransitionBits)
        , (OptionalProperty,'notifyType', NotifyType)
        , (OptionalProperty,'eventTimeStamps', ArrayOf(TimeStamp))
        , (OptionalProperty,'eventMessageTexts', ArrayOf(CharacterString))
        , (OptionalProperty,'eventMessageTextsConfig', ArrayOf(CharacterString))
        , (OptionalProperty,'eventDetectionEnable', Boolean)
        , (OptionalProperty,'eventAlgorithmInhibitRef', ObjectPropertyReference)
        , (OptionalProperty,'eventAlgorithmInhibit', Boolean)
        , (OptionalProperty,'timeDelayNormal', Unsigned)
        , (OptionalProperty,'reliabilityEvaluationInhibit', Boolean)
        ]
github JoelBender / bacpypes / tests / test_primitive_data / test_character_string.py View on Github external
def test_character_string_str(self):
        if _debug: TestCharacterString._debug("test_character_string_str")

        obj = CharacterString("hello")
        assert obj.value == "hello"
        assert str(obj) == "CharacterString(0,X'68656c6c6f')"
github JoelBender / bacpypes / tests / test_objects / test_EventLogObject.py View on Github external
, (OptionalProperty,'stopTime', DateTime)
        , (ReadableProperty,'stopWhenFull', Boolean)
        , (ReadableProperty,'bufferSize', Unsigned)
        , (ReadableProperty,'logBuffer', SequenceOf(EventLogRecord))
        , (WritableProperty,'recordCount', Unsigned)
        , (ReadableProperty,'totalRecordCount', Unsigned)
        , (OptionalProperty,'notificationThreshold', Unsigned)
        , (OptionalProperty,'recordsSinceNotification', Unsigned)
        , (OptionalProperty,'lastNotifyRecord', Unsigned)
        , (OptionalProperty,'notificationClass', Unsigned)
        , (OptionalProperty,'eventEnable', EventTransitionBits)
        , (OptionalProperty,'ackedTransitions', EventTransitionBits)
        , (OptionalProperty,'notifyType', NotifyType)
        , (OptionalProperty,'eventTimeStamps', ArrayOf(TimeStamp))
        , (OptionalProperty,'eventMessageTexts', ArrayOf(CharacterString))
        , (OptionalProperty,'eventMessageTextsConfig', ArrayOf(CharacterString))
        , (OptionalProperty,'eventDetectionEnable', Boolean)
        , (OptionalProperty,'eventAlgorithmInhibitRef', ObjectPropertyReference)
        , (OptionalProperty,'eventAlgorithmInhibit', Boolean)
        ]
github JoelBender / bacpypes / tests / test_objects / test_EventLogObject.py View on Github external
, (OptionalProperty,'startTime', DateTime)
        , (OptionalProperty,'stopTime', DateTime)
        , (ReadableProperty,'stopWhenFull', Boolean)
        , (ReadableProperty,'bufferSize', Unsigned)
        , (ReadableProperty,'logBuffer', SequenceOf(EventLogRecord))
        , (WritableProperty,'recordCount', Unsigned)
        , (ReadableProperty,'totalRecordCount', Unsigned)
        , (OptionalProperty,'notificationThreshold', Unsigned)
        , (OptionalProperty,'recordsSinceNotification', Unsigned)
        , (OptionalProperty,'lastNotifyRecord', Unsigned)
        , (OptionalProperty,'notificationClass', Unsigned)
        , (OptionalProperty,'eventEnable', EventTransitionBits)
        , (OptionalProperty,'ackedTransitions', EventTransitionBits)
        , (OptionalProperty,'notifyType', NotifyType)
        , (OptionalProperty,'eventTimeStamps', ArrayOf(TimeStamp))
        , (OptionalProperty,'eventMessageTexts', ArrayOf(CharacterString))
        , (OptionalProperty,'eventMessageTextsConfig', ArrayOf(CharacterString))
        , (OptionalProperty,'eventDetectionEnable', Boolean)
        , (OptionalProperty,'eventAlgorithmInhibitRef', ObjectPropertyReference)
        , (OptionalProperty,'eventAlgorithmInhibit', Boolean)
        ]
github JoelBender / bacpypes / tests / test_objects / test_StructuredViewObject.py View on Github external
def setUp(self):
        if _debug: Test_StructuredViewObject._debug("Test_StructuredViewObject")
        self.obj = StructuredViewObject()
        self.objType = 'structuredView'
        self.identifiers = self.build_list_of_identifiers(self.obj.properties)
        self.numberOfPropertiesRequired = 4
        self.writeValue = 0
        self.listOfProperties = \
        [ (ReadableProperty,'nodeType', NodeType)
        , (OptionalProperty,'nodeSubtype', CharacterString)
        , (ReadableProperty,'subordinateList', ArrayOf(DeviceObjectReference))
        , (OptionalProperty,'subordinateAnnotations', ArrayOf(CharacterString))
        ]
github JoelBender / bacpypes / tests / test_service / test_object.py View on Github external
# not an array, write access denied
        with self.assertRaises(ExecutionError):
            obj.ReadProperty('location', 0)

        # write access successful
        obj.WriteProperty('location', "work")
        assert obj.location == "work"

        # wrong data type
        with self.assertRaises(InvalidParameterDatatype):
            obj.WriteProperty('location', 12)


# array of character strings
ArrayOfCharacterString = ArrayOf(CharacterString)

@bacpypes_debugging
@register_object_type(vendor_id=999)
class SampleWritableArray(Object):

    objectType = 'sampleWritableLocation'
    properties = [
        WritableProperty('location', ArrayOfCharacterString),
        ]

    def __init__(self, **kwargs):
        if _debug: SampleWritableArray._debug("__init__ %r", kwargs)
        Object.__init__(self, **kwargs)


@bacpypes_debugging
github JoelBender / bacpypes / samples / LocalScheduleObject.py View on Github external
objectIdentifier=('schedule', 3),
        objectName='Schedule 3',
        presentValue=CharacterString(""),
        effectivePeriod=DateRange(
            startDate=(0, 1, 1, 1),
            endDate=(254, 12, 31, 2),
            ),
        exceptionSchedule=ArrayOf(SpecialEvent)([
            SpecialEvent(
                period=SpecialEventPeriod(
                    calendarEntry=CalendarEntry(
                        weekNDay=xtob("FF.FF.05"),
                        ),
                    ),
                listOfTimeValues=[
                    TimeValue(time=(0,0,0,0), value=CharacterString("It's Friday!")),
                    ],
                eventPriority=1,
                ),
            ]),
        scheduleDefault=CharacterString("Keep working."),
        )
    _log.debug("    - so: %r", so)
    this_application.add_object(so)
    schedule_objects.append(so)

    #
    #   A schedule object that refers to an AnalogValueObject in the test
    #   device.
    #
    so = LocalScheduleObject(
        objectIdentifier=('schedule', 4),
github ChristianTremblay / BAC0 / BAC0 / core / proprietary_objects / jci.py View on Github external
Property,
    register_object_type,
)

#
#   Proprietary Objects and their attributes
#

JCIDeviceObject = {
    "name": "JCIDeviceObject",
    "vendor_id": 5,
    "objectType": "device",
    "bacpypes_type": DeviceObject,
    "properties": {
        "SupervisorOnline": {"obj_id": 3653, "primitive": Boolean, "mutable": True},
        "Model": {"obj_id": 1320, "primitive": CharacterString, "mutable": False},
        "MemoryUsage": {"obj_id": 2581, "primitive": Real, "mutable": False},
        "ObjectMemoryUsage": {"obj_id": 2582, "primitive": Real, "mutable": False},
        "CPU": {"obj_id": 2583, "primitive": Real, "mutable": False},
        "FlashUsage": {"obj_id": 2584, "primitive": Real, "mutable": False},
        "JCISystemStatus": {"obj_id": 847, "primitive": Enumerated, "mutable": False},
        "SABusPerformance": {
            "obj_id": 12157,
            "primitive": Enumerated,
            "mutable": False,
        },
        "SABusTokenLoopTime": {
            "obj_id": 12158,
            "primitive": Unsigned,
            "mutable": False,
        },
        "SABusCOVRcvPerMinute": {