Skip to content

File syn_ble_gatt.c

FileList > ble > syn_ble_gatt.c

Go to the source code of this file

Zero-Heap Generic Attribute Profile (GATT) Implementation.

  • #include "syn_ble_gatt.h"
  • #include <string.h>

Public Functions

Type Name
SYN_Status syn_ble_gatt_init (SYN_BLE_GATT * gatt, const SYN_BLE_GATT_Attr * table, uint16_t table_len, void * user_data)
Initialize GATT Server context.
SYN_Status syn_ble_gatt_notify (SYN_BLE_GATT * gatt, uint16_t conn_handle, uint16_t attr_handle, const uint8_t * val, uint16_t val_len, uint8_t * tx_buf, uint16_t * tx_len)
Encode Outbound GATT Notification for attribute.
SYN_Status syn_ble_gatt_process_att_pdu (SYN_BLE_GATT * gatt, uint16_t conn_handle, const uint8_t * att_pdu, uint16_t pdu_len, uint8_t * resp_buf, uint16_t * resp_len)
Process incoming ATT PDU received over L2CAP channel 0x0004.

Public Static Functions

Type Name
const SYN_BLE_GATT_Attr * find_attr (const SYN_BLE_GATT * gatt, uint16_t handle)
Internal attribute lookup helper.

Public Functions Documentation

function syn_ble_gatt_init

Initialize GATT Server context.

SYN_Status syn_ble_gatt_init (
    SYN_BLE_GATT * gatt,
    const SYN_BLE_GATT_Attr * table,
    uint16_t table_len,
    void * user_data
) 

Parameters:

  • gatt Context handle pointer.
  • table Attribute table array pointer.
  • table_len Count of attribute entries.
  • user_data User context pointer.

Returns:

SYN_OK on success.


function syn_ble_gatt_notify

Encode Outbound GATT Notification for attribute.

SYN_Status syn_ble_gatt_notify (
    SYN_BLE_GATT * gatt,
    uint16_t conn_handle,
    uint16_t attr_handle,
    const uint8_t * val,
    uint16_t val_len,
    uint8_t * tx_buf,
    uint16_t * tx_len
) 

Parameters:

  • gatt Context handle pointer.
  • conn_handle Target connection handle.
  • attr_handle Target characteristic value attribute handle.
  • val Value buffer pointer.
  • val_len Value byte length.
  • tx_buf Output buffer for HCI ACL payload.
  • tx_len Output size pointer.

Returns:

SYN_OK on success.


function syn_ble_gatt_process_att_pdu

Process incoming ATT PDU received over L2CAP channel 0x0004.

SYN_Status syn_ble_gatt_process_att_pdu (
    SYN_BLE_GATT * gatt,
    uint16_t conn_handle,
    const uint8_t * att_pdu,
    uint16_t pdu_len,
    uint8_t * resp_buf,
    uint16_t * resp_len
) 

Parameters:

  • gatt Context handle pointer.
  • conn_handle Connection handle.
  • att_pdu Received ATT PDU buffer.
  • pdu_len PDU length.
  • resp_buf Buffer to store outbound ATT Response PDU.
  • resp_len Pointer to store response size.

Returns:

SYN_OK on success.


Public Static Functions Documentation

function find_attr

Internal attribute lookup helper.

static const SYN_BLE_GATT_Attr * find_attr (
    const SYN_BLE_GATT * gatt,
    uint16_t handle
) 

Parameters:

  • gatt GATT server handle.
  • handle Attribute handle.

Returns:

Attribute pointer or NULL.



The documentation for this class was generated from the following file src/syntropic/ble/syn_ble_gatt.c