/* Given state of Eddystone beacon, get advertisement parameters.  */
static void get_adv_params(ble_gap_adv_params_t *p_adv_params, bool non_connectable, bool remain_connectable)
/* Given state of Eddystone beacon, get advertisement parameters.  */
static void get_adv_params(ble_gap_adv_params_t *p_adv_params, bool non_connectable, bool remain_connectable)
{
    memset(p_adv_params, 0, sizeof(ble_gap_adv_params_t));
    p_adv_params->type =
        non_connectable ? BLE_GAP_ADV_TYPE_ADV_NONCONN_IND : BLE_GAP_ADV_TYPE_ADV_IND;
    p_adv_params->p_peer_addr = NULL;
    p_adv_params->fp          = BLE_GAP_ADV_FP_ANY;
    p_adv_params->interval    = non_connectable ? BLE_GAP_ADV_INTERVAL_MAX : 1000;
    p_adv_params->timeout     = non_connectable
                                ? APP_CFG_NON_CONN_ADV_TIMEOUT
                                : (remain_connectable ? 0 : APP_CFG_CONNECTABLE_ADV_TIMEOUT);
}