ble_gap_adv_start

int
ble_gap_adv_start(
                            uint8_t  own_addr_type,
                   const ble_addr_t *direct_addr,
                            int32_t  duration_ms,
    const struct ble_gap_adv_params *adv_params,
                   ble_gap_event_fn *cb,
                               void *cb_arg
)

Description

Initiates advertising.

Parameters

ParameterDescription
own_addr_typeThe type of address the stack should use for itself. Valid values are: BLE_OWN_ADDR_PUBLIC BLE_OWN_ADDR_RANDOM BLE_OWN_ADDR_RPA_PUBLIC_DEFAULT BLE_OWN_ADDR_RPA_RANDOM_DEFAULT
direct_addrThe peer's address for directed advertising. This parameter shall be non-NULL if directed advertising is being used.
duration_msThe duration of the advertisement procedure. On expiration, the procedure ends and a BLE_GAP_EVENT_ADV_COMPLETE event is reported. Units are milliseconds. Specify BLE_HS_FOREVER for no expiration.
adv_paramsAdditional arguments specifying the particulars of the advertising procedure.
cbThe callback to associate with this advertising procedure. If advertising ends, the event is reported through this callback. If advertising results in a connection, the connection inherits this callback as its event-reporting mechanism.
cb_argThe optional argument to pass to the callback function.

Returned values

ValueCondition
0Success.
Core return codeUnexpected error.