Hi, I want to identify different kinds of center in a device product. So I have 2 questiones: 1) Can a center (running S120) set its own name? 2) Can a device (running S110) get the center's name?
Hi, I want to identify different kinds of center in a device product. So I have 2 questiones: 1) Can a center (running S120) set its own name? 2) Can a device (running S110) get the center's name?
1) A device running as a central will not advertise, and it is therefore no need for it to have a name. A central device is identified by its address, or alternatively if it is using resolvable address* it has to be identified by its IRK. A device using a resolvable address will change its address every given interval, for example every 15 min, and therefore, it cannot be identified by its address. By default, nRF51/2 chips are programmed with a random static address that never change.
2) Since a central doesn't have a name, there is no name to give to the peripheral device (s110), the central will instead be identified by its address.
You can get the address of the central device in the BLE_GAP_EVT_CONNECTED event (after being connected): p_ble_evt->evt.gap_evt.connected.peer_address (SDK 11).
If you want to reject devices before they connect, you will have to use a whitelist. Another option is to make the peripheral device disconnect immediately if a wrong device was connected (instead of using whitelist).
The address of the central (and peripheral device) can be changed using sd_ble_gap_address_set(). If you want to set your own addresses to your devices when in production, you can program them to UICR and then retrieve the address from UICR when setting the address.
Note: if you are doing new development, I would recommend you to use the latest version the S130 softdevice instead, because it is the latest softdevice for the nRF51. It supports both central and peripheral role (but you don't have to use both) and it is supported by the latest version of the SDK.
Thanks!
How can I get the central address in the peripheral device (s110) then ?
And can I change the address of the central device manually in s120 ? If so, how to change then?
Thanks!
How can I get the central address in the peripheral device (s110) then ?
And can I change the address of the central device manually in s120 ? If so, how to change then?