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 ?
Take a look at the BLE examples in the SDK, see this Infocenter page.
All application examples include the SoftDevice Event Handler module, which contains a BLE stack interrupt handler (SWI2_IRQHandler). This interrupt handler will be called each time the stack wants to pass an event to the application. The handler reads the stack event, and passes the event to the application through a callback function.
ok thank you, but I still don't see how to pass events to my variable? I need call functions or read some memory? example will help
Yes, you call the SoftDevice API functions and then you get an event when the SD finishes executing that specific function. I do not understand why you need to pass events to a variable, you simply have to handle the events. Download the SDK found here, and open one of the examples that are listed here, e.g. the Heart Rate Application and see how the events are handled.
I have opened "ble_app_hts" example and I try to figure out how it work.
I still don't see how to handle this events from appliation.
You told "the SoftDevice is 100% event-driven" and I don't need to call.
but I can run "sd_ble_opt_get". So there is a two type of function ?
100% event-driven does not mean that you do not need to call any functions. It just means that the SoftDevice uses events and interrupts to pass information to the application.