For with fix for disconnection notifications
Fork of nRF51822 by
btle/btle_advertising.cpp@17:c3e11bb6cb72, 2014-06-04 (annotated)
- Committer:
- Rohit Grover
- Date:
- Wed Jun 04 09:19:57 2014 +0100
- Revision:
- 17:c3e11bb6cb72
- Parent:
- 0:eff01767de02
- Child:
- 22:c6ee8136847e
white space diffs; uncrustify
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 0:eff01767de02 | 1 | /* mbed Microcontroller Library |
bogdanm | 0:eff01767de02 | 2 | * Copyright (c) 2006-2013 ARM Limited |
bogdanm | 0:eff01767de02 | 3 | * |
bogdanm | 0:eff01767de02 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
bogdanm | 0:eff01767de02 | 5 | * you may not use this file except in compliance with the License. |
bogdanm | 0:eff01767de02 | 6 | * You may obtain a copy of the License at |
bogdanm | 0:eff01767de02 | 7 | * |
bogdanm | 0:eff01767de02 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
bogdanm | 0:eff01767de02 | 9 | * |
bogdanm | 0:eff01767de02 | 10 | * Unless required by applicable law or agreed to in writing, software |
bogdanm | 0:eff01767de02 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
bogdanm | 0:eff01767de02 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
bogdanm | 0:eff01767de02 | 13 | * See the License for the specific language governing permissions and |
bogdanm | 0:eff01767de02 | 14 | * limitations under the License. |
bogdanm | 0:eff01767de02 | 15 | */ |
bogdanm | 0:eff01767de02 | 16 | #include "common/common.h" |
bogdanm | 0:eff01767de02 | 17 | |
bogdanm | 0:eff01767de02 | 18 | #include "ble_advdata.h" |
bogdanm | 0:eff01767de02 | 19 | #include "btle.h" |
bogdanm | 0:eff01767de02 | 20 | |
bogdanm | 0:eff01767de02 | 21 | /**************************************************************************/ |
bogdanm | 0:eff01767de02 | 22 | /*! |
bogdanm | 0:eff01767de02 | 23 | @brief Starts the advertising process |
bogdanm | 0:eff01767de02 | 24 | |
bogdanm | 0:eff01767de02 | 25 | @returns |
bogdanm | 0:eff01767de02 | 26 | */ |
bogdanm | 0:eff01767de02 | 27 | /**************************************************************************/ |
bogdanm | 0:eff01767de02 | 28 | error_t btle_advertising_start(void) |
bogdanm | 0:eff01767de02 | 29 | { |
Rohit Grover |
17:c3e11bb6cb72 | 30 | ble_gap_adv_params_t adv_para = {0}; |
bogdanm | 0:eff01767de02 | 31 | |
Rohit Grover |
17:c3e11bb6cb72 | 32 | /* Set the default advertising parameters */ |
Rohit Grover |
17:c3e11bb6cb72 | 33 | adv_para.type = BLE_GAP_ADV_TYPE_ADV_IND; |
Rohit Grover |
17:c3e11bb6cb72 | 34 | adv_para.p_peer_addr = NULL; /* Undirected advertising */ |
Rohit Grover |
17:c3e11bb6cb72 | 35 | adv_para.fp = BLE_GAP_ADV_FP_ANY; |
Rohit Grover |
17:c3e11bb6cb72 | 36 | adv_para.p_whitelist = NULL; |
Rohit Grover |
17:c3e11bb6cb72 | 37 | adv_para.interval = (CFG_GAP_ADV_INTERVAL_MS * 8) / 5; /* Advertising |
Rohit Grover |
17:c3e11bb6cb72 | 38 | * interval in |
Rohit Grover |
17:c3e11bb6cb72 | 39 | * units of 0.625 |
Rohit Grover |
17:c3e11bb6cb72 | 40 | * ms */ |
Rohit Grover |
17:c3e11bb6cb72 | 41 | adv_para.timeout = CFG_GAP_ADV_TIMEOUT_S; |
bogdanm | 0:eff01767de02 | 42 | |
Rohit Grover |
17:c3e11bb6cb72 | 43 | ASSERT_STATUS( sd_ble_gap_adv_start(&adv_para)); |
bogdanm | 0:eff01767de02 | 44 | |
Rohit Grover |
17:c3e11bb6cb72 | 45 | return ERROR_NONE; |
bogdanm | 0:eff01767de02 | 46 | } |