NRF.setSecurity fails with INVALID_PARAM

Posted on
  • Hi!
    I'm trying the various BLE Fuctions and according to the API reference, this should work:

    NRF.setSecurity({passkey:"123456", mitm:1, display:0});
    

    however, I always get this error:

     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v04 (c) 2019 G.Williams
    >Uncaught Error: BLE error 0x7 (INVALID_PARAM)
     at line 1 col 54
    NRF.setSecurity({passkey:"123456", mitm:1, display:0});
                                                         ^
    

    I don't have anything else in the code, just the one line. Is this somehow a documentation error or am I doing something wrong?

  • The reference shows:

    NRF.setSecurity({passkey:"123456", mitm:1, display:1});
    

    This works - but it looks like you changed it to display:0. I think the BLE stack gives INVALID_PARAM because it figures you can't have a passkey if it's not displayed anywhere so the user can read it.

    I could be wrong here but my understanding was even if you scribbled "123456" on the side of the device or wrote it in a manual, that's enough to quality for display:1.

  • Tkank you, I will try this later!
    It's unintuitive but somehow makes sense. It should then be reflected somewhere in the manual that some combinations are invalid.

  • Thanks - I'll update the docs to clear that up

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

NRF.setSecurity fails with INVALID_PARAM

Posted by Avatar for Gefrierbrand @Gefrierbrand

Actions