This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to implement BT Mesh event handle to catch NRF_MESH_EVT_TX_COMPLETE or read current state

Hi guys, i can't figure out how to create an event handler in my Mesh Client.

The functionality of this handler should be to set a flag on the 'NRF_MESH_EVT_TX_COMPLETE'.

I need to know this, because i will be running a timer just before transmission and want to stop it when finished.  I also want to know when the NRF_MESH_EVT_TX_COMPLETE has been thrown, to prevent sending a new message and getting a wrong state error.

To be frank, i'm not sure if making an evt handler is the right move, but is sounds logical, unless there's a register/attribute i can read that shows the current state.

This is how far i've come:

it's a rough copy of a handler reacting on the same state in the config_server.c

I think one of my roadblocks is not knowing how to assign the handler to catch the events. .