Skip to content

Commit

Permalink
Darwin BLE: fix GetMTU() so it returns the actual MTU size instead of…
Browse files Browse the repository at this point in the history
… zero (#10017)
  • Loading branch information
bluebin14 authored and pull[bot] committed Oct 6, 2021
1 parent e691520 commit 1013336
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/platform/Darwin/BlePlatformDelegateImpl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,16 @@
return true;
}

uint16_t BlePlatformDelegateImpl::GetMTU(BLE_CONNECTION_OBJECT connObj) const { return 0; }
uint16_t BlePlatformDelegateImpl::GetMTU(BLE_CONNECTION_OBJECT connObj) const
{
CBPeripheral * peripheral = (__bridge CBPeripheral *) connObj;

// The negotiated mtu length is a property of the peripheral.
uint16_t mtuLength = [[peripheral valueForKey:@"mtuLength"] unsignedShortValue];
ChipLogProgress(Ble, "ATT MTU = %u", mtuLength);

return mtuLength;
}

bool BlePlatformDelegateImpl::SendIndication(
BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId, PacketBufferHandle pBuf)
Expand Down

0 comments on commit 1013336

Please sign in to comment.