diff --git a/src/bacnet/basic/object/ai.c b/src/bacnet/basic/object/ai.c index 0b300637..319701c2 100644 --- a/src/bacnet/basic/object/ai.c +++ b/src/bacnet/basic/object/ai.c @@ -329,6 +329,139 @@ unsigned Analog_Input_Event_State(uint32_t object_instance) } #if defined(INTRINSIC_REPORTING) +/** + * For a given object instance-number, returns the notification_class property + * value + * + * @param object_instance - object-instance number of the object + * + * @return notification_class property value + */ +uint32_t Analog_Input_Notification_Class(uint32_t object_instance) +{ + uint32_t notification_class = BACNET_MAX_INSTANCE; + struct analog_input_descr *pObject = Analog_Input_Object(object_instance); + + if (pObject) { + notification_class = pObject->Notification_Class; + } + + return notification_class; +} + +/** + * For a given object instance-number, sets the notification_class property + * value + * + * @param object_instance - object-instance number of the object + * @param notification_class - notification_class property value + * + * @return true if the notification_class property value was set + */ +bool Analog_Input_Notification_Class_Set( + uint32_t object_instance, uint32_t notification_class) +{ + bool status = false; + struct analog_input_descr *pObject = Analog_Input_Object(object_instance); + + if (pObject) { + pObject->Notification_Class = notification_class; + status = true; + } + + return status; +} + +/** + * For a given object instance-number, returns the event_enable property value + * + * @param object_instance - object-instance number of the object + * + * @return event_enable property value + */ +BACNET_EVENT_ENABLE Analog_Input_Event_Enable(uint32_t object_instance) +{ + uint32_t event_enable = 0; + struct analog_input_descr *pObject = Analog_Input_Object(object_instance); + + if (pObject) { + event_enable = pObject->Event_Enable; + } + + return event_enable; +} + +/** + * For a given object instance-number, sets the event_enable property value + * + * @param object_instance - object-instance number of the object + * @param event_enable - event_enable property value - the combination of bits: + * EVENT_ENABLE_TO_OFFNORMAL, EVENT_ENABLE_TO_FAULT, + * EVENT_ENABLE_TO_NORMAL + * @return true if the event_enable property value was set + */ +bool Analog_Input_Event_Enable_Set( + uint32_t object_instance, BACNET_EVENT_ENABLE event_enable) +{ + bool status = false; + struct analog_input_descr *pObject = Analog_Input_Object(object_instance); + + if (pObject) { + if (!(event_enable & + ~(EVENT_ENABLE_TO_OFFNORMAL | EVENT_ENABLE_TO_FAULT | + EVENT_ENABLE_TO_NORMAL))) { + pObject->Event_Enable = event_enable; + status = true; + } + } + + return status; +} + +/** + * For a given object instance-number, returns the notify_type property value + * + * @param object_instance - object-instance number of the object + * + * @return notify_type property value + */ +BACNET_NOTIFY_TYPE Analog_Input_Notify_Type(uint32_t object_instance) +{ + BACNET_NOTIFY_TYPE notify_type = NOTIFY_EVENT; + struct analog_input_descr *pObject = Analog_Input_Object(object_instance); + + if (pObject) { + notify_type = pObject->Notify_Type; + } + + return notify_type; +} + +/** + * For a given object instance-number, sets the notify_type property value + * + * @param object_instance - object-instance number of the object + * @param notify_type - notify_type property value from the set + * + * @return true if the notify_type property value was set + */ +bool Analog_Input_Notify_Type_Set( + uint32_t object_instance, BACNET_NOTIFY_TYPE notify_type) +{ + bool status = false; + struct analog_input_descr *pObject = Analog_Input_Object(object_instance); + + if (pObject) { + if ((notify_type == NOTIFY_EVENT) || (notify_type == NOTIFY_ALARM)) { + pObject->Notify_Type = notify_type; + status = true; + } + } + + return status; +} + /** * For a given object instance-number, gets the event-detection-enable property * value