BACnet icon indicating copy to clipboard operation
BACnet copied to clipboard

Priority Array read throwing ERROR CODE UNKNOWN PROPERTY

Open mwitt1337 opened this issue 4 years ago • 8 comments

I'm able to read properties and values from the object list without issue until I try to read the priority array.

Code below and screenshot of console output attached.

public BacnetDevice ReadDeviceProperties(BacnetDevice objDevice)
{
  Bacnet_client.ReadPropertyRequest(objDevice.Address, new BacnetObjectId(BacnetObjectTypes.OBJECT_DEVICE, objDevice.InstanceId), BacnetPropertyIds.PROP_OBJECT_LIST, out IList<BacnetValue> value_list);
  LinkedList<BacnetObjectId> object_list = new LinkedList<BacnetObjectId>();
  StringBuilder strOut = new StringBuilder();


  foreach (BacnetValue value in value_list)
  {
    if (Enum.IsDefined(typeof(BacnetObjectTypes), ((BacnetObjectId)value.Value).Type))
      object_list.AddLast((BacnetObjectId)value.Value);
  }

  foreach (BacnetObjectId object_id in object_list)
  {
    //read all properties
    IList<BacnetValue> values = null;
    IList<BacnetValue> priority = null;
    IList<BacnetValue> names = null;
    bool listProps = true;
    


    try
    {
      if (!Bacnet_client.ReadPropertyRequest(objDevice.Address, object_id, BacnetPropertyIds.PROP_OBJECT_NAME, out names))
      {

      }

      if (!Bacnet_client.ReadPropertyRequest(objDevice.Address, object_id, BacnetPropertyIds.PROP_PRESENT_VALUE, out values))
      {
        
      }

      strOut.AppendLine("Device id:" + objDevice.InstanceId + " Property Name:" + names[0] + " Value:" + values[0]);

      if (!Bacnet_client.ReadPropertyRequest(objDevice.Address, object_id, BacnetPropertyIds.PROP_PRIORITY_ARRAY, out priority))
      {

      }

      if (listProps)
        foreach (BacnetValue v in priority)
        {
          strOut.AppendLine("Priority: " + v);
        }

      continue;
    }
    catch (Exception ex)
    {
      strOut.AppendLine("Exception:" + ex.Message);
      //perhaps the 'present value' is non existing - ignore
      continue;
    }
  }
  Console.Write(strOut.ToString());
  return objDevice;
}

image

mwitt1337 avatar Oct 19 '20 18:10 mwitt1337

Hi @mwitt1337, would you be able to provide me wireshark dump with the request and response (only those packets needed) which is triggering the error? This would be the easiest way to fix it. Thanks!

gralin avatar Oct 20 '20 07:10 gralin

I'm trying to figure out what's going on here because there is a growing list of Property Ids that are returning Unknown Property.

I've attached a screenshot from BDT 2.12.01 Bacnet Explorer that returns values for these properties from the same devices that are returning Unknown Property using this API.

Of course the first instinct is to think that the device address is incorrect but shown in my screenshot in the initial post the property name and current value is returning without issue.

Image 9

mwitt1337 avatar Oct 20 '20 13:10 mwitt1337

Here is my list of tested properties

FAILED: UNKNOWN PROPERTY PROP_SYSTEM_STATUS PROP_VENDOR_NAME PROP_VENDOR_IDENTIFIER PROP_MODEL_NAME FIRMWARE_REVISION PROP_APPLICATION_SOFTWARE_VERSION PROP_PROTOCOL_SERVICES_SUPPORTED PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED PROP_LOCAL_DATE PROP_LOCAL_TIME PROP_MAX_MASTER PROP_PRIORITY_ARRAY PROP_PRIORITY

RETURNED VALUES PROP_OBJECT_NAME PROP_PRESENT_VALUE PROP_STATUS_FLAGS = 0000

mwitt1337 avatar Oct 20 '20 13:10 mwitt1337

Hi @mwitt1337, would you be able to provide me wireshark dump with the request and response (only those packets needed) which is triggering the error? This would be the easiest way to fix it. Thanks!

Working on getting the Wireshark data

mwitt1337 avatar Oct 20 '20 13:10 mwitt1337

Dumped from code loop in this thread trying to read priority array.

dump.zip

mwitt1337 avatar Oct 20 '20 22:10 mwitt1337

Thanks @mwitt1337 I will look into this.

gralin avatar Oct 21 '20 13:10 gralin

Update from more testing

I tested the property PROP_VENDOR_NAME and it returns a value for the device that responds to the WhoIs. For clarity here are the steps:

  1. Device responds to WhoIs. We will call this ParentDevice
  2. Successfully read the PROP_OBJECT_LIST from the ParentDevice
  3. Loop through the PROP_OBJECT_LIST. We will call each of these ChildDevice
  4. Call ReadPropertyRequest for each ChildDevice using PROP_OBJECT_NAME and it returns a value
  5. Call ReadPropertyRequest for each ChildDevice using PROP_PRESENT_VALUE and it returns a value
  6. Call ReadPropertyRequest for each ChildDevice using PROP_VENDOR_NAME and it throws Exception UNKNOWN_PROPERTY

The "ParentDevice" returns values for PROP_VENDOR_NAME but each "ChildDevice" returns UNKNOWN_PROPERTY. The "ChildDevice" will return values for PROP_OBJECT_NAME and PROP_PRESENT_VALUE

mwitt1337 avatar Oct 23 '20 14:10 mwitt1337

Any updates?

mwitt1337 avatar Oct 28 '20 18:10 mwitt1337