The problem is that it executes the write characteristic and disconnects before I've had any sort of opportunity to pass the PIN to it.
I put in a dummy PIN that I've commented out to test that it would send it to the camera and it does send it and the camera invokes a failed connect message as expected with it being the wrong PIN.
What I've done to give myself a chance to send the correct PIN is to split the bond function out without the write characteristic part which I activate off one button, then change the PIN value in the console (using the variable 'p' ) and then fire a separate function to do the sendPasskey off another button.
As soon as I fire the sendPasskey function the camera (Line 6) does the immediate disconnect in the same way as if I'd sent it the wrong PIN in the main function and produces the following :
My guess at the moment (with a dummy and a correct PIN producing the same outcome) is that I'm doing something wrong that is somehow related to Comments 6 & 7 from User63214 when he was attempting to do the same?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Many thanks for that.
We now have some real progress of sorts.
The second option you provided worked in terms of invoking the PIN on the camera screen.
The first option just went straight through as per the original version and did not invoke the PIN or fire the passkeyRequest.
I inserted that part into the second one just to confirm that it does fire and it does.
So, this is the version I have been working with
When I trigger it from the Button, it produces the following in the console
The problem is that it executes the write characteristic and disconnects before I've had any sort of opportunity to pass the PIN to it.
I put in a dummy PIN that I've commented out to test that it would send it to the camera and it does send it and the camera invokes a failed connect message as expected with it being the wrong PIN.
What I've done to give myself a chance to send the correct PIN is to split the bond function out without the write characteristic part which I activate off one button, then change the PIN value in the console (using the variable 'p' ) and then fire a separate function to do the sendPasskey off another button.
As soon as I fire the sendPasskey function the camera (Line 6) does the immediate disconnect in the same way as if I'd sent it the wrong PIN in the main function and produces the following :
My guess at the moment (with a dummy and a correct PIN producing the same outcome) is that I'm doing something wrong that is somehow related to Comments 6 & 7 from User63214 when he was attempting to do the same?