nochanges

Dependents:   BLE_Acceleration_Statejudging

Fork of nRF51822 by Nordic Semiconductor

Committer:
Rohit Grover
Date:
Mon Jul 07 13:43:31 2014 +0100
Revision:
37:c29c330d942c
changes required to upgrade to V7 of the soft-device

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rohit Grover 37:c29c330d942c 1 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
Rohit Grover 37:c29c330d942c 2 *
Rohit Grover 37:c29c330d942c 3 * The information contained herein is property of Nordic Semiconductor ASA.
Rohit Grover 37:c29c330d942c 4 * Terms and conditions of usage are described in detail in NORDIC
Rohit Grover 37:c29c330d942c 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
Rohit Grover 37:c29c330d942c 6 *
Rohit Grover 37:c29c330d942c 7 * Licensees are granted free, non-transferable use of the information. NO
Rohit Grover 37:c29c330d942c 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
Rohit Grover 37:c29c330d942c 9 * the file.
Rohit Grover 37:c29c330d942c 10 *
Rohit Grover 37:c29c330d942c 11 */
Rohit Grover 37:c29c330d942c 12
Rohit Grover 37:c29c330d942c 13 /** @file
Rohit Grover 37:c29c330d942c 14 *
Rohit Grover 37:c29c330d942c 15 * @defgroup ble_sdk_srv_lls Link Loss Service
Rohit Grover 37:c29c330d942c 16 * @{
Rohit Grover 37:c29c330d942c 17 * @ingroup ble_sdk_srv
Rohit Grover 37:c29c330d942c 18 * @brief Link Loss Service module.
Rohit Grover 37:c29c330d942c 19 *
Rohit Grover 37:c29c330d942c 20 * @details This module implements the Link Loss Service with the Alert Level characteristic.
Rohit Grover 37:c29c330d942c 21 * During initialization it adds the Link Loss Service and Alert Level characteristic
Rohit Grover 37:c29c330d942c 22 * to the BLE stack database.
Rohit Grover 37:c29c330d942c 23 *
Rohit Grover 37:c29c330d942c 24 * The application must supply an event handler for receiving Link Loss Service
Rohit Grover 37:c29c330d942c 25 * events. Using this handler, the service will notify the application when the
Rohit Grover 37:c29c330d942c 26 * link has been lost, and which Alert Level has been set.
Rohit Grover 37:c29c330d942c 27 *
Rohit Grover 37:c29c330d942c 28 * The service also provides a function for letting the application poll the current
Rohit Grover 37:c29c330d942c 29 * value of the Alert Level characteristic.
Rohit Grover 37:c29c330d942c 30 *
Rohit Grover 37:c29c330d942c 31 * @note The application must propagate BLE stack events to the Link Loss Service
Rohit Grover 37:c29c330d942c 32 * module by calling ble_lls_on_ble_evt() from the @ref ble_stack_handler callback.
Rohit Grover 37:c29c330d942c 33 *
Rohit Grover 37:c29c330d942c 34 * @note Attention!
Rohit Grover 37:c29c330d942c 35 * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile
Rohit Grover 37:c29c330d942c 36 * qualification listings, this section of source code must not be modified.
Rohit Grover 37:c29c330d942c 37 */
Rohit Grover 37:c29c330d942c 38
Rohit Grover 37:c29c330d942c 39 #ifndef BLE_LLS_H__
Rohit Grover 37:c29c330d942c 40 #define BLE_LLS_H__
Rohit Grover 37:c29c330d942c 41
Rohit Grover 37:c29c330d942c 42 #include <stdint.h>
Rohit Grover 37:c29c330d942c 43 #include "ble.h"
Rohit Grover 37:c29c330d942c 44 #include "ble_srv_common.h"
Rohit Grover 37:c29c330d942c 45
Rohit Grover 37:c29c330d942c 46 /**@brief Link Loss Service event type. */
Rohit Grover 37:c29c330d942c 47 typedef enum
Rohit Grover 37:c29c330d942c 48 {
Rohit Grover 37:c29c330d942c 49 BLE_LLS_EVT_LINK_LOSS_ALERT /**< Alert Level Updated event. */
Rohit Grover 37:c29c330d942c 50 } ble_lls_evt_type_t;
Rohit Grover 37:c29c330d942c 51
Rohit Grover 37:c29c330d942c 52 /**@brief Link Loss Service event. */
Rohit Grover 37:c29c330d942c 53 typedef struct
Rohit Grover 37:c29c330d942c 54 {
Rohit Grover 37:c29c330d942c 55 ble_lls_evt_type_t evt_type; /**< Type of event. */
Rohit Grover 37:c29c330d942c 56 union
Rohit Grover 37:c29c330d942c 57 {
Rohit Grover 37:c29c330d942c 58 uint8_t alert_level; /**< New Alert Level value. */
Rohit Grover 37:c29c330d942c 59 } params;
Rohit Grover 37:c29c330d942c 60 } ble_lls_evt_t;
Rohit Grover 37:c29c330d942c 61
Rohit Grover 37:c29c330d942c 62 // Forward declaration of the ble_lls_t type.
Rohit Grover 37:c29c330d942c 63 typedef struct ble_lls_s ble_lls_t;
Rohit Grover 37:c29c330d942c 64
Rohit Grover 37:c29c330d942c 65 /**@brief Link Loss Service event handler type. */
Rohit Grover 37:c29c330d942c 66 typedef void (*ble_lls_evt_handler_t) (ble_lls_t * p_lls, ble_lls_evt_t * p_evt);
Rohit Grover 37:c29c330d942c 67
Rohit Grover 37:c29c330d942c 68 /**@brief Link Loss Service init structure. This contains all options and data needed for initialization of the service. */
Rohit Grover 37:c29c330d942c 69 typedef struct
Rohit Grover 37:c29c330d942c 70 {
Rohit Grover 37:c29c330d942c 71 ble_lls_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Link Loss Service. */
Rohit Grover 37:c29c330d942c 72 ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */
Rohit Grover 37:c29c330d942c 73 uint8_t initial_alert_level; /**< Initial value of the Alert Level characteristic. */
Rohit Grover 37:c29c330d942c 74 ble_srv_security_mode_t lls_attr_md; /**< Initial Security Setting for Link Loss Service Characteristics. */
Rohit Grover 37:c29c330d942c 75 } ble_lls_init_t;
Rohit Grover 37:c29c330d942c 76
Rohit Grover 37:c29c330d942c 77 /**@brief Link Loss Service structure. This contains various status information for the service. */
Rohit Grover 37:c29c330d942c 78 typedef struct ble_lls_s
Rohit Grover 37:c29c330d942c 79 {
Rohit Grover 37:c29c330d942c 80 ble_lls_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Link Loss Service. */
Rohit Grover 37:c29c330d942c 81 ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */
Rohit Grover 37:c29c330d942c 82 uint16_t service_handle; /**< Handle of Link Loss Service (as provided by the BLE stack). */
Rohit Grover 37:c29c330d942c 83 ble_gatts_char_handles_t alert_level_handles; /**< Handles related to the Alert Level characteristic. */
Rohit Grover 37:c29c330d942c 84 } ble_lls_t;
Rohit Grover 37:c29c330d942c 85
Rohit Grover 37:c29c330d942c 86 /**@brief Function for initializing the Link Loss Service.
Rohit Grover 37:c29c330d942c 87 *
Rohit Grover 37:c29c330d942c 88 * @param[out] p_lls Link Loss Service structure. This structure will have to be supplied by
Rohit Grover 37:c29c330d942c 89 * the application. It will be initialized by this function, and will later
Rohit Grover 37:c29c330d942c 90 * be used to identify this particular service instance.
Rohit Grover 37:c29c330d942c 91 * @param[in] p_lls_init Information needed to initialize the service.
Rohit Grover 37:c29c330d942c 92 *
Rohit Grover 37:c29c330d942c 93 * @return NRF_SUCCESS on successful initialization of service, otherwise an error code.
Rohit Grover 37:c29c330d942c 94 */
Rohit Grover 37:c29c330d942c 95 uint32_t ble_lls_init(ble_lls_t * p_lls, const ble_lls_init_t * p_lls_init);
Rohit Grover 37:c29c330d942c 96
Rohit Grover 37:c29c330d942c 97 /**@brief Function for handling the Application's BLE Stack events.
Rohit Grover 37:c29c330d942c 98 *
Rohit Grover 37:c29c330d942c 99 * @details Handles all events from the BLE stack of interest to the Link Loss Service.
Rohit Grover 37:c29c330d942c 100 *
Rohit Grover 37:c29c330d942c 101 * @param[in] p_lls Link Loss Service structure.
Rohit Grover 37:c29c330d942c 102 * @param[in] p_ble_evt Event received from the BLE stack.
Rohit Grover 37:c29c330d942c 103 */
Rohit Grover 37:c29c330d942c 104 void ble_lls_on_ble_evt(ble_lls_t * p_lls, ble_evt_t * p_ble_evt);
Rohit Grover 37:c29c330d942c 105
Rohit Grover 37:c29c330d942c 106 /**@brief Function for getting current value of the Alert Level characteristic.
Rohit Grover 37:c29c330d942c 107 *
Rohit Grover 37:c29c330d942c 108 * @param[in] p_lls Link Loss Service structure.
Rohit Grover 37:c29c330d942c 109 * @param[out] p_alert_level Current Alert Level value.
Rohit Grover 37:c29c330d942c 110 */
Rohit Grover 37:c29c330d942c 111 uint32_t ble_lls_alert_level_get(ble_lls_t * p_lls, uint8_t * p_alert_level);
Rohit Grover 37:c29c330d942c 112
Rohit Grover 37:c29c330d942c 113 #endif // BLE_LLS_H__
Rohit Grover 37:c29c330d942c 114
Rohit Grover 37:c29c330d942c 115 /** @} */