6#include "dawn/proto/nimble/gatt_runtime.hxx"
15void dawn::nimbleGattChrInit(
struct ble_gatt_chr_def &chr,
void *arg)
19 chr.descriptors =
nullptr;
22 chr.val_handle =
nullptr;
25int dawn::nimbleGattChrUuid128Set(
struct ble_gatt_chr_def &chr,
const uint32_t *uuid)
32 chr.uuid =
new (std::nothrow) ble_uuid_t[16]();
33 if (chr.uuid ==
nullptr)
38 std::memcpy(
const_cast<ble_uuid_t *
>(chr.uuid), uuid,
sizeof(uint8_t) * 16);
42void dawn::nimbleGattChrUuidFree(
struct ble_gatt_chr_def &chr)
44 if (chr.uuid !=
nullptr)
46 delete[]
const_cast<ble_uuid_t *
>(chr.uuid);
51void dawn::nimbleGattChrAccessSet(
struct ble_gatt_chr_def &chr,
CIOCommon &io)
55 chr.flags |= BLE_GATT_CHR_F_READ;
60 chr.flags |= BLE_GATT_CHR_F_WRITE;
64#ifdef CONFIG_DAWN_IO_NOTIFY
65int dawn::nimbleGattChrNotifySet(
struct ble_gatt_chr_def &chr,
78 ret = io.setNotifier(notifier, 0, &ncb);
81 DAWNERR(
"ERROR: set notifier failed for objId = 0x%" PRIx32
"\n", objid);
85 chr.flags |= BLE_GATT_CHR_F_NOTIFY;
86 chr.val_handle = &ncb.
handle;
109 if (ncb->
data ==
nullptr)
125#ifdef CONFIG_DAWN_IO_NOTIFY
126 if (ncb->io !=
nullptr && ncb->io->
isNotify())
128 ncb->io->setNotifier(
nullptr, 0,
nullptr);
132 if (ncb->
data !=
nullptr)
139void dawn::nimbleGattChrNotifierFree(
struct ble_gatt_chr_def &chr)
Base class for all I/O objects.
virtual bool isWrite() const =0
Check if IO supports write operations.
virtual bool isNotify() const =0
Check if IO supports notifications.
io_ddata_t * ddata_alloc(size_t batch, size_t chunk_size=0)
Allocate data buffer for this I/O.
virtual bool isRead() const =0
Check if IO supports read operations.
Out-of-tree user-extension hooks for Dawn.
Context data for characteristic notification callbacks.
io_ddata_t * data
GATT attribute handle for notification.
uint16_t handle
Pointer to I/O object being monitored.
uint32_t ObjectId
ObjectID type - single 32-bit value.
Heap-allocated dynamic I/O data buffer.