library for BLE_GAP_backpack

Dependencies:   nrf51-sdk

Fork of nRF51822 by Nordic Semiconductor

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers btle_advertising.cpp Source File

btle_advertising.cpp

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2006-2013 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #include "common/common.h "
00017 
00018 #include "ble_advdata.h"
00019 #include "btle.h"
00020 
00021 /**************************************************************************/
00022 /*!
00023     @brief      Starts the advertising process
00024 
00025     @returns
00026 */
00027 /**************************************************************************/
00028 error_t btle_advertising_start(void)
00029 {
00030     ble_gap_adv_params_t adv_para = {0};
00031 
00032     /* Set the default advertising parameters */
00033     adv_para.type        = BLE_GAP_ADV_TYPE_ADV_IND;
00034     adv_para.p_peer_addr = NULL; /* Undirected advertising */
00035     adv_para.fp          = BLE_GAP_ADV_FP_ANY;
00036     adv_para.p_whitelist = NULL;
00037     adv_para.interval    = (CFG_GAP_ADV_INTERVAL_MS * 8) / 5; /* Advertising
00038                                                                * interval in
00039                                                                * units of 0.625
00040                                                                * ms */
00041     adv_para.timeout     = CFG_GAP_ADV_TIMEOUT_S;
00042 
00043     ASSERT_STATUS( sd_ble_gap_adv_start(&adv_para));
00044 
00045     return ERROR_NONE;
00046 }