cvb

Fork of nrf51-sdk by Lancaster University

Committer:
tb942
Date:
Tue Aug 14 18:27:20 2018 +0000
Revision:
9:d3dd910b0f4b
Parent:
0:bc2961fa1ef0

        

Who changed what in which revision?

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