Question
I'm looking at the Analog_Output_Present_Value_Write function in src/bacnet/basic/object/ao.c and noticed a potential discrepancy between the documentation and implementation. I wanted to clarify the intended behavior.
Observation
Header documentation (ao.h:22-28)
/**
* @brief Callback for gateway write present value request
* @param object_instance - object-instance number of the object
* @param old_value - floating point analog value prior to write
* @param value - floating point analog value of the write
*/
typedef void (*analog_output_write_present_value_callback)(
uint32_t object_instance, float old_value, float value);
The documentation says value should be "floating point analog value of the write".
Implementation (ao.c:474-486)
old_value = Analog_Output_Present_Value(object_instance);
Analog_Output_Present_Value_Set(object_instance, value, priority);
// ...
} else if (Analog_Output_Write_Present_Value_Callback) {
new_value = Analog_Output_Present_Value(object_instance);
Analog_Output_Write_Present_Value_Callback(
object_instance, old_value, new_value);
}
The implementation passes new_value (the resulting present value after priority resolution) rather than value (the value that was actually written).
Example scenario
- Priority 1 has value 100.0 (active)
- User writes 50.0 to Priority 8 (value = 50.0)
- old_value = 100.0 (from priority 1)
- new_value = 100.0 (priority 1 still active)
- Callback receives (100.0, 100.0) — the written value 50.0 is not passed
Question
Which behavior is intended?
- Pass value — the value that was actually written (matches current documentation)
- Pass new_value — the resulting present value after priority resolution (current implementation)
Both have valid use cases, so I wanted to confirm which one is the intended design before suggesting any changes.
Thank you!
Reactions are currently unavailable
Question
I'm looking at the Analog_Output_Present_Value_Write function in src/bacnet/basic/object/ao.c and noticed a potential discrepancy between the documentation and implementation. I wanted to clarify the intended behavior.
Observation
Header documentation (ao.h:22-28)
The documentation says value should be "floating point analog value of the write".
Implementation (ao.c:474-486)
The implementation passes new_value (the resulting present value after priority resolution) rather than value (the value that was actually written).
Example scenario
Question
Which behavior is intended?
Both have valid use cases, so I wanted to confirm which one is the intended design before suggesting any changes.
Thank you!