Skip to content

File syn_ble_att.h

FileList > ble > syn_ble_att.h

Go to the source code of this file

Zero-Heap Attribute Protocol (ATT) Encoding and Decoding.

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

Public Functions

Type Name
SYN_Status syn_ble_att_encode_error_rsp (uint8_t req_opcode, uint16_t handle, uint8_t err_code, uint8_t * buf, uint16_t * len)
Encode ATT Error Response.
SYN_Status syn_ble_att_encode_mtu_rsp (uint16_t server_mtu, uint8_t * buf, uint16_t * len)
Encode ATT Exchange MTU Response.
SYN_Status syn_ble_att_encode_notification (uint16_t handle, const uint8_t * val, uint16_t val_len, uint8_t * buf, uint16_t * len)
Encode ATT Handle Value Notification.
SYN_Status syn_ble_att_encode_read_rsp (const uint8_t * val, uint16_t val_len, uint8_t * buf, uint16_t * len)
Encode ATT Read Response.
SYN_Status syn_ble_att_encode_write_rsp (uint8_t * buf, uint16_t * len)
Encode ATT Write Response.

Macros

Type Name
define SYN_BLE_ATT_ERR_ATTR_NOT_FOUND 0x0AU
define SYN_BLE_ATT_ERR_ATTR_NOT_LONG 0x0BU
define SYN_BLE_ATT_ERR_INSUFFICIENT_AUTH 0x05U
define SYN_BLE_ATT_ERR_INSUFFICIENT_AUTHOR 0x08U
define SYN_BLE_ATT_ERR_INSUFFICIENT_ENCRYPT 0x0FU
define SYN_BLE_ATT_ERR_INSUFFICIENT_KEY_SIZE 0x0CU
define SYN_BLE_ATT_ERR_INSUFFICIENT_RESOURCES 0x11U
define SYN_BLE_ATT_ERR_INVALID_ATTR_LEN 0x0DU
define SYN_BLE_ATT_ERR_INVALID_HANDLE 0x01U
define SYN_BLE_ATT_ERR_INVALID_OFFSET 0x07U
define SYN_BLE_ATT_ERR_INVALID_PDU 0x04U
define SYN_BLE_ATT_ERR_PREPARE_QUEUE_FULL 0x09U
define SYN_BLE_ATT_ERR_READ_NOT_PERMITTED 0x02U
define SYN_BLE_ATT_ERR_REQ_NOT_SUPPORTED 0x06U
define SYN_BLE_ATT_ERR_UNLIKELY_ERROR 0x0EU
define SYN_BLE_ATT_ERR_UNSUPPORTED_GROUP_TYPE 0x10U
define SYN_BLE_ATT_ERR_WRITE_NOT_PERMITTED 0x03U
define SYN_BLE_ATT_MTU_DEFAULT 23U
define SYN_BLE_ATT_OP_ERROR_RSP 0x01U
define SYN_BLE_ATT_OP_EXCHANGE_MTU_REQ 0x02U
define SYN_BLE_ATT_OP_EXCHANGE_MTU_RSP 0x03U
define SYN_BLE_ATT_OP_FIND_BY_TYPE_VALUE_REQ 0x06U
define SYN_BLE_ATT_OP_FIND_BY_TYPE_VALUE_RSP 0x07U
define SYN_BLE_ATT_OP_FIND_INFO_REQ 0x04U
define SYN_BLE_ATT_OP_FIND_INFO_RSP 0x05U
define SYN_BLE_ATT_OP_HANDLE_VAL_CONF 0x1EU
define SYN_BLE_ATT_OP_HANDLE_VAL_IND 0x1DU
define SYN_BLE_ATT_OP_HANDLE_VAL_NOTIF 0x1BU
define SYN_BLE_ATT_OP_READ_BLOB_REQ 0x0CU
define SYN_BLE_ATT_OP_READ_BLOB_RSP 0x0DU
define SYN_BLE_ATT_OP_READ_BY_GROUP_TYPE_REQ 0x10U
define SYN_BLE_ATT_OP_READ_BY_GROUP_TYPE_RSP 0x11U
define SYN_BLE_ATT_OP_READ_BY_TYPE_REQ 0x08U
define SYN_BLE_ATT_OP_READ_BY_TYPE_RSP 0x09U
define SYN_BLE_ATT_OP_READ_REQ 0x0AU
define SYN_BLE_ATT_OP_READ_RSP 0x0BU
define SYN_BLE_ATT_OP_WRITE_CMD 0x52U
define SYN_BLE_ATT_OP_WRITE_REQ 0x12U
define SYN_BLE_ATT_OP_WRITE_RSP 0x13U

Public Functions Documentation

function syn_ble_att_encode_error_rsp

Encode ATT Error Response.

SYN_Status syn_ble_att_encode_error_rsp (
    uint8_t req_opcode,
    uint16_t handle,
    uint8_t err_code,
    uint8_t * buf,
    uint16_t * len
) 

Parameters:

  • req_opcode Request Opcode.
  • handle Attribute Handle.
  • err_code Error Code.
  • buf Output Buffer.
  • len Output Length Pointer.

Returns:

SYN_OK on success.


function syn_ble_att_encode_mtu_rsp

Encode ATT Exchange MTU Response.

SYN_Status syn_ble_att_encode_mtu_rsp (
    uint16_t server_mtu,
    uint8_t * buf,
    uint16_t * len
) 

Parameters:

  • server_mtu Server MTU.
  • buf Output Buffer.
  • len Output Length Pointer.

Returns:

SYN_OK on success.


function syn_ble_att_encode_notification

Encode ATT Handle Value Notification.

SYN_Status syn_ble_att_encode_notification (
    uint16_t handle,
    const uint8_t * val,
    uint16_t val_len,
    uint8_t * buf,
    uint16_t * len
) 

Parameters:

  • handle Attribute Handle.
  • val Value bytes.
  • val_len Value length.
  • buf Output Buffer.
  • len Output Length Pointer.

Returns:

SYN_OK on success.


function syn_ble_att_encode_read_rsp

Encode ATT Read Response.

SYN_Status syn_ble_att_encode_read_rsp (
    const uint8_t * val,
    uint16_t val_len,
    uint8_t * buf,
    uint16_t * len
) 

Parameters:

  • val Value bytes.
  • val_len Value length.
  • buf Output Buffer.
  • len Output Length Pointer.

Returns:

SYN_OK on success.


function syn_ble_att_encode_write_rsp

Encode ATT Write Response.

SYN_Status syn_ble_att_encode_write_rsp (
    uint8_t * buf,
    uint16_t * len
) 

Parameters:

  • buf Output Buffer.
  • len Output Length Pointer.

Returns:

SYN_OK on success.


Macro Definition Documentation

define SYN_BLE_ATT_ERR_ATTR_NOT_FOUND

#define SYN_BLE_ATT_ERR_ATTR_NOT_FOUND `0x0AU`

Attribute Not Found


define SYN_BLE_ATT_ERR_ATTR_NOT_LONG

#define SYN_BLE_ATT_ERR_ATTR_NOT_LONG `0x0BU`

Attribute Not Long


define SYN_BLE_ATT_ERR_INSUFFICIENT_AUTH

#define SYN_BLE_ATT_ERR_INSUFFICIENT_AUTH `0x05U`

Insufficient Authentication


define SYN_BLE_ATT_ERR_INSUFFICIENT_AUTHOR

#define SYN_BLE_ATT_ERR_INSUFFICIENT_AUTHOR `0x08U`

Insufficient Authorization


define SYN_BLE_ATT_ERR_INSUFFICIENT_ENCRYPT

#define SYN_BLE_ATT_ERR_INSUFFICIENT_ENCRYPT `0x0FU`

Insufficient Encryption


define SYN_BLE_ATT_ERR_INSUFFICIENT_KEY_SIZE

#define SYN_BLE_ATT_ERR_INSUFFICIENT_KEY_SIZE `0x0CU`

Insufficient Key Size


define SYN_BLE_ATT_ERR_INSUFFICIENT_RESOURCES

#define SYN_BLE_ATT_ERR_INSUFFICIENT_RESOURCES `0x11U`

Insufficient Resources


define SYN_BLE_ATT_ERR_INVALID_ATTR_LEN

#define SYN_BLE_ATT_ERR_INVALID_ATTR_LEN `0x0DU`

Invalid Attribute Value Length


define SYN_BLE_ATT_ERR_INVALID_HANDLE

#define SYN_BLE_ATT_ERR_INVALID_HANDLE `0x01U`

Invalid Handle


define SYN_BLE_ATT_ERR_INVALID_OFFSET

#define SYN_BLE_ATT_ERR_INVALID_OFFSET `0x07U`

Invalid Offset


define SYN_BLE_ATT_ERR_INVALID_PDU

#define SYN_BLE_ATT_ERR_INVALID_PDU `0x04U`

Invalid PDU


define SYN_BLE_ATT_ERR_PREPARE_QUEUE_FULL

#define SYN_BLE_ATT_ERR_PREPARE_QUEUE_FULL `0x09U`

Prepare Queue Full


define SYN_BLE_ATT_ERR_READ_NOT_PERMITTED

#define SYN_BLE_ATT_ERR_READ_NOT_PERMITTED `0x02U`

Read Not Permitted


define SYN_BLE_ATT_ERR_REQ_NOT_SUPPORTED

#define SYN_BLE_ATT_ERR_REQ_NOT_SUPPORTED `0x06U`

Request Not Supported


define SYN_BLE_ATT_ERR_UNLIKELY_ERROR

#define SYN_BLE_ATT_ERR_UNLIKELY_ERROR `0x0EU`

Unlikely Error


define SYN_BLE_ATT_ERR_UNSUPPORTED_GROUP_TYPE

#define SYN_BLE_ATT_ERR_UNSUPPORTED_GROUP_TYPE `0x10U`

Unsupported Group Type


define SYN_BLE_ATT_ERR_WRITE_NOT_PERMITTED

#define SYN_BLE_ATT_ERR_WRITE_NOT_PERMITTED `0x03U`

Write Not Permitted


define SYN_BLE_ATT_MTU_DEFAULT

#define SYN_BLE_ATT_MTU_DEFAULT `23U`

Default minimum ATT MTU size


define SYN_BLE_ATT_OP_ERROR_RSP

#define SYN_BLE_ATT_OP_ERROR_RSP `0x01U`

Error Response


define SYN_BLE_ATT_OP_EXCHANGE_MTU_REQ

#define SYN_BLE_ATT_OP_EXCHANGE_MTU_REQ `0x02U`

Exchange MTU Request


define SYN_BLE_ATT_OP_EXCHANGE_MTU_RSP

#define SYN_BLE_ATT_OP_EXCHANGE_MTU_RSP `0x03U`

Exchange MTU Response


define SYN_BLE_ATT_OP_FIND_BY_TYPE_VALUE_REQ

#define SYN_BLE_ATT_OP_FIND_BY_TYPE_VALUE_REQ `0x06U`

Find By Type Value Request


define SYN_BLE_ATT_OP_FIND_BY_TYPE_VALUE_RSP

#define SYN_BLE_ATT_OP_FIND_BY_TYPE_VALUE_RSP `0x07U`

Find By Type Value Response


define SYN_BLE_ATT_OP_FIND_INFO_REQ

#define SYN_BLE_ATT_OP_FIND_INFO_REQ `0x04U`

Find Information Request


define SYN_BLE_ATT_OP_FIND_INFO_RSP

#define SYN_BLE_ATT_OP_FIND_INFO_RSP `0x05U`

Find Information Response


define SYN_BLE_ATT_OP_HANDLE_VAL_CONF

#define SYN_BLE_ATT_OP_HANDLE_VAL_CONF `0x1EU`

Handle Value Confirmation


define SYN_BLE_ATT_OP_HANDLE_VAL_IND

#define SYN_BLE_ATT_OP_HANDLE_VAL_IND `0x1DU`

Handle Value Indication


define SYN_BLE_ATT_OP_HANDLE_VAL_NOTIF

#define SYN_BLE_ATT_OP_HANDLE_VAL_NOTIF `0x1BU`

Handle Value Notification


define SYN_BLE_ATT_OP_READ_BLOB_REQ

#define SYN_BLE_ATT_OP_READ_BLOB_REQ `0x0CU`

Read Blob Request


define SYN_BLE_ATT_OP_READ_BLOB_RSP

#define SYN_BLE_ATT_OP_READ_BLOB_RSP `0x0DU`

Read Blob Response


define SYN_BLE_ATT_OP_READ_BY_GROUP_TYPE_REQ

#define SYN_BLE_ATT_OP_READ_BY_GROUP_TYPE_REQ `0x10U`

Read By Group Type Request


define SYN_BLE_ATT_OP_READ_BY_GROUP_TYPE_RSP

#define SYN_BLE_ATT_OP_READ_BY_GROUP_TYPE_RSP `0x11U`

Read By Group Type Response


define SYN_BLE_ATT_OP_READ_BY_TYPE_REQ

#define SYN_BLE_ATT_OP_READ_BY_TYPE_REQ `0x08U`

Read By Type Request


define SYN_BLE_ATT_OP_READ_BY_TYPE_RSP

#define SYN_BLE_ATT_OP_READ_BY_TYPE_RSP `0x09U`

Read By Type Response


define SYN_BLE_ATT_OP_READ_REQ

#define SYN_BLE_ATT_OP_READ_REQ `0x0AU`

Read Request


define SYN_BLE_ATT_OP_READ_RSP

#define SYN_BLE_ATT_OP_READ_RSP `0x0BU`

Read Response


define SYN_BLE_ATT_OP_WRITE_CMD

#define SYN_BLE_ATT_OP_WRITE_CMD `0x52U`

Write Command


define SYN_BLE_ATT_OP_WRITE_REQ

#define SYN_BLE_ATT_OP_WRITE_REQ `0x12U`

Write Request


define SYN_BLE_ATT_OP_WRITE_RSP

#define SYN_BLE_ATT_OP_WRITE_RSP `0x13U`

Write Response



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