Skip to content

Commit 11171c6

Browse files
committed
Update parameters passed to onDataSent, onUpdatesEnabled/Disabled, and onConfirmationReceived callbacks
1 parent 70ca017 commit 11171c6

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
lines changed

connectivity/FEATURE_BLE/include/ble/gatt/GattCallbackParamTypes.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,29 @@ struct GattHVXCallbackParams {
384384

385385
};
386386

387+
/**
388+
* Gatt Data Sent Attribute related events
389+
*
390+
* Used by `onDataSent`
391+
*/
392+
struct GattDataSentCallbackParams {
393+
394+
/**
395+
* The handle of the connection that triggered the event.
396+
*/
397+
ble::connection_handle_t connHandle;
398+
399+
/**
400+
* Attribute Handle to which the event applies
401+
*/
402+
GattAttribute::Handle_t handle;
403+
404+
};
405+
406+
using GattUpdatesEnabledCallbackParams = GattDataSentCallbackParams;
407+
using GattUpdatesDisabledCallbackParams = GattDataSentCallbackParams;
408+
using GattConfirmationReceivedCallbackParams = GattDataSentCallbackParams;
409+
387410
namespace ble {
388411

389412
/**

connectivity/FEATURE_BLE/source/GattServer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,17 @@ GattServer::GattServerShutdownCallbackChain_t& GattServer::onShutdown()
139139

140140
void GattServer::onUpdatesEnabled(EventCallback_t callback)
141141
{
142-
return impl->onUpdatesEnabled(callback);
142+
impl->onUpdatesEnabled(callback);
143143
}
144144

145145
void GattServer::onUpdatesDisabled(EventCallback_t callback)
146146
{
147-
return impl->onUpdatesDisabled(callback);
147+
impl->onUpdatesDisabled(callback);
148148
}
149149

150150
void GattServer::onConfirmationReceived(EventCallback_t callback)
151151
{
152-
return impl->onConfirmationReceived(callback);
152+
impl->onConfirmationReceived(callback);
153153
}
154154

155-
} // ble
155+
} // ble

connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ void GattServer::cccd_cb(attsCccEvt_t *evt)
950950
GattServerEvents::GATT_EVENT_UPDATES_ENABLED :
951951
GattServerEvents::GATT_EVENT_UPDATES_DISABLED;
952952

953-
getInstance().handleEvent(evt_type, evt->handle);
953+
getInstance().handleEvent(evt_type, evt->hdr.param, evt->handle);
954954
}
955955

956956
void GattServer::att_cb(const attEvt_t *evt)
@@ -961,7 +961,7 @@ void GattServer::att_cb(const attEvt_t *evt)
961961
handler->onAttMtuChange(evt->hdr.param, evt->mtu);
962962
}
963963
} else if (evt->hdr.status == ATT_SUCCESS && evt->hdr.event == ATTS_HANDLE_VALUE_CNF) {
964-
getInstance().handleEvent(GattServerEvents::GATT_EVENT_DATA_SENT, evt->handle);
964+
getInstance().handleEvent(GattServerEvents::GATT_EVENT_DATA_SENT, evt->hdr.param, evt->handle);
965965
}
966966
}
967967

@@ -1516,6 +1516,7 @@ void GattServer::handleDataReadEvent(const GattReadCallbackParams *params)
15161516

15171517
void GattServer::handleEvent(
15181518
GattServerEvents::gattEvent_e type,
1519+
ble::connection_handle_t connHandle,
15191520
GattAttribute::Handle_t attributeHandle
15201521
)
15211522
{

connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ class GattServer : public PalSigningMonitor {
153153

154154
void handleEvent(
155155
GattServerEvents::gattEvent_e type,
156+
ble::connection_handle_t connHandle,
156157
GattAttribute::Handle_t attributeHandle
157158
);
158159

0 commit comments

Comments
 (0)