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

Why there are no Broadcaster and Observer role in ble_gap.h

I use sdk_9.0.0 and I have realized that there are only:

#define BLE_GAP_ROLE_INVALID     0x0            /**< Invalid Role. */ 
#define BLE_GAP_ROLE_PERIPH      0x1            /**< Peripheral Role. */
#define BLE_GAP_ROLE_CENTRAL     0x2            /**< Central Role. */ 

Suppose that I want to implement Broadcaster role with Broadcast mode and with advertising type ADV_NONCONN_IND, how should I then achieve it (using SD 130)? ble_advertising.h is only used for connectable advertising so I guess my implementation can only use files inside /sd130/headers?

What about Observer role and Observation procedure, how should that be achieved ?

Parents
  • These defines are used in the BLE_GAP_EVT_CONNECTED event, to see if the connection you just created was a peripheral or a central connection. The defines are also used in the S120 2.x.x, where you can select what role you want to enable on initialization of the BLE stack (in sd_ble_enable()).

    If you want to broadcast, you simply call sd_ble_gap_adv_data_set() and sd_ble_gap_adv_start() in S110 or S130. In the S120 (2.x.x only), you need to initialize as the Peripheral role to enable broadcasting.

    For observer role, you call sd_ble_gap_scan_start() in S130 or S120 1.x.x. In S120 2.x.x you need to enable with the role set to BLE_GAP_ROLE_CENTRAL.

Reply
  • These defines are used in the BLE_GAP_EVT_CONNECTED event, to see if the connection you just created was a peripheral or a central connection. The defines are also used in the S120 2.x.x, where you can select what role you want to enable on initialization of the BLE stack (in sd_ble_enable()).

    If you want to broadcast, you simply call sd_ble_gap_adv_data_set() and sd_ble_gap_adv_start() in S110 or S130. In the S120 (2.x.x only), you need to initialize as the Peripheral role to enable broadcasting.

    For observer role, you call sd_ble_gap_scan_start() in S130 or S120 1.x.x. In S120 2.x.x you need to enable with the role set to BLE_GAP_ROLE_CENTRAL.

Children
Related