ATT Server API

#include "src/ble/att_server.h"

att_server_init

void att_server_init(uint8_t const * db, att_read_callback_t read_callback, att_write_callback_t write_callback);

ATT Server

@TLV: 'BTC' x /

/*

setup ATT server

Parameters

Source


att_server_eatt_init

uint8_t att_server_eatt_init(uint8_t num_eatt_bearers, uint8_t * storage_buffer, uint16_t storage_size);

Enable support for Enhanced ATT bearer

Note: Requires ENABLE_GATT_OVER_EATT

Parameters

Returns

Source


att_server_register_packet_handler

void att_server_register_packet_handler(btstack_packet_handler_t handler);

Enable support for Enhanced ATT bearer

Note: Requires ENABLE_GATT_OVER_EATT

register packet handler for ATT server events: - ATT_EVENT_CAN_SEND_NOW - ATT_EVENT_HANDLE_VALUE_INDICATION_COMPLETE - ATT_EVENT_MTU_EXCHANGE_COMPLETE

Parameters

Source


att_server_register_service_handler

void att_server_register_service_handler(att_service_handler_t * handler);

register read/write callbacks for specific handle range

Parameters

Source


att_server_register_can_send_now_callback

uint8_t att_server_register_can_send_now_callback(btstack_context_callback_registration_t * callback_registration, hci_con_handle_t con_handle);

Request callback when sending is possible

Note: callback might happend during call to this function

Note: pending callback is discarded if the connection disconnects

Parameters

Returns

Source


att_server_get_mtu

uint16_t att_server_get_mtu(hci_con_handle_t con_handle);

Return ATT MTU

Parameters

Returns

Source


att_server_request_to_send_notification

uint8_t att_server_request_to_send_notification(btstack_context_callback_registration_t * callback_registration, hci_con_handle_t con_handle);

Request callback when sending notifcation is possible

Note: callback might happend during call to this function

Note: pending callback will be discarded on HCI disconnect

Parameters

Returns

Source


att_server_request_to_send_indication

uint8_t att_server_request_to_send_indication(btstack_context_callback_registration_t * callback_registration, hci_con_handle_t con_handle);

Request callback when sending indication is possible

Note: callback might happend during call to this function

Note: pending callback will be discarded on HCI disconnect

Parameters

Returns

Source


att_server_notify

uint8_t att_server_notify(hci_con_handle_t con_handle, uint16_t attribute_handle, const uint8_t *value, uint16_t value_len);

notify client about attribute value change

Parameters

Returns

Source


att_server_multiple_notify

uint8_t att_server_multiple_notify(hci_con_handle_t con_handle, uint8_t num_attributes,
const uint16_t * attribute_handles, const uint8_t ** values_data, const uint16_t * values_len);

notify client about multiple attribute value changes

Parameters

Returns

Source


att_server_indicate

uint8_t att_server_indicate(hci_con_handle_t con_handle, uint16_t attribute_handle, const uint8_t *value, uint16_t value_len);

indicate value change to client. client is supposed to reply with an indication_response

Parameters

Returns

Source


#ifdef ENABLE_ATT_DELAYED_RESPONSE

att_server_response_ready

uint8_t att_server_response_ready(hci_con_handle_t con_handle);

response ready - called after returning ATT_READ__RESPONSE_PENDING in an att_read_callback or ATT_ERROR_WRITE_REQUEST_PENDING IN att_write_callback before to trigger callback again and complete the transaction

@nore: The ATT Server will retry handling the current ATT request

Parameters

Returns

Source


#endif

att_server_deinit

void att_server_deinit(void);

De-Init ATT Server

Source


// the following functions will be removed soon

att_server_can_send_packet_now

int  att_server_can_send_packet_now(hci_con_handle_t con_handle);

tests if a notification or indication can be send right now

Parameters

Returns

Source


att_server_request_can_send_now_event

void att_server_request_can_send_now_event(hci_con_handle_t con_handle);

Request emission of ATT_EVENT_CAN_SEND_NOW as soon as possible

Note: ATT_EVENT_CAN_SEND_NOW might be emitted during call to this function so packet handler should be ready to handle it

Parameters

Source


// end of deprecated functions