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

Fork of nRF51822 by Nordic Semiconductor

Committer:
rgrover1
Date:
Wed Apr 15 08:59:11 2015 +0100
Revision:
103:138bdc859cc9
Child:
104:55e59c802b7f
Synchronized with git rev fa183c40
Author: Rohit Grover
updating to v7.1 of the Nordic SDK.
Re-organized file layout to match that from the SDK.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rgrover1 103:138bdc859cc9 1 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
rgrover1 103:138bdc859cc9 2 *
rgrover1 103:138bdc859cc9 3 * The information contained herein is property of Nordic Semiconductor ASA.
rgrover1 103:138bdc859cc9 4 * Terms and conditions of usage are described in detail in NORDIC
rgrover1 103:138bdc859cc9 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
rgrover1 103:138bdc859cc9 6 *
rgrover1 103:138bdc859cc9 7 * Licensees are granted free, non-transferable use of the information. NO
rgrover1 103:138bdc859cc9 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
rgrover1 103:138bdc859cc9 9 * the file.
rgrover1 103:138bdc859cc9 10 *
rgrover1 103:138bdc859cc9 11 */
rgrover1 103:138bdc859cc9 12
rgrover1 103:138bdc859cc9 13 /** @file
rgrover1 103:138bdc859cc9 14 *
rgrover1 103:138bdc859cc9 15 * @defgroup ble_sdk_lib_conn_params Connection Parameters Negotiation
rgrover1 103:138bdc859cc9 16 * @{
rgrover1 103:138bdc859cc9 17 * @ingroup ble_sdk_lib
rgrover1 103:138bdc859cc9 18 * @brief Module for initiating and executing a connection parameters negotiation procedure.
rgrover1 103:138bdc859cc9 19 */
rgrover1 103:138bdc859cc9 20
rgrover1 103:138bdc859cc9 21 #ifndef BLE_CONN_PARAMS_H__
rgrover1 103:138bdc859cc9 22 #define BLE_CONN_PARAMS_H__
rgrover1 103:138bdc859cc9 23
rgrover1 103:138bdc859cc9 24 #include <stdint.h>
rgrover1 103:138bdc859cc9 25 #include "ble.h"
rgrover1 103:138bdc859cc9 26 #include "ble_srv_common.h"
rgrover1 103:138bdc859cc9 27
rgrover1 103:138bdc859cc9 28 /**@brief Connection Parameters Module event type. */
rgrover1 103:138bdc859cc9 29 typedef enum
rgrover1 103:138bdc859cc9 30 {
rgrover1 103:138bdc859cc9 31 BLE_CONN_PARAMS_EVT_FAILED , /**< Negotiation procedure failed. */
rgrover1 103:138bdc859cc9 32 BLE_CONN_PARAMS_EVT_SUCCEEDED /**< Negotiation procedure succeeded. */
rgrover1 103:138bdc859cc9 33 } ble_conn_params_evt_type_t;
rgrover1 103:138bdc859cc9 34
rgrover1 103:138bdc859cc9 35 /**@brief Connection Parameters Module event. */
rgrover1 103:138bdc859cc9 36 typedef struct
rgrover1 103:138bdc859cc9 37 {
rgrover1 103:138bdc859cc9 38 ble_conn_params_evt_type_t evt_type; /**< Type of event. */
rgrover1 103:138bdc859cc9 39 } ble_conn_params_evt_t;
rgrover1 103:138bdc859cc9 40
rgrover1 103:138bdc859cc9 41 /**@brief Connection Parameters Module event handler type. */
rgrover1 103:138bdc859cc9 42 typedef void (*ble_conn_params_evt_handler_t) (ble_conn_params_evt_t * p_evt);
rgrover1 103:138bdc859cc9 43
rgrover1 103:138bdc859cc9 44 /**@brief Connection Parameters Module init structure. This contains all options and data needed for
rgrover1 103:138bdc859cc9 45 * initialization of the connection parameters negotiation module. */
rgrover1 103:138bdc859cc9 46 typedef struct
rgrover1 103:138bdc859cc9 47 {
rgrover1 103:138bdc859cc9 48 ble_gap_conn_params_t * p_conn_params; /**< Pointer to the connection parameters desired by the application. When calling ble_conn_params_init, if this parameter is set to NULL, the connection parameters will be fetched from host. */
rgrover1 103:138bdc859cc9 49 uint32_t first_conn_params_update_delay; /**< Time from initiating event (connect or start of notification) to first time sd_ble_gap_conn_param_update is called (in number of timer ticks). */
rgrover1 103:138bdc859cc9 50 uint32_t next_conn_params_update_delay; /**< Time between each call to sd_ble_gap_conn_param_update after the first (in number of timer ticks). Recommended value 30 seconds as per BLUETOOTH SPECIFICATION Version 4.0. */
rgrover1 103:138bdc859cc9 51 uint8_t max_conn_params_update_count; /**< Number of attempts before giving up the negotiation. */
rgrover1 103:138bdc859cc9 52 uint16_t start_on_notify_cccd_handle; /**< If procedure is to be started when notification is started, set this to the handle of the corresponding CCCD. Set to BLE_GATT_HANDLE_INVALID if procedure is to be started on connect event. */
rgrover1 103:138bdc859cc9 53 bool disconnect_on_fail; /**< Set to TRUE if a failed connection parameters update shall cause an automatic disconnection, set to FALSE otherwise. */
rgrover1 103:138bdc859cc9 54 ble_conn_params_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Connection Parameters. */
rgrover1 103:138bdc859cc9 55 ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */
rgrover1 103:138bdc859cc9 56 } ble_conn_params_init_t;
rgrover1 103:138bdc859cc9 57
rgrover1 103:138bdc859cc9 58
rgrover1 103:138bdc859cc9 59 /**@brief Function for initializing the Connection Parameters module.
rgrover1 103:138bdc859cc9 60 *
rgrover1 103:138bdc859cc9 61 * @note If the negotiation procedure should be triggered when notification/indication of
rgrover1 103:138bdc859cc9 62 * any characteristic is enabled by the peer, then this function must be called after
rgrover1 103:138bdc859cc9 63 * having initialized the services.
rgrover1 103:138bdc859cc9 64 *
rgrover1 103:138bdc859cc9 65 * @param[in] p_init This contains information needed to initialize this module.
rgrover1 103:138bdc859cc9 66 *
rgrover1 103:138bdc859cc9 67 * @return NRF_SUCCESS on successful initialization, otherwise an error code.
rgrover1 103:138bdc859cc9 68 */
rgrover1 103:138bdc859cc9 69 uint32_t ble_conn_params_init(const ble_conn_params_init_t * p_init);
rgrover1 103:138bdc859cc9 70
rgrover1 103:138bdc859cc9 71 /**@brief Function for stopping the Connection Parameters module.
rgrover1 103:138bdc859cc9 72 *
rgrover1 103:138bdc859cc9 73 * @details This function is intended to be used by the application to clean up the connection
rgrover1 103:138bdc859cc9 74 * parameters update module. This will stop the connection parameters update timer if
rgrover1 103:138bdc859cc9 75 * running, thereby preventing any impending connection parameters update procedure. This
rgrover1 103:138bdc859cc9 76 * function must be called by the application when it needs to clean itself up (for
rgrover1 103:138bdc859cc9 77 * example, before disabling the bluetooth SoftDevice) so that an unwanted timer expiry
rgrover1 103:138bdc859cc9 78 * event can be avoided.
rgrover1 103:138bdc859cc9 79 *
rgrover1 103:138bdc859cc9 80 * @return NRF_SUCCESS on successful initialization, otherwise an error code.
rgrover1 103:138bdc859cc9 81 */
rgrover1 103:138bdc859cc9 82 uint32_t ble_conn_params_stop(void);
rgrover1 103:138bdc859cc9 83
rgrover1 103:138bdc859cc9 84 /**@brief Function for changing the current connection parameters to a new set.
rgrover1 103:138bdc859cc9 85 *
rgrover1 103:138bdc859cc9 86 * @details Use this function to change the connection parameters to a new set of parameter
rgrover1 103:138bdc859cc9 87 * (ie different from the ones given at init of the module).
rgrover1 103:138bdc859cc9 88 * This function is usefull for scenario where most of the time the application
rgrover1 103:138bdc859cc9 89 * needs a relatively big connection interval, and just sometimes, for a temporary
rgrover1 103:138bdc859cc9 90 * period requires shorter connection interval, for example to transfer a higher
rgrover1 103:138bdc859cc9 91 * amount of data.
rgrover1 103:138bdc859cc9 92 * If the given parameters does not match the current connection's parameters
rgrover1 103:138bdc859cc9 93 * this function initiates a new negotiation.
rgrover1 103:138bdc859cc9 94 *
rgrover1 103:138bdc859cc9 95 * @param[in] new_params This contains the new connections parameters to setup.
rgrover1 103:138bdc859cc9 96 *
rgrover1 103:138bdc859cc9 97 * @return NRF_SUCCESS on successful initialization, otherwise an error code.
rgrover1 103:138bdc859cc9 98 */
rgrover1 103:138bdc859cc9 99 uint32_t ble_conn_params_change_conn_params(ble_gap_conn_params_t *new_params);
rgrover1 103:138bdc859cc9 100
rgrover1 103:138bdc859cc9 101 /**@brief Function for handling the Application's BLE Stack events.
rgrover1 103:138bdc859cc9 102 *
rgrover1 103:138bdc859cc9 103 * @details Handles all events from the BLE stack that are of interest to this module.
rgrover1 103:138bdc859cc9 104 *
rgrover1 103:138bdc859cc9 105 * @param[in] p_ble_evt The event received from the BLE stack.
rgrover1 103:138bdc859cc9 106 */
rgrover1 103:138bdc859cc9 107 void ble_conn_params_on_ble_evt(ble_evt_t * p_ble_evt);
rgrover1 103:138bdc859cc9 108
rgrover1 103:138bdc859cc9 109 #endif // BLE_CONN_PARAMS_H__
rgrover1 103:138bdc859cc9 110
rgrover1 103:138bdc859cc9 111 /** @} */