diff --git a/epicardium/ble/epic_att_api.c b/epicardium/ble/epic_att_api.c index 62f51847a8139dafd3975ec9dd33b1358855ca0b..74faa187d50ec813083fdc84d17ef1ac75f220bf 100644 --- a/epicardium/ble/epic_att_api.c +++ b/epicardium/ble/epic_att_api.c @@ -25,13 +25,16 @@ static int next_handle = ATTS_DYN_START_HANDLE; void ble_epic_att_api_event(attEvt_t *att_event) { - attEvt_t *e = WsfBufAlloc(sizeof(*e)); + if (att_event->handle >= ATTS_DYN_START_HANDLE && + att_event->handle < next_handle) { + attEvt_t *e = WsfBufAlloc(sizeof(*e)); - if (e) { - memcpy(e, att_event, sizeof(*e)); - ble_epic_ble_api_trigger_event(BLE_EVENT_ATT_EVENT, e); - } else { - LOG_WARN("ble", "could not allocate att event"); + if (e) { + memcpy(e, att_event, sizeof(*e)); + ble_epic_ble_api_trigger_event(BLE_EVENT_ATT_EVENT, e); + } else { + LOG_WARN("ble", "could not allocate att event"); + } } }