1 /** 2 ******************************************************************************* 3 * 4 * @file ble_prf_types.h 5 * 6 * @brief Profile/Service Common Types 7 * 8 ******************************************************************************* 9 * @attention 10 #####Copyright (c) 2019 GOODIX 11 All rights reserved. 12 13 Redistribution and use in source and binary forms, with or without 14 modification, are permitted provided that the following conditions are met: 15 * Redistributions of source code must retain the above copyright 16 notice, this list of conditions and the following disclaimer. 17 * Redistributions in binary form must reproduce the above copyright 18 notice, this list of conditions and the following disclaimer in the 19 documentation and/or other materials provided with the distribution. 20 * Neither the name of GOODIX nor the names of its contributors may be used 21 to endorse or promote products derived from this software without 22 specific prior written permission. 23 24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 POSSIBILITY OF SUCH DAMAGE. 35 ***************************************************************************************** 36 */ 37 38 /** 39 * @addtogroup BLE_SRV BLE Services 40 * @{ 41 * @brief Definitions and prototypes for the BLE Service interface. 42 */ 43 44 /** 45 @defgroup BLE_PRF_TYPE Profile/Service Common Types 46 @{ 47 @brief Definitions for BLE profile/service common types. 48 */ 49 50 #ifndef __BLE_PRF_TYPES_H__ 51 #define __BLE_PRF_TYPES_H__ 52 53 #include <stdint.h> 54 #include "gr55xx_sys.h" 55 56 /** @defgroup BLE_MACRO Defines 57 * @{ 58 */ 59 /** Characteristic Presentation Format Descriptor Size. */ 60 #define PRF_CHAR_PRES_FMT_SIZE (7) 61 /** The invalid profile handle. */ 62 #define PRF_INVALID_HANDLE (0x0000) 63 /** @} */ 64 65 /** @defgroup BLE_PRF_TYPE_ENUM Enumerations 66 * @{ 67 */ 68 /**@brief The values for setting client configuration characteristics. */ 69 typedef enum { 70 PRF_CLI_STOP_NTFIND = 0x0000, /**< Stop notification/indication. */ 71 PRF_CLI_START_NTF, /**< Start notification. */ 72 PRF_CLI_START_IND, /**< Start indication. */ 73 } prf_cli_conf_t; 74 /** @} */ 75 76 /** 77 * @defgroup BLE_PRF_TYPE_TYPEDEF Typedefs 78 * @{ 79 */ 80 /**@brief Function for handling profile/service error. */ 81 typedef void (*prf_error_handler_t)(sdk_err_t err_code); 82 /** @} */ 83 84 /** @defgroup BLE_PRF_TYPE_STRUCT Structures 85 * @{ 86 */ 87 /**@brief Characteristic Presentation Format Descriptor structure. 88 * The packed size is \ref PRF_CHAR_PRES_FMT_SIZE. */ 89 typedef struct { 90 uint16_t unit; /**< Unit (The Unit is a UUID). */ 91 uint16_t description; /**< Description. */ 92 uint8_t format; /**< Format. */ 93 uint8_t exponent; /**< Exponent. */ 94 uint8_t name_space; /**< Name space. */ 95 } prf_char_pres_fmt_t; 96 97 /**@brief The date and time structure. The packed size is 7 bytes. */ 98 typedef struct { 99 uint16_t year; /**< year time element. */ 100 uint8_t month; /**< month time element. */ 101 uint8_t day; /**< day time element. */ 102 uint8_t hour; /**< hour time element. */ 103 uint8_t min; /**< minute time element. */ 104 uint8_t sec; /**< second time element. */ 105 } prf_date_time_t; 106 107 /**@brief Slave preferred connection parameters. */ 108 typedef struct { 109 uint16_t con_intv_min; /**< Connection interval minimum. */ 110 uint16_t con_intv_max; /**< Connection interval maximum. */ 111 uint16_t slave_latency; /**< Slave latency. */ 112 uint16_t conn_timeout; /**< Connection supervision timeout multiplier. */ 113 } gap_slv_pref_t; 114 115 /**@brief Attribute information. */ 116 typedef struct { 117 uint16_t handle; /**< Attribute Handle. */ 118 uint16_t offset; /**< Offset of the attribute value . */ 119 uint16_t length; /**< Attribute length. */ 120 uint8_t status; /**< Status of request. */ 121 uint8_t *p_data; /**< Attribute value. */ 122 } prf_att_info_t; 123 /** @} */ 124 125 #endif /* _BLE_PRF_TYPES_H_ */ 126 /** @} */ 127 /** @} */ 128 129