Lancaster University fork of the Nordic nrf51-SDK repository, which actually lives on github: https://github.com/lancaster-university/nrf51-sdk

Dependents:   nRF51822

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ble_stack_handler_types.h Source File

ble_stack_handler_types.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) Nordic Semiconductor ASA
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without modification,
00006  * are permitted provided that the following conditions are met:
00007  *
00008  *   1. Redistributions of source code must retain the above copyright notice, this
00009  *   list of conditions and the following disclaimer.
00010  *
00011  *   2. Redistributions in binary form must reproduce the above copyright notice, this
00012  *   list of conditions and the following disclaimer in the documentation and/or
00013  *   other materials provided with the distribution.
00014  *
00015  *   3. Neither the name of Nordic Semiconductor ASA nor the names of other
00016  *   contributors to this software may be used to endorse or promote products
00017  *   derived from this software without specific prior written permission.
00018  *
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00021  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00022  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00023  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
00024  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00025  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00026  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
00027  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00028  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00029  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00030  *
00031  */
00032 
00033 /**@file
00034  *
00035  * @defgroup ble_stack_handler_types Types definitions for BLE support in SoftDevice handler.
00036  * @{
00037  * @ingroup  softdevice_handler
00038  * @brief    This file contains the declarations of types required for BLE stack support. These
00039  *           types will be defined when the preprocessor define BLE_STACK_SUPPORT_REQD is defined.
00040  */
00041 
00042 #ifndef BLE_STACK_HANDLER_TYPES_H__
00043 #define BLE_STACK_HANDLER_TYPES_H__
00044 
00045 #define BLE_STACK_SUPPORT_REQD
00046 #ifdef BLE_STACK_SUPPORT_REQD
00047 
00048 #include <stdlib.h>
00049 #include "ble.h"
00050 #include "nrf_sdm.h"
00051 #include "app_error.h "
00052 #include "app_util.h "
00053 
00054 #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. */
00055 #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. */
00056 
00057 /**@brief Application stack event handler type. */
00058 typedef void (*ble_evt_handler_t) (ble_evt_t * p_ble_evt);
00059 
00060 /**@brief     Function for registering for BLE events.
00061  *
00062  * @details   The application should use this function to register for receiving BLE events from
00063  *            the SoftDevice. If the application does not call this function, then any BLE event
00064  *            that may be generated by the SoftDevice will NOT be fetched. Once the application has
00065  *            registered for the events, it is not possible to cancel the registration.
00066  *            However, it is possible to register a different function for handling the events at
00067  *            any point of time.
00068  *
00069  * @param[in] ble_evt_handler Function to be called for each received BLE event.
00070  *
00071  * @retval    NRF_SUCCESS     Successful registration.
00072  * @retval    NRF_ERROR_NULL  Null pointer provided as input.
00073  */
00074 uint32_t softdevice_ble_evt_handler_set(ble_evt_handler_t ble_evt_handler);
00075 
00076 #else
00077 
00078 #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.*/
00079 #define BLE_STACK_HANDLER_SCHED_EVT_SIZE  0
00080 
00081 #endif // BLE_STACK_SUPPORT_REQD
00082 
00083 #endif // BLE_STACK_HANDLER_TYPES_H__
00084 
00085 /** @} */