Toyomasa Watarai / nrf51-sdk

Fork of nrf51-sdk by Nordic Semiconductor

Committer:
vcoubard
Date:
Thu Apr 07 17:38:06 2016 +0100
Revision:
32:6335323e4327
Parent:
31:c05fa48ed560
Synchronized with git rev 8a57aa2d
Author: Liyou Zhou
Change README to point to sdk v10

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vcoubard 29:286940b7ee5a 1 /*
vcoubard 29:286940b7ee5a 2 * Copyright (c) Nordic Semiconductor ASA
vcoubard 29:286940b7ee5a 3 * All rights reserved.
vcoubard 29:286940b7ee5a 4 *
vcoubard 29:286940b7ee5a 5 * Redistribution and use in source and binary forms, with or without modification,
vcoubard 29:286940b7ee5a 6 * are permitted provided that the following conditions are met:
vcoubard 29:286940b7ee5a 7 *
vcoubard 29:286940b7ee5a 8 * 1. Redistributions of source code must retain the above copyright notice, this
vcoubard 29:286940b7ee5a 9 * list of conditions and the following disclaimer.
vcoubard 29:286940b7ee5a 10 *
vcoubard 29:286940b7ee5a 11 * 2. Redistributions in binary form must reproduce the above copyright notice, this
vcoubard 29:286940b7ee5a 12 * list of conditions and the following disclaimer in the documentation and/or
vcoubard 29:286940b7ee5a 13 * other materials provided with the distribution.
vcoubard 29:286940b7ee5a 14 *
vcoubard 29:286940b7ee5a 15 * 3. Neither the name of Nordic Semiconductor ASA nor the names of other
vcoubard 29:286940b7ee5a 16 * contributors to this software may be used to endorse or promote products
vcoubard 29:286940b7ee5a 17 * derived from this software without specific prior written permission.
vcoubard 29:286940b7ee5a 18 *
vcoubard 29:286940b7ee5a 19 *
vcoubard 29:286940b7ee5a 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
vcoubard 29:286940b7ee5a 21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
vcoubard 29:286940b7ee5a 22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
vcoubard 29:286940b7ee5a 23 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
vcoubard 29:286940b7ee5a 24 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
vcoubard 29:286940b7ee5a 25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
vcoubard 29:286940b7ee5a 26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
vcoubard 29:286940b7ee5a 27 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
vcoubard 29:286940b7ee5a 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
vcoubard 29:286940b7ee5a 29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
vcoubard 29:286940b7ee5a 30 *
vcoubard 1:ebc0e0ef0a11 31 */
vcoubard 1:ebc0e0ef0a11 32
vcoubard 1:ebc0e0ef0a11 33 /** @file
vcoubard 1:ebc0e0ef0a11 34 *
vcoubard 1:ebc0e0ef0a11 35 * @defgroup nrf_dfu_app_handler DFU BLE packet handling in application
vcoubard 1:ebc0e0ef0a11 36 * @{
vcoubard 1:ebc0e0ef0a11 37 *
vcoubard 1:ebc0e0ef0a11 38 * @brief Handling of DFU BLE packets in the application.
vcoubard 1:ebc0e0ef0a11 39 *
vcoubard 1:ebc0e0ef0a11 40 * @details This module implements the handling of DFU packets for switching
vcoubard 1:ebc0e0ef0a11 41 * from an application to the bootloader and start DFU mode. The DFU
vcoubard 1:ebc0e0ef0a11 42 * packets are transmitted over BLE.
vcoubard 1:ebc0e0ef0a11 43 * This module handles only the StartDFU packet, which allows a BLE
vcoubard 1:ebc0e0ef0a11 44 * application to expose support for the DFU Service.
vcoubard 1:ebc0e0ef0a11 45 * The actual DFU Service runs in a dedicated environment after a BLE
vcoubard 32:6335323e4327 46 * disconnect and reset of the \nRFXX device.
vcoubard 1:ebc0e0ef0a11 47 * The host must reconnect and continue the update procedure with
vcoubard 1:ebc0e0ef0a11 48 * access to the full DFU Service.
vcoubard 1:ebc0e0ef0a11 49 *
vcoubard 1:ebc0e0ef0a11 50 * @note The application must propagate DFU events to this module by calling
vcoubard 1:ebc0e0ef0a11 51 * @ref dfu_app_on_dfu_evt from the @ref ble_dfu_evt_handler_t callback.
vcoubard 1:ebc0e0ef0a11 52 */
vcoubard 1:ebc0e0ef0a11 53
vcoubard 1:ebc0e0ef0a11 54 #ifndef DFU_APP_HANDLER_H__
vcoubard 1:ebc0e0ef0a11 55 #define DFU_APP_HANDLER_H__
vcoubard 1:ebc0e0ef0a11 56
vcoubard 1:ebc0e0ef0a11 57 #include "ble_dfu.h"
vcoubard 1:ebc0e0ef0a11 58 #include "nrf_svc.h"
vcoubard 1:ebc0e0ef0a11 59 #include "bootloader_types.h"
vcoubard 1:ebc0e0ef0a11 60 #include "device_manager.h"
vcoubard 1:ebc0e0ef0a11 61
vcoubard 1:ebc0e0ef0a11 62 #define DFU_APP_ATT_TABLE_POS 0 /**< Position for the ATT table changed setting. */
vcoubard 1:ebc0e0ef0a11 63 #define DFU_APP_ATT_TABLE_CHANGED 1 /**< Value indicating that the ATT table might have changed. This value will be set in the application-specific context in Device Manager when entering DFU mode. */
vcoubard 1:ebc0e0ef0a11 64
vcoubard 1:ebc0e0ef0a11 65 /**@brief DFU application reset_prepare function. This function is a callback that allows the
vcoubard 1:ebc0e0ef0a11 66 * application to prepare for an upcoming application reset.
vcoubard 1:ebc0e0ef0a11 67 */
vcoubard 1:ebc0e0ef0a11 68 typedef void (*dfu_app_reset_prepare_t)(void);
vcoubard 1:ebc0e0ef0a11 69
vcoubard 1:ebc0e0ef0a11 70 /**@brief Function for handling events from the DFU Service.
vcoubard 1:ebc0e0ef0a11 71 *
vcoubard 1:ebc0e0ef0a11 72 * @details The application must inject this function into the DFU Service or propagate DFU events
vcoubard 1:ebc0e0ef0a11 73 * to the dfu_app_handler module by calling this function in the application-specific DFU event
vcoubard 1:ebc0e0ef0a11 74 * handler.
vcoubard 1:ebc0e0ef0a11 75 *
vcoubard 1:ebc0e0ef0a11 76 * @param[in] p_dfu Pointer to the DFU Service structure to which the include event relates.
vcoubard 1:ebc0e0ef0a11 77 * @param[in] p_evt Pointer to the DFU event.
vcoubard 1:ebc0e0ef0a11 78 */
vcoubard 1:ebc0e0ef0a11 79 void dfu_app_on_dfu_evt(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt);
vcoubard 1:ebc0e0ef0a11 80
vcoubard 1:ebc0e0ef0a11 81 /**@brief Function for registering a function to prepare a reset.
vcoubard 1:ebc0e0ef0a11 82 *
vcoubard 1:ebc0e0ef0a11 83 * @details The provided function is executed before resetting the system into bootloader/DFU
vcoubard 1:ebc0e0ef0a11 84 * mode. By registering this function, the caller is notified before the reset and can
vcoubard 1:ebc0e0ef0a11 85 * thus prepare the application for reset. For example, the application can gracefully
vcoubard 1:ebc0e0ef0a11 86 * disconnect any peers on BLE, turn of LEDS, ensure that all pending flash operations
vcoubard 1:ebc0e0ef0a11 87 * have completed, and so on.
vcoubard 1:ebc0e0ef0a11 88 *
vcoubard 1:ebc0e0ef0a11 89 * @param[in] reset_prepare_func Function to be executed before a reset.
vcoubard 1:ebc0e0ef0a11 90 */
vcoubard 1:ebc0e0ef0a11 91 void dfu_app_reset_prepare_set(dfu_app_reset_prepare_t reset_prepare_func);
vcoubard 1:ebc0e0ef0a11 92
vcoubard 1:ebc0e0ef0a11 93 /**@brief Function for setting the Device Manager application instance.
vcoubard 1:ebc0e0ef0a11 94 *
vcoubard 1:ebc0e0ef0a11 95 * @details This function allows to set the @ref dm_application_instance_t value that is returned by the
vcoubard 1:ebc0e0ef0a11 96 * Device Manager when the application registers using @ref dm_register.
vcoubard 1:ebc0e0ef0a11 97 * If this function is not called, it is not be possible to share bonding information
vcoubard 1:ebc0e0ef0a11 98 * from the application to the bootloader/DFU when entering DFU mode.
vcoubard 1:ebc0e0ef0a11 99 *
vcoubard 1:ebc0e0ef0a11 100 * @param[in] app_instance Value for the application instance in use.
vcoubard 1:ebc0e0ef0a11 101 */
vcoubard 1:ebc0e0ef0a11 102 void dfu_app_dm_appl_instance_set(dm_application_instance_t app_instance);
vcoubard 1:ebc0e0ef0a11 103
vcoubard 1:ebc0e0ef0a11 104 #endif // DFU_APP_HANDLER_H__
vcoubard 1:ebc0e0ef0a11 105
vcoubard 1:ebc0e0ef0a11 106 /** @} */