copy advertising data into the message

pull/13228/head
Paul Szczeanek 2020-06-09 08:46:43 +01:00 committed by Vincent Coubard
parent d3bda92bee
commit ebf9ec963d
3 changed files with 6 additions and 6 deletions

View File

@ -155,14 +155,14 @@ void DmAdvSetData(uint8_t advHandle, uint8_t op, uint8_t location, uint8_t len,
WSF_ASSERT((location == DM_DATA_LOC_SCAN) || (location == DM_DATA_LOC_ADV));
WSF_ASSERT(advHandle < DM_NUM_ADV_SETS);
if ((pMsg = WsfMsgAlloc(sizeof(dmAdvApiSetData_t))) != NULL)
if ((pMsg = WsfMsgAlloc(sizeof(dmAdvApiSetData_t) + len)) != NULL)
{
pMsg->hdr.event = DM_ADV_MSG_API_SET_DATA;
pMsg->advHandle = advHandle;
pMsg->op = op;
pMsg->location = location;
pMsg->len = len;
pMsg->pData = pData;
memcpy(pMsg->pData, pData, len);
WsfMsgSend(dmCb.handlerId, pMsg);
}
}

View File

@ -106,7 +106,7 @@ typedef struct
uint8_t op;
uint8_t location;
uint8_t len;
uint8_t *pData;
uint8_t pData[];
} dmAdvApiSetData_t;
/* Data structure for DM_ADV_MSG_API_START */
@ -156,7 +156,7 @@ typedef struct
uint8_t advHandle;
uint8_t op;
uint8_t len;
uint8_t *pData;
uint8_t pData[];
} dmAdvPerApiSetData_t;
/* Data structure for DM_ADV_PER_MSG_API_START */

View File

@ -1669,13 +1669,13 @@ void DmPerAdvSetData(uint8_t advHandle, uint8_t op, uint8_t len, uint8_t *pData)
WSF_ASSERT(advHandle < DM_NUM_ADV_SETS);
WSF_ASSERT(len <= HCI_PER_ADV_DATA_LEN);
if ((pMsg = WsfMsgAlloc(sizeof(dmAdvPerApiSetData_t))) != NULL)
if ((pMsg = WsfMsgAlloc(sizeof(dmAdvPerApiSetData_t) + len)) != NULL)
{
pMsg->hdr.event = DM_ADV_PER_MSG_API_SET_DATA;
pMsg->advHandle = advHandle;
pMsg->op = op;
pMsg->len = len;
pMsg->pData = pData;
memcpy(pMsg->pData, pData, len);
WsfMsgSend(dmCb.handlerId, pMsg);
}
}