diff --git a/bacnet-stack/demo/dcc/main.c b/bacnet-stack/demo/dcc/main.c index 95c95b6c..5a825d71 100644 --- a/bacnet-stack/demo/dcc/main.c +++ b/bacnet-stack/demo/dcc/main.c @@ -51,6 +51,12 @@ #include "txbuf.h" #include "dlenv.h" +/* All included BACnet objects */ +object_functions_t Object_Table[] = { + {DEVICE_OBJ_FUNCTIONS}, + {MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, +}; + /* buffer used for receive */ static uint8_t Rx_Buf[MAX_MPDU] = { 0 }; diff --git a/bacnet-stack/demo/epics/main.c b/bacnet-stack/demo/epics/main.c index ee4d18f9..bbddeac1 100644 --- a/bacnet-stack/demo/epics/main.c +++ b/bacnet-stack/demo/epics/main.c @@ -62,6 +62,12 @@ /** @addtogroup BACEPICS * @{ */ +/* All included BACnet objects */ +object_functions_t Object_Table[] = { + {DEVICE_OBJ_FUNCTIONS}, + {MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, +}; + /* buffer used for receive */ static uint8_t Rx_Buf[MAX_MPDU] = { 0 }; diff --git a/bacnet-stack/demo/gateway/main.c b/bacnet-stack/demo/gateway/main.c index 0aa46520..733d5fdb 100644 --- a/bacnet-stack/demo/gateway/main.c +++ b/bacnet-stack/demo/gateway/main.c @@ -67,6 +67,12 @@ /** @addtogroup GatewayDemo */ /*@{*/ +/* All included BACnet objects */ +object_functions_t Object_Table[] = { + {DEVICE_OBJ_FUNCTIONS}, + {MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, +}; + /** Buffer used for receiving */ static uint8_t Rx_Buf[MAX_MPDU] = { 0 }; diff --git a/bacnet-stack/demo/iamrouter/main.c b/bacnet-stack/demo/iamrouter/main.c index 79760273..a220fc3d 100644 --- a/bacnet-stack/demo/iamrouter/main.c +++ b/bacnet-stack/demo/iamrouter/main.c @@ -46,6 +46,12 @@ #include "txbuf.h" #include "dlenv.h" +/* All included BACnet objects */ +object_functions_t Object_Table[] = { + {DEVICE_OBJ_FUNCTIONS}, + {MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, +}; + /* buffer used for receive */ static uint8_t Rx_Buf[MAX_MPDU] = { 0 }; diff --git a/bacnet-stack/demo/initrouter/main.c b/bacnet-stack/demo/initrouter/main.c index 4b9a811c..bc09b1d5 100644 --- a/bacnet-stack/demo/initrouter/main.c +++ b/bacnet-stack/demo/initrouter/main.c @@ -48,6 +48,12 @@ #include "txbuf.h" #include "dlenv.h" +/* All included BACnet objects */ +object_functions_t Object_Table[] = { + {DEVICE_OBJ_FUNCTIONS}, + {MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, +}; + /* buffer used for receive */ static uint8_t Rx_Buf[MAX_MPDU] = { 0 }; diff --git a/bacnet-stack/demo/object/device.c b/bacnet-stack/demo/object/device.c index 7291197c..1c1242c4 100644 --- a/bacnet-stack/demo/object/device.c +++ b/bacnet-stack/demo/object/device.c @@ -43,22 +43,6 @@ #include "handlers.h" #include "datalink.h" #include "address.h" -/* include the objects */ -#include "device.h" -#include "ai.h" -#include "ao.h" -#include "av.h" -#include "bi.h" -#include "bo.h" -#include "bv.h" -#include "lc.h" -#include "lsp.h" -#include "mso.h" -#include "ms-input.h" -#include "trendlog.h" -#if defined(BACFILE) -#include "bacfile.h" /* object list dependency */ -#endif /* os specfic includes */ #include "timer.h" @@ -78,98 +62,9 @@ extern int Routed_Device_Read_Property_Local( extern bool Routed_Device_Write_Property_Local( BACNET_WRITE_PROPERTY_DATA * wp_data); -/** Defines the group of object helper functions for any supported Object. - * @ingroup ObjHelpers - * Each Object must provide some implementation of each of these helpers - * in order to properly support the handlers. Eg, the ReadProperty handler - * handler_read_property() relies on the instance of Object_Read_Property - * for each Object type. - * In both appearance and operation, this group of functions acts like - * they are member functions of a C++ Object base class. - */ -static struct object_functions { - BACNET_OBJECT_TYPE Object_Type; - object_init_function Object_Init; - object_count_function Object_Count; - object_index_to_instance_function Object_Index_To_Instance; - object_valid_instance_function Object_Valid_Instance; - object_name_function Object_Name; - read_property_function Object_Read_Property; - write_property_function Object_Write_Property; - rpm_property_lists_function Object_RPM_List; - rr_info_function Object_RR_Info; - object_iterate_function Object_Iterator; -} Object_Table[] = { - { - OBJECT_DEVICE, NULL, Device_Count, Device_Index_To_Instance, - Device_Valid_Object_Instance_Number, Device_Name, - Device_Read_Property_Local, Device_Write_Property_Local, - Device_Property_Lists, DeviceGetRRInfo, NULL}, { - OBJECT_ANALOG_INPUT, Analog_Input_Init, Analog_Input_Count, - Analog_Input_Index_To_Instance, Analog_Input_Valid_Instance, - Analog_Input_Name, Analog_Input_Read_Property, NULL, - Analog_Input_Property_Lists, NULL, NULL}, { - OBJECT_ANALOG_OUTPUT, Analog_Output_Init, Analog_Output_Count, - Analog_Output_Index_To_Instance, Analog_Output_Valid_Instance, - Analog_Output_Name, Analog_Output_Read_Property, - Analog_Output_Write_Property, Analog_Output_Property_Lists, - NULL, NULL}, { - OBJECT_ANALOG_VALUE, Analog_Value_Init, Analog_Value_Count, - Analog_Value_Index_To_Instance, Analog_Value_Valid_Instance, - Analog_Value_Name, Analog_Value_Read_Property, - Analog_Value_Write_Property, Analog_Value_Property_Lists, NULL, - NULL}, { - OBJECT_BINARY_INPUT, Binary_Input_Init, Binary_Input_Count, - Binary_Input_Index_To_Instance, Binary_Input_Valid_Instance, - Binary_Input_Name, Binary_Input_Read_Property, NULL, - Binary_Input_Property_Lists, NULL, NULL}, { - OBJECT_BINARY_OUTPUT, Binary_Output_Init, Binary_Output_Count, - Binary_Output_Index_To_Instance, Binary_Output_Valid_Instance, - Binary_Output_Name, Binary_Output_Read_Property, - Binary_Output_Write_Property, Binary_Output_Property_Lists, - NULL, NULL}, { - OBJECT_BINARY_VALUE, Binary_Value_Init, Binary_Value_Count, - Binary_Value_Index_To_Instance, Binary_Value_Valid_Instance, - Binary_Value_Name, Binary_Value_Read_Property, - Binary_Value_Write_Property, Binary_Value_Property_Lists, NULL, - NULL}, { - OBJECT_LIFE_SAFETY_POINT, Life_Safety_Point_Init, - Life_Safety_Point_Count, Life_Safety_Point_Index_To_Instance, - Life_Safety_Point_Valid_Instance, Life_Safety_Point_Name, - Life_Safety_Point_Read_Property, - Life_Safety_Point_Write_Property, - Life_Safety_Point_Property_Lists, NULL, NULL}, { - OBJECT_LOAD_CONTROL, Load_Control_Init, Load_Control_Count, - Load_Control_Index_To_Instance, Load_Control_Valid_Instance, - Load_Control_Name, Load_Control_Read_Property, - Load_Control_Write_Property, Load_Control_Property_Lists, NULL, - NULL}, { - OBJECT_MULTI_STATE_OUTPUT, Multistate_Output_Init, - Multistate_Output_Count, Multistate_Output_Index_To_Instance, - Multistate_Output_Valid_Instance, Multistate_Output_Name, - Multistate_Output_Read_Property, - Multistate_Output_Write_Property, - Multistate_Output_Property_Lists, NULL, NULL}, { - OBJECT_MULTI_STATE_INPUT, Multistate_Input_Init, - Multistate_Input_Count, Multistate_Input_Index_To_Instance, - Multistate_Input_Valid_Instance, Multistate_Input_Name, - Multistate_Input_Read_Property, - Multistate_Input_Write_Property, - Multistate_Input_Property_Lists, NULL, NULL}, { - OBJECT_TRENDLOG, Trend_Log_Init, Trend_Log_Count, - Trend_Log_Index_To_Instance, Trend_Log_Valid_Instance, - Trend_Log_Name, Trend_Log_Read_Property, - Trend_Log_Write_Property, Trend_Log_Property_Lists, - TrendLogGetRRInfo, NULL}, -#if defined(BACFILE) - { - OBJECT_FILE, bacfile_init, bacfile_count, bacfile_index_to_instance, - bacfile_valid_instance, bacfile_name, bacfile_read_property, - bacfile_write_property, BACfile_Property_Lists, NULL}, -#endif - { - MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL} -}; +/* Defined in user application; + object functions for all included BACnet objects */ +extern object_functions_t Object_Table[]; /** Glue function to let the Device object, when called by a handler, * lookup which Object type needs to be invoked. diff --git a/bacnet-stack/demo/readfile/main.c b/bacnet-stack/demo/readfile/main.c index 17315f91..e916f9d4 100644 --- a/bacnet-stack/demo/readfile/main.c +++ b/bacnet-stack/demo/readfile/main.c @@ -50,6 +50,12 @@ #include "txbuf.h" #include "dlenv.h" +/* All included BACnet objects */ +object_functions_t Object_Table[] = { + {DEVICE_OBJ_FUNCTIONS}, + {MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, +}; + /* buffer used for receive */ static uint8_t Rx_Buf[MAX_MPDU] = { 0 }; diff --git a/bacnet-stack/demo/readprop/main.c b/bacnet-stack/demo/readprop/main.c index 75178132..5fa426c3 100644 --- a/bacnet-stack/demo/readprop/main.c +++ b/bacnet-stack/demo/readprop/main.c @@ -53,6 +53,12 @@ #include "txbuf.h" #include "dlenv.h" +/* All included BACnet objects */ +object_functions_t Object_Table[] = { + {DEVICE_OBJ_FUNCTIONS}, + {MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, +}; + /* buffer used for receive */ static uint8_t Rx_Buf[MAX_MPDU] = { 0 }; diff --git a/bacnet-stack/demo/readpropm/main.c b/bacnet-stack/demo/readpropm/main.c index f0d0f8b9..9225cb3f 100644 --- a/bacnet-stack/demo/readpropm/main.c +++ b/bacnet-stack/demo/readpropm/main.c @@ -54,6 +54,12 @@ #include "txbuf.h" #include "dlenv.h" +/* All included BACnet objects */ +object_functions_t Object_Table[] = { + {DEVICE_OBJ_FUNCTIONS}, + {MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, +}; + /* buffer used for receive */ static uint8_t Rx_Buf[MAX_MPDU] = { 0 }; diff --git a/bacnet-stack/demo/reinit/main.c b/bacnet-stack/demo/reinit/main.c index a5c13a3b..12f7a30a 100644 --- a/bacnet-stack/demo/reinit/main.c +++ b/bacnet-stack/demo/reinit/main.c @@ -51,6 +51,12 @@ #include "txbuf.h" #include "dlenv.h" +/* All included BACnet objects */ +object_functions_t Object_Table[] = { + {DEVICE_OBJ_FUNCTIONS}, + {MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, +}; + /* buffer used for receive */ static uint8_t Rx_Buf[MAX_MPDU] = { 0 }; diff --git a/bacnet-stack/demo/server/main.c b/bacnet-stack/demo/server/main.c index 08b61409..fd5d006e 100644 --- a/bacnet-stack/demo/server/main.c +++ b/bacnet-stack/demo/server/main.c @@ -50,6 +50,40 @@ #include "version.h" /* include the device object */ #include "device.h" +#include "ai.h" +#include "ao.h" +#include "av.h" +#include "bi.h" +#include "bo.h" +#include "bv.h" +#include "lc.h" +#include "lsp.h" +#include "mso.h" +#include "ms-input.h" +#include "trendlog.h" +#if defined(BACFILE) +#include "bacfile.h" +#endif + +/* All included BACnet objects */ +object_functions_t Object_Table[] = { + {DEVICE_OBJ_FUNCTIONS}, + {ANALOG_INPUT_OBJ_FUNCTIONS}, + {ANALOG_OUTPUT_OBJ_FUNCTIONS}, + {ANALOG_VALUE_OBJ_FUNCTIONS}, + {BINARY_INPUT_OBJ_FUNCTIONS}, + {BINARY_OUTPUT_OBJ_FUNCTIONS}, + {BINARY_VALUE_OBJ_FUNCTIONS}, + {LIFE_SAFETY_POINT_OBJ_FUNCTIONS}, + {LOAD_CONTROL_OBJ_FUNCTIONS}, + {MULTI_STATE_OUTPUT_OBJ_FUNCTIONS}, + {MULTI_STATE_INPUT_OBJ_FUNCTIONS}, + {TRENDLOG_OBJ_FUNCTIONS}, +#if defined(BACFILE) + {FILE_OBJ_FUNCTIONS}, +#endif + {MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, +}; /** @file server/main.c Example server application using the BACnet Stack. */ diff --git a/bacnet-stack/demo/timesync/main.c b/bacnet-stack/demo/timesync/main.c index ea6368d1..3826c870 100644 --- a/bacnet-stack/demo/timesync/main.c +++ b/bacnet-stack/demo/timesync/main.c @@ -46,6 +46,12 @@ #include "txbuf.h" #include "dlenv.h" +/* All included BACnet objects */ +object_functions_t Object_Table[] = { + {DEVICE_OBJ_FUNCTIONS}, + {MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, +}; + /* buffer used for receive */ static uint8_t Rx_Buf[MAX_MPDU] = { 0 }; diff --git a/bacnet-stack/demo/ucov/main.c b/bacnet-stack/demo/ucov/main.c index e4479013..4d9bbb7b 100644 --- a/bacnet-stack/demo/ucov/main.c +++ b/bacnet-stack/demo/ucov/main.c @@ -50,6 +50,12 @@ #include "txbuf.h" #include "dlenv.h" +/* All included BACnet objects */ +object_functions_t Object_Table[] = { + {DEVICE_OBJ_FUNCTIONS}, + {MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, +}; + static void Init_Service_Handlers( void) { diff --git a/bacnet-stack/demo/whohas/main.c b/bacnet-stack/demo/whohas/main.c index e6bc69af..d4599197 100644 --- a/bacnet-stack/demo/whohas/main.c +++ b/bacnet-stack/demo/whohas/main.c @@ -50,6 +50,12 @@ #include "txbuf.h" #include "dlenv.h" +/* All included BACnet objects */ +object_functions_t Object_Table[] = { + {DEVICE_OBJ_FUNCTIONS}, + {MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, +}; + /* buffer used for receive */ static uint8_t Rx_Buf[MAX_MPDU] = { 0 }; diff --git a/bacnet-stack/demo/whois/main.c b/bacnet-stack/demo/whois/main.c index 225a6edc..0ec9a046 100644 --- a/bacnet-stack/demo/whois/main.c +++ b/bacnet-stack/demo/whois/main.c @@ -49,6 +49,12 @@ #endif #include "dlenv.h" +/* All included BACnet objects */ +object_functions_t Object_Table[] = { + {DEVICE_OBJ_FUNCTIONS}, + {MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, +}; + /* buffer used for receive */ static uint8_t Rx_Buf[MAX_MPDU] = { 0 }; diff --git a/bacnet-stack/demo/whoisrouter/main.c b/bacnet-stack/demo/whoisrouter/main.c index f6981bd7..8b71661c 100644 --- a/bacnet-stack/demo/whoisrouter/main.c +++ b/bacnet-stack/demo/whoisrouter/main.c @@ -51,6 +51,12 @@ #endif #include "dlenv.h" +/* All included BACnet objects */ +object_functions_t Object_Table[] = { + {DEVICE_OBJ_FUNCTIONS}, + {MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, +}; + /* buffer used for receive */ static uint8_t Rx_Buf[MAX_MPDU] = { 0 }; diff --git a/bacnet-stack/demo/writefile/main.c b/bacnet-stack/demo/writefile/main.c index 9e6c49e8..fd2c69c2 100644 --- a/bacnet-stack/demo/writefile/main.c +++ b/bacnet-stack/demo/writefile/main.c @@ -50,6 +50,12 @@ #include "txbuf.h" #include "dlenv.h" +/* All included BACnet objects */ +object_functions_t Object_Table[] = { + {DEVICE_OBJ_FUNCTIONS}, + {MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, +}; + /* buffer used for receive */ static uint8_t Rx_Buf[MAX_MPDU] = { 0 }; diff --git a/bacnet-stack/demo/writeprop/main.c b/bacnet-stack/demo/writeprop/main.c index c1f7efdf..28428970 100644 --- a/bacnet-stack/demo/writeprop/main.c +++ b/bacnet-stack/demo/writeprop/main.c @@ -56,6 +56,12 @@ #define MAX_PROPERTY_VALUES 64 #endif +/* All included BACnet objects */ +object_functions_t Object_Table[] = { + {DEVICE_OBJ_FUNCTIONS}, + {MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, +}; + /* buffer used for receive */ static uint8_t Rx_Buf[MAX_MPDU] = { 0 }; diff --git a/bacnet-stack/include/ai.h b/bacnet-stack/include/ai.h index 4c07e52f..855e4bc2 100644 --- a/bacnet-stack/include/ai.h +++ b/bacnet-stack/include/ai.h @@ -91,4 +91,11 @@ extern "C" { #ifdef __cplusplus } #endif /* __cplusplus */ + +#define ANALOG_INPUT_OBJ_FUNCTIONS \ + OBJECT_ANALOG_INPUT, Analog_Input_Init, Analog_Input_Count, \ + Analog_Input_Index_To_Instance, Analog_Input_Valid_Instance, \ + Analog_Input_Name, Analog_Input_Read_Property, NULL, \ + Analog_Input_Property_Lists, NULL, NULL + #endif diff --git a/bacnet-stack/include/ao.h b/bacnet-stack/include/ao.h index 707eb5e1..6213cb10 100644 --- a/bacnet-stack/include/ao.h +++ b/bacnet-stack/include/ao.h @@ -99,4 +99,12 @@ extern "C" { #ifdef __cplusplus } #endif /* __cplusplus */ + +#define ANALOG_OUTPUT_OBJ_FUNCTIONS \ + OBJECT_ANALOG_OUTPUT, Analog_Output_Init, Analog_Output_Count, \ + Analog_Output_Index_To_Instance, Analog_Output_Valid_Instance, \ + Analog_Output_Name, Analog_Output_Read_Property, \ + Analog_Output_Write_Property, Analog_Output_Property_Lists, \ + NULL, NULL + #endif diff --git a/bacnet-stack/include/av.h b/bacnet-stack/include/av.h index 79cd009e..63b1aae7 100644 --- a/bacnet-stack/include/av.h +++ b/bacnet-stack/include/av.h @@ -75,4 +75,12 @@ extern "C" { #ifdef __cplusplus } #endif /* __cplusplus */ + +#define ANALOG_VALUE_OBJ_FUNCTIONS \ + OBJECT_ANALOG_VALUE, Analog_Value_Init, Analog_Value_Count, \ + Analog_Value_Index_To_Instance, Analog_Value_Valid_Instance, \ + Analog_Value_Name, Analog_Value_Read_Property, \ + Analog_Value_Write_Property, Analog_Value_Property_Lists, NULL, \ + NULL + #endif diff --git a/bacnet-stack/include/bacfile.h b/bacnet-stack/include/bacfile.h index 9c6caf74..c36d83d5 100644 --- a/bacnet-stack/include/bacfile.h +++ b/bacnet-stack/include/bacfile.h @@ -94,4 +94,10 @@ extern "C" { #ifdef __cplusplus } #endif /* __cplusplus */ + +#define FILE_OBJ_FUNCTIONS \ + OBJECT_FILE, bacfile_init, bacfile_count, bacfile_index_to_instance, \ + bacfile_valid_instance, bacfile_name, bacfile_read_property, \ + bacfile_write_property, BACfile_Property_Lists, NULL + #endif diff --git a/bacnet-stack/include/bi.h b/bacnet-stack/include/bi.h index 1a3e8094..1654c19e 100644 --- a/bacnet-stack/include/bi.h +++ b/bacnet-stack/include/bi.h @@ -113,4 +113,11 @@ extern "C" { #ifdef __cplusplus } #endif /* __cplusplus */ + +#define BINARY_INPUT_OBJ_FUNCTIONS \ + OBJECT_BINARY_INPUT, Binary_Input_Init, Binary_Input_Count, \ + Binary_Input_Index_To_Instance, Binary_Input_Valid_Instance, \ + Binary_Input_Name, Binary_Input_Read_Property, NULL, \ + Binary_Input_Property_Lists, NULL, NULL + #endif diff --git a/bacnet-stack/include/bo.h b/bacnet-stack/include/bo.h index 4cc729b3..ffbc1dbf 100644 --- a/bacnet-stack/include/bo.h +++ b/bacnet-stack/include/bo.h @@ -108,4 +108,12 @@ extern "C" { #ifdef __cplusplus } #endif /* __cplusplus */ + +#define BINARY_OUTPUT_OBJ_FUNCTIONS \ + OBJECT_BINARY_OUTPUT, Binary_Output_Init, Binary_Output_Count, \ + Binary_Output_Index_To_Instance, Binary_Output_Valid_Instance, \ + Binary_Output_Name, Binary_Output_Read_Property, \ + Binary_Output_Write_Property, Binary_Output_Property_Lists, \ + NULL, NULL + #endif diff --git a/bacnet-stack/include/bv.h b/bacnet-stack/include/bv.h index 02abeed7..96ddc99b 100644 --- a/bacnet-stack/include/bv.h +++ b/bacnet-stack/include/bv.h @@ -69,4 +69,12 @@ extern "C" { #ifdef __cplusplus } #endif /* __cplusplus */ + +#define BINARY_VALUE_OBJ_FUNCTIONS \ + OBJECT_BINARY_VALUE, Binary_Value_Init, Binary_Value_Count, \ + Binary_Value_Index_To_Instance, Binary_Value_Valid_Instance, \ + Binary_Value_Name, Binary_Value_Read_Property, \ + Binary_Value_Write_Property, Binary_Value_Property_Lists, NULL, \ + NULL + #endif diff --git a/bacnet-stack/include/device.h b/bacnet-stack/include/device.h index c070622d..25af4e20 100644 --- a/bacnet-stack/include/device.h +++ b/bacnet-stack/include/device.h @@ -100,6 +100,28 @@ typedef unsigned ( *object_iterate_function) ( unsigned current_index); +/** Defines the group of object helper functions for any supported Object. + * @ingroup ObjHelpers + * Each Object must provide some implementation of each of these helpers + * in order to properly support the handlers. Eg, the ReadProperty handler + * handler_read_property() relies on the instance of Object_Read_Property + * for each Object type. + * In both appearance and operation, this group of functions acts like + * they are member functions of a C++ Object base class. + */ +typedef struct object_functions { + BACNET_OBJECT_TYPE Object_Type; + object_init_function Object_Init; + object_count_function Object_Count; + object_index_to_instance_function Object_Index_To_Instance; + object_valid_instance_function Object_Valid_Instance; + object_name_function Object_Name; + read_property_function Object_Read_Property; + write_property_function Object_Write_Property; + rpm_property_lists_function Object_RPM_List; + rr_info_function Object_RR_Info; + object_iterate_function Object_Iterator; +} object_functions_t; /* String Lengths - excluding any nul terminator */ #define MAX_DEV_NAME_LEN 32 @@ -314,12 +336,23 @@ extern "C" { size_t length); void Routed_Device_Inc_Database_Revision( void); + int Device_Read_Property_Local( + BACNET_READ_PROPERTY_DATA * rpdata); + bool Device_Write_Property_Local( + BACNET_WRITE_PROPERTY_DATA * wp_data); #ifdef __cplusplus } #endif /* __cplusplus */ + +#define DEVICE_OBJ_FUNCTIONS \ + OBJECT_DEVICE, NULL, Device_Count, Device_Index_To_Instance, \ + Device_Valid_Object_Instance_Number, Device_Name, \ + Device_Read_Property_Local, Device_Write_Property_Local, \ + Device_Property_Lists, DeviceGetRRInfo, NULL + /** @defgroup ObjFrmwk Object Framework * The modules in this section describe the BACnet-stack's framework for * BACnet-defined Objects (Device, Analog Input, etc). There are two submodules diff --git a/bacnet-stack/include/lc.h b/bacnet-stack/include/lc.h index e562ec4d..f69d6573 100644 --- a/bacnet-stack/include/lc.h +++ b/bacnet-stack/include/lc.h @@ -74,4 +74,12 @@ extern "C" { #ifdef __cplusplus } #endif /* __cplusplus */ + +#define LOAD_CONTROL_OBJ_FUNCTIONS \ + OBJECT_LOAD_CONTROL, Load_Control_Init, Load_Control_Count, \ + Load_Control_Index_To_Instance, Load_Control_Valid_Instance, \ + Load_Control_Name, Load_Control_Read_Property, \ + Load_Control_Write_Property, Load_Control_Property_Lists, NULL, \ + NULL + #endif diff --git a/bacnet-stack/include/lsp.h b/bacnet-stack/include/lsp.h index d231f92d..349e6eba 100644 --- a/bacnet-stack/include/lsp.h +++ b/bacnet-stack/include/lsp.h @@ -68,4 +68,13 @@ extern "C" { #ifdef __cplusplus } #endif /* __cplusplus */ + +#define LIFE_SAFETY_POINT_OBJ_FUNCTIONS \ + OBJECT_LIFE_SAFETY_POINT, Life_Safety_Point_Init, \ + Life_Safety_Point_Count, Life_Safety_Point_Index_To_Instance, \ + Life_Safety_Point_Valid_Instance, Life_Safety_Point_Name, \ + Life_Safety_Point_Read_Property, \ + Life_Safety_Point_Write_Property, \ + Life_Safety_Point_Property_Lists, NULL, NULL + #endif diff --git a/bacnet-stack/include/ms-input.h b/bacnet-stack/include/ms-input.h index 3dc84dcf..ee973cb9b 100644 --- a/bacnet-stack/include/ms-input.h +++ b/bacnet-stack/include/ms-input.h @@ -93,4 +93,13 @@ extern "C" { #ifdef __cplusplus } #endif /* __cplusplus */ + +#define MULTI_STATE_INPUT_OBJ_FUNCTIONS \ + OBJECT_MULTI_STATE_INPUT, Multistate_Input_Init, \ + Multistate_Input_Count, Multistate_Input_Index_To_Instance, \ + Multistate_Input_Valid_Instance, Multistate_Input_Name, \ + Multistate_Input_Read_Property, \ + Multistate_Input_Write_Property, \ + Multistate_Input_Property_Lists, NULL, NULL + #endif diff --git a/bacnet-stack/include/mso.h b/bacnet-stack/include/mso.h index 48dd2fd7..d06e879d 100644 --- a/bacnet-stack/include/mso.h +++ b/bacnet-stack/include/mso.h @@ -69,4 +69,13 @@ extern "C" { #ifdef __cplusplus } #endif /* __cplusplus */ + +#define MULTI_STATE_OUTPUT_OBJ_FUNCTIONS \ + OBJECT_MULTI_STATE_OUTPUT, Multistate_Output_Init, \ + Multistate_Output_Count, Multistate_Output_Index_To_Instance, \ + Multistate_Output_Valid_Instance, Multistate_Output_Name, \ + Multistate_Output_Read_Property, \ + Multistate_Output_Write_Property, \ + Multistate_Output_Property_Lists, NULL, NULL + #endif diff --git a/bacnet-stack/include/trendlog.h b/bacnet-stack/include/trendlog.h index 9c8b85a9..9fbd7782 100644 --- a/bacnet-stack/include/trendlog.h +++ b/bacnet-stack/include/trendlog.h @@ -196,4 +196,12 @@ extern "C" { #ifdef __cplusplus } #endif /* __cplusplus */ + +#define TRENDLOG_OBJ_FUNCTIONS \ + OBJECT_TRENDLOG, Trend_Log_Init, Trend_Log_Count, \ + Trend_Log_Index_To_Instance, Trend_Log_Valid_Instance, \ + Trend_Log_Name, Trend_Log_Read_Property, \ + Trend_Log_Write_Property, Trend_Log_Property_Lists, \ + TrendLogGetRRInfo, NULL + #endif