test
Fork of nRF51822 by
Embed:
(wiki syntax)
Show/hide line numbers
dfu_app_handler.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 nrf_dfu_app_handler DFU BLE packet handling in Application 00036 * @{ 00037 * 00038 * @brief DFU BLE packet handling for application. 00039 * 00040 * @details This module implements handling of DFU packets transmitted over BLE for switching from 00041 * application mode to Bootloader running full DFU service. 00042 * This module only handles the StartDFU packet allowing for any BLE application to expose 00043 * support for the DFU service. 00044 * Actual DFU service will execute in dedicated environment after a BLE disconnect and 00045 * reset of the nRF51 chip. 00046 * The host must then reconnect and can continue the update procedure with access to full 00047 * DFU service. 00048 * 00049 * @note The application must propagate dfu events to the DFU App handler module by calling 00050 * dfu_app_on_dfu_evt() from the @ref ble_dfu_evt_handler_t callback. 00051 */ 00052 00053 #ifndef DFU_APP_HANDLER_H__ 00054 #define DFU_APP_HANDLER_H__ 00055 00056 #include "ble_dfu.h " 00057 #include "nrf_svc.h" 00058 #include "bootloader_types.h " 00059 #include "device_manager.h " 00060 00061 /**@brief DFU Application reset prepare function. This function is a callback which allows the 00062 * application to prepare for an upcoming application reset. 00063 */ 00064 typedef void (*dfu_app_reset_prepare_t)(void); 00065 00066 /**@brief Function for handling of \ref ble_dfu_evt_t from DFU Service. 00067 * 00068 * @details The application must inject this function into the DFU service or propagate DFU events 00069 * to dfu_app_handler module by calling this function in application specific DFU event 00070 * handler. 00071 * 00072 * @param[in] p_dfu Pointer to the DFU Service structure for which the include event 00073 * relates. 00074 * @param[in] p_evt Pointer to the DFU event. 00075 */ 00076 void dfu_app_on_dfu_evt(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt); 00077 00078 /**@brief Function for registering for reset prepare calls. 00079 * 00080 * @details The function provided will be executed before reseting the system into Bootloader/DFU 00081 * mode. By setting this function the caller will be notified prior to the reset and can 00082 * thus prepare the application for reset. As example the application can gracefully 00083 * disconnect any peers on BLE, turning of LEDS, ensure all pending flash operations 00084 * has completed, etc. 00085 * 00086 * @param[in] reset_prepare_func Function to be execute prior to a reset. 00087 */ 00088 void dfu_app_reset_prepare_set(dfu_app_reset_prepare_t reset_prepare_func); 00089 00090 /**@brief Function for setting Device manager handle for current BLE connection. 00091 * 00092 * @param[in] p_dm_handle Pointer to device manager handle of current connection. 00093 */ 00094 void dfu_app_set_dm_handle(dm_handle_t const * p_dm_handle); 00095 00096 #endif // DFU_APP_HANDLER_H__ 00097 00098 /** @} */
Generated on Tue Jul 12 2022 21:00:16 by 1.7.2