Patched version of nrf51822 FOTA compatible driver, with GPTIO disabled, as it clashed with the mbed definitions...

Fork of nRF51822 by Nordic Semiconductor

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers dfu_app_handler.h Source File

dfu_app_handler.h

Go to the documentation of this file.
00001 /* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
00002  *
00003  * The information contained herein is property of Nordic Semiconductor ASA.
00004  * Terms and conditions of usage are described in detail in NORDIC
00005  * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
00006  *
00007  * Licensees are granted free, non-transferable use of the information. NO
00008  * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
00009  * the file.
00010  *
00011  */
00012   
00013 /** @file
00014  *
00015  * @defgroup nrf_dfu_app_handler DFU BLE packet handling in Application
00016  * @{
00017  *
00018  * @brief DFU BLE packet handling for application.
00019  *
00020  * @details This module implements handling of DFU packets transmitted over BLE for switching from 
00021  *          application mode to Bootloader running full DFU service.
00022  *          This module only handles the StartDFU packet allowing for any BLE application to expose
00023  *          support for the DFU service.
00024  *          Actual DFU service will execute in dedicated environment after a BLE disconnect and 
00025  *          reset of the nRF51 chip.
00026  *          The host must then reconnect and can continue the update procedure with access to full
00027  *          DFU service.
00028  *
00029  * @note The application must propagate dfu events to the DFU App handler module by calling
00030  *       dfu_app_on_dfu_evt() from the @ref ble_dfu_evt_handler_t callback.
00031  */
00032  
00033 #ifndef DFU_APP_HANDLER_H__
00034 #define DFU_APP_HANDLER_H__
00035 
00036 #include "ble_dfu.h "
00037 #include "nrf_svc.h"
00038 #include "bootloader_types.h "
00039 #include "device_manager.h "
00040 
00041 /**@brief DFU Application reset prepare function. This function is a callback which allows the 
00042  *        application to prepare for an upcoming application reset. 
00043  */
00044 typedef void (*dfu_app_reset_prepare_t)(void);
00045 
00046 /**@brief   Function for handling of \ref ble_dfu_evt_t from DFU Service. 
00047  *
00048  * @details The application must inject this function into the DFU service or propagate DFU events
00049  *          to dfu_app_handler module by calling this function in application specific DFU event 
00050  *          handler.
00051  * 
00052  * @param[in] p_dfu              Pointer to the DFU Service structure for which the include event 
00053  *                               relates.
00054  * @param[in] p_evt  Pointer to the DFU event.
00055  */
00056 void dfu_app_on_dfu_evt(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt);
00057 
00058 /**@brief Function for registering for reset prepare calls. 
00059  *
00060  * @details The function provided will be executed before reseting the system into Bootloader/DFU
00061  *          mode. By setting this function the caller will be notified prior to the reset and can
00062  *          thus prepare the application for reset. As example the application can gracefully
00063  *          disconnect any peers on BLE, turning of LEDS, ensure all pending flash operations
00064  *          has completed, etc.
00065  *
00066  * @param[in] reset_prepare_func  Function to be execute prior to a reset.
00067  */
00068 void dfu_app_reset_prepare_set(dfu_app_reset_prepare_t reset_prepare_func);
00069 
00070 /**@brief Function for setting Device manager handle for current BLE connection.
00071  *
00072  * @param[in] p_dm_handle  Pointer to device manager handle of current connection.
00073  */
00074 void dfu_app_set_dm_handle(dm_handle_t const * p_dm_handle);
00075 
00076 #endif // DFU_APP_HANDLER_H__
00077 
00078 /** @} */