Commit e181fcad authored by schneider's avatar schneider
Browse files

Merge branch 'schneider/ble-wait-disc-cfg-cmpl' into 'master'

feat(ble): Delay epic con open ind until epicardium is done

See merge request !458
parents 62791cdf 045d3a2c
Pipeline #5160 passed with stages
in 41 seconds
......@@ -48,6 +48,7 @@ void ble_epic_att_api_free_att_write_data(struct epic_att_write *w);
void ble_epic_ble_api_trigger_event(enum epic_ble_event_type type, void *data);
void ble_epic_ble_api_init(void);
void ble_epic_dm_api_event(dmEvt_t *dm_event);
void ble_epic_disc_cfg_complete(void);
void ble_adv_init(void);
void ble_adv_setup(void);
......
#include <stdint.h>
#include <stdbool.h>
#include "ble_api.h"
#include "wsf_types.h"
#include "util/bstream.h"
#include "app_api.h"
......@@ -258,6 +259,7 @@ void bleDiscCback(dmConnId_t connId, uint8_t status)
case APP_DISC_CFG_CMPL:
AppDiscComplete(connId, APP_DISC_CFG_CMPL);
ble_epic_disc_cfg_complete();
break;
case APP_DISC_CFG_CONN_START:
......
......@@ -24,6 +24,7 @@ static StaticQueue_t ble_event_queue_data;
static uint8_t adv_data_buf[HCI_ADV_DATA_LEN];
static uint8_t sr_data_buf[HCI_ADV_DATA_LEN];
static dmEvt_t connection_open_event;
int epic_ble_free_event(struct epic_ble_event *e)
{
......@@ -85,7 +86,7 @@ void ble_epic_ble_api_init(void)
ble_epic_att_api_init();
}
void ble_epic_dm_api_event(dmEvt_t *dm_event)
static void send_dm_event(dmEvt_t *dm_event)
{
dmEvt_t *e = WsfBufAlloc(sizeof(*e));
......@@ -97,6 +98,24 @@ void ble_epic_dm_api_event(dmEvt_t *dm_event)
}
}
void ble_epic_dm_api_event(dmEvt_t *dm_event)
{
if (dm_event->hdr.event == DM_CONN_OPEN_IND) {
/* Cache the connection open indication until
* epicardium is done dicovering services. */
memcpy(&connection_open_event,
dm_event,
sizeof(connection_open_event));
} else {
send_dm_event(dm_event);
}
}
void ble_epic_disc_cfg_complete(void)
{
send_dm_event(&connection_open_event);
}
void epic_ble_close_connection(uint8_t connId)
{
AppConnClose(connId);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment