29class BluetoothGATTGetServicesResponse;
49static constexpr conn_err_t GATT_NOT_CONNECTED = ble_device_base::GATT_ERR_NOT_CONNECTED;
54static constexpr bool SUPPORTS_PAIRING =
true;
55static constexpr bool SUPPORTS_CACHE_CLEARING =
true;
56#elif defined(USE_RP2040_BLE) && defined(USE_BLE_GATT_CLIENT)
60static constexpr bool SUPPORTS_PAIRING =
true;
61static constexpr bool SUPPORTS_CACHE_CLEARING =
false;
63static constexpr bool SUPPORTS_PAIRING =
false;
64static constexpr bool SUPPORTS_CACHE_CLEARING =
false;
68#if (defined(USE_ESP32) || defined(USE_RP2040_BLE)) && defined(USE_BLE_GATT_CLIENT)
73#if defined(USE_ESP32) && defined(USE_BLE_GATT_CLIENT)
80static constexpr int DONE_SENDING_SERVICES = -2;
81static constexpr int INIT_SENDING_SERVICES = -3;
82static constexpr int SERVICES_DONE_PENDING = -4;
85static_assert(DONE_SENDING_SERVICES < 0 && INIT_SENDING_SERVICES < 0 && SERVICES_DONE_PENDING < 0);
86static_assert(DONE_SENDING_SERVICES != GATT_NOT_CONNECTED && INIT_SENDING_SERVICES != GATT_NOT_CONNECTED &&
87 SERVICES_DONE_PENDING != GATT_NOT_CONNECTED);
91static constexpr uint8_t SERVICES_DONE_RETRY_LIMIT = 30;
95static constexpr uint16_t PENDING_ACK_RETRY_LIMIT = 250;
100static constexpr size_t MAX_PACKET_SIZE = 1360;
103static constexpr uint8_t SERVICE_OVERHEAD_LEGACY = 25;
104static constexpr uint8_t SERVICE_OVERHEAD_EFFICIENT = 10;
105static constexpr uint8_t CHAR_SIZE_128BIT = 35;
106static constexpr uint8_t DESC_SIZE_128BIT = 25;
107static constexpr uint8_t DESC_PER_CHAR = 1;
113 size_t service_overhead = use_efficient_uuids ? SERVICE_OVERHEAD_EFFICIENT : SERVICE_OVERHEAD_LEGACY;
114 return service_overhead + (CHAR_SIZE_128BIT + DESC_SIZE_128BIT * DESC_PER_CHAR) * char_count;
125 const uint8_t *u = uuid.
uuid128();
127 out[0] = ((uint64_t) u[15] << 56) | ((uint64_t) u[14] << 48) | ((uint64_t) u[13] << 40) | ((uint64_t) u[12] << 32) |
128 ((uint64_t) u[11] << 24) | ((uint64_t) u[10] << 16) | ((uint64_t) u[9] << 8) | ((uint64_t) u[8]);
129 out[1] = ((uint64_t) u[7] << 56) | ((uint64_t) u[6] << 48) | ((uint64_t) u[5] << 40) | ((uint64_t) u[4] << 32) |
130 ((uint64_t) u[3] << 24) | ((uint64_t) u[2] << 16) | ((uint64_t) u[1] << 8) | ((uint64_t) u[0]);
136 out[0] = ((uint64_t) value << 32) | 0x00001000ULL;
137 out[1] = 0x800000805F9B34FBULL;
149 short_uuid = uuid.
uuid16();
151 short_uuid = uuid.
uuid32();
155#ifdef USE_BLUETOOTH_PROXY_CONNECTIONS
166 uint8_t connection_index,
const char *address_str);
conn_err_t unpair_device(uint64_t address)
size_t estimate_service_size(uint16_t char_count, bool use_efficient_uuids)
Estimate the wire size of a service (service overhead + its characteristics, assuming 128-bit UUIDs a...
void fill_128bit_uuid_array(std::array< uint64_t, 2 > &out, const ble_device_base::ESPBTUUID &uuid)
BatchClose
Result of close_service_batch: keep filling the batch or send it now.
BatchClose close_service_batch(api::BluetoothGATTGetServicesResponse &resp, size_t ¤t_size, int16_t &send_service, uint8_t connection_index, const char *address_str)
Close out the service just packed into resp (account its actual wire size, advance the cursor) and de...
void fill_gatt_uuid(std::array< uint64_t, 2 > &uuid_128, uint32_t &short_uuid, const ble_device_base::ESPBTUUID &uuid, bool use_efficient_uuids)
Fill the UUID in the appropriate wire format based on client support and UUID type (128-bit array for...
conn_err_t clear_gatt_cache(uint64_t address)