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