In CySmart App first Click on Pair icon ( Next to the BLE device name). Doing this will ask you for entering the passkey and pairing will be done. Now , refresh the CySmart screen and Click on the Device Name for the BLE connection. Once the device is paired , in future connections you just need to click on Device Name.
From the PSoC Creator Project just comment out the API CyBle_GapAuthReq(cyBle_connHandle.bdHandle,&cyBle_authInfo).
As Gyan stated, this is not a FIX, this is a workaround for now. He is still working on root cause for the issue and is trying to unblock you for now so your communication can work.
Further debug will take time.
This back from the app team, we use a multi platform cross compiler, so not every command is available.
We would just have to see what behavior happened when a connection attempt is made. I can't request pairing manually at all. The only call for connecting is ble.connect(),
We will test now, but without pairing we are sunk, do not consider this closed, so far the patch is not production worthy.
Hello, any news here, we are on hold until this is resolved, we are line down on three projects.
I am fully accepting that is could be my coding, so please do not hesitate to ask me to try anything, but we must have successful Android connections to move forward
Any update on the debug here. According to Herb adding the work around, break iOS functionality. Can you make sure that any workarounds/fixes provided are testing with BOTH iOS and Android going forward?
Guys, please see the message below, the work-around kills Apple. We connect, but nothing works, get no services CYSMART on Apple unless the GapAuthReq instruction is given. With GapAuthReq implemented it works on Apple but not Android.
So to make it clear, using CYSMART:
if apiResult = CyBle_GapAuthReq(cyBle_connHandle.bdHandle,&cyBle_authInfo); // request pairing is implemented, it works on APPLE but not ANDROID, the Android pairs the first time, and works, repeat connect attempts always looks connected, returns no services.
if apiResult = CyBle_GapAuthReq(cyBle_connHandle.bdHandle,&cyBle_authInfo); // request pairing is not implemented, it works on ANDROID but not APPLE since there is no way to force the pairing from the host side in Apple, it is a device function, even CYSMART does not have a pairing button in the app."
I would appreciate an update on status, we have a call in 2 hours to discuss this with our customer, do we know anything at this point?
Gyan is based in India so likely will not have an update until Sunday/Monday our time. He is actively debugging this and I have a message into him for an update.
Thank you, I assumed as much, but with 2 committed designs, one very late, and one releasing in 3 weeks, plus three more on deck waiting, you can imagine how concerning this is to us, thanks again for the support.
As far as my testing , I do not see any issue with the PSoC Creator Project. I tested it with other BLE App (nrfConnect) and there your project works perfectly with an Android device.
I believe here the CySmart as well as your own Custom App is not handling the pairing request properly and causing the issue. May be you can report this to your Android App development team to look into it.
All the BLE Apps might not having all the functions implemented as I see and you mentioned that CySmart iOS app does not have the pairing request option in built and the peripheral has to send the security request if it wants to pair. Android CySmart app has this option.
I would suggest you to test the project with nrfCONNECT BLE app and see if you face any issue there till we come up with a fix with CySmart Android App.
Just for your information on the BLE pairing concepts -
The pairing is always initiated by the master device. However, a slave device ( Peripheral) can send a security request to master device ( If it wants) to initiate the pairing procedure.
You need to click on "Not Pair" icon to initiate pairing.
Gyan, I concur, I have been able to duplicate success with NRF, I did see one additional instability in CYSMART that I I need to share with you, it is another data point.
While testing the master requests pairing, CYSMART connected, paired and then disconnected, a reconnect worked and it was fine after that. NRF did not behave this way, it connected the first time and just kept working.
Please share with us your plans for CYSMART improvement.
This back from our app team, on APPLE pairing, we need to send a connection reject, since they did not send the password and then apple will automatically attempt to pair. The characteristic they refer to below is encryption, I have authentication with encryption selected in the security tab.
See if you can send me a authentication failure message.
The pairing is triggered by the peripheral. Meaning the peripheral has to refuse the write or read request of your central to a characteristic. Your central gets the refusal "unauthorized authentication" and then tries to pair with the peripheral and showing the pairing alert pop up you are waiting for. This is all done by core bluetooth automatically. The only thing you need to do is change the characteristics options and permissions in your peripheral. This is the apple sample code to trigger a pairing:
Please help me with an implementation that will do this please.
Setting the AUTHENTICATION flag for a characteristic was indeed the solution here. Once the flag is set for a characteristic then the iOS device requests a READ (WRITE will not trigger) from the service / characteristic, the pairing request pops up as expected once the error message is properly sent to the iOS device.
Thank you to everyone involved with coming up with the solution!
OK, we figured it out over the weekend, to pair correctly using this radio, you set the passkey, and ensure the settings are correct in the BLE profile, the most important one being AUTHORIZATION REQUIRED.
In your app you try to read any characteristic with AUTHORIZATION REQUIRED generates the pairing request in APPLE or ANDROID. In Android you get a pairing and a disconnect, and when you reconnect it works., APPLE works first time.
That was an ordeal for us, and there appears to be nothing obvious in the BLE datasheet pointing this out, or in any of the examples. This was all we found, after learning that the BLE stack on the phone was expecting a pair request, based on a failed access, and the CYBLE_EVT_GATTC_ERROR_RSP is what is triggering the pair request.
An Error Response event is sent by the server (CYBLE_EVT_GATTC_ERROR_RSP) in response to the Read
Multiple Request if insufficient authentication, insufficient authorization, insufficient encryption key size is used by the client, or if a read operation is not permitted on any of the Characteristic values. The Error Code parameter is set as specified in the Attribute Protocol.