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