Exported Functions

group HB_Exported_Functions

Functions

bool hb_init(hb_data_cb pcb)

Initialize heartbeat module.

This function sets up the heartbeat module for operation within a mesh network, enabling heartbeat message broadcasting and handling based on the configuration.

Parameters:

pcb[in] Function pointer for heartbeat data callback.

Return values:
  • true – Initialization succeeded.

  • false – Initialization failed due to invalid callback or resource limitations.

Returns:

Initialization result.

void hb_deinit(void)

Deinitialize heartbeat module.

Cleans up and frees resources held by the heartbeat module, ending its operation within the network.

void hb_timer_start(uint8_t timer)

Start the heartbeat timer.

Begins the operation of the specified heartbeat timer to handle periodic tasks.

Parameters:

timer[in] Specifies whether the publication or subscription timer is managed (HB_TIMER_PUB or HB_TIMER_SUB).

void hb_timer_stop(uint8_t timer)

Stop the heartbeat timer.

Ends the operation of the specified heartbeat timer, halting periodic messaging.

Parameters:

timer[in] Identifies the timer being stopped (HB_TIMER_PUB or HB_TIMER_SUB).

bool hb_receive_filter(uint16_t src, uint16_t dst)

Determine if the message needs processing.

Filters incoming messages to check if they should be processed based on source and destination addresses.

Parameters:
  • src[in] Source address of the message.

  • dst[in] Destination address of the message.

Return values:
  • true – Message requires processing.

  • false – Message is not processed.

Returns:

Filter result.

bool hb_handle_msg(mesh_msg_p pmesh_msg)

Process the mesh message.

Handles incoming mesh messages if they meet criteria set by the heartbeat module.

Parameters:

pmesh_msg[in] Pointer to the mesh message structure.

Return values:
  • true – Message was successfully processed.

  • false – Processing was not successful due to mismatched criteria or handler errors.

Returns:

Processing result.

void hb_msg_send(hb_trigger_type_t type)

Send a heartbeat message.

Initiates sending of a heartbeat message triggered by a specific source type.

Parameters:

type[in] Specifies the source type triggering the message (e.g., relay, proxy).

void hb_handle_timeout(uint8_t timer)

Handle timeout events for heartbeat timers.

Manages actions that need to occur when a heartbeat timer encounters a timeout event.

Parameters:

timer[in] Selects between publication or subscription timer for handling.

void hb_publication_set(hb_pub_t pub)

Set publication parameters for heartbeat.

Configures parameters governing how heartbeat messages are published within the network.

Parameters:

pub[in] Specifies configuration parameters for heartbeat publications.

hb_pub_t hb_publication_get(void)

Retrieve publication parameters.

Gathers current settings for how heartbeat messages are published.

Returns:

Publication parameters currently in use.

void hb_subscription_set(hb_sub_t sub)

Set subscription parameters for heartbeat.

Adjusts settings for handling subscription to incoming heartbeat messages within the mesh network.

Parameters:

sub[in] Specifies configuration parameters for heartbeat subscriptions.

hb_sub_t hb_subscription_get(void)

Retrieve subscription parameters.

Gathers current settings for how heartbeat subscription is managed and processed.

Returns:

Subscription parameters in use currently.

uint8_t hb_log2_greater(uint16_t value)

Calculate a log value that is greater or equal.

Computes a logarithmic value where 2^exp(n-1) meets or exceeds the input value.

Parameters:

value[in] The input value for log calculation.

Returns:

Calculated log value.

uint8_t hb_log2_less(uint16_t value)

Calculate a log value that is less or equal.

Computes a logarithmic value where 2^exp(n-1) is beneath or meets the input value.

Parameters:

value[in] The input value for log calculation.

Returns:

Calculated log value.

uint16_t hb_exp2(uint8_t log_value)

Calculate an exponential value.

Expands a logarithmic value into a computed exponential value.

Parameters:

log_value[in] The log value to expand.

Returns:

Resulting exponential value.