Document ComFlagEx for Uninitialized State Handling Fix

This commit is contained in:
Cornelius Köpp 2024-02-12 23:11:00 +01:00
parent 96bd0ee9ec
commit 21ab50fd00

View File

@ -7,6 +7,12 @@
class GroupObjectTableObject; class GroupObjectTableObject;
/**
* LIMITATION: The differentiation between uninitialized and initialized state can NOT be represented correctly in ComFlag alone:
* It might be in state Transmitting during a ReadRequest on startup while value is still not valid.
*
* See ComFlagEx for a clear uninitialized handling.
*/
enum ComFlag : uint8_t enum ComFlag : uint8_t
{ {
Updated = 0, //!< Group object was updated Updated = 0, //!< Group object was updated
@ -15,13 +21,17 @@ enum ComFlag : uint8_t
Transmitting = 3, //!< Group Object is processed a the moment (read or write) Transmitting = 3, //!< Group Object is processed a the moment (read or write)
Ok = 4, //!< read or write request were send successfully Ok = 4, //!< read or write request were send successfully
Error = 5, //!< there was an error on processing a request Error = 5, //!< there was an error on processing a request
Uninitialized = 6 //!< uninitialized Group Object, its value is not valid Uninitialized = 6 //!< uninitialized Group Object, its value is not valid; WARNING: Other Values do NOT guarantee an actual valid value!
}; };
// extended ComFlag: Uninitialized it not handled correctly as ComFlag /**
// it might be in state Transmitting during a ReadRequest on startup while value is still not valid * Extended ComFlag
// we use MSB to store Uninitialized and keep the size of GroupObject the same saving memory ressources * Add a separate uninitialized flag to overcome the limitations of ComFlag.
// the old Uninitialized handling is still there for compatibility reasons. *
* Implementation Note:
* We use MSB to store uninitialized state and keep the size of GroupObject the same saving memory resources.
* The old uninitialized handling is not changed for compatibility reasons.
*/
struct ComFlagEx struct ComFlagEx
{ {
bool uninitialized : 1; bool uninitialized : 1;