microsoft / jacdac

Device and service catalogs for Jacdac.
https://aka.ms/jacdac
Creative Commons Attribution 4.0 International
66 stars 25 forks source link

shorten packet to fit into BLE large packets #55

Closed pelikhan closed 3 years ago

pelikhan commented 3 years ago

Use BLE large packets and use 242bytes or something.

jamesadevine commented 3 years ago

What do you mean? Isn't the MTU of BLE really small? https://stackoverflow.com/questions/38913743/maximum-packet-length-for-bluetooth-le

jamesadevine commented 3 years ago

Do all devices support the ATT packet extension?

pelikhan commented 3 years ago

James to look at this.

jamesadevine commented 3 years ago

@pelikhan @mmoskal

I've spoke to Martin Woolley at the Bluetooth SIG and he says that not every device will have the same MTU. This means that packet chunking will be required for some devices anyway.

As a result, I think we should account for packet chunking in the design of the BLE physical layer. This means we can keep the current packet size and layout of JACDAC frames.

Thoughts?

jamesadevine commented 3 years ago

(this is a similar approach to what we already do with say USB + HF2)

mmoskal commented 3 years ago

isn't there a common size? we don't really care about all devices, I think we care about nrf52 and maybe esp32; I assume all laptops/phones would support the max size?

jamesadevine commented 3 years ago

@mmoskal It depends which version of BLE we are talking about. BLE 5.2 (Vol 3 Part F) supports an ATT value of up to 512 bytes.

For version 4.2, the LE data extension has variable support. From reading around, iPhones support an LE extension of around 185 bytes. I believe this is fixed and cannot be modified by applications.

We could design only for BLE 5.2 if we think that's the way to go...

mmoskal commented 3 years ago

OK, let's go with fragmentation then

jamesadevine commented 3 years ago

I think either way, the current packet and frame layout does not need to be modified to account for BLE specifically. Agree?

mmoskal commented 3 years ago

Correct.