We have BLE on a vehicle that acts as a peripheral and pairs with the user's iOS device as a central device.
As we understand, the only way for a peripheral to be "remembered" for the next connection is registration with ANCS. If we don't register while being connected and then the user goes away, when he next time is in range, fresh pairing has to happen.
Is that the right understanding?
Before we register, we are discovering the ANCS on an iOS device, with UID for ANCS and connection handle as arguments. There are times when discovering API returns 0x06 (implying service not available). At times, we are able to discover the service and are able to register.
We wanted to know if there is a deterministic way to ensure ANCS to be discoverable from the peripheral side?
If not, is there another way (say any other service) by which the peripheral can take some action to be remembered?
I am not sure what you mean here. ANCS has nothing to do with being "remembered", although it is another service that the two sides can connect, pair, and communicate on.
You can just as easily have the iOS device "remember" the vehicle if you had an app that initiated a connection, and then the vehicle BLE and iOS successfully paired and bonded.
So, your issue is not with ANCS, but due to not properly creating a bond between the devices. As you have noticed, ANCS may not be available at all times, so, it is not the appropriate way to ensure you are able to connect at arbitrary times.
If the pairing process needs to be repeated every time the devices are connecting, it is because they are simply pairing. To avoid this, they want to use "bonding" which means the two sides store the encryption key and identity keys in order to recognize each other for future connections.
This process is handled by the BLE stacks on both devices, and have nothing to do with ANCS or your app (except for the app requesting a secure connection). And you will want to consult the BLE specifications reference at https://www.bluetooth.com for correct implementation of this process on the vehicle's BLE device.
Argun Tekant / DTS Engineer / Core Technologies