11static constexpr uint8_t ATT_FIND_INFO_RSP = 0x05;
12static constexpr uint8_t ATT_FIND_BY_TYPE_VALUE_RSP = 0x07;
13static constexpr uint8_t ATT_READ_BY_TYPE_RSP = 0x09;
14static constexpr uint8_t ATT_READ_BY_GRP_TYPE_RSP = 0x11;
15static constexpr size_t ATT_MAX_MTU = 517;
21 for (
size_t i = 1; i <
count; i++) {
22 const uint16_t current =
handle(i);
24 while (j > 0 &&
handle(j - 1) > current)
27 std::rotate(records + j *
size, records + i *
size, records + (i + 1) *
size);
37 case ATT_READ_BY_TYPE_RSP:
38 case ATT_READ_BY_GRP_TYPE_RSP:
43 case ATT_FIND_INFO_RSP:
45 if (data[0] == 1 || data[0] == 2)
48 case ATT_FIND_BY_TYPE_VALUE_RSP:
void sort_att_response_by_handle(uint8_t op_code, uint8_t *data, size_t len)
Sort the records of an ATT discovery response by handle, in place; data is the PDU after the opcode.
void sort_records_by_handle(uint8_t *records, size_t len, size_t size)
Sort records of size bytes that each start with a little-endian handle, in place; a partial tail is l...
constexpr uint16_t encode_uint16(uint8_t msb, uint8_t lsb)
Encode a 16-bit value given the most and least significant byte.
spi_device_handle_t handle