mirror of https://github.com/ARMmbed/mbed-os.git
copy advertising data into the message
parent
d3bda92bee
commit
ebf9ec963d
|
@ -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((location == DM_DATA_LOC_SCAN) || (location == DM_DATA_LOC_ADV));
|
||||||
WSF_ASSERT(advHandle < DM_NUM_ADV_SETS);
|
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->hdr.event = DM_ADV_MSG_API_SET_DATA;
|
||||||
pMsg->advHandle = advHandle;
|
pMsg->advHandle = advHandle;
|
||||||
pMsg->op = op;
|
pMsg->op = op;
|
||||||
pMsg->location = location;
|
pMsg->location = location;
|
||||||
pMsg->len = len;
|
pMsg->len = len;
|
||||||
pMsg->pData = pData;
|
memcpy(pMsg->pData, pData, len);
|
||||||
WsfMsgSend(dmCb.handlerId, pMsg);
|
WsfMsgSend(dmCb.handlerId, pMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ typedef struct
|
||||||
uint8_t op;
|
uint8_t op;
|
||||||
uint8_t location;
|
uint8_t location;
|
||||||
uint8_t len;
|
uint8_t len;
|
||||||
uint8_t *pData;
|
uint8_t pData[];
|
||||||
} dmAdvApiSetData_t;
|
} dmAdvApiSetData_t;
|
||||||
|
|
||||||
/* Data structure for DM_ADV_MSG_API_START */
|
/* Data structure for DM_ADV_MSG_API_START */
|
||||||
|
@ -156,7 +156,7 @@ typedef struct
|
||||||
uint8_t advHandle;
|
uint8_t advHandle;
|
||||||
uint8_t op;
|
uint8_t op;
|
||||||
uint8_t len;
|
uint8_t len;
|
||||||
uint8_t *pData;
|
uint8_t pData[];
|
||||||
} dmAdvPerApiSetData_t;
|
} dmAdvPerApiSetData_t;
|
||||||
|
|
||||||
/* Data structure for DM_ADV_PER_MSG_API_START */
|
/* Data structure for DM_ADV_PER_MSG_API_START */
|
||||||
|
|
|
@ -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(advHandle < DM_NUM_ADV_SETS);
|
||||||
WSF_ASSERT(len <= HCI_PER_ADV_DATA_LEN);
|
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->hdr.event = DM_ADV_PER_MSG_API_SET_DATA;
|
||||||
pMsg->advHandle = advHandle;
|
pMsg->advHandle = advHandle;
|
||||||
pMsg->op = op;
|
pMsg->op = op;
|
||||||
pMsg->len = len;
|
pMsg->len = len;
|
||||||
pMsg->pData = pData;
|
memcpy(pMsg->pData, pData, len);
|
||||||
WsfMsgSend(dmCb.handlerId, pMsg);
|
WsfMsgSend(dmCb.handlerId, pMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue