Un-refactored property-list module to lower resource requirements on small devices.
This commit is contained in:
@@ -15,6 +15,7 @@ MY_BACNET_DEFINES = -DPRINT_ENABLED=1
|
||||
MY_BACNET_DEFINES += -DBACAPP_ALL
|
||||
MY_BACNET_DEFINES += -DBACFILE
|
||||
MY_BACNET_DEFINES += -DINTRINSIC_REPORTING
|
||||
MY_BACNET_DEFINES += -DBACNET_PROPERTY_LISTS=1
|
||||
BACNET_DEFINES ?= $(MY_BACNET_DEFINES)
|
||||
|
||||
# un-comment the next line to build in uci integration
|
||||
|
||||
@@ -13,6 +13,8 @@ SRCS = main.c \
|
||||
|
||||
OBJS = ${SRCS:.c=.o}
|
||||
|
||||
CFLAGS += -DBACNET_PROPERTY_LISTS=1
|
||||
|
||||
all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET}
|
||||
|
||||
@@ -50,7 +50,19 @@
|
||||
ANALOG_INPUT_DESCR AI_Descr[MAX_ANALOG_INPUTS];
|
||||
|
||||
/* These arrays are used by the ReadPropertyMultiple handler */
|
||||
static const int Properties_Optional[] = {
|
||||
static const int Analog_Input_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
|
||||
};
|
||||
|
||||
static const int Analog_Input_Properties_Optional[] = {
|
||||
PROP_DESCRIPTION,
|
||||
PROP_RELIABILITY,
|
||||
PROP_COV_INCREMENT,
|
||||
@@ -69,7 +81,7 @@ static const int Properties_Optional[] = {
|
||||
-1
|
||||
};
|
||||
|
||||
static const int Properties_Proprietary[] = {
|
||||
static const int Analog_Input_Properties_Proprietary[] = {
|
||||
9997,
|
||||
9998,
|
||||
9999,
|
||||
@@ -82,11 +94,11 @@ void Analog_Input_Property_Lists(
|
||||
const int **pProprietary)
|
||||
{
|
||||
if (pRequired)
|
||||
*pRequired = property_list_required(OBJECT_ANALOG_INPUT);
|
||||
*pRequired = Analog_Input_Properties_Required;
|
||||
if (pOptional)
|
||||
*pOptional = Properties_Optional;
|
||||
*pOptional = Analog_Input_Properties_Optional;
|
||||
if (pProprietary)
|
||||
*pProprietary = Properties_Proprietary;
|
||||
*pProprietary = Analog_Input_Properties_Proprietary;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -77,11 +77,26 @@ struct bacnet_channel_object Channel[BACNET_CHANNELS_MAX];
|
||||
|
||||
/* These arrays are used by the ReadPropertyMultiple handler
|
||||
property-list property (as of protocol-revision 14) */
|
||||
static const int Properties_Optional[] = {
|
||||
static const int Channel_Properties_Required[] = {
|
||||
PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME,
|
||||
PROP_OBJECT_TYPE,
|
||||
PROP_PRESENT_VALUE,
|
||||
PROP_LAST_PRIORITY,
|
||||
PROP_WRITE_STATUS,
|
||||
PROP_STATUS_FLAGS,
|
||||
PROP_OUT_OF_SERVICE,
|
||||
PROP_LIST_OF_OBJECT_PROPERTY_REFERENCES,
|
||||
PROP_CHANNEL_NUMBER,
|
||||
PROP_CONTROL_GROUPS,
|
||||
-1
|
||||
};
|
||||
|
||||
static const int Properties_Proprietary[] = {
|
||||
static const int Channel_Properties_Optional[] = {
|
||||
-1
|
||||
};
|
||||
|
||||
static const int Channel_Properties_Proprietary[] = {
|
||||
-1
|
||||
};
|
||||
|
||||
@@ -101,11 +116,11 @@ void Channel_Property_Lists(const int **pRequired,
|
||||
const int **pProprietary)
|
||||
{
|
||||
if (pRequired)
|
||||
*pRequired = property_list_required(OBJECT_CHANNEL);
|
||||
*pRequired = Channel_Properties_Required;
|
||||
if (pOptional)
|
||||
*pOptional = Properties_Optional;
|
||||
*pOptional = Channel_Properties_Optional;
|
||||
if (pProprietary)
|
||||
*pProprietary = Properties_Proprietary;
|
||||
*pProprietary = Channel_Properties_Proprietary;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -306,12 +306,23 @@ int cl_decode_apdu(
|
||||
COMMAND_DESCR Command_Descr[MAX_COMMANDS];
|
||||
|
||||
/* These arrays are used by the ReadPropertyMultiple handler */
|
||||
static const int Properties_Optional[] = {
|
||||
static const int Command_Properties_Required[] = {
|
||||
PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME,
|
||||
PROP_OBJECT_TYPE,
|
||||
PROP_PRESENT_VALUE,
|
||||
PROP_IN_PROCESS,
|
||||
PROP_ALL_WRITES_SUCCESSFUL,
|
||||
PROP_ACTION,
|
||||
-1
|
||||
};
|
||||
|
||||
static const int Command_Properties_Optional[] = {
|
||||
PROP_DESCRIPTION,
|
||||
-1
|
||||
};
|
||||
|
||||
static const int Properties_Proprietary[] = {
|
||||
static const int Command_Properties_Proprietary[] = {
|
||||
-1
|
||||
};
|
||||
|
||||
@@ -332,11 +343,11 @@ void Command_Property_Lists(
|
||||
const int **pProprietary)
|
||||
{
|
||||
if (pRequired)
|
||||
*pRequired = property_list_required(OBJECT_COMMAND);
|
||||
*pRequired = Command_Properties_Required;
|
||||
if (pOptional)
|
||||
*pOptional = Properties_Optional;
|
||||
*pOptional = Command_Properties_Optional;
|
||||
if (pProprietary)
|
||||
*pProprietary = Properties_Proprietary;
|
||||
*pProprietary = Command_Properties_Proprietary;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -75,11 +75,32 @@ struct lighting_output_object Lighting_Output[MAX_LIGHTING_OUTPUTS];
|
||||
|
||||
/* These arrays are used by the ReadPropertyMultiple handler and
|
||||
property-list property (as of protocol-revision 14) */
|
||||
static const int Properties_Optional[] = {
|
||||
static const int Lighting_Output_Properties_Required[] = {
|
||||
PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME,
|
||||
PROP_OBJECT_TYPE,
|
||||
PROP_PRESENT_VALUE,
|
||||
PROP_TRACKING_VALUE,
|
||||
PROP_LIGHTING_COMMAND,
|
||||
PROP_IN_PROGRESS,
|
||||
PROP_STATUS_FLAGS,
|
||||
PROP_OUT_OF_SERVICE,
|
||||
PROP_BLINK_WARN_ENABLE,
|
||||
PROP_EGRESS_TIME,
|
||||
PROP_EGRESS_ACTIVE,
|
||||
PROP_DEFAULT_FADE_TIME,
|
||||
PROP_DEFAULT_RAMP_RATE,
|
||||
PROP_DEFAULT_STEP_INCREMENT,
|
||||
PROP_PRIORITY_ARRAY,
|
||||
PROP_RELINQUISH_DEFAULT,
|
||||
PROP_LIGHTING_COMMAND_DEFAULT_PRIORITY,
|
||||
-1
|
||||
};
|
||||
static const int Lighting_Output_Properties_Optional[] = {
|
||||
-1
|
||||
};
|
||||
|
||||
static const int Properties_Proprietary[] = {
|
||||
static const int Lighting_Output_Properties_Proprietary[] = {
|
||||
-1
|
||||
};
|
||||
|
||||
@@ -100,11 +121,11 @@ void Lighting_Output_Property_Lists(
|
||||
const int **pProprietary)
|
||||
{
|
||||
if (pRequired)
|
||||
*pRequired = property_list_required(OBJECT_LIGHTING_OUTPUT);
|
||||
*pRequired = Lighting_Output_Properties_Required;
|
||||
if (pOptional)
|
||||
*pOptional = Properties_Optional;
|
||||
*pOptional = Lighting_Output_Properties_Optional;
|
||||
if (pProprietary)
|
||||
*pProprietary = Properties_Proprietary;
|
||||
*pProprietary = Lighting_Output_Properties_Proprietary;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -56,12 +56,29 @@ static BACNET_LIFE_SAFETY_OPERATION
|
||||
static bool Life_Safety_Point_Out_Of_Service[MAX_LIFE_SAFETY_POINTS];
|
||||
/* These arrays are used by the ReadPropertyMultiple handler and
|
||||
property-list property (as of protocol-revision 14) */
|
||||
static const int Properties_Optional[] = {
|
||||
static const int Life_Safety_Point_Properties_Required[] = {
|
||||
PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME,
|
||||
PROP_OBJECT_TYPE,
|
||||
PROP_PRESENT_VALUE,
|
||||
PROP_TRACKING_VALUE,
|
||||
PROP_STATUS_FLAGS,
|
||||
PROP_EVENT_STATE,
|
||||
PROP_OUT_OF_SERVICE,
|
||||
PROP_RELIABILITY,
|
||||
PROP_MODE,
|
||||
PROP_ACCEPTED_MODES,
|
||||
PROP_SILENCED,
|
||||
PROP_OPERATION_EXPECTED,
|
||||
-1
|
||||
};
|
||||
|
||||
static const int Life_Safety_Point_Properties_Optional[] = {
|
||||
PROP_DESCRIPTION,
|
||||
-1
|
||||
};
|
||||
|
||||
static const int Properties_Proprietary[] = {
|
||||
static const int Life_Safety_Point_Properties_Proprietary[] = {
|
||||
-1
|
||||
};
|
||||
|
||||
@@ -82,13 +99,13 @@ void Life_Safety_Point_Property_Lists(
|
||||
const int **pProprietary)
|
||||
{
|
||||
if (pRequired) {
|
||||
*pRequired = property_list_required(OBJECT_LIFE_SAFETY_POINT);
|
||||
*pRequired = Life_Safety_Point_Properties_Required;
|
||||
}
|
||||
if (pOptional) {
|
||||
*pOptional = Properties_Optional;
|
||||
*pOptional = Life_Safety_Point_Properties_Optional;
|
||||
}
|
||||
if (pProprietary) {
|
||||
*pProprietary = Properties_Proprietary;
|
||||
*pProprietary = Life_Safety_Point_Properties_Proprietary;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -30,7 +30,13 @@
|
||||
#include "bacdef.h"
|
||||
#include "bacstr.h"
|
||||
#include "datetime.h"
|
||||
#if defined (BACAPP_LIGHTING_COMMAND)
|
||||
#include "lighting.h"
|
||||
#endif
|
||||
#if defined (BACAPP_DEVICE_OBJECT_PROP_REF)
|
||||
#include "bacdevobjpropref.h"
|
||||
#endif
|
||||
|
||||
|
||||
struct BACnet_Application_Data_Value;
|
||||
typedef struct BACnet_Application_Data_Value {
|
||||
@@ -77,6 +83,10 @@ typedef struct BACnet_Application_Data_Value {
|
||||
#endif
|
||||
#if defined (BACAPP_LIGHTING_COMMAND)
|
||||
BACNET_LIGHTING_COMMAND Lighting_Command;
|
||||
#endif
|
||||
#if defined (BACAPP_DEVICE_OBJECT_PROP_REF)
|
||||
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE
|
||||
Device_Object_Property_Reference;
|
||||
#endif
|
||||
} type;
|
||||
/* simple linked list if needed */
|
||||
|
||||
@@ -1788,4 +1788,43 @@ typedef enum BACnetWriteStatus {
|
||||
BACNET_WRITE_STATUS_FAILED = 3
|
||||
} BACNET_WRITE_STATUS;
|
||||
|
||||
/* BACnetNetworkType ::= ENUMERATED */
|
||||
typedef enum {
|
||||
PORT_TYPE_ETHERNET = 0,
|
||||
PORT_TYPE_ARCNET = 1,
|
||||
PORT_TYPE_MSTP = 2,
|
||||
PORT_TYPE_PTP = 3,
|
||||
PORT_TYPE_LONTALK = 4,
|
||||
PORT_TYPE_BIP = 5,
|
||||
PORT_TYPE_ZIGBEE = 6,
|
||||
PORT_TYPE_VIRTUAL = 7,
|
||||
PORT_TYPE_NON_BACNET = 8
|
||||
/* Enumerated values 0-63 are reserved for definition by ASHRAE.
|
||||
Enumerated values 64-255 may be used by others subject to the
|
||||
procedures and constraints described in Clause 23.*/
|
||||
} BACNET_PORT_TYPE;
|
||||
|
||||
/* BACnetNetworkNumberQuality ::= ENUMERATED */
|
||||
typedef enum {
|
||||
PORT_QUALITY_UNKNOWN = 0,
|
||||
PORT_QUALITY_LEARNED = 1,
|
||||
PORT_QUALITY_LEARNED_CONFIGURED = 2,
|
||||
PORT_QUALITY_CONFIGURED = 3
|
||||
} BACNET_PORT_QUALITY;
|
||||
|
||||
/* BACnetNetworkPortCommand :: = ENUMERATED */
|
||||
typedef enum {
|
||||
PORT_COMMAND_IDLE = 0,
|
||||
PORT_COMMAND_DISCARD_CHANGES = 1,
|
||||
PORT_COMMAND_RENEW_FD_REGISTRATION = 2,
|
||||
PORT_COMMAND_RESTART_SLAVE_DISCOVERY = 3,
|
||||
PORT_COMMAND_RENEW_DHCP = 4,
|
||||
PORT_COMMAND_RESTART_AUTONEGOTIATION = 5,
|
||||
PORT_COMMAND_DISCONNECT = 6,
|
||||
PORT_COMMAND_RESTART_PORT = 7
|
||||
/* Enumerated values 0-127 are reserved for definition by ASHRAE.
|
||||
Enumerated values 128-255 may be used by others subject to the
|
||||
procedures and constraints described in Clause 23. */
|
||||
} BACNET_PORT_COMMAND;
|
||||
|
||||
#endif /* end of BACENUM_H */
|
||||
|
||||
@@ -127,36 +127,37 @@
|
||||
defined(BACAPP_DATE) || \
|
||||
defined(BACAPP_TIME) || \
|
||||
defined(BACAPP_LIGHTING_COMMAND) || \
|
||||
defined(BACAPP_DEVICE_OBJECT_PROP_REF) || \
|
||||
defined(BACAPP_OBJECT_ID))
|
||||
#define BACAPP_ALL
|
||||
#endif
|
||||
|
||||
#if defined (BACAPP_ALL)
|
||||
#define BACAPP_NULL
|
||||
#define BACAPP_BOOLEAN
|
||||
#define BACAPP_UNSIGNED
|
||||
#define BACAPP_SIGNED
|
||||
#define BACAPP_REAL
|
||||
#define BACAPP_DOUBLE
|
||||
#define BACAPP_OCTET_STRING
|
||||
#define BACAPP_CHARACTER_STRING
|
||||
#define BACAPP_BIT_STRING
|
||||
#define BACAPP_ENUMERATED
|
||||
#define BACAPP_DATE
|
||||
#define BACAPP_TIME
|
||||
#define BACAPP_OBJECT_ID
|
||||
#define BACAPP_LIGHTING_COMMAND
|
||||
#define BACAPP_NULL
|
||||
#define BACAPP_BOOLEAN
|
||||
#define BACAPP_UNSIGNED
|
||||
#define BACAPP_SIGNED
|
||||
#define BACAPP_REAL
|
||||
#define BACAPP_DOUBLE
|
||||
#define BACAPP_OCTET_STRING
|
||||
#define BACAPP_CHARACTER_STRING
|
||||
#define BACAPP_BIT_STRING
|
||||
#define BACAPP_ENUMERATED
|
||||
#define BACAPP_DATE
|
||||
#define BACAPP_TIME
|
||||
#define BACAPP_OBJECT_ID
|
||||
#define BACAPP_DEVICE_OBJECT_PROP_REF
|
||||
#define BACAPP_LIGHTING_COMMAND
|
||||
#elif defined (BACAPP_MINIMAL)
|
||||
#define BACAPP_NULL
|
||||
#define BACAPP_BOOLEAN
|
||||
#define BACAPP_UNSIGNED
|
||||
#define BACAPP_SIGNED
|
||||
#define BACAPP_REAL
|
||||
#define BACAPP_CHARACTER_STRING
|
||||
#define BACAPP_ENUMERATED
|
||||
#define BACAPP_DATE
|
||||
#define BACAPP_TIME
|
||||
#define BACAPP_OBJECT_ID
|
||||
#define BACAPP_NULL
|
||||
#define BACAPP_BOOLEAN
|
||||
#define BACAPP_UNSIGNED
|
||||
#define BACAPP_SIGNED
|
||||
#define BACAPP_REAL
|
||||
#define BACAPP_CHARACTER_STRING
|
||||
#define BACAPP_ENUMERATED
|
||||
#define BACAPP_DATE
|
||||
#define BACAPP_TIME
|
||||
#define BACAPP_OBJECT_ID
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -153,6 +153,14 @@ int bacapp_encode_application_data(
|
||||
lighting_command_encode(&apdu[0],
|
||||
&value->type.Lighting_Command);
|
||||
break;
|
||||
#endif
|
||||
#if defined (BACAPP_DEVICE_OBJECT_PROP_REF)
|
||||
case BACNET_APPLICATION_TAG_DEVICE_OBJECT_PROPERTY_REFERENCE:
|
||||
/* BACnetDeviceObjectPropertyReference */
|
||||
apdu_len =
|
||||
bacapp_encode_device_obj_property_ref(&apdu[0],
|
||||
&value->type.Device_Object_Property_Reference);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
@@ -676,9 +684,9 @@ BACNET_APPLICATION_TAG bacapp_context_tag_type(
|
||||
case 1:
|
||||
/* 2015.08.22 EKH 135-2012 pg 708
|
||||
todo - Context 1 in Recipient list would be a BACnetAddress, not coded yet...
|
||||
BACnetRecipient::= CHOICE {
|
||||
device [0] BACnetObjectIdentifier,
|
||||
address [1] BACnetAddress
|
||||
BACnetRecipient::= CHOICE {
|
||||
device [0] BACnetObjectIdentifier,
|
||||
address [1] BACnetAddress
|
||||
}
|
||||
*/
|
||||
break;
|
||||
|
||||
+27
-21
@@ -40,6 +40,11 @@
|
||||
#include "rp.h"
|
||||
#include "proplist.h"
|
||||
|
||||
#ifndef BACNET_PROPERTY_LISTS
|
||||
#define BACNET_PROPERTY_LISTS 0
|
||||
#endif
|
||||
|
||||
#if BACNET_PROPERTY_LISTS
|
||||
/** @file proplist.c List of Required and Optional object properties */
|
||||
/* note: the PROP_PROPERTY_LIST is NOT included in these lists, on purpose */
|
||||
|
||||
@@ -830,27 +835,6 @@ static const int Integer_Value_Properties_Optional[] = {
|
||||
-1
|
||||
};
|
||||
|
||||
/**
|
||||
* Function that returns the number of BACnet object properties in a list
|
||||
*
|
||||
* @param pList - array of type 'int' that is a list of BACnet object
|
||||
* properties, terminated by a '-1' value.
|
||||
*/
|
||||
unsigned property_list_count(
|
||||
const int *pList)
|
||||
{
|
||||
unsigned property_count = 0;
|
||||
|
||||
if (pList) {
|
||||
while (*pList != -1) {
|
||||
property_count++;
|
||||
pList++;
|
||||
}
|
||||
}
|
||||
|
||||
return property_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that returns the list of all Optional properties
|
||||
* of known standard objects.
|
||||
@@ -1141,6 +1125,28 @@ unsigned property_list_special_count(
|
||||
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Function that returns the number of BACnet object properties in a list
|
||||
*
|
||||
* @param pList - array of type 'int' that is a list of BACnet object
|
||||
* properties, terminated by a '-1' value.
|
||||
*/
|
||||
unsigned property_list_count(
|
||||
const int *pList)
|
||||
{
|
||||
unsigned property_count = 0;
|
||||
|
||||
if (pList) {
|
||||
while (*pList != -1) {
|
||||
property_count++;
|
||||
pList++;
|
||||
}
|
||||
}
|
||||
|
||||
return property_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* ReadProperty handler for this property. For the given ReadProperty
|
||||
|
||||
Reference in New Issue
Block a user