Nordic stack and drivers for the mbed BLE API

Dependents:   idd_hw5_bleFanProto

Fork of nRF51822 by Nordic Semiconductor

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ble_tps.h Source File

ble_tps.h

Go to the documentation of this file.
00001 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
00002  *
00003  * The information contained herein is property of Nordic Semiconductor ASA.
00004  * Terms and conditions of usage are described in detail in NORDIC
00005  * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
00006  *
00007  * Licensees are granted free, non-transferable use of the information. NO
00008  * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
00009  * the file.
00010  *
00011  */
00012 
00013 /** @file
00014  *
00015  * @defgroup ble_sdk_srv_tps TX Power Service
00016  * @{
00017  * @ingroup ble_sdk_srv
00018  * @brief TX Power Service module.
00019  *
00020  * @details This module implements the TX Power Service with the TX Power Level characteristic.
00021  *          During initialization it adds the TX Power Service and TX Power Level characteristic
00022  *          with the specified initial value to the BLE stack database.
00023  *
00024  *          It provides a function for letting the application update the TX Power Level
00025  *          characteristic.
00026  *
00027  * @note Attention! 
00028  *  To maintain compliance with Nordic Semiconductor ASA Bluetooth profile 
00029  *  qualification listings, this section of source code must not be modified.
00030  */
00031 
00032 #ifndef BLE_TPS_H__
00033 #define BLE_TPS_H__
00034 
00035 #include <stdint.h>
00036 #include "ble.h"
00037 #include "ble_srv_common.h "
00038 
00039 /**@brief TX Power Service init structure. This contains all options and data needed for
00040  *        initialization of the service. */
00041 typedef struct
00042 {
00043     int8_t                    initial_tx_power_level;   /**< Initial value of the TX Power Level characteristic (in dBm). */
00044     ble_srv_security_mode_t   tps_attr_md;              /**< Initial Security Setting for TX Power Service Characteristics. */
00045 } ble_tps_init_t;
00046 
00047 /**@brief TX Power Service structure. This contains various status information for the service. */
00048 typedef struct
00049 {
00050     uint16_t                  service_handle;           /**< Handle of TX Power Service (as provided by the BLE stack). */
00051     ble_gatts_char_handles_t  tx_power_level_handles;   /**< Handles related to the TX Power Level characteristic. */
00052 } ble_tps_t;
00053 
00054 /**@brief Function for initializing the TX Power Service.
00055  *
00056  * @param[out]  p_tps       TX Power Service structure. This structure will have to be supplied by
00057  *                          the application. It will be initialized by this function, and will later
00058  *                          be used to identify this particular service instance.
00059  * @param[in]   p_tps_init  Information needed to initialize the service.
00060  *
00061  * @return      NRF_SUCCESS on successful initialization of service, otherwise an error code.
00062  */
00063 uint32_t ble_tps_init(ble_tps_t * p_hrs, const ble_tps_init_t * p_tps_init);
00064 
00065 /**@brief Function for setting the state of the Sensor Contact Detected bit.
00066  *
00067  * @param[in]   p_tps            TX Power Service structure.
00068  * @param[in]   tx_power_level   New TX Power Level (unit dBm, range -100 to 20).
00069  *
00070  * @return      NRF_SUCCESS on success, otherwise an error code.
00071  */
00072 uint32_t ble_tps_tx_power_level_set(ble_tps_t * p_tps, int8_t tx_power_level);
00073 
00074 #endif // BLE_TPS_H__
00075 
00076 /** @} */