test
Fork of nRF51822 by
btle/btle_advertising.cpp@386:3253b512fb24, 2015-07-21 (annotated)
- Committer:
- rgrover1
- Date:
- Tue Jul 21 13:23:43 2015 +0100
- Revision:
- 386:3253b512fb24
- Parent:
- source/btle/btle_advertising.cpp@381:c997e9717fb7
Synchronized with git rev 928a5e63
Author: Rohit Grover
Release 0.4.1
=============
This is a minor release.
Enhancements
~~~~~~~~~~~~
* Hide duplicate symbol definitions in ble_types.h. These have already been
brought into ble/blecommon.h.
* Replace DiscoveredCharacteristic::setupOnDataRead() with
GattClient::onDataRead().
* Implement new API GattServer::areUpdatesEnabled() to determine notification
status for a characteristic.
Bugfixes
~~~~~~~~
* fix for #20: GattServer::addService() incorrectly initialized value
attribute-handles. These were getting confused with characteristicIndex.
Event handlers also return attribute handles correctly now; they were also
previously returning characteristic indices.
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 | } |