MangoAutomation / BACnet4J

BACnet/IP stack written in Java. Forked from http://sourceforge.net/projects/bacnet4j/
GNU General Public License v3.0
188 stars 111 forks source link

Wrong object properties defined for weeklySchedule? #45

Closed Frozenlock closed 5 years ago

Frozenlock commented 5 years ago

The PropertyTypeDefinition for weeklySchedule appears to return inconsistent information (unless I misunderstood something):

getArrayLength -> 7

isArray -> false

Even the other sequence-like methods return false: isCollection -> false isList -> false

Shouldn't isArray return true whenever getArrayLength is larger than zero?

michelseiler commented 5 years ago

According to BACnet Standard 135-2016, it should be a BACnetARRAY [7] of BACnetDailySchedule.

I get the correct output with my (not up to date) fork:

ObjectPropertyTypeDefinition objectPropertyTypeDefinition = ObjectProperties.getObjectPropertyTypeDefinition(ObjectType.schedule, PropertyIdentifier.weeklySchedule);
System.out.println("clazz: " + objectPropertyTypeDefinition.getPropertyTypeDefinition().getClazz());
System.out.println("isCollection: " + objectPropertyTypeDefinition.getPropertyTypeDefinition().isCollection());
System.out.println("isArray: " + objectPropertyTypeDefinition.getPropertyTypeDefinition().isArray());
System.out.println("isList: " + objectPropertyTypeDefinition.getPropertyTypeDefinition().isList());
System.out.println("arrayLength: " + objectPropertyTypeDefinition.getPropertyTypeDefinition().getArrayLength());

// Output:
// clazz: class com.serotonin.bacnet4j.type.constructed.DailySchedule
// isCollection: true
// isArray: true
// isList: false
// arrayLength: 7
michelseiler commented 5 years ago

I have run the code with the master branch and get the same result.

Frozenlock commented 5 years ago

Yes, you are correct. I tried again, from scratch, and It was caused by a mistake on my part when retrieving the property. My apologies.