added text printing for property-list property. Added property-list property to analog-input object.

This commit is contained in:
skarg
2013-11-16 21:49:06 +00:00
parent cedaa5a944
commit 94cf94b09d
5 changed files with 42 additions and 21 deletions
+15 -15
View File
@@ -37,6 +37,7 @@
#include "config.h" /* the custom stuff */
#include "device.h"
#include "handlers.h"
#include "proplist.h"
#include "timestamp.h"
#include "ai.h"
@@ -48,19 +49,7 @@
ANALOG_INPUT_DESCR AI_Descr[MAX_ANALOG_INPUTS];
/* These three arrays are used by the ReadPropertyMultiple handler */
static const int Properties_Required[] = {
PROP_OBJECT_IDENTIFIER,
PROP_OBJECT_NAME,
PROP_OBJECT_TYPE,
PROP_PRESENT_VALUE,
PROP_STATUS_FLAGS,
PROP_EVENT_STATE,
PROP_OUT_OF_SERVICE,
PROP_UNITS,
-1
};
/* These arrays are used by the ReadPropertyMultiple handler */
static const int Properties_Optional[] = {
PROP_DESCRIPTION,
PROP_RELIABILITY,
@@ -92,7 +81,7 @@ void Analog_Input_Property_Lists(
const int **pProprietary)
{
if (pRequired)
*pRequired = Properties_Required;
*pRequired = property_list_required(OBJECT_ANALOG_INPUT);
if (pOptional)
*pOptional = Properties_Optional;
if (pProprietary)
@@ -242,6 +231,7 @@ int Analog_Input_Read_Property(
int len = 0;
#endif
uint8_t *apdu = NULL;
const int *pRequired = NULL, *pOptional = NULL, *pProprietary = NULL;
if ((rpdata == NULL) || (rpdata->application_data == NULL) ||
(rpdata->application_data_len == 0)) {
@@ -446,7 +436,14 @@ int Analog_Input_Read_Property(
}
break;
#endif
case PROP_PROPERTY_LIST:
Analog_Input_Property_Lists(&pRequired, &pOptional, &pProprietary);
apdu_len = property_list_encode(
rpdata,
pRequired,
pOptional,
pProprietary);
break;
case 9997:
/* test case for real encoding-decoding unsigned value correctly */
apdu_len = encode_application_real(&apdu[0], 90.510F);
@@ -467,6 +464,7 @@ int Analog_Input_Read_Property(
}
/* only array properties can have array options */
if ((apdu_len >= 0) && (rpdata->object_property != PROP_EVENT_TIME_STAMPS)
&& (rpdata->object_property != PROP_PROPERTY_LIST)
&& (rpdata->array_index != BACNET_ARRAY_ALL)) {
rpdata->error_class = ERROR_CLASS_PROPERTY;
rpdata->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY;
@@ -499,6 +497,7 @@ bool Analog_Input_Write_Property(
}
/* only array properties can have array options */
if ((wp_data->object_property != PROP_EVENT_TIME_STAMPS) &&
(wp_data->object_property != PROP_PROPERTY_LIST) &&
(wp_data->array_index != BACNET_ARRAY_ALL)) {
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY;
@@ -664,6 +663,7 @@ bool Analog_Input_Write_Property(
case PROP_ACKED_TRANSITIONS:
case PROP_EVENT_TIME_STAMPS:
#endif
case PROP_PROPERTY_LIST:
case 9997:
case 9998:
case 9999:
+5 -6
View File
@@ -1557,6 +1557,7 @@ bool Channel_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data)
return false;
}
if ((wp_data->object_property != PROP_PRIORITY_ARRAY) &&
(wp_data->object_property != PROP_PROPERTY_LIST) &&
(wp_data->array_index != BACNET_ARRAY_ALL)) {
/* only array properties can have array options */
wp_data->error_class = ERROR_CLASS_PROPERTY;
@@ -1686,15 +1687,13 @@ void Channel_Init(void)
Channel[i].Write_Status = BACNET_WRITE_STATUS_IDLE;
for (m = 0; m < CHANNEL_MEMBERS_MAX; m++) {
Channel[i].Members[m].objectIdentifier.type =
OBJECT_CHANNEL;
Channel[i].Members[m].objectIdentifier.instance =
BACNET_MAX_INSTANCE;
Channel[i].Members[m].propertyIdentifier = MAX_BACNET_PROPERTY_ID;
OBJECT_LIGHTING_OUTPUT;
Channel[i].Members[m].objectIdentifier.instance = i+1;
Channel[i].Members[m].propertyIdentifier = PROP_LIGHTING_COMMAND;
Channel[i].Members[m].arrayIndex = BACNET_ARRAY_ALL;
Channel[i].Members[m].deviceIndentifier.type =
OBJECT_DEVICE;
Channel[i].Members[m].deviceIndentifier.instance =
BACNET_MAX_INSTANCE;
Channel[i].Members[m].deviceIndentifier.instance = 0;
}
Channel[i].Number = 0;
for (g = 0; g < CONTROL_GROUPS_MAX; g++) {
+3
View File
@@ -54,6 +54,9 @@ extern "C" {
unsigned *found_index);
const char *bactext_property_name(
unsigned index);
const char *bactext_property_name_default(
unsigned index,
const char *default_string);
bool bactext_property_index(
const char *search_name,
unsigned *found_index);
+11
View File
@@ -1130,6 +1130,17 @@ int bacapp_snprintf_value(
break;
case BACNET_APPLICATION_TAG_ENUMERATED:
switch (property) {
case PROP_PROPERTY_LIST:
char_str = bactext_property_name_default(
value->type.Enumerated, NULL);
if (char_str) {
ret_val = snprintf(str, str_len, "%s", char_str);
} else {
ret_val =
snprintf(str, str_len, "%lu",
(unsigned long) value->type.Enumerated);
}
break;
case PROP_OBJECT_TYPE:
if (value->type.Enumerated < MAX_ASHRAE_OBJECT_TYPE) {
ret_val =
+8
View File
@@ -1039,6 +1039,14 @@ const char *bactext_property_name(
ASHRAE_Reserved_String, Vendor_Proprietary_String);
}
const char *bactext_property_name_default(
unsigned index,
const char *default_string)
{
return indtext_by_index_default(bacnet_property_names, index,
default_string);
}
unsigned bactext_property_id(
const char *name)
{