Files
relay_chn/private_include/relay_chn_notify.h

52 lines
1.2 KiB
C

/*
* SPDX-FileCopyrightText: 2025 Kozmotronik Tech
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#include "esp_err.h"
#include <stdint.h>
#include "relay_chn_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Init the notify module.
*
* @return
* - ESP_OK: Success
* - ESP_ERR_NO_MEM: Not enough memory to create notify queue
*/
esp_err_t relay_chn_notify_init(void);
/**
* @brief Deinit the notify module.
*
* This function cleans up resources used by the notify module.
*/
void relay_chn_notify_deinit(void);
/**
* @brief Notify all registered listeners about a state change.
*
* This function sends a state change event to an internal queue, which will then
* be processed by a dedicated task to notify all registered listeners. This
* function is typically called internally by the relay channel core logic.
*
* @param chn_id The ID of the relay channel whose state has changed.
* @param old_state The previous state of the relay channel.
* @param new_state The new state of the relay channel.
*/
esp_err_t relay_chn_notify_state_change(uint8_t chn_id,
relay_chn_state_t old_state,
relay_chn_state_t new_state);
#ifdef __cplusplus
}
#endif