I'm trying to understand example "ble_app_hts" how after advertising make a connection. I didn't see in code any call of function "sd_ble_gap_connect" ? how is made connection ?
I'm trying to understand example "ble_app_hts" how after advertising make a connection. I didn't see in code any call of function "sd_ble_gap_connect" ? how is made connection ?
ok, now I will know. but the other hands: if we use IRQ (don't call function) how to obtain the error code after data event? if connection failed ?
The SoftDevice will pass events to the application using a Software Interrupt, e.g. when a packet has been received, when a connection has been established, when the connection is lost etc.
but is there a variable or other type of feedback to me? how to use this information in my code? For example to printf a status , error ?
The events are the feedback you get after calling the SoftDevice API( i.e. functions with sd_-prefix). You need to handle the events passed from the SoftDevice in the application, e.g. once a peripheral has connected you will get the BLE_GAP_EVT_CONNECTED event. If the connection times out then you will get a BLE_GAP_EVT_TIMEOUT event. You use the logging interface to print status/errors to a terminal.
"You need to handle the events passed from the SoftDevice in the application", ok, but how? I have to call some function or other way? How do I get the BLE_GAP_EVT_CONNECTED event ? I need this event in my own global or local variable .