For epics creation, if not showing the actual values, replace Present_Value and Priority_Array values with a single question mark, just as VTS3 wants it. (Ie, print "?" and not "{?, ?}" ).

Various small fixes to remove warnings and make assertion statements more meaningful when they are tripped.
This commit is contained in:
tbrennan3
2010-08-24 20:04:43 +00:00
parent fd22542ad1
commit 968687b4f4
+42 -15
View File
@@ -396,9 +396,29 @@ void PrintReadPropertyData(
return; return;
} }
if ((value != NULL) && (value->next != NULL)) { if ((value != NULL) && (value->next != NULL)) {
/* Then this is an array of values; open brace */ /* Then this is an array of values.
fprintf(stdout, "{ "); * But are we showing Values? We (VTS3) want ? instead of {?,?} to show up. */
print_brace = true; /* remember to close it */ switch( rpm_property->propertyIdentifier )
{
/* Screen the Properties that can be arrays or Sequences */
case PROP_PRESENT_VALUE:
case PROP_PRIORITY_ARRAY:
if (!ShowValues) {
fprintf(stdout, "? \r\n");
/* We want the Values freed below, but don't want to
* print anything for them. To achieve this, swap
* out the Property for a non-existent Property
* and catch that below. */
rpm_property->propertyIdentifier = PROP_PROTOCOL_CONFORMANCE_CLASS;
break;
}
/* Else, fall through to normal processing. */
default:
/* Normal array: open brace */
fprintf(stdout, "{ ");
print_brace = true; /* remember to close it */
break;
}
} }
if (!Using_Walked_List) if (!Using_Walked_List)
@@ -422,7 +442,7 @@ void PrintReadPropertyData(
Object_List_Length = value->type.Unsigned_Int; Object_List_Length = value->type.Unsigned_Int;
break; break;
} else } else
assert(Walked_List_Index == assert(Walked_List_Index == (uint32_t)
rpm_property->propertyArrayIndex); rpm_property->propertyArrayIndex);
} else { } else {
Walked_List_Index++; Walked_List_Index++;
@@ -442,8 +462,8 @@ void PrintReadPropertyData(
} }
if (rpm_property->propertyIdentifier == PROP_OBJECT_LIST) { if (rpm_property->propertyIdentifier == PROP_OBJECT_LIST) {
if (value->tag != BACNET_APPLICATION_TAG_OBJECT_ID) { if ( value->tag != BACNET_APPLICATION_TAG_OBJECT_ID) {
assert(false); /* Something not right here */ assert(value->tag == BACNET_APPLICATION_TAG_OBJECT_ID); /* Something not right here */
break; break;
} }
/* Store the object list so we can interrogate /* Store the object list so we can interrogate
@@ -470,7 +490,7 @@ void PrintReadPropertyData(
} else if (rpm_property->propertyIdentifier == } else if (rpm_property->propertyIdentifier ==
PROP_SUBORDINATE_LIST) { PROP_SUBORDINATE_LIST) {
if (value->tag != BACNET_APPLICATION_TAG_OBJECT_ID) { if (value->tag != BACNET_APPLICATION_TAG_OBJECT_ID) {
assert(false); /* Something not right here */ assert(value->tag == BACNET_APPLICATION_TAG_OBJECT_ID); /* Something not right here */
break; break;
} }
/* TODO: handle Sequence of { Device ObjID, Object ID }, */ /* TODO: handle Sequence of { Device ObjID, Object ID }, */
@@ -502,6 +522,10 @@ void PrintReadPropertyData(
rpm_property->propertyIdentifier); rpm_property->propertyIdentifier);
break; break;
/* Our special non-existent case; do nothing further here. */
case PROP_PROTOCOL_CONFORMANCE_CLASS:
break;
default: default:
/* Some properties are presented just as '?' in an EPICS; /* Some properties are presented just as '?' in an EPICS;
* screen these out here, unless ShowValues is true. */ * screen these out here, unless ShowValues is true. */
@@ -582,7 +606,7 @@ static uint8_t Read_Properties(
{ {
uint8_t invoke_id = 0; uint8_t invoke_id = 0;
struct special_property_list_t PropertyListStruct; struct special_property_list_t PropertyListStruct;
int i; uint i;
if ((!Has_RPM && (Property_List_Index == 0)) || if ((!Has_RPM && (Property_List_Index == 0)) ||
(Property_List_Length == 0)) { (Property_List_Length == 0)) {
@@ -858,9 +882,7 @@ int main(
int argc, int argc,
char *argv[]) char *argv[])
{ {
BACNET_ADDRESS src = { BACNET_ADDRESS src; /* address where message came from */
0
}; /* address where message came from */
uint16_t pdu_len = 0; uint16_t pdu_len = 0;
unsigned timeout = 100; /* milliseconds */ unsigned timeout = 100; /* milliseconds */
unsigned max_apdu = 0; unsigned max_apdu = 0;
@@ -876,6 +898,7 @@ int main(
KEY nextKey; KEY nextKey;
CheckCommandLineArgs(argc, argv); /* Won't return if there is an issue. */ CheckCommandLineArgs(argc, argv); /* Won't return if there is an issue. */
memset(&src, 0, sizeof( BACNET_ADDRESS));
/* setup my info */ /* setup my info */
Device_Set_Object_Instance_Number(BACNET_MAX_INSTANCE); Device_Set_Object_Instance_Number(BACNET_MAX_INSTANCE);
@@ -964,6 +987,7 @@ int main(
/* Update times; aids single-step debugging */ /* Update times; aids single-step debugging */
last_seconds = current_seconds; last_seconds = current_seconds;
StartNextObject(rpm_object, &myObject); StartNextObject(rpm_object, &myObject);
invoke_id = invoke_id =
Send_Read_Property_Multiple_Request(buffer, MAX_PDU, Send_Read_Property_Multiple_Request(buffer, MAX_PDU,
Target_Device_Object_Instance, rpm_object); Target_Device_Object_Instance, rpm_object);
@@ -1062,8 +1086,9 @@ int main(
(invoke_id == (invoke_id ==
Read_Property_Multiple_Data.service_data.invoke_id)) { Read_Property_Multiple_Data.service_data.invoke_id)) {
Read_Property_Multiple_Data.new_data = false; Read_Property_Multiple_Data.new_data = false;
PrintReadPropertyData(Read_Property_Multiple_Data. PrintReadPropertyData
rpm_data->listOfProperties); (Read_Property_Multiple_Data.rpm_data->
listOfProperties);
if (tsm_invoke_id_free(invoke_id)) { if (tsm_invoke_id_free(invoke_id)) {
invoke_id = 0; invoke_id = 0;
} else { } else {
@@ -1142,7 +1167,7 @@ int main(
printf(" { \r\n"); printf(" { \r\n");
/* Test code: /* Test code:
if ( myObject.type == OBJECT_STRUCTURED_VIEW ) if ( myObject.type == OBJECT_STRUCTURED_VIEW )
printf( " -- Structured View %d \n", myObject.instance ); printf( " -- Structured View %d \n", myObject.instance );
*/ */
} else { } else {
/* Closing brace for the last Object */ /* Closing brace for the last Object */
@@ -1187,4 +1212,6 @@ int main(
return 0; return 0;
} }
/*@} *//* End group BACEPICS */ /*@} */
/* End group BACEPICS */