diff --git a/src/bacnet/basic/object/bi.c b/src/bacnet/basic/object/bi.c index 04638351..e67d5db8 100644 --- a/src/bacnet/basic/object/bi.c +++ b/src/bacnet/basic/object/bi.c @@ -908,7 +908,9 @@ int Binary_Input_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata) case PROP_STATUS_FLAGS: /* note: see the details in the standard on how to use these */ bitstring_init(&bit_string); - bitstring_set_bit(&bit_string, STATUS_FLAG_IN_ALARM, false); + bitstring_set_bit( + &bit_string, STATUS_FLAG_IN_ALARM, + pObject->Event_State != EVENT_STATE_NORMAL); state = Binary_Input_Fault(rpdata->object_instance); bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, state); bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false); @@ -917,8 +919,8 @@ int Binary_Input_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata) apdu_len = encode_application_bitstring(&apdu[0], &bit_string); break; case PROP_EVENT_STATE: - apdu_len = - encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL); + apdu_len = encode_application_enumerated( + &apdu[0], Binary_Input_Event_State(rpdata->object_instance)); break; case PROP_OUT_OF_SERVICE: state = Binary_Input_Out_Of_Service(rpdata->object_instance); diff --git a/src/bacnet/basic/object/bv.c b/src/bacnet/basic/object/bv.c index e4ae81c3..9277283d 100644 --- a/src/bacnet/basic/object/bv.c +++ b/src/bacnet/basic/object/bv.c @@ -915,7 +915,9 @@ int Binary_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata) case PROP_STATUS_FLAGS: /* note: see the details in the standard on how to use these */ bitstring_init(&bit_string); - bitstring_set_bit(&bit_string, STATUS_FLAG_IN_ALARM, false); + bitstring_set_bit( + &bit_string, STATUS_FLAG_IN_ALARM, + pObject->Event_State != EVENT_STATE_NORMAL); state = Binary_Value_Fault(rpdata->object_instance); bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, state); bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false); @@ -924,8 +926,8 @@ int Binary_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata) apdu_len = encode_application_bitstring(&apdu[0], &bit_string); break; case PROP_EVENT_STATE: - apdu_len = - encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL); + apdu_len = encode_application_enumerated( + &apdu[0], Binary_Value_Event_State(rpdata->object_instance)); break; case PROP_OUT_OF_SERVICE: state = Binary_Value_Out_Of_Service(rpdata->object_instance);