• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ sd_ble_gap_adv_start函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中sd_ble_gap_adv_start函数的典型用法代码示例。如果您正苦于以下问题:C++ sd_ble_gap_adv_start函数的具体用法?C++ sd_ble_gap_adv_start怎么用?C++ sd_ble_gap_adv_start使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了sd_ble_gap_adv_start函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ble_device_start_advertising

/**@brief Function for starting advertising.
 */
void ble_device_start_advertising(void)
{
  uint32_t err_code;

  err_code = sd_ble_gap_adv_start(&m_adv_params);
  APP_ERROR_CHECK(err_code);
}
开发者ID:JUMA-IO,项目名称:nRF51_Platform,代码行数:9,代码来源:device_main.c


示例2: app_beacon_start

void app_beacon_start(void)
{
    uint32_t err_code;
    uint8_t adv_pdu[ADV_DATA_LEN];
    
    uint8_t adv_len = encode_adv_packet(&adv_pdu[0]);
    
    err_code = sd_ble_gap_adv_data_set(adv_pdu, adv_len, NULL, 0);
    
    if (err_code != NRF_SUCCESS)
    {
        if (m_beacon.error_handler != NULL)
        {
            m_beacon.error_handler(err_code);
        }
    } 
    
    err_code = sd_ble_gap_adv_start(&m_beacon.adv_params);
    
    if (err_code != NRF_SUCCESS)
    {
        if (m_beacon.error_handler != NULL)
        {
            m_beacon.error_handler(err_code);
        }
    } 
}
开发者ID:BlockWorksCo,项目名称:Playground,代码行数:27,代码来源:advertiser_beacon.c


示例3: bleApp_advertisingStart

/**@brief Start advertising.
 */
void bleApp_advertisingStart() {
    uint32_t             err_code;
    ble_gap_adv_params_t adv_params;

    // Start advertising
    memset(&adv_params, 0, sizeof(adv_params));

    adv_params.type        = BLE_GAP_ADV_TYPE_ADV_IND;
    adv_params.p_peer_addr = NULL;
    adv_params.fp          = BLE_GAP_ADV_FP_ANY;
    adv_params.interval    = APP_ADV_INTERVAL;
    adv_params.timeout     = APP_ADV_TIMEOUT_IN_SECONDS;

    err_code = sd_ble_gap_adv_start(&adv_params);
    /* Allow invalid state errors, trap everything else.  We do this because we
     * may already be advertising when we try to start advertising again, and
     * that's okay. */
    if (err_code == NRF_ERROR_INVALID_STATE) {
    	;
    } else {
    	APP_ERROR_CHECK(err_code);
    }

    led_setState(LED_BLUE, LED_STATE_SLOW_FLASH);
}
开发者ID:M-Blocks,项目名称:MBlocks-MB,代码行数:27,代码来源:bleApp.c


示例4: app_ble_start

/**
 * @brief Advertising開始
 */
void app_ble_start(void)
{
    uint32_t             err_code;
    ble_gap_adv_params_t adv_params;

    // Start advertising
    memset(&adv_params, 0, sizeof(adv_params));

    adv_params.type        = BLE_GAP_ADV_TYPE_ADV_IND;
    adv_params.p_peer_addr = NULL;
    adv_params.fp          = BLE_GAP_ADV_FP_ANY;
    adv_params.interval    = MSEC_TO_UNITS(APP_ADV_INTERVAL, UNIT_0_625_MS);
    adv_params.timeout     = APP_ADV_TIMEOUT_IN_SECONDS;
#ifdef APP_ADV_DISABLE_CH37
	adv_params.channel_mask.ch_37_off = 1;
#endif	//APP_ADV_DISABLE_CH37
#ifdef APP_ADV_DISABLE_CH38
	adv_params.channel_mask.ch_38_off = 1;
#endif	//APP_ADV_DISABLE_CH38
#ifdef APP_ADV_DISABLE_CH39
	adv_params.channel_mask.ch_39_off = 1;
#endif	//APP_ADV_DISABLE_CH39

    err_code = sd_ble_gap_adv_start(&adv_params);
    APP_ERROR_CHECK(err_code);
    led_on(LED_PIN_NO_ADVERTISING);

    app_trace_log("advertising start\r\n");
}
开发者ID:hirokuma,项目名称:nrf51822_uitron_ssp,代码行数:32,代码来源:app_ble.c


示例5: ble_gap_event_handler

static void ble_gap_event_handler(ble_evt_t* evt)
{
    switch (evt->header.evt_id)
    {
    case BLE_GAP_EVT_CONNECTED:
        break;

    case BLE_GAP_EVT_DISCONNECTED:
          sd_ble_gap_adv_start(&ble_adv_params);
          break;

    case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
          APP_ERROR_CHECK(sd_ble_gap_sec_params_reply(evt->evt.gap_evt.conn_handle,
            BLE_GAP_SEC_STATUS_SUCCESS, &ble_gap_bond_params));
          break;

    case BLE_GAP_EVT_CONN_SEC_UPDATE:
        break;
      
    case BLE_GAP_EVT_AUTH_STATUS:
        break;

    default:
        break;
    }
}
开发者ID:Eppo791906066,项目名称:nRF51-ble-bcast-mesh,代码行数:26,代码来源:nrf_adv_conn.c


示例6: memset

BLETransceiver::Error BLETransceiver::advertise(uint16_t arg_u16_advDuration)
{
	uint32_t             err_code;
	ble_gap_adv_params_t adv_params;
	Error loc_s8_err = GENERAL_ERROR;

	// Start advertising
	memset(&adv_params, 0, sizeof(adv_params));

	adv_params.type        = BLE_GAP_ADV_TYPE_ADV_IND;
	adv_params.p_peer_addr = NULL;
	adv_params.fp          = BLE_GAP_ADV_FP_ANY;
	adv_params.interval    = u16_appAdvInterval;
	adv_params.timeout     = arg_u16_advDuration;

	err_code = sd_ble_gap_adv_start(&adv_params);
	if(err_code != NRF_SUCCESS)
	{
		APP_ERROR_CHECK(err_code);
	}
	else
	{
		b_isAdvertising = true;
		loc_s8_err = NO_ERROR;
	}
	return loc_s8_err;
}
开发者ID:Lahorde,项目名称:nrf51_template_application,代码行数:27,代码来源:ble_transceiver.cpp


示例7: main

int main(void)
{
    // If transport layer is using UART with flow control we need to get one
    // GPIOTE user for the CTS wakeup pin.
    APP_GPIOTE_INIT(1);

    leds_init();

    // Indicate that the application has started up. This can be used to verify that
    // application resets if reset button is pressed or the chip has been reset with
    // a debugger. The led will be off during reset.
    nrf_gpio_pin_set(MAIN_FUNCTION_LED_PIN_NO);

    connectivity_chip_reset();

    bluetooth_init();

    // Enter main loop.
    for (;;)
    {
        uint32_t err_code;

        // Start/restart advertising.
        if (m_start_adv_flag)
        {
            err_code = sd_ble_gap_adv_start(&m_adv_params);
            APP_ERROR_CHECK(err_code);
            nrf_gpio_pin_set(ADVERTISING_LED_PIN_NO);
            m_start_adv_flag = false;
        }

        // Power management.
        power_manage();
    }
}
开发者ID:rpi-fongming,项目名称:nolem_m2d,代码行数:35,代码来源:main.c


示例8: nrf_adv_conn_init

void nrf_adv_conn_init(void)
{
    uint32_t error_code;
    
    /* Fill advertisement data struct: */
    uint8_t flags = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED;

    memset(&ble_adv_data, 0, sizeof(ble_adv_data));

    ble_adv_data.flags.size = 1;
    ble_adv_data.flags.p_data = &flags;
    ble_adv_data.name_type    = BLE_ADVDATA_FULL_NAME;
    //ble_adv_data.p_manuf_specific_data = &man_data;

    ble_gap_conn_sec_mode_t name_sec_mode = {1, 1};
    ble_gap_addr_t my_addr;
    
    error_code = sd_ble_gap_address_get(&my_addr);
    APP_ERROR_CHECK(error_code);
    
    char name[64];
    sprintf(name, "rbc_mesh #%d", 
        ((uint16_t) my_addr.addr[4] << 8) | (my_addr.addr[5]));
    
    error_code = sd_ble_gap_device_name_set(&name_sec_mode, (uint8_t*) name, strlen(name));
    APP_ERROR_CHECK(error_code);
    
    /* Set advertisement data with ble_advdata-lib */
    error_code = ble_advdata_set(&ble_adv_data, NULL);
    APP_ERROR_CHECK(error_code);

    /* Start advertising */
    error_code = sd_ble_gap_adv_start(&ble_adv_params);
    APP_ERROR_CHECK(error_code);
}
开发者ID:Eppo791906066,项目名称:nRF51-ble-bcast-mesh,代码行数:35,代码来源:nrf_adv_conn.c


示例9: advertising_start

/**@brief Function for starting advertising.
 */
static uint32_t advertising_start(void)
{
    uint32_t err_code;
    ble_gap_adv_params_t adv_params;

    if ((m_flags & DFU_BLE_FLAG_IS_ADVERTISING) != 0)
    {
        return NRF_SUCCESS;
    }

    // Initialize advertising parameters (used when starting advertising).
    memset(&adv_params, 0, sizeof(adv_params));

    err_code = advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
    VERIFY_SUCCESS(err_code);

    adv_params.type        = BLE_GAP_ADV_TYPE_ADV_IND;
    adv_params.p_peer_addr = NULL;
    adv_params.fp          = BLE_GAP_ADV_FP_ANY;
    adv_params.interval    = APP_ADV_INTERVAL;
    adv_params.timeout     = APP_ADV_TIMEOUT_IN_SECONDS;

    err_code = sd_ble_gap_adv_start(&adv_params);
    VERIFY_SUCCESS(err_code);

    dfu_set_status(DFUS_ADVERTISING_START);

    m_flags |= DFU_BLE_FLAG_IS_ADVERTISING;
    return NRF_SUCCESS;
}
开发者ID:CWBudde,项目名称:Espruino,代码行数:32,代码来源:nrf_ble_dfu.c


示例10: advertise_advertise

bool advertise_advertise(void)
{
    if (IS_CONNECTING)
    {
        return false;
    }

    //If advertising before, stop it.
    if (IS_ADVERTISING)
    {
        sd_ble_gap_adv_stop();
    }

    advertise_set_data();

    ble_gap_adv_params_t adv_settings = { 0 };
    adv_settings.type = BLE_GAP_ADV_TYPE_ADV_IND;
    adv_settings.fp = BLE_GAP_ADV_FP_ANY;
    adv_settings.interval = MSEC_TO_UNITS(25, UNIT_0_625_MS);
    adv_settings.timeout = BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED;

    APP_ERROR_CHECK(sd_ble_gap_adv_start(&adv_settings));
    status_set(STATUS_ADVERTISING);
    return true;
}
开发者ID:chadgra,项目名称:WaterBall,代码行数:25,代码来源:advertise.c


示例11: advertising_start

/**@brief Function for starting advertising.
 */
static void advertising_start(void)
{
    uint32_t err_code;
    
    err_code = sd_ble_gap_adv_start(&m_adv_params);
    APP_ERROR_CHECK(err_code);
}
开发者ID:tkadom,项目名称:TWBLE,代码行数:9,代码来源:main.c


示例12: gap_adv_start_handle

/**@brief Function for decoding a command packet with RPC_SD_BLE_GAP_ADV_START opcode.
 *
 * This function will decode the command, call the BLE Stack API, and also send command response
 * to the peer through the the transport layer.
 *
 * @param[in] p_command         The encoded structure that needs to be decoded and passed on
 *                              to the BLE Stack API.
 * @param[in] command_len       The length of the encoded command read from transport layer.
 *
 * @retval NRF_SUCCESS               If the decoding of the command was successful, the SoftDevice
 *                                   API was called, and the command response was sent to peer,
 *                                   otherwise an error code.
 * @retval NRF_ERROR_INVALID_LENGTH  If the content length of the packet is not conforming to the
 *                                   codec specification.
 */
static uint32_t gap_adv_start_handle(uint8_t * p_command, uint32_t command_len)
{
    ble_gap_adv_params_t adv_params;
    ble_gap_addr_t       directed_peer_address;
    ble_gap_whitelist_t  white_list;

    uint32_t index = 0;

    adv_params.type = p_command[index++];
    RPC_DECODER_LENGTH_CHECK(command_len, index, SD_BLE_GAP_ADV_START);

    if (p_command[index++] == RPC_BLE_FIELD_PRESENT)
    {
        // Peer Address Present. Decode the peer address.
        index                  += addr_decode(&directed_peer_address, &(p_command[index]));
        adv_params.p_peer_addr  = &(directed_peer_address);

        RPC_DECODER_LENGTH_CHECK(command_len, index, SD_BLE_GAP_ADV_START);
    }
    else
    {
        adv_params.p_peer_addr = NULL;
    }

    adv_params.fp = p_command[index++];
    RPC_DECODER_LENGTH_CHECK(command_len, index, SD_BLE_GAP_ADV_START);

    // Whitelist present.
    if (p_command[index++] == RPC_BLE_FIELD_PRESENT)
    {
        uint8_t  decoded_length = 0;
        uint32_t err_code       = whitelist_decode(&white_list,
                                                   &(p_command[index]),
                                                   &decoded_length);
        if (err_code != NRF_SUCCESS)
        {
            return ble_rpc_cmd_resp_send(SD_BLE_GAP_ADV_START, err_code);
        }
        index = index + decoded_length;
        RPC_DECODER_LENGTH_CHECK(command_len, index, SD_BLE_GAP_ADV_START);
        adv_params.p_whitelist = &white_list;
        RPC_DECODER_LENGTH_CHECK(command_len, index, SD_BLE_GAP_ADV_START);
    }
    else
    {
        adv_params.p_whitelist = NULL;
    }

    adv_params.interval = uint16_decode(&p_command[index]);
    index              += sizeof(uint16_t);
    RPC_DECODER_LENGTH_CHECK(command_len, index, SD_BLE_GAP_ADV_START);

    adv_params.timeout  = uint16_decode(&p_command[index]);
    RPC_DECODER_LENGTH_CHECK(command_len, index, SD_BLE_GAP_ADV_START);

    uint32_t err_code   = sd_ble_gap_adv_start(&adv_params);

    return ble_rpc_cmd_resp_send(SD_BLE_GAP_ADV_START, err_code);
}
开发者ID:huiyue000,项目名称:51822,代码行数:74,代码来源:ble_rpc_cmd_decoder_gap.c


示例13: conn_mw_ble_gap_adv_start

uint32_t conn_mw_ble_gap_adv_start(uint8_t const * const p_rx_buf,
                                  uint32_t              rx_buf_len,
                                  uint8_t * const       p_tx_buf,
                                  uint32_t * const      p_tx_buf_len)
{
    SER_ASSERT_NOT_NULL(p_rx_buf);
    SER_ASSERT_NOT_NULL(p_tx_buf);
    SER_ASSERT_NOT_NULL(p_tx_buf_len);

    uint32_t err_code = NRF_SUCCESS;
    uint32_t sd_err_code;

#if NRF_SD_BLE_API_VERSION > 5
    uint8_t conn_cfg_tag;
    uint8_t adv_handle;

    err_code = ble_gap_adv_start_req_dec(p_rx_buf, rx_buf_len, &adv_handle, &conn_cfg_tag);
    SER_ASSERT(err_code == NRF_SUCCESS, err_code);

    sd_err_code = sd_ble_gap_adv_start(adv_handle, conn_cfg_tag);
#else
    ble_gap_addr_t         peer_addr;
    ble_gap_adv_params_t   adv_params;
    ble_gap_adv_params_t * p_adv_params;

    adv_params.p_peer_addr = &peer_addr;
    p_adv_params = &adv_params;
#if NRF_SD_BLE_API_VERSION >= 4
    uint8_t conn_cfg_tag;
    err_code = ble_gap_adv_start_req_dec(p_rx_buf, rx_buf_len, &p_adv_params, &conn_cfg_tag);
    SER_ASSERT(err_code == NRF_SUCCESS, err_code);

    sd_err_code = sd_ble_gap_adv_start(p_adv_params, conn_cfg_tag);
#else
    err_code = ble_gap_adv_start_req_dec(p_rx_buf, rx_buf_len, &p_adv_params);
    SER_ASSERT(err_code == NRF_SUCCESS, err_code);

    sd_err_code = sd_ble_gap_adv_start(p_adv_params);
#endif
#endif
    err_code = ble_gap_adv_start_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
    SER_ASSERT(err_code == NRF_SUCCESS, err_code);

    return err_code;
}
开发者ID:kiibohd,项目名称:controller,代码行数:45,代码来源:conn_mw_ble_gap.c


示例14: advertising_start

/**@brief Start advertising.
 */
static void advertising_start(void)
{
    uint32_t err_code;
    
    err_code = sd_ble_gap_adv_start(&m_adv_params);
    APP_ERROR_CHECK(err_code);
    
    nrf_gpio_pin_set(ADVERTISING_LED_PIN_NO);
}
开发者ID:rpi-fongming,项目名称:nolem_m2d,代码行数:11,代码来源:main.c


示例15: advertising_start

/**@brief Function for starting advertising.
 */
static void advertising_start(void)
{
    uint32_t err_code;

    err_code = sd_ble_gap_adv_start(&m_adv_params);
    APP_ERROR_CHECK(err_code);

    err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
    APP_ERROR_CHECK(err_code);
}
开发者ID:BLEHexapod,项目名称:nrf_sdk,代码行数:12,代码来源:main.c


示例16: advertising_start

/**@brief Function for starting advertising.
 */
static void advertising_start(void)
{
    ret_code_t err_code;

    err_code = sd_ble_gap_adv_start(&m_adv_params, APP_BLE_CONN_CFG_TAG);
    APP_ERROR_CHECK(err_code);

    err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
    APP_ERROR_CHECK(err_code);
}
开发者ID:hitll,项目名称:nrf52832-mdk,代码行数:12,代码来源:main.c


示例17: advertising_start

/**@brief Function for starting advertising.
 */
static void advertising_start(void)
{
    uint32_t err_code;

    err_code = sd_ble_gap_adv_start(&m_adv_params);
    APP_ERROR_CHECK(err_code);

    APPL_LOG("[APPL]: Advertising.\r\n");

    m_display_state = LEDS_BLE_ADVERTISING;
}
开发者ID:xueliu,项目名称:nRF51822,代码行数:13,代码来源:main.c


示例18: advertising_start

void advertising_start(void) {
  ble_gap_adv_params_t adv_params;

  memset(&adv_params, 0, sizeof(adv_params));
  adv_params.type        = BLE_GAP_ADV_TYPE_ADV_IND;
  adv_params.p_peer_addr = NULL;
  adv_params.fp          = BLE_GAP_ADV_FP_ANY;
  adv_params.interval    = APP_ADV_INTERVAL;
  adv_params.timeout     = APP_ADV_TIMEOUT_IN_SECONDS;

  ERR_CHECK(sd_ble_gap_adv_start(&adv_params));
}
开发者ID:Books305,项目名称:twiz-fw,代码行数:12,代码来源:twi_advertising.c


示例19: adv_start

/**@brief Starting advertising.
 * @param[in]   p_adv_params  Advertisement parameters to use.
 */
static void adv_start(ble_gap_adv_params_t * p_adv_params)
{
    ret_code_t err_code = NRF_SUCCESS;

    es_tlm_adv_cnt_inc();

    err_code = sd_ble_gap_adv_start(p_adv_params);

    if (err_code != NRF_ERROR_BUSY && err_code != NRF_SUCCESS)
    {
        APP_ERROR_CHECK(err_code);
    }
}
开发者ID:AaltoNEPPI,项目名称:nRF52_dev,代码行数:16,代码来源:es_adv.c


示例20: advertising_start

/**@brief Function for starting advertising.
 */
static void advertising_start(void)
{
    uint32_t err_code;

    err_code = sd_ble_gap_adv_start(&m_adv_params);
    APP_ERROR_CHECK(err_code);

    APPL_LOG("[APPL]: Advertising.\r\n");

    m_display_state = LEDS_BLE_ADVERTISING;
    err_code = app_timer_start(m_led_blink_timer, LED_BLINK_INTERVAL, NULL);
    APP_ERROR_CHECK(err_code);
}
开发者ID:451506709,项目名称:automated_machine,代码行数:15,代码来源:main.c



注:本文中的sd_ble_gap_adv_start函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ sd_ble_gap_appearance_set函数代码示例发布时间:2022-05-30
下一篇:
C++ sd_app_evt_wait函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap