Is there any example on how to use this function espconn_get_connection_info() ?
I would like to check the state of my connection but when I read description in espconn.h I get another explanation:
Code: Select all
/******************************************************************************
* FunctionName : espconn_get_connection_info
* Description : used to specify the function that should be called when disconnect
* Parameters : espconn -- espconn to set the err callback
* discon_cb -- err callback function to call when err
* Returns : none
*******************************************************************************/
sint8 espconn_get_connection_info(struct espconn *pespconn, remot_info **pcon_info, uint8 typeflags);
It says that this function sets a callback function to be called when connection disconnects?! Do you have a simple example of how this function is actually used?
Is this OK:
Code: Select all
remot_info *ri = (struct remot_info *)os_zalloc(sizeof(struct remot_info));
espconn_get_connection_info(myConn, &ri, 0);
enum espconn_state connInfo = ri->state;
// connInfo now holds information about myConn connection?
It is a bit difficult to debug so I thought I better ask here before trying when I get home tonight from work.
Thanks!