11.typedef 定义复杂别名

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);
........

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

eyleian

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值