|
OBSERVER Embedded C library v1.0.0
|
Public API for the deterministic Observer library. More...


Go to the source code of this file.
Functions | |
| subscr_status_e | subscribe (observer_cb_t *subscription_table, observer_cb_t cb_2_register, uint8_t subscription_table_size) |
| Register a callback in the subscription table (void callbacks). More... | |
| subscr_status_e | unsubscribe (observer_cb_t *subscription_table, observer_cb_t cb_2_remove, uint8_t subscription_table_size) |
| Unregister a callback from the subscription table (void callbacks). More... | |
| subscr_status_e | notify (observer_cb_t *subscription_table, uint8_t subscription_table_size) |
| Notify all registered callbacks (no argument). More... | |
| subscr_status_e | subscribe_state_change (observer_cb_state_t *subscription_table, observer_cb_state_t cb_2_register, uint8_t subscription_table_size) |
| Register a callback with event_state_e argument. More... | |
| subscr_status_e | unsubscribe_state_change (observer_cb_state_t *subscription_table, observer_cb_state_t cb_2_remove, uint8_t subscription_table_size) |
| Unregister a callback with event_state_e argument. More... | |
| subscr_status_e | notify_state_change (observer_cb_state_t *subscription_table, uint8_t subscription_table_size, event_state_e state) |
| Notify all registered callbacks with event_state_e argument. More... | |
| subscr_status_e | subscribe_u8 (observer_cb_u8_arg_t *subscription_table, observer_cb_u8_arg_t cb_2_register, uint8_t subscription_table_size) |
| Register a callback with uint8_t argument. More... | |
| subscr_status_e | unsubscribe_u8 (observer_cb_u8_arg_t *subscription_table, observer_cb_u8_arg_t cb_2_remove, uint8_t subscription_table_size) |
| Unregister a callback with uint8_t argument. More... | |
| subscr_status_e | notify_u8 (observer_cb_u8_arg_t *subscription_table, uint8_t subscription_table_size, uint8_t data) |
| Notify all registered callbacks with uint8_t argument. More... | |
Public API for the deterministic Observer library.
Provides declarations for a static-memory, deterministic implementation of the Observer design pattern for safety-critical embedded systems. Designed in compliance with MISRA C and ISO 26262 software safety requirements.
@features
void, uint8_t, and event_state_e.@thread_safety None of the API functions are reentrant or thread-safe. Caller must ensure synchronization (e.g., mutex, critical section, or interrupt masking) if concurrent access is possible.
@safety Deterministic, static allocation only. All pointer arguments validated before use.
| subscr_status_e notify | ( | observer_cb_t * | subscription_table, |
| uint8_t | subscription_table_size | ||
| ) |
Notify all registered callbacks (no argument).
Invokes all non-NULL callbacks in ascending index order.
| [in] | subscription_table | Pointer to an array of observer_cb_t. |
| [in] | subscription_table_size | Table length. |
| subscr_status_e notify_state_change | ( | observer_cb_state_t * | subscription_table, |
| uint8_t | subscription_table_size, | ||
| event_state_e | state | ||
| ) |
Notify all registered callbacks with event_state_e argument.
Calls all valid (non-NULL) callbacks, passing the given event state.
| [in] | subscription_table | Pointer to array of observer_cb_state_t. |
| [in] | subscription_table_size | Table length. |
| [in] | state | Event state passed to callbacks. |
state. @safety Not reentrant; caller must ensure synchronization. @traceability OBSR-FUNC-006 | subscr_status_e notify_u8 | ( | observer_cb_u8_arg_t * | subscription_table, |
| uint8_t | subscription_table_size, | ||
| uint8_t | data | ||
| ) |
Notify all registered callbacks with uint8_t argument.
Invokes all registered callbacks, passing a uint8_t data value.
| [in] | subscription_table | Pointer to array of observer_cb_u8_arg_t. |
| [in] | subscription_table_size | Table length. |
| [in] | data | Data argument passed to each callback. |
data. @safety Not reentrant; caller must ensure synchronization. @traceability OBSR-FUNC-009 | subscr_status_e subscribe | ( | observer_cb_t * | subscription_table, |
| observer_cb_t | cb_2_register, | ||
| uint8_t | subscription_table_size | ||
| ) |
Register a callback in the subscription table (void callbacks).
Registers a callback function in the provided subscription table. If the callback is already present, it is not added again.
| [in,out] | subscription_table | Pointer to an array of observer_cb_t. |
| [in] | cb_2_register | Callback function to register. |
| [in] | subscription_table_size | Number of entries in the table (must be > 0). |
subscription_table points to a valid array of given size. cb_2_register is stored in the table. @safety Not reentrant; caller must ensure synchronization. @traceability OBSR-FUNC-001 | subscr_status_e subscribe_state_change | ( | observer_cb_state_t * | subscription_table, |
| observer_cb_state_t | cb_2_register, | ||
| uint8_t | subscription_table_size | ||
| ) |
Register a callback with event_state_e argument.
Registers a state-change callback in the given subscription table. Prevents duplicate registrations.
| [in,out] | subscription_table | Pointer to array of observer_cb_state_t. |
| [in] | cb_2_register | Callback function to register. |
| [in] | subscription_table_size | Table length (must be > 0). |
| subscr_status_e subscribe_u8 | ( | observer_cb_u8_arg_t * | subscription_table, |
| observer_cb_u8_arg_t | cb_2_register, | ||
| uint8_t | subscription_table_size | ||
| ) |
Register a callback with uint8_t argument.
Registers a callback in the given table if not already present.
| [in,out] | subscription_table | Pointer to array of observer_cb_u8_arg_t. |
| [in] | cb_2_register | Callback to register. |
| [in] | subscription_table_size | Table length (must be > 0). |
| subscr_status_e unsubscribe | ( | observer_cb_t * | subscription_table, |
| observer_cb_t | cb_2_remove, | ||
| uint8_t | subscription_table_size | ||
| ) |
Unregister a callback from the subscription table (void callbacks).
Removes a registered callback and compacts the table by shifting subsequent entries left.
| [in,out] | subscription_table | Pointer to an array of observer_cb_t. |
| [in] | cb_2_remove | Callback function to remove. |
| [in] | subscription_table_size | Table length. |
| subscr_status_e unsubscribe_state_change | ( | observer_cb_state_t * | subscription_table, |
| observer_cb_state_t | cb_2_remove, | ||
| uint8_t | subscription_table_size | ||
| ) |
Unregister a callback with event_state_e argument.
Removes a previously registered callback from the table and compacts it.
| [in,out] | subscription_table | Pointer to array of observer_cb_state_t. |
| [in] | cb_2_remove | Callback function to remove. |
| [in] | subscription_table_size | Table length. |
| subscr_status_e unsubscribe_u8 | ( | observer_cb_u8_arg_t * | subscription_table, |
| observer_cb_u8_arg_t | cb_2_remove, | ||
| uint8_t | subscription_table_size | ||
| ) |
Unregister a callback with uint8_t argument.
Removes a callback from the table and shifts subsequent entries left.
| [in,out] | subscription_table | Pointer to array of observer_cb_u8_arg_t. |
| [in] | cb_2_remove | Callback to remove. |
| [in] | subscription_table_size | Table length. |