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_dis Device Information Service
yihui 1:a607cd9655d7 16 * @{
yihui 1:a607cd9655d7 17 * @ingroup ble_sdk_srv
yihui 1:a607cd9655d7 18 * @brief Device Information Service module.
yihui 1:a607cd9655d7 19 *
yihui 1:a607cd9655d7 20 * @details This module implements the Device Information Service.
yihui 1:a607cd9655d7 21 * During initialization it adds the Device Information Service to the BLE stack database.
yihui 1:a607cd9655d7 22 * It then encodes the supplied information, and adds the curresponding characteristics.
yihui 1:a607cd9655d7 23 *
yihui 1:a607cd9655d7 24 * @note Attention!
yihui 1:a607cd9655d7 25 * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile
yihui 1:a607cd9655d7 26 * qualification listings, this section of source code must not be modified.
yihui 1:a607cd9655d7 27 */
yihui 1:a607cd9655d7 28
yihui 1:a607cd9655d7 29 #ifndef BLE_DIS_H__
yihui 1:a607cd9655d7 30 #define BLE_DIS_H__
yihui 1:a607cd9655d7 31
yihui 1:a607cd9655d7 32 #include <stdint.h>
yihui 1:a607cd9655d7 33 #include "ble_srv_common.h"
yihui 1:a607cd9655d7 34
yihui 1:a607cd9655d7 35 // Vendor ID Source values
yihui 1:a607cd9655d7 36 #define BLE_DIS_VENDOR_ID_SRC_BLUETOOTH_SIG 1 /**< Vendor ID assigned by Bluetooth SIG. */
yihui 1:a607cd9655d7 37 #define BLE_DIS_VENDOR_ID_SRC_USB_IMPL_FORUM 2 /**< Vendor ID assigned by USB Implementer's Forum. */
yihui 1:a607cd9655d7 38
yihui 1:a607cd9655d7 39 /**@brief System ID parameters */
yihui 1:a607cd9655d7 40 typedef struct
yihui 1:a607cd9655d7 41 {
yihui 1:a607cd9655d7 42 uint64_t manufacturer_id; /**< Manufacturer ID. Only 5 LSOs shall be used. */
yihui 1:a607cd9655d7 43 uint32_t organizationally_unique_id; /**< Organizationally unique ID. Only 3 LSOs shall be used. */
yihui 1:a607cd9655d7 44 } ble_dis_sys_id_t;
yihui 1:a607cd9655d7 45
yihui 1:a607cd9655d7 46 /**@brief IEEE 11073-20601 Regulatory Certification Data List Structure */
yihui 1:a607cd9655d7 47 typedef struct
yihui 1:a607cd9655d7 48 {
yihui 1:a607cd9655d7 49 uint8_t * p_list; /**< Pointer the byte array containing the encoded opaque structure based on IEEE 11073-20601 specification. */
yihui 1:a607cd9655d7 50 uint8_t list_len; /**< Length of the byte array. */
yihui 1:a607cd9655d7 51 } ble_dis_reg_cert_data_list_t;
yihui 1:a607cd9655d7 52
yihui 1:a607cd9655d7 53 /**@brief PnP ID parameters */
yihui 1:a607cd9655d7 54 typedef struct
yihui 1:a607cd9655d7 55 {
yihui 1:a607cd9655d7 56 uint8_t vendor_id_source; /**< Vendor ID Source. see @ref DIS_VENDOR_ID_SRC_VALUES. */
yihui 1:a607cd9655d7 57 uint16_t vendor_id; /**< Vendor ID. */
yihui 1:a607cd9655d7 58 uint16_t product_id; /**< Product ID. */
yihui 1:a607cd9655d7 59 uint16_t product_version; /**< Product Version. */
yihui 1:a607cd9655d7 60 } ble_dis_pnp_id_t;
yihui 1:a607cd9655d7 61
yihui 1:a607cd9655d7 62 /**@brief Device Information Service init structure. This contains all possible characteristics
yihui 1:a607cd9655d7 63 * needed for initialization of the service.
yihui 1:a607cd9655d7 64 */
yihui 1:a607cd9655d7 65 typedef struct
yihui 1:a607cd9655d7 66 {
yihui 1:a607cd9655d7 67 ble_srv_utf8_str_t manufact_name_str; /**< Manufacturer Name String. */
yihui 1:a607cd9655d7 68 ble_srv_utf8_str_t model_num_str; /**< Model Number String. */
yihui 1:a607cd9655d7 69 ble_srv_utf8_str_t serial_num_str; /**< Serial Number String. */
yihui 1:a607cd9655d7 70 ble_srv_utf8_str_t hw_rev_str; /**< Hardware Revision String. */
yihui 1:a607cd9655d7 71 ble_srv_utf8_str_t fw_rev_str; /**< Firmware Revision String. */
yihui 1:a607cd9655d7 72 ble_srv_utf8_str_t sw_rev_str; /**< Software Revision String. */
yihui 1:a607cd9655d7 73 ble_dis_sys_id_t * p_sys_id; /**< System ID. */
yihui 1:a607cd9655d7 74 ble_dis_reg_cert_data_list_t * p_reg_cert_data_list; /**< IEEE 11073-20601 Regulatory Certification Data List. */
yihui 1:a607cd9655d7 75 ble_dis_pnp_id_t * p_pnp_id; /**< PnP ID. */
yihui 1:a607cd9655d7 76 ble_srv_security_mode_t dis_attr_md; /**< Initial Security Setting for Device Information Characteristics. */
yihui 1:a607cd9655d7 77 } ble_dis_init_t;
yihui 1:a607cd9655d7 78
yihui 1:a607cd9655d7 79 /**@brief Function for initializing the Device Information Service.
yihui 1:a607cd9655d7 80 *
yihui 1:a607cd9655d7 81 * @details This call allows the application to initialize the device information service.
yihui 1:a607cd9655d7 82 * It adds the DIS service and DIS characteristics to the database, using the initial
yihui 1:a607cd9655d7 83 * values supplied through the p_dis_init parameter. Characteristics which are not to be
yihui 1:a607cd9655d7 84 * added, shall be set to NULL in p_dis_init.
yihui 1:a607cd9655d7 85 *
yihui 1:a607cd9655d7 86 * @param[in] p_dis_init The structure containing the values of characteristics needed by the
yihui 1:a607cd9655d7 87 * service.
yihui 1:a607cd9655d7 88 *
yihui 1:a607cd9655d7 89 * @return NRF_SUCCESS on successful initialization of service.
yihui 1:a607cd9655d7 90 */
yihui 1:a607cd9655d7 91 uint32_t ble_dis_init(const ble_dis_init_t * p_dis_init);
yihui 1:a607cd9655d7 92
yihui 1:a607cd9655d7 93 #endif // BLE_DIS_H__
yihui 1:a607cd9655d7 94
yihui 1:a607cd9655d7 95 /** @} */