ruuvi / ruuvi.gateway_esp.c

Ruuvi Gateway ESP32 code
BSD 3-Clause "New" or "Revised" License
24 stars 15 forks source link

Make ESP32 to broadcast BLE advertisements continuously (prototyping task only) #811

Closed laurijamsa closed 1 month ago

laurijamsa commented 1 year ago

This is to verify that it works well and won't interfere with any other functionality.

Apple developer docs https://developer.apple.com/library/archive/qa/qa1931/_index.html state:

The advertising interval of your peripheral affects the time to discovery and connect performance. Outside of ideal conditions, for example when your app is no longer active in the foreground, the time to discovery becomes longer. To maximize the probability of being discovered, the accessory must advertise at one of the listed intervals exactly. The recommended advertising pattern and advertising intervals are: First, advertise at 20 ms intervals for at least 30 seconds. If not discovered after 30 seconds, you may change to one of the following longer intervals: 152.5 ms, 211.25 ms, 318.75 ms, 417.5 ms, 546.25 ms, 760 ms, 852.5 ms, 1022.5 ms, 1285 ms

RuuviTag is broadcasting at 1285ms. Because Gateway is not a battery powered device, it could broadcast faster without issues. We could try to go with for example with 211.25ms interval for better user experience. If data will be updated every ~1sec, then we would basically send five identical advertisements in a row and then update and send again 5 times.

laurijamsa commented 1 year ago

Let's use 211.25ms interval by default and also test with 20ms to find potential bottlenecks

Scrin commented 1 year ago

I assume this (re)broadcasting would broadcast only ruuvitag broadcasts, even if the gateway is configured to process all advertisements?

Additionally, will there be a loop protection to prevent two gateways from rebroadcasting each other's data forever, and if so, how?

laurijamsa commented 1 year ago

I assume this (re)broadcasting would broadcast only ruuvitag broadcasts, even if the gateway is configured to process all advertisements?

Additionally, will there be a loop protection to prevent two gateways from rebroadcasting each other's data forever, and if so, how?

Sorry, this issue description was not clear because I didn't mention that this is related to prototyping with SEN55 and SCD41 sensors that are connected to Gateway hardware. This issue is not about rebroadcasting. We have another issue about it: https://github.com/ruuvi/ruuvi.gateway_esp.c/issues/659