Ignore notification with empty message.
This commit is contained in:
parent
1b71a10beb
commit
3934e9bef2
|
@ -158,8 +158,11 @@ void AlertNotificationClient::OnNotification(ble_gap_event *event) {
|
|||
const auto maxMessageSize{NotificationManager::MaximumMessageSize()};
|
||||
const auto maxBufferSize{maxMessageSize + headerSize};
|
||||
|
||||
const auto dbgPacketLen = OS_MBUF_PKTLEN(event->notify_rx.om);
|
||||
size_t bufferSize = std::min(dbgPacketLen + stringTerminatorSize, maxBufferSize);
|
||||
// Ignore notifications with empty message
|
||||
const auto packetLen = OS_MBUF_PKTLEN(event->notify_rx.om);
|
||||
if(packetLen <= headerSize) return;
|
||||
|
||||
size_t bufferSize = std::min(packetLen + stringTerminatorSize, maxBufferSize);
|
||||
auto messageSize = std::min(maxMessageSize, (bufferSize - headerSize));
|
||||
|
||||
NotificationManager::Notification notif;
|
||||
|
|
|
@ -66,8 +66,11 @@ int AlertNotificationService::OnAlert(uint16_t conn_handle, uint16_t attr_handle
|
|||
const auto maxMessageSize {NotificationManager::MaximumMessageSize()};
|
||||
const auto maxBufferSize{maxMessageSize + headerSize};
|
||||
|
||||
const auto dbgPacketLen = OS_MBUF_PKTLEN(ctxt->om);
|
||||
size_t bufferSize = std::min(dbgPacketLen + stringTerminatorSize, maxBufferSize);
|
||||
// Ignore notifications with empty message
|
||||
const auto packetLen = OS_MBUF_PKTLEN(ctxt->om);
|
||||
if(packetLen <= headerSize) return 0;
|
||||
|
||||
size_t bufferSize = std::min(packetLen + stringTerminatorSize, maxBufferSize);
|
||||
auto messageSize = std::min(maxMessageSize, (bufferSize-headerSize));
|
||||
Categories category;
|
||||
|
||||
|
|
Loading…
Reference in a new issue