test
Fork of nRF51822 by
Embed:
(wiki syntax)
Show/hide line numbers
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 00047 #ifdef BLE_STACK_SUPPORT_REQD 00048 00049 #include <stdlib.h> 00050 #include "ble.h" 00051 #include "nrf_sdm.h" 00052 #include "app_error.h" 00053 #include "app_util.h" 00054 00055 #ifdef __cplusplus 00056 extern "C" { 00057 #endif // #ifdef __cplusplus 00058 00059 #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. */ 00060 #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. */ 00061 00062 /**@brief Application stack event handler type. */ 00063 typedef void (*ble_evt_handler_t) (ble_evt_t * p_ble_evt); 00064 00065 /**@brief Function for registering for BLE events. 00066 * 00067 * @details The application should use this function to register for receiving BLE events from 00068 * the SoftDevice. If the application does not call this function, then any BLE event 00069 * that may be generated by the SoftDevice will NOT be fetched. Once the application has 00070 * registered for the events, it is not possible to cancel the registration. 00071 * However, it is possible to register a different function for handling the events at 00072 * any point of time. 00073 * 00074 * @param[in] ble_evt_handler Function to be called for each received BLE event. 00075 * 00076 * @retval NRF_SUCCESS Successful registration. 00077 * @retval NRF_ERROR_NULL Null pointer provided as input. 00078 */ 00079 uint32_t softdevice_ble_evt_handler_set(ble_evt_handler_t ble_evt_handler); 00080 00081 #ifdef __cplusplus 00082 } 00083 #endif // #ifdef __cplusplus 00084 00085 #else 00086 00087 #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.*/ 00088 #define BLE_STACK_HANDLER_SCHED_EVT_SIZE 0 00089 00090 #endif // BLE_STACK_SUPPORT_REQD 00091 00092 #endif // BLE_STACK_HANDLER_TYPES_H__ 00093 00094 /** @} */
Generated on Tue Jul 12 2022 21:00:16 by 1.7.2