1
0
mirror of https://github.com/stargieg/bacnet-stack synced 2025-10-26 23:35:52 +08:00

uci time_delay, fix ucievent

This commit is contained in:
Patrick Grimm 2013-03-31 15:00:41 +02:00
parent c40dbd9888
commit 9f34d735c4
3 changed files with 28 additions and 2 deletions

View File

@ -134,6 +134,8 @@ void Analog_Value_Init(
int ucinc;
int ucievent_default;
int ucievent;
int ucitime_delay_default;
int ucitime_delay;
int ucilimit_default;
int ucilimit;
int ucihigh_limit_default;
@ -159,6 +161,8 @@ void Analog_Value_Init(
"nc", -1);
ucievent_default = ucix_get_option_int(ctx, "bacnet_av", "default",
"event", -1);
ucitime_delay_default = ucix_get_option_int(ctx, "bacnet_av", "default",
"time_delay", -1);
ucilimit_default = ucix_get_option_int(ctx, "bacnet_av", "default",
"limit", -1);
ucihigh_limit_default = ucix_get_option_int(ctx, "bacnet_av", "default",
@ -222,6 +226,8 @@ void Analog_Value_Init(
"nc", ucinc_default);
ucievent = ucix_get_option_int(ctx, "bacnet_av", int_to_string,
"event", ucievent_default);
ucitime_delay = ucix_get_option_int(ctx, "bacnet_av", int_to_string,
"time_delay", ucitime_delay_default);
ucilimit = ucix_get_option_int(ctx, "bacnet_av", int_to_string,
"limit", ucilimit_default);
ucihigh_limit = ucix_get_option_int(ctx, "bacnet_av", int_to_string,
@ -234,6 +240,8 @@ void Analog_Value_Init(
else AV_Descr[i].Notification_Class = BACNET_MAX_INSTANCE;
if (ucievent > -1) AV_Descr[i].Event_Enable = ucievent;
else AV_Descr[i].Event_Enable = 0;
if (ucitime_delay > -1) AV_Descr[i].Time_Delay = ucitime_delay;
else AV_Descr[i].Time_Delay = 0;
if (ucilimit > -1) AV_Descr[i].Limit_Enable = ucilimit;
else AV_Descr[i].Limit_Enable = 0;
if (ucihigh_limit > -1) AV_Descr[i].High_Limit = ucihigh_limit;
@ -1038,6 +1046,7 @@ bool Analog_Value_Write_Property(
if (status) {
CurrentAV->Time_Delay = value.type.Unsigned_Int;
CurrentAV->Remaining_Time_Delay = CurrentAV->Time_Delay;
ucix_add_option_int(ctx, "bacnet_av", index_c, "time_delay", value.type.Unsigned_Int);
}
break;

View File

@ -105,6 +105,7 @@ static object_functions_t My_Object_Table[] = {
NULL /* COV */ ,
NULL /* COV Clear */ ,
NULL /* Intrinsic Reporting */ },
#if 0
{OBJECT_ANALOG_INPUT,
Analog_Input_Init,
Analog_Input_Count,
@ -135,6 +136,7 @@ static object_functions_t My_Object_Table[] = {
NULL /* COV */ ,
NULL /* COV Clear */ ,
NULL /* Intrinsic Reporting */ },
#endif
{OBJECT_ANALOG_VALUE,
Analog_Value_Init,
Analog_Value_Count,
@ -150,6 +152,7 @@ static object_functions_t My_Object_Table[] = {
NULL /* COV */ ,
NULL /* COV Clear */ ,
Analog_Value_Intrinsic_Reporting},
#if 0
{OBJECT_BINARY_INPUT,
Binary_Input_Init,
Binary_Input_Count,
@ -210,6 +213,7 @@ static object_functions_t My_Object_Table[] = {
NULL /* COV */ ,
NULL /* COV Clear */ ,
NULL /* Intrinsic Reporting */ },
#endif
#if defined(INTRINSIC_REPORTING)
{OBJECT_NOTIFICATION_CLASS,
Notification_Class_Init,
@ -227,6 +231,7 @@ static object_functions_t My_Object_Table[] = {
NULL /* COV Clear */ ,
NULL /* Intrinsic Reporting */ },
#endif
#if 0
{OBJECT_LIFE_SAFETY_POINT,
Life_Safety_Point_Init,
Life_Safety_Point_Count,
@ -287,6 +292,7 @@ static object_functions_t My_Object_Table[] = {
NULL /* COV */ ,
NULL /* COV Clear */ ,
NULL /* Intrinsic Reporting */ },
#endif
{OBJECT_MULTI_STATE_VALUE,
Multistate_Value_Init,
Multistate_Value_Count,
@ -302,6 +308,7 @@ static object_functions_t My_Object_Table[] = {
NULL /* COV */ ,
NULL /* COV Clear */ ,
Multistate_Value_Intrinsic_Reporting },
#if 0
{OBJECT_TRENDLOG,
Trend_Log_Init,
Trend_Log_Count,
@ -333,6 +340,7 @@ static object_functions_t My_Object_Table[] = {
NULL /* COV */ ,
NULL /* COV Clear */ ,
NULL /* Intrinsic Reporting */ },
#endif
#endif
{MAX_BACNET_OBJECT_TYPE,
NULL /* Init */ ,

View File

@ -138,6 +138,8 @@ void Multistate_Value_Init(
int ucinc;
int ucievent_default;
int ucievent;
int ucitime_delay_default;
int ucitime_delay;
const char int_to_string[64] = "";
fprintf(stderr, "Multistate_Value_Init\n");
ctx = ucix_init("bacnet_mv");
@ -154,6 +156,8 @@ void Multistate_Value_Init(
"nc", -1);
ucievent_default = ucix_get_option_int(ctx, "bacnet_mv", "default",
"event", -1);
ucitime_delay_default = ucix_get_option_int(ctx, "bacnet_mv", "default",
"time_delay", -1);
for (i = 0; i < MAX_MULTI_STATE_VALUES; i++) {
memset(&MSV_Descr[i], 0x00, sizeof(MULTI_STATE_VALUE_DESCR));
@ -228,13 +232,17 @@ void Multistate_Value_Init(
ucinc = ucix_get_option_int(ctx, "bacnet_mv", int_to_string,
"nc", ucinc_default);
ucievent = ucix_get_option_int(ctx, "bacnet_mv", int_to_string,
"nc", ucievent_default);
"event", ucievent_default);
ucitime_delay = ucix_get_option_int(ctx, "bacnet_mv", int_to_string,
"time_delay", ucitime_delay_default);
MSV_Descr[i].Event_State = EVENT_STATE_NORMAL;
/* notification class not connected */
if (ucinc > -1) MSV_Descr[i].Notification_Class = ucinc;
else MSV_Descr[i].Notification_Class = BACNET_MAX_INSTANCE;
if (ucinc > -1) MSV_Descr[i].Event_Enable = ucievent;
if (ucievent > -1) MSV_Descr[i].Event_Enable = ucievent;
else MSV_Descr[i].Event_Enable = 0;
if (ucitime_delay > -1) MSV_Descr[i].Time_Delay = ucitime_delay;
else MSV_Descr[i].Time_Delay = 0;
/* initialize Event time stamps using wildcards
and set Acked_transitions */
for (j = 0; j < MAX_BACNET_EVENT_TRANSITION; j++) {
@ -1299,6 +1307,7 @@ bool Multistate_Value_Write_Property(
if (status) {
CurrentMSV->Time_Delay = value.type.Unsigned_Int;
CurrentMSV->Remaining_Time_Delay = CurrentMSV->Time_Delay;
ucix_add_option_int(ctx, "bacnet_mv", index_c, "time_delay", value.type.Unsigned_Int);
}
break;