Fix BLE ECDH handshake: wait for CCCD write before sending pubkey
All checks were successful
CI / build (push) Successful in 1m5s
All checks were successful
CI / build (push) Successful in 1m5s
BleRelayManager.kt: Android's gatt.writeCharacteristic() returns false when a previous GATT operation (CCCD writeDescriptor) is still pending. Split startEcdhHandshake() into two phases: CCCD setup (with ecdhCccdPending flag) and sendEcdhHandshake() triggered from onDescriptorWrite callback. main.cpp: After SET_ID over USB, update BLE advertising scan response manufacturer data so Android can find the server by its new UUID prefix.
This commit is contained in:
parent
a242bfa58a
commit
3be06b7469
2 changed files with 43 additions and 7 deletions
|
|
@ -617,6 +617,15 @@ void loop() {
|
|||
preferences.end();
|
||||
uuidProvisioned = true;
|
||||
pUuidChar->setValue(deviceUuid, ESP_UUID_LEN);
|
||||
|
||||
uint8_t mfgPayload[6];
|
||||
mfgPayload[0] = 0xFF;
|
||||
mfgPayload[1] = 0xFF;
|
||||
memcpy(mfgPayload + 2, deviceUuid, 4);
|
||||
NimBLEAdvertisementData scanResp;
|
||||
scanResp.setCompleteServices(NimBLEUUID(SERVICE_UUID));
|
||||
scanResp.setManufacturerData(std::string((char*)mfgPayload, 6));
|
||||
NimBLEDevice::getAdvertising()->setScanResponseData(scanResp);
|
||||
Serial.println("OK");
|
||||
Serial.println("UUID stored in NVS");
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue