-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcy_ble_custom.h
171 lines (127 loc) · 5.15 KB
/
cy_ble_custom.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/***************************************************************************//**
* \file cy_ble_custom.h
* \version 3.60
*
* \brief
* Contains the function prototypes and constants for the Custom service.
*
********************************************************************************
* \copyright
* Copyright 2017-2021, Cypress Semiconductor Corporation. All rights reserved.
* You may use this file only in accordance with the license, terms, conditions,
* disclaimers, and limitations in the end user license agreement accompanying
* the software package with which this file was provided.
*******************************************************************************/
#ifndef CY_BLE_CUSTOM_H
#define CY_BLE_CUSTOM_H
#include "cy_ble.h"
#if defined(CY_IP_MXBLESS)
/* C binding of definitions if building with C++ compiler */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*******************************************************************************
* API Constants
*******************************************************************************/
/* The maximum supported Custom server services */
#define CY_BLE_CUSTOMS_SERVICE_COUNT (CY_BLE_CONFIG_CUSTOMS_SERVICE_COUNT)
/* The maximum supported Custom client services */
#define CY_BLE_CUSTOMC_SERVICE_COUNT (CY_BLE_CONFIG_CUSTOMC_SERVICE_COUNT)
/*******************************************************************************
* Data Types
*******************************************************************************/
/**
* \addtogroup group_ble_service_api_custom
* \{
*/
/** Structure with Custom attribute information */
typedef struct
{
/** Custom Characteristic handle */
cy_ble_gatt_db_attr_handle_t customServCharHandle;
/** Custom Characteristic Descriptors Handles */
const cy_ble_gatt_db_attr_handle_t *customServCharDesc;
} cy_stc_ble_customs_info_t;
/** Structure with Custom Service attribute handles */
typedef struct
{
/** Handle of a Custom Service */
cy_ble_gatt_db_attr_handle_t customServHandle;
/** Information about Custom Characteristics */
const cy_stc_ble_customs_info_t *customServInfo;
} cy_stc_ble_customs_t;
/** Structure with Discovered Attributes Information of Custom Service Descriptors */
typedef struct
{
/** Custom Descriptor handle */
cy_ble_gatt_db_attr_handle_t *descHandle;
/** Custom Descriptor 128 bit UUID */
const void *uuid;
/** UUID Format - 16-bit (0x01) or 128-bit (0x02) */
uint8_t uuidFormat;
} cy_stc_ble_customc_desc_t;
/** Structure with Discovered Attributes Information of Custom Service Characteristics */
typedef struct
{
/** Characteristic handle */
cy_ble_gatt_db_attr_handle_t *customServCharHandle;
/** Characteristic end handle */
cy_ble_gatt_db_attr_handle_t *customServCharEndHandle;
/** Custom Characteristic UUID */
const void *uuid;
/** UUID Format - 16-bit (0x01) or 128-bit (0x02) */
uint8_t uuidFormat;
/** Properties for Value Field */
uint8_t *properties;
/** Number of descriptors */
uint8_t descCount;
/** Characteristic descriptors */
const cy_stc_ble_customc_desc_t *customServCharDesc;
} cy_stc_ble_customc_char_t;
/** Structure with Discovered Attributes Information of Custom Service */
typedef struct
{
/** Custom Service Handle */
cy_ble_gatt_db_attr_handle_t *customServHandle;
/** Custom Service UUID */
const void *uuid;
/** UUID Format - 16-bit (0x01) or 128-bit (0x02) */
uint8_t uuidFormat;
/** Number of Characteristics */
uint8_t charCount;
/** Custom Service Characteristics */
const cy_stc_ble_customc_char_t *customServChar;
} cy_stc_ble_customc_t;
/** Service configuration structure (server) */
typedef struct
{
/** Service GATT DB Handles structure */
const cy_stc_ble_customs_t *attrInfo;
} cy_stc_ble_customs_config_t;
/** Service Configuration structure (client) */
typedef struct
{
/** Structure with Discovered Attributes Information */
const cy_stc_ble_customc_t *attrInfo;
/** The number supported Custom Services as client */
uint8_t serviceCount;
/** The Discovery Service index */
uint8_t serviceDiscIdx;
} cy_stc_ble_customc_config_t;
/** \} */
/*******************************************************************************
* Function Prototypes
*******************************************************************************/
cy_en_ble_api_result_t Cy_BLE_CUSTOMS_Init(const cy_stc_ble_customs_config_t *config);
cy_en_ble_api_result_t Cy_BLE_CUSTOMC_Init(const cy_stc_ble_customc_config_t *config);
/*******************************************************************************
* External Data references
*******************************************************************************/
extern const cy_stc_ble_customs_config_t *cy_ble_customsConfigPtr;
extern const cy_stc_ble_customc_config_t *cy_ble_customcConfigPtr;
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* CY_IP_MXBLESS */
#endif /* CY_BLE_CUSTOM_H */
/* [] END OF FILE */