iosbluetooth-lowenergycore-bluetoothbtle

Core Bluetooth Peripheral disconnects every 30 seconds


I have an app that acts as a Bluetooth LE peripheral. I have a single service with four characteristics. 2 out of the 4 are read and write only, the other two are configured as notify.

If I subscribe to one of the "notify" characteristics then the app will not disconnect until I do so manually, works well.

My issue is, If I read or write to the other characteristics, and the then am inactive for around 30 seconds, the BTLE connection disconnects from the peripheral. This may be a limitation set by apple, not sure.

Anyone know of a solution to keep the peripheral active even when there aren't any subscribers and no read or write command has been received in 30 seconds??


Solution

  • This is a by-product of the BLE 4.0 specs. Bluetooth Low Energy is explicitly designed to not maintain a connection for long periods which is what you are describing.

    The only way to bypass this (beyond subscribing to a characteristic as you have found) would be to modify the implementation of the BLE stack on the peripheral you are connecting to and removing or elongating the interval of connection to a point that you find satisfactory.

    Although this may not help you either as both sides of the BLE communication negotiate these values and iOS may impose a maximum below your requested threshold.