9#include "rwip_config.h"
14 const gatt_srv_cb_t *p_cb,
17 return gatt_user_srv_register(pref_mtu, prio_level, p_cb, p_user_lid);
21 const uint8_t *p_uuid, uint8_t nb_att,
22 const uint8_t *p_att_mask,
23 const gatt_att_desc_t *p_atts,
24 uint8_t nb_att_rsvd, uint16_t *p_start_hdl)
26 return gatt_db_svc_add(user_lid, info, p_uuid, nb_att, p_att_mask, p_atts,
27 nb_att_rsvd, p_start_hdl);
31 uint16_t uuid16, uint8_t nb_att,
32 const uint8_t *p_att_mask,
33 const gatt_att16_desc_t *p_atts,
34 uint8_t nb_att_rsvd, uint16_t *p_start_hdl)
36 return gatt_db_svc16_add(user_lid, info, uuid16, nb_att, p_att_mask, p_atts,
37 nb_att_rsvd, p_start_hdl);
42 return gatt_db_svc_remove(user_lid, start_hdl);
46 uint16_t dummy, uint16_t hdl, uint16_t length,
47 const uint8_t *p_value)
53 if (co_buf_alloc(&p_data, GATT_BUFFER_HEADER_LEN, length,
54 GATT_BUFFER_TAIL_LEN) != CO_BUF_ERR_NO_ERROR) {
55 status = ATT_ERR_INSUFF_RESOURCE;
58 co_buf_copy_data_from_mem(p_data, p_value, length);
61 status = gatt_srv_event_send(conidx, user_lid, dummy, GATT_NOTIFY, hdl,
64 co_buf_release(p_data);
70 uint16_t dummy, uint16_t hdl, uint16_t length,
71 const uint8_t *p_value)
77 if (co_buf_alloc(&p_data, GATT_BUFFER_HEADER_LEN, length,
78 GATT_BUFFER_TAIL_LEN) != CO_BUF_ERR_NO_ERROR) {
79 status = ATT_ERR_INSUFF_RESOURCE;
82 co_buf_copy_data_from_mem(p_data, p_value, length);
85 status = gatt_srv_event_send(conidx, user_lid, dummy, GATT_INDICATE,
88 co_buf_release(p_data);
94 uint16_t token, uint16_t status,
95 uint16_t att_length, uint16_t length,
96 const uint8_t *p_value)
99 co_buf_t *p_data = NULL;
101 if (status == GAP_ERR_NO_ERROR) {
103 if (co_buf_alloc(&p_data, GATT_BUFFER_HEADER_LEN, length,
104 GATT_BUFFER_TAIL_LEN) != CO_BUF_ERR_NO_ERROR) {
105 status = ATT_ERR_INSUFF_RESOURCE;
108 co_buf_copy_data_from_mem(p_data, p_value, length);
113 state = gatt_srv_att_read_get_cfm(conidx, user_lid, token, status,
117 if (p_data != NULL) {
118 co_buf_release(p_data);
124 uint16_t token, uint16_t status)
126 return gatt_srv_att_val_set_cfm(conidx, user_lid, token, status);
uint16_t xc_ble_gatt_service_remove(uint8_t user_lid, uint16_t start_hdl)
Command used to remove a service from local attribute database.
uint16_t xc_ble_gatt_user_srv_register(uint16_t pref_mtu, uint8_t prio_level, const gatt_srv_cb_t *p_cb, uint8_t *p_user_lid)
Command used to register a GATT user. This must be done prior to any GATT procedure execution.
uint16_t xc_ble_gatt_srv_read_cfm(uint8_t conidx, uint8_t user_lid, uint16_t token, uint16_t status, uint16_t att_length, uint16_t length, const uint8_t *p_value)
Upper layer provide attribute value requested by GATT Layer for a read procedure If rejected,...
uint16_t xc_ble_gatt_srv_write_cfm(uint8_t conidx, uint8_t user_lid, uint16_t token, uint16_t status)
Upper layer provide status of attribute value modification by GATT server user. Confirmation server u...
uint16_t xc_ble_gatt_service16_add(uint8_t user_lid, uint8_t info, uint16_t uuid16, uint8_t nb_att, const uint8_t *p_att_mask, const gatt_att16_desc_t *p_atts, uint8_t nb_att_rsvd, uint16_t *p_start_hdl)
Command used to add a service into local attribute database.
uint16_t xc_ble_gatt_srv_indicate(uint8_t conidx, uint8_t user_lid, uint16_t dummy, uint16_t hdl, uint16_t length, const uint8_t *p_value)
Command used by a GATT server user to send indication
uint16_t xc_ble_gatt_srv_notify(uint8_t conidx, uint8_t user_lid, uint16_t dummy, uint16_t hdl, uint16_t length, const uint8_t *p_value)
Command used by a GATT server user to send notifications
uint16_t xc_ble_gatt_service_add(uint8_t user_lid, uint8_t info, const uint8_t *p_uuid, uint8_t nb_att, const uint8_t *p_att_mask, const gatt_att_desc_t *p_atts, uint8_t nb_att_rsvd, uint16_t *p_start_hdl)
Command used to add a service into local attribute database.
GATT server API. Copyright (c) 2022 - 2025, XinChip All rights reserved.