ble_prf_types.h
Go to the documentation of this file.
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 "
gr_includes.h
"
54
#include <stdint.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
{
71
PRF_CLI_STOP_NTFIND
= 0x0000,
/**< Stop notification/indication. */
72
PRF_CLI_START_NTF
,
/**< Start notification. */
73
PRF_CLI_START_IND
,
/**< Start indication. */
74
}
prf_cli_conf_t
;
75
/** @} */
76
77
/**
78
* @defgroup BLE_PRF_TYPE_TYPEDEF Typedefs
79
* @{
80
*/
81
/**@brief Function for handling profile/service error. */
82
typedef
void (*
prf_error_handler_t
)(
sdk_err_t
err_code);
83
/** @} */
84
85
/** @defgroup BLE_PRF_TYPE_STRUCT Structures
86
* @{
87
*/
88
/**@brief Characteristic Presentation Format Descriptor structure.
89
* The packed size is \ref PRF_CHAR_PRES_FMT_SIZE. */
90
typedef
struct
91
{
92
uint16_t
unit
;
/**< Unit (The Unit is a UUID). */
93
uint16_t
description
;
/**< Description. */
94
uint8_t
format
;
/**< Format. */
95
uint8_t
exponent
;
/**< Exponent. */
96
uint8_t
name_space
;
/**< Name space. */
97
}
prf_char_pres_fmt_t
;
98
99
/**@brief The date and time structure. The packed size is 7 bytes. */
100
typedef
struct
101
{
102
uint16_t
year
;
/**< year time element. */
103
uint8_t
month
;
/**< month time element. */
104
uint8_t
day
;
/**< day time element. */
105
uint8_t
hour
;
/**< hour time element. */
106
uint8_t
min
;
/**< minute time element. */
107
uint8_t
sec
;
/**< second time element. */
108
}
prf_date_time_t
;
109
110
/**@brief Slave preferred connection parameters. */
111
typedef
struct
112
{
113
uint16_t
con_intv_min
;
/**< Connection interval minimum. */
114
uint16_t
con_intv_max
;
/**< Connection interval maximum. */
115
uint16_t
slave_latency
;
/**< Slave latency. */
116
uint16_t
conn_timeout
;
/**< Connection supervision timeout multiplier. */
117
}
gap_slv_pref_t
;
118
119
/**@brief Attribute information. */
120
typedef
struct
121
{
122
uint16_t
handle
;
/**< Attribute Handle. */
123
uint16_t
offset
;
/**< Offset of the attribute value . */
124
uint16_t
length
;
/**< Attribute length. */
125
uint8_t
status
;
/**< Status of request. */
126
uint8_t *
p_data
;
/**< Attribute value. */
127
}
prf_att_info_t
;
128
/** @} */
129
130
#endif
/* _BLE_PRF_TYPES_H_ */
131
/** @} */
132
/** @} */
133
prf_date_time_t::month
uint8_t month
Definition:
ble_prf_types.h:103
prf_char_pres_fmt_t::exponent
uint8_t exponent
Definition:
ble_prf_types.h:95
PRF_CLI_START_IND
@ PRF_CLI_START_IND
Definition:
ble_prf_types.h:73
prf_cli_conf_t
prf_cli_conf_t
The values for setting client configuration characteristics.
Definition:
ble_prf_types.h:70
gap_slv_pref_t::slave_latency
uint16_t slave_latency
Definition:
ble_prf_types.h:115
gr_includes.h
Include Files API.
prf_att_info_t::status
uint8_t status
Definition:
ble_prf_types.h:125
PRF_CLI_START_NTF
@ PRF_CLI_START_NTF
Definition:
ble_prf_types.h:72
prf_char_pres_fmt_t
Characteristic Presentation Format Descriptor structure. The packed size is PRF_CHAR_PRES_FMT_SIZE.
Definition:
ble_prf_types.h:91
prf_att_info_t::length
uint16_t length
Definition:
ble_prf_types.h:124
prf_att_info_t
Attribute information.
Definition:
ble_prf_types.h:121
PRF_CLI_STOP_NTFIND
@ PRF_CLI_STOP_NTFIND
Definition:
ble_prf_types.h:71
prf_date_time_t::min
uint8_t min
Definition:
ble_prf_types.h:106
sdk_err_t
uint16_t sdk_err_t
SDK API result type.
Definition:
ble_error.h:273
prf_att_info_t::p_data
uint8_t * p_data
Definition:
ble_prf_types.h:126
prf_date_time_t
The date and time structure. The packed size is 7 bytes.
Definition:
ble_prf_types.h:101
prf_att_info_t::handle
uint16_t handle
Definition:
ble_prf_types.h:122
gap_slv_pref_t::con_intv_max
uint16_t con_intv_max
Definition:
ble_prf_types.h:114
prf_char_pres_fmt_t::description
uint16_t description
Definition:
ble_prf_types.h:93
prf_char_pres_fmt_t::unit
uint16_t unit
Definition:
ble_prf_types.h:92
prf_error_handler_t
void(* prf_error_handler_t)(sdk_err_t err_code)
Function for handling profile/service error.
Definition:
ble_prf_types.h:82
gap_slv_pref_t::con_intv_min
uint16_t con_intv_min
Definition:
ble_prf_types.h:113
prf_date_time_t::day
uint8_t day
Definition:
ble_prf_types.h:104
prf_date_time_t::hour
uint8_t hour
Definition:
ble_prf_types.h:105
gap_slv_pref_t
Slave preferred connection parameters.
Definition:
ble_prf_types.h:112
prf_char_pres_fmt_t::format
uint8_t format
Definition:
ble_prf_types.h:94
prf_date_time_t::year
uint16_t year
Definition:
ble_prf_types.h:102
prf_date_time_t::sec
uint8_t sec
Definition:
ble_prf_types.h:107
gap_slv_pref_t::conn_timeout
uint16_t conn_timeout
Definition:
ble_prf_types.h:116
prf_char_pres_fmt_t::name_space
uint8_t name_space
Definition:
ble_prf_types.h:96
prf_att_info_t::offset
uint16_t offset
Definition:
ble_prf_types.h:123