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