1、示例
2、代码
typedef void (*object_init_function) (void);
typedef unsigned (*object_count_function) (void);
typedef uint32_t(*object_index_to_instance_function) (unsigned index);
typedef bool(*object_name_function) (uint32_t object_instance, BACNET_CHARACTER_STRING * object_name);
typedef bool(*object_valid_instance_function) (uint32_t object_instance);
typedef unsigned (*object_iterate_function) (unsigned current_index);
typedef bool(*object_value_list_function) (uint32_t object_instance, BACNET_PROPERTY_VALUE * value_list);
typedef bool(*object_cov_function) (uint32_t object_instance);
typedef void (*object_cov_clear_function) (uint32_t object_instance);
typedef void (*object_intrinsic_reporting_function) (uint32_t object_instance);
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_value_list_function Object_Value_List;
object_cov_function Object_COV;
object_cov_clear_function Object_COV_Clear;
object_intrinsic_reporting_function Object_Intrinsic_Reporting;
} object_functions_t;
void Device_Init(object_functions_t * object_table);
static struct my_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;
} Object_Table[] =
{
{
OBJECT_DEVICE,
NULL, /* don't init - recursive! */
Device_Count,
Device_Index_To_Instance,
Device_Valid_Object_Instance_Number,
Device_Object_Name,
Device_Read_Property_Local,
Device_Write_Property_Local,
Device_Property_Lists
},
{
OBJECT_BINARY_OUTPUT,
Binary_Output_Init,
Binary_Output_Count,
Binary_Output_Index_To_Instance,
Binary_Output_Valid_Instance,
Binary_Output_Object_Name,
Binary_Output_Read_Property,
Binary_Output_Write_Property,
Binary_Output_Property_Lists
},
{
MAX_BACNET_OBJECT_TYPE,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
}
};
unsigned Device_Count(void);
uint32_t Device_Index_To_Instance(unsigned index);
bool Device_Valid_Object_Instance_Number(uint32_t object_id);
bool Device_Object_Name(uint32_t object_instance, BACNET_CHARACTER_STRING * object_name);
......
void Binary_Output_Init(void);
unsigned Binary_Output_Count(void);
uint32_t Binary_Output_Index_To_Instance(unsigned index);
........