mirror of https://github.com/ARMmbed/mbed-os.git
BLE: Create and handle write_command Event.
This event is raised when a write command has been sent to the controller. It can be used to queue a new write command.pull/10581/head
parent
e814a3cfb3
commit
de482e4029
|
@ -147,6 +147,15 @@ public:
|
||||||
uint16_t att_mtu_size
|
uint16_t att_mtu_size
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see pal::GattClient::EventHandler::on_write_command_sent
|
||||||
|
*/
|
||||||
|
void on_write_command_sent_(
|
||||||
|
ble::connection_handle_t connection_handle,
|
||||||
|
ble::attribute_handle_t attribute_handle,
|
||||||
|
uint8_t status
|
||||||
|
);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct ProcedureControlBlock;
|
struct ProcedureControlBlock;
|
||||||
struct DiscoveryControlBlock;
|
struct DiscoveryControlBlock;
|
||||||
|
|
|
@ -52,6 +52,18 @@ struct GattClientEventHandler : StaticInterface<Impl, GattClientEventHandler> {
|
||||||
) {
|
) {
|
||||||
impl()->on_att_mtu_change_(connection_handle, att_mtu_size);
|
impl()->on_att_mtu_change_(connection_handle, att_mtu_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void on_write_command_sent(
|
||||||
|
ble::connection_handle_t connection_handle,
|
||||||
|
ble::attribute_handle_t attribute_handle,
|
||||||
|
uint8_t status
|
||||||
|
) {
|
||||||
|
impl()->on_write_command_sent_(
|
||||||
|
connection_handle,
|
||||||
|
attribute_handle,
|
||||||
|
status
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1339,6 +1339,24 @@ void GenericGattClient<TPalGattClient, SigningMonitorEventHandler>::on_att_mtu_c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<template<class> class TPalGattClient, class SigningMonitorEventHandler>
|
||||||
|
void GenericGattClient<TPalGattClient, SigningMonitorEventHandler>::on_write_command_sent_(
|
||||||
|
ble::connection_handle_t connection_handle,
|
||||||
|
ble::attribute_handle_t attribute_handle,
|
||||||
|
uint8_t status
|
||||||
|
) {
|
||||||
|
GattWriteCallbackParams response = {
|
||||||
|
connection_handle,
|
||||||
|
attribute_handle,
|
||||||
|
GattWriteCallbackParams::OP_WRITE_CMD,
|
||||||
|
BLE_ERROR_NONE,
|
||||||
|
status
|
||||||
|
};
|
||||||
|
|
||||||
|
this->processWriteResponse(&response);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<template<class> class TPalGattClient, class SigningMonitorEventHandler>
|
template<template<class> class TPalGattClient, class SigningMonitorEventHandler>
|
||||||
void GenericGattClient<TPalGattClient, SigningMonitorEventHandler>::on_termination(connection_handle_t connection_handle) {
|
void GenericGattClient<TPalGattClient, SigningMonitorEventHandler>::on_termination(connection_handle_t connection_handle) {
|
||||||
if (_termination_callback) {
|
if (_termination_callback) {
|
||||||
|
|
|
@ -32,6 +32,16 @@ void CordioAttClient::att_client_handler(const attEvt_t* event)
|
||||||
if (handler) {
|
if (handler) {
|
||||||
handler->on_att_mtu_change(event->hdr.param, event->mtu);
|
handler->on_att_mtu_change(event->hdr.param, event->mtu);
|
||||||
}
|
}
|
||||||
|
} else if (event->hdr.event == ATTC_WRITE_CMD_RSP) {
|
||||||
|
ble::vendor::cordio::BLE& ble = ble::vendor::cordio::BLE::deviceInstance();
|
||||||
|
impl::PalGattClientImpl::EventHandler *handler = ble.getPalGattClient().get_event_handler();
|
||||||
|
if (handler) {
|
||||||
|
handler->on_write_command_sent(
|
||||||
|
event->hdr.param,
|
||||||
|
event->handle,
|
||||||
|
event->hdr.status
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// all handlers are stored in a static array
|
// all handlers are stored in a static array
|
||||||
static const event_handler_t handlers[] = {
|
static const event_handler_t handlers[] = {
|
||||||
|
|
Loading…
Reference in New Issue