Nordic stack and drivers for the mbed BLE API
Dependents: Sensen-classic-v8-IAQ_copy_4
Fork of nRF51822 by
TARGET_MCU_NRF51822/sdk/source/softdevice/common/softdevice_handler/ble_stack_handler_types.h@639:7f459d371b75, 2017-11-10 (annotated)
- Committer:
- amithy
- Date:
- Fri Nov 10 20:27:44 2017 +0000
- Revision:
- 639:7f459d371b75
- Parent:
- 638:c90ae1400bf2
t
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Vincent Coubard |
638:c90ae1400bf2 | 1 | /* |
Vincent Coubard |
638:c90ae1400bf2 | 2 | * Copyright (c) Nordic Semiconductor ASA |
Vincent Coubard |
638:c90ae1400bf2 | 3 | * All rights reserved. |
Vincent Coubard |
638:c90ae1400bf2 | 4 | * |
Vincent Coubard |
638:c90ae1400bf2 | 5 | * Redistribution and use in source and binary forms, with or without modification, |
Vincent Coubard |
638:c90ae1400bf2 | 6 | * are permitted provided that the following conditions are met: |
Vincent Coubard |
638:c90ae1400bf2 | 7 | * |
Vincent Coubard |
638:c90ae1400bf2 | 8 | * 1. Redistributions of source code must retain the above copyright notice, this |
Vincent Coubard |
638:c90ae1400bf2 | 9 | * list of conditions and the following disclaimer. |
Vincent Coubard |
638:c90ae1400bf2 | 10 | * |
Vincent Coubard |
638:c90ae1400bf2 | 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this |
Vincent Coubard |
638:c90ae1400bf2 | 12 | * list of conditions and the following disclaimer in the documentation and/or |
Vincent Coubard |
638:c90ae1400bf2 | 13 | * other materials provided with the distribution. |
Vincent Coubard |
638:c90ae1400bf2 | 14 | * |
Vincent Coubard |
638:c90ae1400bf2 | 15 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of other |
Vincent Coubard |
638:c90ae1400bf2 | 16 | * contributors to this software may be used to endorse or promote products |
Vincent Coubard |
638:c90ae1400bf2 | 17 | * derived from this software without specific prior written permission. |
Vincent Coubard |
638:c90ae1400bf2 | 18 | * |
Vincent Coubard |
638:c90ae1400bf2 | 19 | * |
Vincent Coubard |
638:c90ae1400bf2 | 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
Vincent Coubard |
638:c90ae1400bf2 | 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
Vincent Coubard |
638:c90ae1400bf2 | 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Vincent Coubard |
638:c90ae1400bf2 | 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
Vincent Coubard |
638:c90ae1400bf2 | 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
Vincent Coubard |
638:c90ae1400bf2 | 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
Vincent Coubard |
638:c90ae1400bf2 | 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
Vincent Coubard |
638:c90ae1400bf2 | 27 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
Vincent Coubard |
638:c90ae1400bf2 | 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
Vincent Coubard |
638:c90ae1400bf2 | 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Vincent Coubard |
638:c90ae1400bf2 | 30 | * |
Vincent Coubard |
638:c90ae1400bf2 | 31 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 32 | |
Vincent Coubard |
638:c90ae1400bf2 | 33 | /**@file |
Vincent Coubard |
638:c90ae1400bf2 | 34 | * |
Vincent Coubard |
638:c90ae1400bf2 | 35 | * @defgroup ble_stack_handler_types Types definitions for BLE support in SoftDevice handler. |
Vincent Coubard |
638:c90ae1400bf2 | 36 | * @{ |
Vincent Coubard |
638:c90ae1400bf2 | 37 | * @ingroup softdevice_handler |
Vincent Coubard |
638:c90ae1400bf2 | 38 | * @brief This file contains the declarations of types required for BLE stack support. These |
Vincent Coubard |
638:c90ae1400bf2 | 39 | * types will be defined when the preprocessor define BLE_STACK_SUPPORT_REQD is defined. |
Vincent Coubard |
638:c90ae1400bf2 | 40 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 41 | |
Vincent Coubard |
638:c90ae1400bf2 | 42 | #ifndef BLE_STACK_HANDLER_TYPES_H__ |
Vincent Coubard |
638:c90ae1400bf2 | 43 | #define BLE_STACK_HANDLER_TYPES_H__ |
Vincent Coubard |
638:c90ae1400bf2 | 44 | |
Vincent Coubard |
638:c90ae1400bf2 | 45 | #define BLE_STACK_SUPPORT_REQD |
Vincent Coubard |
638:c90ae1400bf2 | 46 | #ifdef BLE_STACK_SUPPORT_REQD |
Vincent Coubard |
638:c90ae1400bf2 | 47 | |
Vincent Coubard |
638:c90ae1400bf2 | 48 | #include <stdlib.h> |
Vincent Coubard |
638:c90ae1400bf2 | 49 | #include "nrf_ble.h" |
Vincent Coubard |
638:c90ae1400bf2 | 50 | #include "nrf_sdm.h" |
Vincent Coubard |
638:c90ae1400bf2 | 51 | #include "app_error.h" |
Vincent Coubard |
638:c90ae1400bf2 | 52 | #include "app_util.h" |
Vincent Coubard |
638:c90ae1400bf2 | 53 | |
Vincent Coubard |
638:c90ae1400bf2 | 54 | #define BLE_STACK_EVT_MSG_BUF_SIZE (sizeof(ble_evt_t) + (GATT_MTU_SIZE_DEFAULT)) /**< Size of BLE event message buffer. This will be provided to the SoftDevice while fetching an event. */ |
Vincent Coubard |
638:c90ae1400bf2 | 55 | #define BLE_STACK_HANDLER_SCHED_EVT_SIZE 0 /**< The size of the scheduler event used by SoftDevice handler when passing BLE events using the @ref app_scheduler. */ |
Vincent Coubard |
638:c90ae1400bf2 | 56 | |
Vincent Coubard |
638:c90ae1400bf2 | 57 | /**@brief Application stack event handler type. */ |
Vincent Coubard |
638:c90ae1400bf2 | 58 | typedef void (*ble_evt_handler_t) (ble_evt_t * p_ble_evt); |
Vincent Coubard |
638:c90ae1400bf2 | 59 | |
Vincent Coubard |
638:c90ae1400bf2 | 60 | /**@brief Function for registering for BLE events. |
Vincent Coubard |
638:c90ae1400bf2 | 61 | * |
Vincent Coubard |
638:c90ae1400bf2 | 62 | * @details The application should use this function to register for receiving BLE events from |
Vincent Coubard |
638:c90ae1400bf2 | 63 | * the SoftDevice. If the application does not call this function, then any BLE event |
Vincent Coubard |
638:c90ae1400bf2 | 64 | * that may be generated by the SoftDevice will NOT be fetched. Once the application has |
Vincent Coubard |
638:c90ae1400bf2 | 65 | * registered for the events, it is not possible to cancel the registration. |
Vincent Coubard |
638:c90ae1400bf2 | 66 | * However, it is possible to register a different function for handling the events at |
Vincent Coubard |
638:c90ae1400bf2 | 67 | * any point of time. |
Vincent Coubard |
638:c90ae1400bf2 | 68 | * |
Vincent Coubard |
638:c90ae1400bf2 | 69 | * @param[in] ble_evt_handler Function to be called for each received BLE event. |
Vincent Coubard |
638:c90ae1400bf2 | 70 | * |
Vincent Coubard |
638:c90ae1400bf2 | 71 | * @retval NRF_SUCCESS Successful registration. |
Vincent Coubard |
638:c90ae1400bf2 | 72 | * @retval NRF_ERROR_NULL Null pointer provided as input. |
Vincent Coubard |
638:c90ae1400bf2 | 73 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 74 | uint32_t softdevice_ble_evt_handler_set(ble_evt_handler_t ble_evt_handler); |
Vincent Coubard |
638:c90ae1400bf2 | 75 | |
Vincent Coubard |
638:c90ae1400bf2 | 76 | #else |
Vincent Coubard |
638:c90ae1400bf2 | 77 | |
Vincent Coubard |
638:c90ae1400bf2 | 78 | #define BLE_STACK_EVT_MSG_BUF_SIZE 0 /**< Since the BLE stack support is not required, this is equated to 0, so that the @ref softdevice_handler.h can compute the internal event buffer size without having to care for BLE events.*/ |
Vincent Coubard |
638:c90ae1400bf2 | 79 | #define BLE_STACK_HANDLER_SCHED_EVT_SIZE 0 |
Vincent Coubard |
638:c90ae1400bf2 | 80 | |
Vincent Coubard |
638:c90ae1400bf2 | 81 | #endif // BLE_STACK_SUPPORT_REQD |
Vincent Coubard |
638:c90ae1400bf2 | 82 | |
Vincent Coubard |
638:c90ae1400bf2 | 83 | #endif // BLE_STACK_HANDLER_TYPES_H__ |
Vincent Coubard |
638:c90ae1400bf2 | 84 | |
Vincent Coubard |
638:c90ae1400bf2 | 85 | /** @} */ |