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