System.IO.BACnet - 发送 ReadPropertyMultiple 而不指定 BacnetPropertyReference->propertyArrayIndex

System.IO.BACnet - send ReadPropertyMultiple without specifying BacnetPropertyReference->propertyArrayIndex

我正在为我的 C# BACNet 客户端使用 System.IO.BACnet 库。

我正在尝试向服务器发送“ReadPropertyMultiple”请求,但是我无法读取非数组 BACNet 属性,因为 System.IO.BACnet.BacnetClient.ReadPropertyMultipleRequest 需要 System.IO.BACnet.BacnetPropertyReference 列表(s) ...

public bool ReadPropertyMultipleRequest(BacnetAddress address, BacnetObjectId objectId, IList<BacnetPropertyReference> propertyIdAndArrayIndex, out IList<BacnetReadAccessResult> values, byte invokeId = 0);

.. 和 System.IO.BACnet.BacnetPropertyReference 需要 propertyArrayIndex ..

public struct BacnetPropertyReference
{
    public uint propertyIdentifier;
    public uint propertyArrayIndex;

    public BacnetPropertyReference(uint id, uint arrayIndex);

    public BacnetPropertyIds GetPropertyId();
    public override string ToString();
}

.. 如果未设置,则默认为 0。这会导致在发送带有此列表的请求后,所有属性都使用 propertyArrayIndex: 0 进行请求,这对于非数组对象属性将失败。

示例:

要求:

回复:

不将 propertyArrayIndex 添加到请求中从而能够使用 ReadPropertyMultiple 请求读取非数组属性的正确方法是什么?

如果您请求 array-index“0”,您应该(理论上)收到(后续)元素的数量,而不是完整的值列表(/包含值的剩余元素)。

您不能为 non-array 项使用 (the) 'Read-Property'(服务)吗 (?)。

解决方法是设置propertyArrayIndex = uint.MaxValue.

例如:

BacnetPropertyReference reff = new BacnetPropertyReference((uint) BacnetPropertyIds.PROP_PRESENT_VALUE, uint.MaxValue);