mirror of https://github.com/ARMmbed/mbed-os.git
packetisation
parent
834e6c4f9b
commit
26f40e07f7
|
@ -48,7 +48,8 @@ class GenericGap : public ::Gap,
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/* TODO: move to config */
|
/* TODO: move to config */
|
||||||
static const size_t MAX_ADVERTISING_SETS = 64;
|
static const size_t MAX_ADVERTISING_SETS = 15;
|
||||||
|
static const size_t MAX_HCI_DATA_LENGTH = 251;
|
||||||
/**
|
/**
|
||||||
* Construct a GenericGap instance for a given BLE instance ID.
|
* Construct a GenericGap instance for a given BLE instance ID.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1693,13 +1693,37 @@ ble_error_t GenericGap::setAdvertisingPayload(AdvHandle_t handle, const GapAdver
|
||||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _pal_gap.set_extended_advertising_data(
|
ble_error_t status = BLE_ERROR_NONE;
|
||||||
handle,
|
uint16_t index = 0;
|
||||||
/*TODO fragment*/ pal::advertising_fragment_description_t::FIRST_FRAGMENT,
|
const uint16_t& length = payload->getPayloadLen();
|
||||||
payload->setMinimiseFragmentation,
|
uint16_t packet_data_length = length;
|
||||||
payload->getPayloadLen(),
|
pal::advertising_fragment_description_t operation;
|
||||||
payload->getPayload()
|
operation = (length > MAX_HCI_DATA_LENGTH) ?
|
||||||
);
|
pal::advertising_fragment_description_t::COMPLETE_FRAGMENT
|
||||||
|
: operation = pal::advertising_fragment_description_t::FIRST_FRAGMENT;
|
||||||
|
|
||||||
|
while (index < length) {
|
||||||
|
if ((length - index) > MAX_HCI_DATA_LENGTH) {
|
||||||
|
packet_data_length = MAX_HCI_DATA_LENGTH;
|
||||||
|
} else {
|
||||||
|
packet_data_length = length - index;
|
||||||
|
operation = pal::advertising_fragment_description_t::LAST_FRAGMENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
_pal_gap.set_extended_advertising_data(
|
||||||
|
handle,
|
||||||
|
packet_data_length,
|
||||||
|
payload->setMinimiseFragmentation,
|
||||||
|
packet_data_length,
|
||||||
|
payload->getPayload() + index
|
||||||
|
);
|
||||||
|
|
||||||
|
index += packet_data_length;
|
||||||
|
|
||||||
|
operation = pal::advertising_fragment_description_t::INTERMEDIATE_FRAGMENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ble_error_t GenericGap::setAdvertisingScanResponse(AdvHandle_t handle, const GapAdvertisingData* response) {
|
ble_error_t GenericGap::setAdvertisingScanResponse(AdvHandle_t handle, const GapAdvertisingData* response) {
|
||||||
|
|
Loading…
Reference in New Issue