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) 2012 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_sdk_srv_tps TX Power Service
yihui 1:a607cd9655d7 16 * @{
yihui 1:a607cd9655d7 17 * @ingroup ble_sdk_srv
yihui 1:a607cd9655d7 18 * @brief TX Power Service module.
yihui 1:a607cd9655d7 19 *
yihui 1:a607cd9655d7 20 * @details This module implements the TX Power Service with the TX Power Level characteristic.
yihui 1:a607cd9655d7 21 * During initialization it adds the TX Power Service and TX Power Level characteristic
yihui 1:a607cd9655d7 22 * with the specified initial value to the BLE stack database.
yihui 1:a607cd9655d7 23 *
yihui 1:a607cd9655d7 24 * It provides a function for letting the application update the TX Power Level
yihui 1:a607cd9655d7 25 * characteristic.
yihui 1:a607cd9655d7 26 *
yihui 1:a607cd9655d7 27 * @note Attention!
yihui 1:a607cd9655d7 28 * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile
yihui 1:a607cd9655d7 29 * qualification listings, this section of source code must not be modified.
yihui 1:a607cd9655d7 30 */
yihui 1:a607cd9655d7 31
yihui 1:a607cd9655d7 32 #ifndef BLE_TPS_H__
yihui 1:a607cd9655d7 33 #define BLE_TPS_H__
yihui 1:a607cd9655d7 34
yihui 1:a607cd9655d7 35 #include <stdint.h>
yihui 1:a607cd9655d7 36 #include "ble.h"
yihui 1:a607cd9655d7 37 #include "ble_srv_common.h"
yihui 1:a607cd9655d7 38
yihui 1:a607cd9655d7 39 /**@brief TX Power Service init structure. This contains all options and data needed for
yihui 1:a607cd9655d7 40 * initialization of the service. */
yihui 1:a607cd9655d7 41 typedef struct
yihui 1:a607cd9655d7 42 {
yihui 1:a607cd9655d7 43 int8_t initial_tx_power_level; /**< Initial value of the TX Power Level characteristic (in dBm). */
yihui 1:a607cd9655d7 44 ble_srv_security_mode_t tps_attr_md; /**< Initial Security Setting for TX Power Service Characteristics. */
yihui 1:a607cd9655d7 45 } ble_tps_init_t;
yihui 1:a607cd9655d7 46
yihui 1:a607cd9655d7 47 /**@brief TX Power Service structure. This contains various status information for the service. */
yihui 1:a607cd9655d7 48 typedef struct
yihui 1:a607cd9655d7 49 {
yihui 1:a607cd9655d7 50 uint16_t service_handle; /**< Handle of TX Power Service (as provided by the BLE stack). */
yihui 1:a607cd9655d7 51 ble_gatts_char_handles_t tx_power_level_handles; /**< Handles related to the TX Power Level characteristic. */
yihui 1:a607cd9655d7 52 } ble_tps_t;
yihui 1:a607cd9655d7 53
yihui 1:a607cd9655d7 54 /**@brief Function for initializing the TX Power Service.
yihui 1:a607cd9655d7 55 *
yihui 1:a607cd9655d7 56 * @param[out] p_tps TX Power Service structure. This structure will have to be supplied by
yihui 1:a607cd9655d7 57 * the application. It will be initialized by this function, and will later
yihui 1:a607cd9655d7 58 * be used to identify this particular service instance.
yihui 1:a607cd9655d7 59 * @param[in] p_tps_init Information needed to initialize the service.
yihui 1:a607cd9655d7 60 *
yihui 1:a607cd9655d7 61 * @return NRF_SUCCESS on successful initialization of service, otherwise an error code.
yihui 1:a607cd9655d7 62 */
yihui 1:a607cd9655d7 63 uint32_t ble_tps_init(ble_tps_t * p_hrs, const ble_tps_init_t * p_tps_init);
yihui 1:a607cd9655d7 64
yihui 1:a607cd9655d7 65 /**@brief Function for setting the state of the Sensor Contact Detected bit.
yihui 1:a607cd9655d7 66 *
yihui 1:a607cd9655d7 67 * @param[in] p_tps TX Power Service structure.
yihui 1:a607cd9655d7 68 * @param[in] tx_power_level New TX Power Level (unit dBm, range -100 to 20).
yihui 1:a607cd9655d7 69 *
yihui 1:a607cd9655d7 70 * @return NRF_SUCCESS on success, otherwise an error code.
yihui 1:a607cd9655d7 71 */
yihui 1:a607cd9655d7 72 uint32_t ble_tps_tx_power_level_set(ble_tps_t * p_tps, int8_t tx_power_level);
yihui 1:a607cd9655d7 73
yihui 1:a607cd9655d7 74 #endif // BLE_TPS_H__
yihui 1:a607cd9655d7 75
yihui 1:a607cd9655d7 76 /** @} */