Exported Functions

group HB_Exported_Functions

Functions

bool hb_init(hb_data_cb pcb)

initialize heartbeat module

参数:

pcb[in] heartbeat callback function

void hb_deinit(void)

deinitialize heartbeat module

void hb_timer_start(uint8_t timer)

start the heartbeat timer

参数:

timer[in] HB_TIMER_PUB or HB_TIMER_SUB

返回:

none

void hb_timer_stop(uint8_t timer)

stop the heartbeat timer

参数:

timer[in] HB_TIMER_PUB or HB_TIMER_SUB

返回:

none

bool hb_receive_filter(uint16_t src, uint16_t dst)

detect if the message need be processed

参数:
  • src[in] message source addr

  • dst[in] message destination addr

返回值:
  • true – need process

  • false – do not process

返回:

operation result

bool hb_handle_msg(mesh_msg_p pmesh_msg)

process the message

参数:

pmesh_msg[in] mesh message

返回值:
  • true – processed

  • false – not processed

返回:

operation result

void hb_msg_send(hb_trigger_type_t type)

send hb message

参数:

type[in] the trigger source type

返回:

none

void hb_handle_timeout(uint8_t timer)

timeout handler

参数:

timer[in] publish or subscribe

返回:

none

void hb_publication_set(hb_pub_t pub)

set heartbeat publication parameter

参数:

pub[in] heartbeat publication parameter

hb_pub_t hb_publication_get(void)

get heartbeat publication parameter

返回:

heartbeat publication parameter

void hb_subscription_set(hb_sub_t sub)

set heartbeat subscription parameter

参数:

sub[in] heartbeat subscription parameter

hb_sub_t hb_subscription_get(void)

get heartbeat subscription parameter

返回:

heartbeat subscription parameter

uint8_t hb_log2_greater(uint16_t value)

log value

参数:

value[in] value to log, 2exp(n-1) is greater than or equal to value

返回:

log value

uint8_t hb_log2_less(uint16_t value)

log value

参数:

value[in] value to log, 2exp(n-1) is less than or equal to value

返回:

log value

uint16_t hb_exp2(uint8_t log_value)

exp value

参数:

log_value[in] value to exp

返回:

exp value