AnsweredAssumed Answered

prf_disp_disconnect_reg(prf_dispatch_disconnect)

Question asked by Leaf Lee on May 18, 2018

I am developing a project on QN902x and on IAR ARM 8.11.3 platform.

There are some statements in the file of app_main.c:

...

static void prf_register(void)
{
prf_init_reg(prf_init);

prf_disp_disconnect_reg(prf_dispatch_disconnect);
}

...

 

"prf_disp_disconnect_reg()" should be a MACRO, and I trace it to the file of ble.h:

...

typedef void (*prf_disp_disconnect_cb)(uint8_t status, uint8_t reason, uint16_t conhdl, uint8_t idx);
typedef void (*p_prf_disp_disconnect_reg)(prf_disp_disconnect_cb app_func);
#define prf_disp_disconnect_reg ((p_prf_disp_disconnect_reg)(_prf_disp_disconnect_reg))

...

I think the statement of "prf_disp_disconnect_reg(prf_dispatch_disconnect);" should run the function in the file of prf_utils.c:

...

void prf_dispatch_disconnect(uint8_t status, uint8_t reason, uint16_t conhdl, uint8_t idx)
{

...

 

I have 2 questions:

 

1. How to translate "prf_disp_disconnect_reg()" to "prf_dispatch_disconnect()"

2. "prf_disp_disconnect_reg(prf_dispatch_disconnect);" has no aguments of "uint8_t status, uint8_t reason, uint16_t conhdl, uint8_t idx". If the MACRO run "prf_dispatch_disconnect(status, reason, conhdl, idx)", where are those 4 arguments from?

 

Outcomes