I'm writing firmware for the SensorTag that communicates with an iPhone. I have implemented the BLE HID, which seems to be working fine. Based on internal sensor readings, I would like to enable and disable the keyboard by interrupting and reestablishing the connection.
I am able to break the connection successfully with a call to
GAPRole_TerminateConnection();
This works fine--I see the keyboard reappear on the iOS device, indicating the connection is broken. The problem is that the connection is automatically reestablished after about 1/2 second, and the keyboard vanishes again. This is not happening due to anything I am doing in the code that I added; I've checked that very carefully.
I'm not sure if the iPhone is aggressively reestablishing the channel or if the firmware is reestablishing the channel.
How can I tell the firmware not to reestablish the connection (until I want it too), and not to allow the iPhone to do so, either?
It seemed like I could do this by stopping advertising:
uint8 initial_advertising_enable = FALSE; GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &initial_advertising_enable );
That did not work.
Any other thoughts?