BLE FOTA APP

Dependencies:   BLE_API mbed

It doesn't work with the default FOTA bootloader. It use NVIC_SystemReset() to enter a bootloader.

Committer:
yihui
Date:
Fri Oct 10 03:36:28 2014 +0000
Revision:
1:a607cd9655d7
use NVIC_SystemReset() to run bootloader

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yihui 1:a607cd9655d7 1 /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
yihui 1:a607cd9655d7 2 *
yihui 1:a607cd9655d7 3 * The information contained herein is property of Nordic Semiconductor ASA.
yihui 1:a607cd9655d7 4 * Terms and conditions of usage are described in detail in NORDIC
yihui 1:a607cd9655d7 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
yihui 1:a607cd9655d7 6 *
yihui 1:a607cd9655d7 7 * Licensees are granted free, non-transferable use of the information. NO
yihui 1:a607cd9655d7 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
yihui 1:a607cd9655d7 9 * the file.
yihui 1:a607cd9655d7 10 *
yihui 1:a607cd9655d7 11 */
yihui 1:a607cd9655d7 12
yihui 1:a607cd9655d7 13 /**@file
yihui 1:a607cd9655d7 14 *
yihui 1:a607cd9655d7 15 * @defgroup ble_stack_handler_types Types definitions for BLE support in SoftDevice handler.
yihui 1:a607cd9655d7 16 * @{
yihui 1:a607cd9655d7 17 * @ingroup softdevice_handler
yihui 1:a607cd9655d7 18 * @brief This file contains the declarations of types required for BLE stack support. These
yihui 1:a607cd9655d7 19 * types will be defined when the preprocessor define BLE_STACK_SUPPORT_REQD is defined.
yihui 1:a607cd9655d7 20 */
yihui 1:a607cd9655d7 21
yihui 1:a607cd9655d7 22 #ifndef BLE_STACK_HANDLER_TYPES_H__
yihui 1:a607cd9655d7 23 #define BLE_STACK_HANDLER_TYPES_H__
yihui 1:a607cd9655d7 24
yihui 1:a607cd9655d7 25 #ifdef BLE_STACK_SUPPORT_REQD
yihui 1:a607cd9655d7 26
yihui 1:a607cd9655d7 27 #include <stdlib.h>
yihui 1:a607cd9655d7 28 #include "ble.h"
yihui 1:a607cd9655d7 29 #include "nrf_sdm.h"
yihui 1:a607cd9655d7 30 #include "app_error.h"
yihui 1:a607cd9655d7 31 #include "app_scheduler.h"
yihui 1:a607cd9655d7 32 #include "app_util.h"
yihui 1:a607cd9655d7 33
yihui 1:a607cd9655d7 34 #ifdef __cplusplus
yihui 1:a607cd9655d7 35 extern "C" {
yihui 1:a607cd9655d7 36 #endif // #ifdef __cplusplus
yihui 1:a607cd9655d7 37
yihui 1:a607cd9655d7 38 #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. */
yihui 1:a607cd9655d7 39 #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. */
yihui 1:a607cd9655d7 40
yihui 1:a607cd9655d7 41 /**@brief Application stack event handler type. */
yihui 1:a607cd9655d7 42 typedef void (*ble_evt_handler_t) (ble_evt_t * p_ble_evt);
yihui 1:a607cd9655d7 43
yihui 1:a607cd9655d7 44 /**@brief Function for registering for BLE events.
yihui 1:a607cd9655d7 45 *
yihui 1:a607cd9655d7 46 * @details The application should use this function to register for receiving BLE events from
yihui 1:a607cd9655d7 47 * the SoftDevice. If the application does not call this function, then any BLE event
yihui 1:a607cd9655d7 48 * that may be generated by the SoftDevice will NOT be fetched. Once the application has
yihui 1:a607cd9655d7 49 * registered for the events, it is not possible to possible to cancel the registration.
yihui 1:a607cd9655d7 50 * However, it is possible to register a different function for handling the events at
yihui 1:a607cd9655d7 51 * any point of time.
yihui 1:a607cd9655d7 52 *
yihui 1:a607cd9655d7 53 * @param[in] ble_evt_handler Function to be called for each received BLE event.
yihui 1:a607cd9655d7 54 *
yihui 1:a607cd9655d7 55 * @retval NRF_SUCCESS Successful registration.
yihui 1:a607cd9655d7 56 * @retval NRF_ERROR_NULL Null pointer provided as input.
yihui 1:a607cd9655d7 57 */
yihui 1:a607cd9655d7 58 uint32_t softdevice_ble_evt_handler_set(ble_evt_handler_t ble_evt_handler);
yihui 1:a607cd9655d7 59
yihui 1:a607cd9655d7 60 #else
yihui 1:a607cd9655d7 61
yihui 1:a607cd9655d7 62 #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.*/
yihui 1:a607cd9655d7 63 #define BLE_STACK_HANDLER_SCHED_EVT_SIZE 0
yihui 1:a607cd9655d7 64
yihui 1:a607cd9655d7 65 #endif // BLE_STACK_SUPPORT_REQD
yihui 1:a607cd9655d7 66
yihui 1:a607cd9655d7 67 #ifdef __cplusplus
yihui 1:a607cd9655d7 68 }
yihui 1:a607cd9655d7 69 #endif // #ifdef __cplusplus
yihui 1:a607cd9655d7 70
yihui 1:a607cd9655d7 71 #endif // BLE_STACK_HANDLER_TYPES_H__
yihui 1:a607cd9655d7 72
yihui 1:a607cd9655d7 73 /** @} */