Corrected epics demo handling of proprietary properties.
This commit is contained in:
@@ -392,16 +392,6 @@ void PrintReadPropertyData(
|
|||||||
bactext_error_code_name((int) rpm_property->error.error_code));
|
bactext_error_code_name((int) rpm_property->error.error_code));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
if (data->array_index == BACNET_ARRAY_ALL)
|
|
||||||
fprintf(stderr, "%s #%u %s\n",
|
|
||||||
bactext_object_type_name(data->object_type), data->object_instance,
|
|
||||||
bactext_property_name(data->object_property));
|
|
||||||
else
|
|
||||||
fprintf(stderr, "%s #%u %s[%d]\n",
|
|
||||||
bactext_object_type_name(data->object_type), data->object_instance,
|
|
||||||
bactext_property_name(data->object_property), data->array_index);
|
|
||||||
#endif
|
|
||||||
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; open brace */
|
||||||
fprintf(stdout, "{ ");
|
fprintf(stdout, "{ ");
|
||||||
@@ -552,6 +542,19 @@ void PrintReadPropertyData(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Print the property identifier name to stdout,
|
||||||
|
* handling the proprietary property numbers.
|
||||||
|
* @param propertyIdentifier [in] The property identifier number.
|
||||||
|
*/
|
||||||
|
void Print_Property_Identifier(uint32_t propertyIdentifier)
|
||||||
|
{
|
||||||
|
if (propertyIdentifier < 512) {
|
||||||
|
fprintf(stdout, "%s", bactext_property_name(propertyIdentifier));
|
||||||
|
} else {
|
||||||
|
fprintf(stdout, "proprietary %lu", propertyIdentifier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Send an RP request to read one property from the current Object.
|
/** Send an RP request to read one property from the current Object.
|
||||||
* Singly process large arrays too, like the Device Object's Object_List.
|
* Singly process large arrays too, like the Device Object's Object_List.
|
||||||
* If GET_LIST_OF_ALL_RESPONSE failed, we will fall back to using just
|
* If GET_LIST_OF_ALL_RESPONSE failed, we will fall back to using just
|
||||||
@@ -600,17 +603,18 @@ static uint8_t Read_Properties(
|
|||||||
IsLongArray = false;
|
IsLongArray = false;
|
||||||
if (Using_Walked_List) {
|
if (Using_Walked_List) {
|
||||||
if (Walked_List_Length == 0) {
|
if (Walked_List_Length == 0) {
|
||||||
/* printf(" %s: ", bactext_property_name( prop ) ); */
|
|
||||||
array_index = 0;
|
array_index = 0;
|
||||||
} else {
|
} else {
|
||||||
array_index = Walked_List_Index;
|
array_index = Walked_List_Index;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stdout, " %s: ", bactext_property_name(prop));
|
fprintf(stdout, " ");
|
||||||
|
Print_Property_Identifier(prop);
|
||||||
|
fprintf(stdout, ": ");
|
||||||
array_index = BACNET_ARRAY_ALL;
|
array_index = BACNET_ARRAY_ALL;
|
||||||
|
|
||||||
switch (prop) {
|
switch (prop) {
|
||||||
/* These are all potentially long arrays, so they may abort */
|
/* These are all potentially long arrays, so they may abort */
|
||||||
case PROP_OBJECT_LIST:
|
case PROP_OBJECT_LIST:
|
||||||
case PROP_STATE_TEXT:
|
case PROP_STATE_TEXT:
|
||||||
case PROP_STRUCTURED_OBJECT_LIST:
|
case PROP_STRUCTURED_OBJECT_LIST:
|
||||||
@@ -681,8 +685,9 @@ EPICS_STATES ProcessRPMData(
|
|||||||
free(old_value);
|
free(old_value);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stdout, " %s: ",
|
fprintf(stdout, " ");
|
||||||
bactext_property_name(rpm_property->propertyIdentifier));
|
Print_Property_Identifier(rpm_property->propertyIdentifier);
|
||||||
|
fprintf(stdout, ": ");
|
||||||
PrintReadPropertyData(rpm_property);
|
PrintReadPropertyData(rpm_property);
|
||||||
}
|
}
|
||||||
old_rpm_property = rpm_property;
|
old_rpm_property = rpm_property;
|
||||||
@@ -1089,9 +1094,10 @@ int main(
|
|||||||
Walked_List_Index = Walked_List_Length = 0;
|
Walked_List_Index = Walked_List_Length = 0;
|
||||||
} else {
|
} else {
|
||||||
/* OK, skip this one and try the next property. */
|
/* OK, skip this one and try the next property. */
|
||||||
fprintf(stdout, " -- Failed to get %s \r\n",
|
fprintf(stdout, " -- Failed to get ");
|
||||||
bactext_property_name(pPropList
|
Print_Property_Identifier(
|
||||||
[Property_List_Index]));
|
pPropList[Property_List_Index]);
|
||||||
|
fprintf(stdout, " \r\n");
|
||||||
if ( ++Property_List_Index >= Property_List_Length )
|
if ( ++Property_List_Index >= Property_List_Length )
|
||||||
myState = NEXT_OBJECT; /* Give up and move on to the next. */
|
myState = NEXT_OBJECT; /* Give up and move on to the next. */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,19 +58,6 @@ static void PrintReadPropertyData(
|
|||||||
bool print_brace = false;
|
bool print_brace = false;
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
#if 0
|
|
||||||
if (data->array_index == BACNET_ARRAY_ALL)
|
|
||||||
fprintf(stderr, "%s #%lu %s\n",
|
|
||||||
bactext_object_type_name(data->object_type),
|
|
||||||
(unsigned long) data->object_instance,
|
|
||||||
bactext_property_name(data->object_property));
|
|
||||||
else
|
|
||||||
fprintf(stderr, "%s #%lu %s[%d]\n",
|
|
||||||
bactext_object_type_name(data->object_type),
|
|
||||||
(unsigned long) data->object_instance,
|
|
||||||
bactext_property_name(data->object_property),
|
|
||||||
data->array_index);
|
|
||||||
#endif
|
|
||||||
application_data = data->application_data;
|
application_data = data->application_data;
|
||||||
application_data_len = data->application_data_len;
|
application_data_len = data->application_data_len;
|
||||||
/* FIXME: what if application_data_len is bigger than 255? */
|
/* FIXME: what if application_data_len is bigger than 255? */
|
||||||
|
|||||||
Reference in New Issue
Block a user