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

General questions on the code loaded on nRF devices

Hi all, i am experimenting on the example "ble_app_beacon" on my smart beacon kit, but i have two questions about it (though they are pretty general):

  • When a connection with a device happens, in the code we have the execution of "ble evt dispatch" and, inside this, "on ble evt" with also other stuff; let's say that in "on ble evt" i trigger a led, after doing this what instructions are executed in the code? I mean, the two devices stay connected, where does the code loop at this point? in the case "connected" of "on ble evt"?

  • In the code i mentioned, there is loaded the DFU service; let's say that i want to remove this service to add a new one, can the beacon connects without any services loaded for a first try? In other words, how can i REMOVE the DFU service (is it enough to delete it from "services_init?) without getting an error and still make the beacon connect with other devices?

Thanks in advance, sorry for bothering but i'm having a hard time at learning the Nordic system!

  • Hi,

    The program is event driven, where events can originate from timers, from the radio or from other hardware peripherals. The code as such does not necessarily loop doing anything other than just not exiting from main. Look at the main loop in the examples to see what is happening when there are no events being processed.

    You can remove services and characteristics, but be aware of the following:

    • Some services may also be advertised. If they are they should be removed from the advertising packet if they are removed.
    • Some centrals may cache what services and characteristics are on a peripheral. Without the service changed characteristic the central may stil show the "old" services and characteristics even though they are changed.

    In general I would recommend having a look at some of our tutorials, in particular those under Bluetooth Low Energy such as the BLE advertising, characteristics and services tutorials.

    Regards, Terje

  • Yeah i already followed all the tutorials, thanks for the explanation!

Related