summaryrefslogtreecommitdiff
path: root/bsp/Infineon/psoc6-evaluationkit-062S2/libs/TARGET_RTT-062S2/bluetooth/cycfg_gatt_db.c
blob: a3810b9a84e1c7d4de633b26bceafd22cf11ea09 (plain)
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
172
173
174
175
176
/******************************************************************************
* File Name: cycfg_gatt_db.c
*
* Description:
* BLE device's GATT database and device configuration.
* This file should not be modified. It was automatically generated by
* Bluetooth Configurator 2.60.0.1460
*
*******************************************************************************
* Copyright 2023 Cypress Semiconductor Corporation (an Infineon company) or
* an affiliate of Cypress Semiconductor Corporation.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/

#include "cycfg_gatt_db.h"
#include "wiced_bt_uuid.h"
#include "wiced_bt_gatt.h"

/******************************************************************************
* GATT server definitions
******************************************************************************/

const uint8_t gatt_database[] = 
{
    /* Primary Service: Generic Access */
    PRIMARY_SERVICE_UUID16 (
            HDLS_GAP,
            __UUID_SERVICE_GENERIC_ACCESS),
        /* Characteristic: Device Name */
        CHARACTERISTIC_UUID16 (
                HDLC_GAP_DEVICE_NAME,
                HDLC_GAP_DEVICE_NAME_VALUE,
                __UUID_CHARACTERISTIC_DEVICE_NAME,
                GATTDB_CHAR_PROP_READ,
                GATTDB_PERM_READABLE),
        /* Characteristic: Appearance */
        CHARACTERISTIC_UUID16 (
                HDLC_GAP_APPEARANCE,
                HDLC_GAP_APPEARANCE_VALUE,
                __UUID_CHARACTERISTIC_APPEARANCE,
                GATTDB_CHAR_PROP_READ,
                GATTDB_PERM_READABLE),

    /* Primary Service: Generic Attribute */
    PRIMARY_SERVICE_UUID16 (
            HDLS_GATT,
            __UUID_SERVICE_GENERIC_ATTRIBUTE),
        /* Characteristic: Service Changed */
        CHARACTERISTIC_UUID16 (
                HDLC_GATT_SERVICE_CHANGED,
                HDLC_GATT_SERVICE_CHANGED_VALUE,
                __UUID_CHARACTERISTIC_SERVICE_CHANGED,
                GATTDB_CHAR_PROP_INDICATE,
                GATTDB_PERM_NONE),
            /* Descriptor: Client Characteristic Configuration */
            CHAR_DESCRIPTOR_UUID16_WRITABLE (
                    HDLD_GATT_SERVICE_CHANGED_CLIENT_CHAR_CONFIG,
                    __UUID_DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION,
                    GATTDB_PERM_READABLE | GATTDB_PERM_WRITE_REQ),

    /* Primary Service: Hello Sensor */
    PRIMARY_SERVICE_UUID128 (
            HDLS_HELLO_SENSOR,
            __UUID_SERVICE_HELLO_SENSOR),
        /* Characteristic: Notify */
        CHARACTERISTIC_UUID128 (
                HDLC_HELLO_SENSOR_NOTIFY,
                HDLC_HELLO_SENSOR_NOTIFY_VALUE,
                __UUID_CHARACTERISTIC_HELLO_SENSOR_NOTIFY,
                GATTDB_CHAR_PROP_READ | GATTDB_CHAR_PROP_NOTIFY | GATTDB_CHAR_PROP_INDICATE,
                GATTDB_PERM_READABLE | GATTDB_PERM_AUTH_READABLE),
            /* Descriptor: Client Characteristic Configuration */
            CHAR_DESCRIPTOR_UUID16_WRITABLE (
                    HDLD_HELLO_SENSOR_NOTIFY_CLIENT_CHAR_CONFIG,
                    __UUID_DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION,
                    GATTDB_PERM_READABLE | GATTDB_PERM_WRITE_REQ | GATTDB_PERM_AUTH_WRITABLE),
        /* Characteristic: Blink */
        CHARACTERISTIC_UUID128_WRITABLE (
                HDLC_HELLO_SENSOR_BLINK,
                HDLC_HELLO_SENSOR_BLINK_VALUE,
                __UUID_CHARACTERISTIC_HELLO_SENSOR_BLINK,
                GATTDB_CHAR_PROP_READ | GATTDB_CHAR_PROP_WRITE | GATTDB_CHAR_PROP_WRITE_NO_RESPONSE,
                GATTDB_PERM_READABLE | GATTDB_PERM_WRITE_REQ | GATTDB_PERM_WRITE_CMD),
};

/* Length of the GATT database */
const uint16_t gatt_database_len = sizeof(gatt_database);

/******************************************************************************
* GATT Initial Value Arrays
******************************************************************************/
 
uint8_t app_gap_device_name[] = {'H', 'e', 'l', 'l', 'o', '\0',};
uint8_t app_gap_appearance[] = {0x00, 0x00,};
uint8_t app_gatt_service_changed[] = {0x00, 0x00, 0x00, 0x00,};
uint8_t app_gatt_service_changed_client_char_config[] = {0x00, 0x00,};
uint8_t app_hello_sensor_notify[] = {'H', 'e', 'l', 'l', 'o', ' ', '0',};
uint8_t app_hello_sensor_notify_client_char_config[] = {0x00, 0x00,};
uint8_t app_hello_sensor_blink[] = {0x00,};
 
/******************************************************************************
* GATT Lookup Table
******************************************************************************/
 
gatt_db_lookup_table_t app_gatt_db_ext_attr_tbl[] =
{
    {
        HDLC_GAP_DEVICE_NAME_VALUE,                   /* attribute handle */
        5,                                            /* maxlen */
        5,                                            /* curlen */
        app_gap_device_name,                          /* attribute data */
    },
    {
        HDLC_GAP_APPEARANCE_VALUE,                    /* attribute handle */
        2,                                            /* maxlen */
        2,                                            /* curlen */
        app_gap_appearance,                           /* attribute data */
    },
    {
        HDLC_GATT_SERVICE_CHANGED_VALUE,              /* attribute handle */
        4,                                            /* maxlen */
        4,                                            /* curlen */
        app_gatt_service_changed,                     /* attribute data */
    },
    {
        HDLD_GATT_SERVICE_CHANGED_CLIENT_CHAR_CONFIG, /* attribute handle */
        2,                                            /* maxlen */
        2,                                            /* curlen */
        app_gatt_service_changed_client_char_config,  /* attribute data */
    },
    {
        HDLC_HELLO_SENSOR_NOTIFY_VALUE,               /* attribute handle */
        7,                                            /* maxlen */
        7,                                            /* curlen */
        app_hello_sensor_notify,                      /* attribute data */
    },
    {
        HDLD_HELLO_SENSOR_NOTIFY_CLIENT_CHAR_CONFIG,  /* attribute handle */
        2,                                            /* maxlen */
        2,                                            /* curlen */
        app_hello_sensor_notify_client_char_config,   /* attribute data */
    },
    {
        HDLC_HELLO_SENSOR_BLINK_VALUE,                /* attribute handle */
        1,                                            /* maxlen */
        1,                                            /* curlen */
        app_hello_sensor_blink,                       /* attribute data */
    },
};

/* Number of Lookup Table entries */
const uint16_t app_gatt_db_ext_attr_tbl_size = 
    (sizeof(app_gatt_db_ext_attr_tbl) / sizeof(gatt_db_lookup_table_t));

/* Number of GATT initial value arrays entries */
const uint16_t app_gap_device_name_len = 5;
const uint16_t app_gap_appearance_len = (sizeof(app_gap_appearance));
const uint16_t app_gatt_service_changed_len = (sizeof(app_gatt_service_changed));
const uint16_t app_gatt_service_changed_client_char_config_len =
    (sizeof(app_gatt_service_changed_client_char_config));
const uint16_t app_hello_sensor_notify_len = (sizeof(app_hello_sensor_notify));
const uint16_t app_hello_sensor_notify_client_char_config_len =
    (sizeof(app_hello_sensor_notify_client_char_config));
const uint16_t app_hello_sensor_blink_len = (sizeof(app_hello_sensor_blink));