Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of nRF51822 by
nordic/nrf-sdk/bootloader_dfu/dfu_app_handler.h@66:b3680699d9a4, 2014-09-22 (annotated)
- Committer:
- Rohit Grover 
- Date:
- Mon Sep 22 11:19:51 2014 +0100
- Revision:
- 66:b3680699d9a4
Release 0.2.0
=============
Highlights:
Add support for over-the-air firmware updates.
Features
~~~~~~~~
- Add files to support DFU bootloader.
- charHandle is now a part of GattCharacteristicWriteCBParams.
- nRF51GattServer::addService(): Skip any incompletely defined, read-only
characteristics. For instance, the DeviceInformationService may have many
optional, read-only characteristics which may be safely dropped if the
application hasn't defined them.
Bugfixes
~~~~~~~~
None.
Compatibility
~~~~~~~~~~~~~
Works with 0.2.0 of BLE_API.
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| Rohit Grover | 66:b3680699d9a4 | 1 | /* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. | 
| Rohit Grover | 66:b3680699d9a4 | 2 | * | 
| Rohit Grover | 66:b3680699d9a4 | 3 | * The information contained herein is property of Nordic Semiconductor ASA. | 
| Rohit Grover | 66:b3680699d9a4 | 4 | * Terms and conditions of usage are described in detail in NORDIC | 
| Rohit Grover | 66:b3680699d9a4 | 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. | 
| Rohit Grover | 66:b3680699d9a4 | 6 | * | 
| Rohit Grover | 66:b3680699d9a4 | 7 | * Licensees are granted free, non-transferable use of the information. NO | 
| Rohit Grover | 66:b3680699d9a4 | 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from | 
| Rohit Grover | 66:b3680699d9a4 | 9 | * the file. | 
| Rohit Grover | 66:b3680699d9a4 | 10 | * | 
| Rohit Grover | 66:b3680699d9a4 | 11 | */ | 
| Rohit Grover | 66:b3680699d9a4 | 12 | |
| Rohit Grover | 66:b3680699d9a4 | 13 | /** @file | 
| Rohit Grover | 66:b3680699d9a4 | 14 | * | 
| Rohit Grover | 66:b3680699d9a4 | 15 | * @defgroup nrf_dfu_app_handler DFU BLE packet handling in Application | 
| Rohit Grover | 66:b3680699d9a4 | 16 | * @{ | 
| Rohit Grover | 66:b3680699d9a4 | 17 | * | 
| Rohit Grover | 66:b3680699d9a4 | 18 | * @brief DFU BLE packet handling for application. | 
| Rohit Grover | 66:b3680699d9a4 | 19 | * | 
| Rohit Grover | 66:b3680699d9a4 | 20 | * @details This module implements handling of DFU packets transmitted over BLE for switching from | 
| Rohit Grover | 66:b3680699d9a4 | 21 | * application mode to Bootloader running full DFU service. | 
| Rohit Grover | 66:b3680699d9a4 | 22 | * This module only handles the StartDFU packet allowing for any BLE application to expose | 
| Rohit Grover | 66:b3680699d9a4 | 23 | * support for the DFU service. | 
| Rohit Grover | 66:b3680699d9a4 | 24 | * Actual DFU service will execute in dedicated environment after a BLE disconnect and | 
| Rohit Grover | 66:b3680699d9a4 | 25 | * reset of the nRF51 chip. | 
| Rohit Grover | 66:b3680699d9a4 | 26 | * The host must then reconnect and can continue the update procedure with access to full | 
| Rohit Grover | 66:b3680699d9a4 | 27 | * DFU service. | 
| Rohit Grover | 66:b3680699d9a4 | 28 | * | 
| Rohit Grover | 66:b3680699d9a4 | 29 | * @note The application must propagate dfu events to the DFU App handler module by calling | 
| Rohit Grover | 66:b3680699d9a4 | 30 | * dfu_app_on_dfu_evt() from the from the @ref ble_dfu_evt_handler_t callback. | 
| Rohit Grover | 66:b3680699d9a4 | 31 | */ | 
| Rohit Grover | 66:b3680699d9a4 | 32 | |
| Rohit Grover | 66:b3680699d9a4 | 33 | #ifndef DFU_APP_HANDLER_H__ | 
| Rohit Grover | 66:b3680699d9a4 | 34 | #define DFU_APP_HANDLER_H__ | 
| Rohit Grover | 66:b3680699d9a4 | 35 | |
| Rohit Grover | 66:b3680699d9a4 | 36 | #include "dfu_app_handler.h" | 
| Rohit Grover | 66:b3680699d9a4 | 37 | #include "ble_dfu.h" | 
| Rohit Grover | 66:b3680699d9a4 | 38 | |
| Rohit Grover | 66:b3680699d9a4 | 39 | /**@brief DFU Application reset prepare function. This function is a callback which allows the | 
| Rohit Grover | 66:b3680699d9a4 | 40 | * application to prepare for an upcoming application reset. | 
| Rohit Grover | 66:b3680699d9a4 | 41 | */ | 
| Rohit Grover | 66:b3680699d9a4 | 42 | typedef void (*dfu_app_reset_prepare_t)(void); | 
| Rohit Grover | 66:b3680699d9a4 | 43 | |
| Rohit Grover | 66:b3680699d9a4 | 44 | |
| Rohit Grover | 66:b3680699d9a4 | 45 | /**@brief Function for handling of \ref ble_dfu_evt_t from DFU Service. | 
| Rohit Grover | 66:b3680699d9a4 | 46 | * | 
| Rohit Grover | 66:b3680699d9a4 | 47 | * @details The application must inject this function into the DFU service or propagate DFU events | 
| Rohit Grover | 66:b3680699d9a4 | 48 | * to dfu_app_handler module by calling this function in application specific DFU event | 
| Rohit Grover | 66:b3680699d9a4 | 49 | * handler. | 
| Rohit Grover | 66:b3680699d9a4 | 50 | * | 
| Rohit Grover | 66:b3680699d9a4 | 51 | * @param[in] p_dfu Pointer to the DFU Service structure for which the include event relates. | 
| Rohit Grover | 66:b3680699d9a4 | 52 | * @param[in] p_evt Pointer to the DFU event. | 
| Rohit Grover | 66:b3680699d9a4 | 53 | */ | 
| Rohit Grover | 66:b3680699d9a4 | 54 | void dfu_app_on_dfu_evt(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt); | 
| Rohit Grover | 66:b3680699d9a4 | 55 | |
| Rohit Grover | 66:b3680699d9a4 | 56 | |
| Rohit Grover | 66:b3680699d9a4 | 57 | /**@brief Function for registering for reset prepare calls. | 
| Rohit Grover | 66:b3680699d9a4 | 58 | * | 
| Rohit Grover | 66:b3680699d9a4 | 59 | * @details The function provided will be executed before reseting the system into Bootloader/DFU | 
| Rohit Grover | 66:b3680699d9a4 | 60 | * mode. By setting this function the caller will be notified prior to the reset and can | 
| Rohit Grover | 66:b3680699d9a4 | 61 | * thus prepare the application for reset. As example the application can gracefully | 
| Rohit Grover | 66:b3680699d9a4 | 62 | * disconnect any peers on BLE, turning of LEDS, ensure all pending flash operations | 
| Rohit Grover | 66:b3680699d9a4 | 63 | * has completed, etc. | 
| Rohit Grover | 66:b3680699d9a4 | 64 | * | 
| Rohit Grover | 66:b3680699d9a4 | 65 | * @param[in] reset_prepare_func Function to be execute prior to a reset. | 
| Rohit Grover | 66:b3680699d9a4 | 66 | */ | 
| Rohit Grover | 66:b3680699d9a4 | 67 | void dfu_app_reset_prepare_set(dfu_app_reset_prepare_t reset_prepare_func); | 
| Rohit Grover | 66:b3680699d9a4 | 68 | |
| Rohit Grover | 66:b3680699d9a4 | 69 | |
| Rohit Grover | 66:b3680699d9a4 | 70 | #endif // DFU_APP_HANDLER_H__ | 
| Rohit Grover | 66:b3680699d9a4 | 71 | |
| Rohit Grover | 66:b3680699d9a4 | 72 | /** @} */ | 
