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