/** * @file include/di_fw/heartbeat.h * @brief Device periodic heartbeat module (device:data) * @copyright 2016 Dual Inventive Technology Centre B.V. */ #ifndef INCLUDE_DI_FW_HEARTBEAT_H_ #define INCLUDE_DI_FW_HEARTBEAT_H_ #include /** * Application specific heartbeat publish callback (e.g CAN-bus, DI-Net RPC over TCP) */ typedef void (*di_fw_heartbeat_publish_cb_t)(void); /** * Initialize the heartbeat to periodically publish device:data */ void di_fw_heartbeat_init(void); /** * Control periodic sending of the device:data heartbeat * @param cb Application specific hearbeat publish callback (e.g CAN-bus, DI-Net RPC over TCP) * @return DNOK in case of succes, * DNE_BUSY in case the heartbeat is already enabled * DNE_NORES if the periodic event could not be added */ di_errno_t di_fw_heartbeat_enable(di_fw_heartbeat_publish_cb_t cb); /** * Disable periodic heartbeat publishing * @return DNOK if the heartbeat is disabled */ di_errno_t di_fw_heartbeat_disable(void); /** * Callback for publishing the heartbeat over the first registered CAN-bus of di_fw_can * @note DI_FW_HEARTBEAT_CAN_PUBLISH_ACTIVE_STATE_RT_ENABLED must be set from the board.h to * send RT messages when the device is in the active state */ void di_fw_heartbeat_can_publish(void); #endif /* INCLUDE_DI_FW_HEARTBEAT_H_ */