Skip to content

File syn_ble_gatt.h

FileList > ble > syn_ble_gatt.h

Go to the source code of this file

Zero-Heap Generic Attribute Profile (GATT) Server Engine.

  • #include "../common/syn_defs.h"
  • #include "syn_ble_att.h"
  • #include "syn_ble_l2cap.h"
  • #include <stdbool.h>
  • #include <stddef.h>
  • #include <stdint.h>

Classes

Type Name
struct SYN_BLE_GATT_Attr
struct SYN_BLE_GATT_s

Public Types

Type Name
typedef SYN_Status(* SYN_BLE_GATT_ReadCb
typedef SYN_Status(* SYN_BLE_GATT_WriteCb

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.

Macros

Type Name
define SYN_BLE_MAX_ATTRIBUTES 32U
define SYN_BLE_PROP_INDICATE 0x20U
define SYN_BLE_PROP_NOTIFY 0x10U
define SYN_BLE_PROP_READ 0x02U
define SYN_BLE_PROP_WRITE 0x08U
define SYN_BLE_PROP_WRITE_CMD 0x04U
define SYN_BLE_UUID_CCCD 0x2902U
define SYN_BLE_UUID_CHARACTERISTIC 0x2803U
define SYN_BLE_UUID_PRIMARY_SERVICE 0x2800U
define SYN_BLE_UUID_SECONDARY_SERVICE 0x2801U

Public Types Documentation

typedef SYN_BLE_GATT_ReadCb

typedef SYN_Status(* SYN_BLE_GATT_ReadCb) (SYN_BLE_GATT *gatt, uint16_t conn_handle, uint16_t attr_handle, uint8_t *val, uint16_t *val_len, void *user_data);

Attribute Read Callback


typedef SYN_BLE_GATT_WriteCb

typedef SYN_Status(* SYN_BLE_GATT_WriteCb) (SYN_BLE_GATT *gatt, uint16_t conn_handle, uint16_t attr_handle, const uint8_t *val, uint16_t val_len, void *user_data);

Attribute Write Callback


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.


Macro Definition Documentation

define SYN_BLE_MAX_ATTRIBUTES

#define SYN_BLE_MAX_ATTRIBUTES `32U`

Maximum GATT attribute table capacity


define SYN_BLE_PROP_INDICATE

#define SYN_BLE_PROP_INDICATE `0x20U`

Indicate Property


define SYN_BLE_PROP_NOTIFY

#define SYN_BLE_PROP_NOTIFY `0x10U`

Notify Property


define SYN_BLE_PROP_READ

#define SYN_BLE_PROP_READ `0x02U`

Read Property


define SYN_BLE_PROP_WRITE

#define SYN_BLE_PROP_WRITE `0x08U`

Write Request Property


define SYN_BLE_PROP_WRITE_CMD

#define SYN_BLE_PROP_WRITE_CMD `0x04U`

Write Command (Without Response) Property


define SYN_BLE_UUID_CCCD

#define SYN_BLE_UUID_CCCD `0x2902U`

Client Characteristic Configuration Descriptor UUID


define SYN_BLE_UUID_CHARACTERISTIC

#define SYN_BLE_UUID_CHARACTERISTIC `0x2803U`

Characteristic Declaration UUID


define SYN_BLE_UUID_PRIMARY_SERVICE

#define SYN_BLE_UUID_PRIMARY_SERVICE `0x2800U`

Primary Service Declaration UUID


define SYN_BLE_UUID_SECONDARY_SERVICE

#define SYN_BLE_UUID_SECONDARY_SERVICE `0x2801U`

Secondary Service Declaration UUID



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